account: add test for expence account in analytic line

bzr revid: ced-95e77f7f90068d522adc4af256c235e4b4785cef
This commit is contained in:
ced 2007-07-02 13:06:19 +00:00
parent 644b7231fe
commit 0a31058c9a
1 changed files with 2 additions and 0 deletions

View File

@ -77,6 +77,8 @@ class account_analytic_line(osv.osv):
a = prod.product_tmpl_id.property_account_expense
if not a:
a = prod.categ_id.property_account_expense_categ
if not a:
raise osv.except_osv('Error !', 'There is no expense account define for this product: "%s" (id:%d)' % (prod.name, prod.id,))
return {'value' : {'amount' : -round(unit_amount * prod.standard_price * rate,2), 'general_account_id':a[0]}}
return {}