[IMP] stock_account: anglo-saxon stock input->expense->default

Before this commit, in anglo-saxon accounting the account of a
vendor's bill line was defined as the stock input account, or the
default account.

With this commit the chain becomes:

- if one: stock input account,
- else if one: expense account,
- else: default account

opw-695167
This commit is contained in:
Nicolas Lempereur
2016-12-09 15:32:18 +01:00
parent e191b5af6e
commit f8db92e278
@@ -89,5 +89,6 @@ class AccountInvoiceLine(models.Model):
def get_invoice_line_account(self, type, product, fpos, company):
if company.anglo_saxon_accounting and type in ('in_invoice', 'in_refund') and product and product.type == 'product':
accounts = product.product_tmpl_id.get_product_accounts(fiscal_pos=fpos)
return accounts['stock_input']
if accounts['stock_input']:
return accounts['stock_input']
return super(AccountInvoiceLine, self).get_invoice_line_account(type, product, fpos, company)