Merge pull request #154 from akretion/9-fix-account_mass_reconcile-simple

Fix writeoff variables passed to reconcile method
This commit is contained in:
Yannick Vaucher
2016-09-28 13:27:57 +02:00
committed by GitHub

View File

@@ -155,13 +155,13 @@ class MassReconcileBase(models.AbstractModel):
)
if below_writeoff:
if sum_credit > sum_debit:
writeoff_account_id = self.account_profit_id.id
writeoff_account = self.account_profit_id
else:
writeoff_account_id = self.account_lost_id.id
writeoff_account = self.account_lost_id
line_rs = ml_obj.browse(line_ids)
line_rs.reconcile(
writeoff_acc_id=writeoff_account_id,
writeoff_journal_id=self.journal_id.id
writeoff_acc_id=writeoff_account,
writeoff_journal_id=self.journal_id
)
return True, True
elif allow_partial:
@@ -173,13 +173,13 @@ class MassReconcileBase(models.AbstractModel):
# it will do a full reconcile instead of a partial reconcile
# and make a write-off for exchange
if sum_credit > sum_debit:
writeoff_account_id = self.income_exchange_account_id.id
writeoff_account = self.income_exchange_account_id
else:
writeoff_account_id = self.expense_exchange_account_id.id
writeoff_account = self.expense_exchange_account_id
line_rs = ml_obj.browse(line_ids)
line_rs.reconcile(
writeoff_acc_id=writeoff_account_id,
writeoff_journal_id=self.journal_id.id
writeoff_acc_id=writeoff_account,
writeoff_journal_id=self.journal_id
)
return True, False
return False, False