[FIX] stock_landed_costs: missing AML
There are 2 journal items missing on the accounting entry that represents the assignation of the landed costs (for a product that has already left the stock!) => expense account at the debit and stock output account at the credit (amount is equal to the cost of the landed cost) opw-671311
This commit is contained in:
parent
037257b887
commit
df212977b8
|
@ -142,11 +142,11 @@ class stock_landed_cost(osv.osv):
|
|||
|
||||
#Create account move lines for quants already out of stock
|
||||
if qty_out > 0:
|
||||
debit_line = dict(debit_line,
|
||||
debit_line = dict(base_line,
|
||||
name=(line.name + ": " + str(qty_out) + _(' already out')),
|
||||
quantity=qty_out,
|
||||
account_id=already_out_account_id)
|
||||
credit_line = dict(credit_line,
|
||||
credit_line = dict(base_line,
|
||||
name=(line.name + ": " + str(qty_out) + _(' already out')),
|
||||
quantity=qty_out,
|
||||
account_id=debit_account_id)
|
||||
|
@ -160,6 +160,30 @@ class stock_landed_cost(osv.osv):
|
|||
credit_line['debit'] = -diff
|
||||
aml_obj.create(cr, uid, debit_line, context=context)
|
||||
aml_obj.create(cr, uid, credit_line, context=context)
|
||||
|
||||
# Ugly work-around to know if anglo-saxon accounting is used. In 9.0, we can use the
|
||||
# field 'anglo_saxon_accounting' on the company.
|
||||
if hasattr(self.pool['account.invoice.line'], '_anglo_saxon_sale_move_lines'):
|
||||
debit_line = dict(base_line,
|
||||
name=(line.name + ": " + str(qty_out) + _(' already out')),
|
||||
quantity=qty_out,
|
||||
account_id=credit_account_id)
|
||||
credit_line = dict(base_line,
|
||||
name=(line.name + ": " + str(qty_out) + _(' already out')),
|
||||
quantity=qty_out,
|
||||
account_id=already_out_account_id)
|
||||
|
||||
if diff > 0:
|
||||
debit_line['debit'] = diff
|
||||
credit_line['credit'] = diff
|
||||
else:
|
||||
# negative cost, reverse the entry
|
||||
debit_line['credit'] = -diff
|
||||
credit_line['debit'] = -diff
|
||||
aml_obj.create(cr, uid, debit_line, context=context)
|
||||
aml_obj.create(cr, uid, credit_line, context=context)
|
||||
|
||||
|
||||
return True
|
||||
|
||||
def _create_account_move(self, cr, uid, cost, context=None):
|
||||
|
|
Loading…
Reference in New Issue