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 33f4aae
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sale_order_route/README.rst
@@ -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 adds new route_id field in sale order object.
When the value of the field is changed, all routes from order lines will be filled with this value.

Credits
=======

Contributors
------------
* Ainara Galdona <ainaragaldona@avanzosc.es>
* Ana Juaristi <anajuaristi@avanzosc.es>
5 changes: 5 additions & 0 deletions sale_order_route/__init__.py
@@ -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
18 changes: 18 additions & 0 deletions sale_order_route/__openerp__.py
@@ -0,0 +1,18 @@
# -*- 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 <ainaragaldona@avanzosc.es>",
"Ana Juaristi <anajuaristi@avanzosc.es>"],
"depends": [
'sale_stock',
],
"category": "Sales Management",
"data": ['views/sale_order_view.xml'],
"installable": True
}
5 changes: 5 additions & 0 deletions sale_order_route/models/__init__.py
@@ -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
@@ -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
@@ -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">{'default_route_id': route_id}</attribute>
</field>
</field>
</record>
</data>
</openerp>

0 comments on commit 33f4aae

Please sign in to comment.