[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: 796900feb7
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
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
Reference in New Issue
Block a user