diff options
| author | amoyaux <arnold.moyaux@gmail.com> | 2017-02-14 14:35:07 +0100 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2017-02-15 15:13:47 +0100 |
| commit | b7fd6fd9af58eee753828fd8dfd6012e722b5b87 (patch) | |
| tree | 7ee271e38a5f9346facb8d8cbff1f23093d98a1c | |
| parent | 149fed42c566fe739ee370bd9d7fe9eeab64a13f (diff) | |
[FIX] sale: Traceback product_packaging on SO line
When we add a SO line on a sale order with a product packaging, a
traceback is raised.
The problem comes from a default value and a domain set in the context
which reference a product template but since this rev: 796900feb76f7ca5084d6b5f90cb24d5448cc326
the product packagings are linked to product_product and not
product_template anymore.
So we used the product_id field instead of product_tmpl_id. And remove
product_tmpl_id from the sale_order_line model which is not used anymore
| -rw-r--r-- | addons/sale_stock/models/sale_order.py | 1 | ||||
| -rw-r--r-- | addons/sale_stock/views/sale_order_views.xml | 3 |
2 files changed, 1 insertions, 3 deletions
diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 3e5a757ef6e..46a586774c2 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -89,7 +89,6 @@ class SaleOrderLine(models.Model): product_packaging = fields.Many2one('product.packaging', string='Packaging', default=False) route_id = fields.Many2one('stock.location.route', string='Route', domain=[('sale_selectable', '=', True)]) - product_tmpl_id = fields.Many2one('product.template', related='product_id.product_tmpl_id', string='Product Template', readonly=True) @api.depends('order_id.state') def _compute_invoice_status(self): diff --git a/addons/sale_stock/views/sale_order_views.xml b/addons/sale_stock/views/sale_order_views.xml index e686523e646..7e6e4192851 100644 --- a/addons/sale_stock/views/sale_order_views.xml +++ b/addons/sale_stock/views/sale_order_views.xml @@ -24,8 +24,7 @@ </group> </xpath> <xpath expr="//page/field[@name='order_line']/form/group/group/field[@name='tax_id']" position="before"> - <field name="product_tmpl_id" invisible="1"/> - <field name="product_packaging" context="{'default_product_tmpl_id': product_tmpl_id, 'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}" domain="[('product_tmpl_id','=',product_tmpl_id)]" groups="product.group_stock_packaging" /> + <field name="product_packaging" context="{'default_product_id': product_id, 'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging" /> </xpath> <xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before"> <field name="route_id" groups="sale_stock.group_route_so_lines"/> |
