[MERGE] lp:~openerp-dev/openobject-addons/trunk-bug-938728-odo
lp bug: https://launchpad.net/bugs/938728 fixed bzr revid: vta@openerp.com-20121205095759-grel33pdnwuefurt
This commit is contained in:
commit
d5be24ec7a
|
@ -1432,7 +1432,7 @@ class account_invoice_line(osv.osv):
|
|||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
|
||||
def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
company_id = company_id if company_id != None else context.get('company_id',False)
|
||||
|
@ -1478,14 +1478,11 @@ class account_invoice_line(osv.osv):
|
|||
result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
|
||||
result['name'] = res.partner_ref
|
||||
|
||||
domain = {}
|
||||
result['uos_id'] = res.uom_id.id or uom or False
|
||||
result['uos_id'] = uom_id or res.uom_id.id
|
||||
if res.description:
|
||||
result['name'] += '\n'+res.description
|
||||
if result['uos_id']:
|
||||
res2 = res.uom_id.category_id.id
|
||||
if res2:
|
||||
domain = {'uos_id':[('category_id','=',res2 )]}
|
||||
|
||||
domain = {'uos_id':[('category_id','=',res.uom_id.category_id.id)]}
|
||||
|
||||
res_final = {'value':result, 'domain':domain}
|
||||
|
||||
|
@ -1501,10 +1498,10 @@ class account_invoice_line(osv.osv):
|
|||
new_price = res_final['value']['price_unit'] * currency.rate
|
||||
res_final['value']['price_unit'] = new_price
|
||||
|
||||
if uom:
|
||||
uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
|
||||
if res.uom_id.category_id.id == uom.category_id.id:
|
||||
new_price = res_final['value']['price_unit'] * uom.factor_inv
|
||||
if result['uos_id'] != res.uom_id.id:
|
||||
selected_uom = self.pool.get('product.uom_id').browse(cr, uid, result['uos_id'], context=context)
|
||||
if res.uom_id.category_id.id == selected_uom.category_id.id:
|
||||
new_price = res_final['value']['price_unit'] * uom_id.factor_inv
|
||||
res_final['value']['price_unit'] = new_price
|
||||
return res_final
|
||||
|
||||
|
@ -1516,8 +1513,6 @@ class account_invoice_line(osv.osv):
|
|||
context.update({'company_id': company_id})
|
||||
warning = {}
|
||||
res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, currency_id, context=context)
|
||||
if 'uos_id' in res['value']:
|
||||
del res['value']['uos_id']
|
||||
if not uom:
|
||||
res['value']['price_unit'] = 0.0
|
||||
if product and uom:
|
||||
|
|
Loading…
Reference in New Issue