Skip to content

Commit

Permalink
[IMP] account_reconcile_oca: Improve _compute_reconcile_data_info. Wh…
Browse files Browse the repository at this point in the history
…en changing account_id on journal item, data displayed in reconcilitation menu now is updated
  • Loading branch information
sergiobstoj committed Dec 27, 2024
1 parent 3e6180f commit 1b3c5c5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion account_reconcile_oca/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,23 @@ def _update_move_partner(self):
return
self.partner_id = self.manual_partner_id

@api.depends("reconcile_data", "is_reconciled")
def _check_recompute_reconcile_data(self):
self.ensure_one()
if self.reconcile_data:
reconciled_data_account_id = self.reconcile_data.get("data", [{}])[0].get(
"account_id", [0, ""]
)[0]
move_line_id = self.reconcile_data.get("data", [{}])[0].get("id", False)
move_line = self.env["account.move.line"].browse(move_line_id) or False
if reconciled_data_account_id != move_line.account_id.id:
return True

Check warning on line 459 in account_reconcile_oca/models/account_bank_statement_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_bank_statement_line.py#L459

Added line #L459 was not covered by tests
return False

@api.depends("reconcile_data", "is_reconciled", "move_id.line_ids.account_id")
def _compute_reconcile_data_info(self):
for record in self:
if record._check_recompute_reconcile_data():
record.reconcile_data = False

Check warning on line 466 in account_reconcile_oca/models/account_bank_statement_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_bank_statement_line.py#L466

Added line #L466 was not covered by tests
if record.reconcile_data:
record.reconcile_data_info = record.reconcile_data
else:
Expand Down

0 comments on commit 1b3c5c5

Please sign in to comment.