Skip to content

Commit

Permalink
[ADD] sale_order_route: new module to load route in sale order lines …
Browse files Browse the repository at this point in the history
…from the order.
  • Loading branch information
agaldona committed Apr 13, 2016
1 parent 5fe2bdc commit 023176e
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sale_order_route/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

================
Sale Order Route
================

This module links a sale order with a inventory route. Changing this field
will change the route in each of the lines, filling with the value of the order.

Credits
=======

Contributors
------------
* Ainara Galdona <[email protected]>
* Ana Juaristi <[email protected]>
5 changes: 5 additions & 0 deletions sale_order_route/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# (c) 2016 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import models
19 changes: 19 additions & 0 deletions sale_order_route/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# (c) 2016 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
"name": "Sale Order Route",
"version": "8.0.1.0.0",
'author': 'OdooMRP team',
'website': "http://www.odoomrp.com",
'contributors': ["Ainara Galdona <[email protected]>",
"Ana Juaristi <[email protected]>"],
"depends": [
'sale_stock',
'web_context_tunnel'
],
"category": "Sales Management",
"data": ['views/sale_order_view.xml'],
"installable": True
}
5 changes: 5 additions & 0 deletions sale_order_route/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# (c) 2016 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import sale_order
21 changes: 21 additions & 0 deletions sale_order_route/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# (c) 2016 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import models, fields, api


class SaleOrder(models.Model):

_inherit = 'sale.order'

route_id = fields.Many2one(comodel_name='stock.location.route',
string='Route',
domain=[('sale_selectable', '=', True)])

@api.multi
@api.onchange('route_id')
def onchange_route_id(self):
self.ensure_one()
for line in self.order_line:
line.route_id = self.route_id
18 changes: 18 additions & 0 deletions sale_order_route/views/sale_order_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_order_form">
<field name="name">sale.order.route.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_order_form_inherit" />
<field name="arch" type="xml">
<field name="warehouse_id" position="after">
<field name="route_id" groups="sale_stock.group_route_so_lines"/>
</field>
<field name="order_line" position="attributes">
<attribute name="context_route">{'default_route_id': route_id}</attribute>
</field>
</field>
</record>
</data>
</openerp>

0 comments on commit 023176e

Please sign in to comment.