diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 0d0a147e324180bca60d690fe5f866e9374e33e0..c0fc9c5cbcf2821a7d355321e51a9c3c935f2089 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -230,6 +230,7 @@ class sale_order_line(osv.osv): 'product_packaging': fields.many2one('product.packaging', 'Packaging'), 'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'), 'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale_selectable', '=', True)]), + 'product_tmpl_id': fields.related('product_id', 'product_tmpl_id', type='many2one', relation='product.template', string='Product Template'), } _defaults = { @@ -299,7 +300,7 @@ class sale_order_line(osv.osv): #update of result obtained in super function product_obj = product_obj.browse(cr, uid, product, context=context) - res['value']['delay'] = (product_obj.sale_delay or 0.0) + res['value'].update({'product_tmpl_id': product_obj.product_tmpl_id.id, 'delay': (product_obj.sale_delay or 0.0)}) # Calling product_packaging_change function after updating UoM res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context) diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml index f3db20171b4b6ab47ae9734d9afc7f1dd9e5605c..b754a8d0c7fc901f57f287074b9e1e74ceaa5a21 100644 --- a/addons/sale_stock/sale_stock_view.xml +++ b/addons/sale_stock/sale_stock_view.xml @@ -63,7 +63,8 @@ </div> </xpath> <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='tax_id']" position="before"> - <field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_tmpl_id','=',product_id)]" groups="product.group_stock_packaging" /> + <field name="product_tmpl_id" invisible="1"/> + <field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_tmpl_id','=',product_tmpl_id)]" groups="product.group_stock_packaging" /> </xpath> <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='sequence']" position="after"> <field name="delay" invisible="1"/>