Fixed the amount_residual_currency on partial reconcile
This commit is contained in:
@@ -16,25 +16,47 @@ class OpenItemsReport(models.AbstractModel):
|
||||
|
||||
def _get_account_partial_reconciled(self, company_id, date_at_object):
|
||||
domain = [("max_date", ">", date_at_object), ("company_id", "=", company_id)]
|
||||
fields = ["debit_move_id", "credit_move_id", "amount"]
|
||||
fields = [
|
||||
"debit_move_id",
|
||||
"credit_move_id",
|
||||
"amount",
|
||||
"debit_amount_currency",
|
||||
"credit_amount_currency",
|
||||
]
|
||||
accounts_partial_reconcile = self.env["account.partial.reconcile"].search_read(
|
||||
domain=domain, fields=fields
|
||||
)
|
||||
debit_amount = {}
|
||||
debit_amount_currency = {}
|
||||
credit_amount = {}
|
||||
credit_amount_currency = {}
|
||||
for account_partial_reconcile_data in accounts_partial_reconcile:
|
||||
debit_move_id = account_partial_reconcile_data["debit_move_id"][0]
|
||||
credit_move_id = account_partial_reconcile_data["credit_move_id"][0]
|
||||
if debit_move_id not in debit_amount.keys():
|
||||
debit_amount[debit_move_id] = 0.0
|
||||
debit_amount_currency[debit_move_id] = 0.0
|
||||
debit_amount[debit_move_id] += account_partial_reconcile_data["amount"]
|
||||
debit_amount_currency[debit_move_id] += account_partial_reconcile_data[
|
||||
"debit_amount_currency"
|
||||
]
|
||||
if credit_move_id not in credit_amount.keys():
|
||||
credit_amount[credit_move_id] = 0.0
|
||||
credit_amount_currency[credit_move_id] = 0.0
|
||||
credit_amount[credit_move_id] += account_partial_reconcile_data["amount"]
|
||||
credit_amount_currency[credit_move_id] += account_partial_reconcile_data[
|
||||
"credit_amount_currency"
|
||||
]
|
||||
account_partial_reconcile_data.update(
|
||||
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id}
|
||||
)
|
||||
return accounts_partial_reconcile, debit_amount, credit_amount
|
||||
return (
|
||||
accounts_partial_reconcile,
|
||||
debit_amount,
|
||||
credit_amount,
|
||||
debit_amount_currency,
|
||||
credit_amount_currency,
|
||||
)
|
||||
|
||||
def _get_data(
|
||||
self,
|
||||
@@ -60,6 +82,8 @@ class OpenItemsReport(models.AbstractModel):
|
||||
acc_partial_rec,
|
||||
debit_amount,
|
||||
credit_amount,
|
||||
debit_amount_currency,
|
||||
credit_amount_currency,
|
||||
) = self._get_account_partial_reconciled(company_id, date_at_object)
|
||||
if acc_partial_rec:
|
||||
ml_ids = list(map(operator.itemgetter("id"), move_lines))
|
||||
@@ -80,6 +104,8 @@ class OpenItemsReport(models.AbstractModel):
|
||||
company_id,
|
||||
partner_ids,
|
||||
only_posted_moves,
|
||||
debit_amount_currency,
|
||||
credit_amount_currency,
|
||||
)
|
||||
move_lines = [
|
||||
move_line
|
||||
|
||||
Reference in New Issue
Block a user