[IMP] account_anglo_saxon: Improve code
bzr revid: mra@mra-laptop-20110725101424-q3zlft8s7tsz8dys
This commit is contained in:
parent
5783538775
commit
e678571316
|
@ -134,14 +134,13 @@ class account_invoice_line(osv.osv):
|
||||||
'taxes':line.get('taxes',[]),
|
'taxes':line.get('taxes',[]),
|
||||||
})
|
})
|
||||||
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, company_id=None):
|
|
||||||
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, company_id)
|
|
||||||
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, company_id)
|
|
||||||
|
|
||||||
|
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:
|
||||||
|
return res
|
||||||
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,11 +152,11 @@ 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
|
||||||
|
|
||||||
account_invoice_line()
|
account_invoice_line()
|
||||||
|
|
||||||
class account_invoice(osv.osv):
|
class account_invoice(osv.osv):
|
||||||
|
@ -180,6 +179,6 @@ class account_invoice(osv.osv):
|
||||||
line.update({'account_id': (account_data['id'],account_data['name'])})
|
line.update({'account_id': (account_data['id'],account_data['name'])})
|
||||||
res = super(account_invoice,self)._refund_cleanup_lines(cr, uid, lines)
|
res = super(account_invoice,self)._refund_cleanup_lines(cr, uid, lines)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
account_invoice()
|
account_invoice()
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
Loading…
Reference in New Issue