merge
lp bug: https://launchpad.net/bugs/813329 fixed bzr revid: fp@tinyerp.com-20110924103329-os9x9kostsrhpetv
This commit is contained in:
commit
735276e89e
|
@ -136,12 +136,11 @@ class account_invoice_line(osv.osv):
|
||||||
res += diff_res
|
res += diff_res
|
||||||
return res
|
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, address_invoice_id=False, currency_id=False, context=None):
|
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, address_invoice_id=False, currency_id=False, context=None, company_id=None):
|
||||||
|
fiscal_pool = self.pool.get('account.fiscal.position')
|
||||||
|
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id)
|
||||||
if not product:
|
if not product:
|
||||||
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
return res
|
||||||
else:
|
|
||||||
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
|
||||||
|
|
||||||
if type in ('in_invoice','in_refund'):
|
if type in ('in_invoice','in_refund'):
|
||||||
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||||
if type == 'in_invoice':
|
if type == 'in_invoice':
|
||||||
|
@ -153,8 +152,8 @@ class account_invoice_line(osv.osv):
|
||||||
if not oa:
|
if not oa:
|
||||||
oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
|
oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
|
||||||
if oa:
|
if oa:
|
||||||
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id, context=context) or False
|
fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False
|
||||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
|
a = fiscal_pool.map_account(cr, uid, fpos, oa)
|
||||||
res['value'].update({'account_id':a})
|
res['value'].update({'account_id':a})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue