[FIX] Will take into account the type of the invoice for the default account in the invoice line
lp bug: https://launchpad.net/bugs/1084819 fixed bzr revid: jco@openerp.com-20121221094147-mp7dhttfob7y2xis
This commit is contained in:
parent
1dbea4a07a
commit
dba6e07ecd
|
@ -1393,8 +1393,13 @@ class account_invoice_line(osv.osv):
|
|||
def _default_account_id(self, cr, uid, context=None):
|
||||
# XXX this gets the default account for the user's company,
|
||||
# it should get the default account for the invoice's company
|
||||
# however, the invoice's company does not reach this point
|
||||
prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
|
||||
# however, the invoice's company does not reach this point (but will throw error on validation)
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('type') in ('out_invoice','out_refund'):
|
||||
prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
|
||||
else:
|
||||
prop = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category', context=context)
|
||||
return prop and prop.id or False
|
||||
|
||||
_defaults = {
|
||||
|
|
Loading…
Reference in New Issue