[IMP] sale: Improved code by adding context argument wherever required.
* product_visible_discount, warning: Added remaining context argument on product_id_change method. bzr revid: uco@tinyerp.com-20110718095344-tdlsys7uueqp9kdy
This commit is contained in:
parent
4ee9ed8762
commit
e84d292ceb
|
@ -40,7 +40,8 @@ class sale_order_line(osv.osv):
|
|||
|
||||
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
|
||||
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||
lang=False, update_tax=True,date_order=False,packaging=False,fiscal_position=False, flag=False):
|
||||
lang=False, update_tax=True, date_order=False, packaging=False,
|
||||
fiscal_position=False, flag=False, context=None):
|
||||
|
||||
def get_real_price(res_dict, product_id, qty, uom, pricelist):
|
||||
item_obj = self.pool.get('product.pricelist.item')
|
||||
|
@ -70,7 +71,7 @@ class sale_order_line(osv.osv):
|
|||
|
||||
res=super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
|
||||
uom, qty_uos, uos, name, partner_id,
|
||||
lang, update_tax,date_order,fiscal_position=fiscal_position,flag=flag)
|
||||
lang, update_tax, date_order, fiscal_position=fiscal_position, flag=flag, context=context)
|
||||
|
||||
context = {'lang': lang, 'partner_id': partner_id}
|
||||
result=res['value']
|
||||
|
|
|
@ -1024,7 +1024,7 @@ class sale_order_line(osv.osv):
|
|||
if flag:
|
||||
res = self.product_id_change(cr, uid, ids, pricelist=pricelist,
|
||||
product=product, qty=qty, uom=uom, partner_id=partner_id,
|
||||
packaging=packaging, flag=False)
|
||||
packaging=packaging, flag=False, context=context)
|
||||
warning_msgs = res.get('warning') and res['warning']['message']
|
||||
|
||||
products = product_obj.browse(cr, uid, product, context=context)
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
<field
|
||||
name="product_packaging"
|
||||
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_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)"
|
||||
on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
name="product_packaging"
|
||||
attrs="{'readonly':[('layout_type','!=','article')]}"
|
||||
context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_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)"
|
||||
on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
groups="base.group_extended"/>
|
||||
<separator colspan="4" string="Manual Description" />
|
||||
|
|
|
@ -197,7 +197,7 @@ class sale_order_line(osv.osv):
|
|||
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
|
||||
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||
lang=False, update_tax=True, date_order=False, packaging=False,
|
||||
fiscal_position=False, flag=False):
|
||||
fiscal_position=False, flag=False, context=None):
|
||||
warning = {}
|
||||
if not product:
|
||||
return {'value': {'th_weight' : 0, 'product_packaging': False,
|
||||
|
@ -218,7 +218,7 @@ class sale_order_line(osv.osv):
|
|||
|
||||
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
|
||||
uom, qty_uos, uos, name, partner_id,
|
||||
lang, update_tax, date_order, packaging, fiscal_position, flag)
|
||||
lang, update_tax, date_order, packaging, fiscal_position, flag, context=context)
|
||||
|
||||
if result.get('warning',False):
|
||||
warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
|
||||
|
|
Loading…
Reference in New Issue