Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sale_order_route/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
'name': 'Sale Order Route',
'version': '16.0.1.0.0',
'version': '18.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Set route on sale order',
Expand All @@ -18,5 +18,5 @@
'website': 'http://www.akretion.com',
'depends': ['sale_stock'],
'data': ['views/sale_order.xml', 'views/sale_report.xml'],
'installable': False,
'installable': True,
}
5 changes: 2 additions & 3 deletions sale_order_route/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class SaleOrder(models.Model):
route_id = fields.Many2one(
'stock.route', string='Route',
ondelete='restrict', readonly=True, tracking=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
check_company=True,
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False), ('sale_selectable', '=', True)]")

Expand All @@ -22,7 +21,7 @@ def _action_confirm(self):
vals = {'route_id': order.route_id.id or False}
order.order_line.filtered(
lambda l:
l.product_id and l.product_id.type in ('product', 'consu')).write(vals)
l.product_id and l.product_id.type == 'consu').write(vals)
return super()._action_confirm()


Expand All @@ -35,7 +34,7 @@ class SaleOrderLine(models.Model):
@api.depends('display_type', 'product_id')
def _compute_route_id(self):
for line in self:
if not line.display_type and line.product_id and line.product_id.type in ('product', 'consu'):
if not line.display_type and line.product_id and line.product_id.type == 'consu':
line.route_id = line.order_id.route_id or False
else:
line.route_id = False
15 changes: 2 additions & 13 deletions sale_order_route/views/sale_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,19 @@
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
<field name="arch" type="xml">
<field name="partner_shipping_id" position="after">
<field name="route_id" options="{'no_create_edit': True}"/>
<field name="route_id" options="{'no_create_edit': True}" readonly="state not in ('draft', 'sent')"/>
</field>
</field>
</record>

<record id="view_quotation_tree" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_quotation_tree"/>
<field name="inherit_id" ref="sale_stock.sale_order_tree"/>
<field name="arch" type="xml">
<field name="warehouse_id" position="after">
<field name="route_id" optional="hide"/>
</field>
</field>
</record>

<record id="view_order_tree" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_order_tree"/>
<field name="arch" type="xml">
<field name="warehouse_id" position="after">
<field name="route_id" optional="hide"/>
</field>
</field>
</record>


</odoo>