[FIX] stock_landed_costs: stock input account
When assigning landed costs to products that have already left the stock, the expense account is used instead of the stock input account. opw-671311
This commit is contained in:
parent
7cf20afb0b
commit
b955bac100
|
@ -108,7 +108,7 @@ class stock_landed_cost(osv.osv):
|
||||||
accounts = product_obj.get_product_accounts(cr, uid, line.product_id.product_tmpl_id.id, context=context)
|
accounts = product_obj.get_product_accounts(cr, uid, line.product_id.product_tmpl_id.id, context=context)
|
||||||
debit_account_id = accounts['property_stock_valuation_account_id']
|
debit_account_id = accounts['property_stock_valuation_account_id']
|
||||||
already_out_account_id = accounts['stock_account_output']
|
already_out_account_id = accounts['stock_account_output']
|
||||||
credit_account_id = line.cost_line_id.account_id.id or cost_product.property_account_expense.id or cost_product.categ_id.property_account_expense_categ.id
|
credit_account_id = accounts['stock_account_input']
|
||||||
|
|
||||||
if not credit_account_id:
|
if not credit_account_id:
|
||||||
raise osv.except_osv(_('Error!'), _('Please configure Stock Expense Account for product: %s.') % (cost_product.name))
|
raise osv.except_osv(_('Error!'), _('Please configure Stock Expense Account for product: %s.') % (cost_product.name))
|
||||||
|
|
Loading…
Reference in New Issue