Skip to content

Commit

Permalink
add the feature for the auto_reconcile process
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwul committed May 8, 2024
1 parent f434d93 commit 076b39f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
3 changes: 1 addition & 2 deletions account_offbalance_sponsorship/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-

from . import controllers
from . import models
from . import models
1 change: 1 addition & 0 deletions account_offbalance_sponsorship/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
# any module necessary for this one to work correctly
'depends': ['base',
'sponsorship_compassion',
'account_reconcile_compassion',
],

# always loaded
Expand Down
24 changes: 24 additions & 0 deletions account_offbalance_sponsorship/models/bank_statement_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,27 @@ def _create_counterpart_and_new_aml(self, counterpart_moves, counterpart_aml_dic
{"account_id": res.journal_id.payment_debit_account_id.id, "move_id": res.id, "debit": 0,
"credit": self.amount}))
return res

def reconcile(self, lines_vals_list, to_check=False):
super().reconcile( lines_vals_list, to_check)
add_lines=False
company = self.move_id.company_id
param_obj = self.env["res.config.settings"].sudo().with_company(company)
account_offbalance_receivable = (param_obj.get_param("account_offbalance_receivable"))
account_offbalance_asset = (param_obj.get_param("account_offbalance_asset"))
for l in self.move_id.line_ids:
if l.account_id.id == account_offbalance_receivable:
add_lines = True
if add_lines:
for l in lines_vals_list:
if l['id']:
counterpart_reconciled = self.env["account.move.line"].browse(l["id"])
if account_offbalance_receivable == counterpart_reconciled.account_id.id:
self.move_id.line_ids += (
self.env["account.move.line"].with_context(check_move_validity=False).create(
{"account_id": account_offbalance_asset, "move_id": self.move_id.id, "debit": self.amount,
"credit": 0}
) + self.env["account.move.line"].with_context(check_move_validity=False).create(
{"account_id": self.move_id.journal_id.payment_debit_account_id.id, "move_id": self.move_id.id, "debit": 0,
"credit": self.amount}))

0 comments on commit 076b39f

Please sign in to comment.