[FIX] stock_account: get_invoice_line_account in valuation = 'periodic'

Let's consider the product category PC in valuation = 'periodic' and the product P
with the category PC.

When creating a vendor bill with P, the account on line doesn't have to be
the stock input account but the expense account.

opw:744409
This commit is contained in:
Goffin Simon
2017-05-29 15:55:47 +02:00
parent bf201e9014
commit e9d6dcf16f
@@ -99,6 +99,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)
if accounts['stock_input']:
if product.categ_id.property_valuation != 'manual_periodic' and accounts['stock_input']:
return accounts['stock_input']
return super(AccountInvoiceLine, self).get_invoice_line_account(type, product, fpos, company)