Skip to content

Commit

Permalink
Merge pull request #705 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/account-reconcile (16.0)
  • Loading branch information
bt-admin authored Feb 5, 2025
2 parents dcfc1ec + 521a52c commit a7308fc
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ addon | version | maintainers | summary
[account_move_reconcile_forbid_cancel](account_move_reconcile_forbid_cancel/) | 16.0.1.0.1 | | Account Move Reconcile Forbid Cancel
[account_move_so_import](account_move_so_import/) | 16.0.1.0.0 | | Journal Entry Sale Order completion
[account_reconcile_analytic_tag](account_reconcile_analytic_tag/) | 16.0.1.2.1 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Analytic tags in account reconciliation
[account_reconcile_oca](account_reconcile_oca/) | 16.0.2.2.4 | [![etobella](https://github.com/etobella.png?size=30px)](https://github.com/etobella) | Reconcile addons for Odoo CE accounting
[account_reconcile_oca](account_reconcile_oca/) | 16.0.2.3.0 | [![etobella](https://github.com/etobella.png?size=30px)](https://github.com/etobella) | Reconcile addons for Odoo CE accounting
[account_statement_base](account_statement_base/) | 16.0.1.14.0 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Base module for Bank Statements
[base_transaction_id](base_transaction_id/) | 16.0.1.0.0 | | Base transaction ID for financial institutes

Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Reconcile Oca
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f1380712a90ddc273dc735f694fa67586b925e76a980c6a740cfc77dec728814
!! source digest: sha256:e6c35a94d7647b0b2eda8d07d4b6b4d7799ffe98c3de2f13f458030606e35188
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Account Reconcile Oca",
"summary": """
Reconcile addons for Odoo CE accounting""",
"version": "16.0.2.2.4",
"version": "16.0.2.3.0",
"license": "AGPL-3",
"author": "CreuBlanca,Dixmit,Odoo Community Association (OCA)",
"maintainers": ["etobella"],
Expand Down
15 changes: 12 additions & 3 deletions account_reconcile_oca/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ def _inverse_reconcile_data_info(self):
def _reconcile_data_by_model(self, data, reconcile_model, reconcile_auxiliary_id):
new_data = []
liquidity_amount = 0.0
currency = self._get_reconcile_currency()
currency_amount = False
default_name = ""
for line_data in data:
if line_data["kind"] == "suspense":
Expand All @@ -555,6 +557,13 @@ def _reconcile_data_by_model(self, data, reconcile_model, reconcile_auxiliary_id
amount = self.foreign_currency_id.compute(
amount, self.journal_id.currency_id or self.company_currency_id
)
if currency != self.company_id.currency_id:
currency_amount = self.company_id.currency_id._convert(
amount,
currency,
self.company_id,
self.date,
)
new_line.update(
{
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
Expand All @@ -567,9 +576,9 @@ def _reconcile_data_by_model(self, data, reconcile_model, reconcile_auxiliary_id
.browse(line["account_id"])
.name_get()[0],
"date": fields.Date.to_string(self.date),
"line_currency_id": self.company_id.currency_id.id,
"line_currency_id": currency.id,
"currency_id": self.company_id.currency_id.id,
"currency_amount": amount,
"currency_amount": currency_amount or amount,
"name": line.get("name") or self.payment_ref,
}
)
Expand Down Expand Up @@ -630,7 +639,7 @@ def _default_reconcile_data(self, from_unreconcile=False):
)
amount -= sum(line.get("amount") for line in line_data)
data += line_data
if res.get("auto_reconcile"):
if res.get("auto_reconcile") and self.reconcile_data_info:
self.reconcile_bank_line()
return self._recompute_suspense_line(
data,
Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Account Reconcile Oca</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f1380712a90ddc273dc735f694fa67586b925e76a980c6a740cfc77dec728814
!! source digest: sha256:e6c35a94d7647b0b2eda8d07d4b6b4d7799ffe98c3de2f13f458030606e35188
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon allows to reconcile bank statements and account marked as <cite>reconcile</cite>.</p>
Expand Down
51 changes: 51 additions & 0 deletions account_reconcile_oca/tests/test_bank_account_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,57 @@ def test_reconcile_invoice_keep(self):
self.assertTrue(reconcile_move.reversal_move_id)
self.assertFalse(bank_stmt_line.is_reconciled)

def test_reconcile_model_with_foreign_currency(self):
"""
We want to test what happens when we select a reconcile model to fill a
bank statement with a foreign currency.
"""
bank_stmt = self.acc_bank_stmt_model.create(
{
"journal_id": self.bank_journal_usd.id,
"date": time.strftime("%Y-07-15"),
"name": "test",
}
)
bank_stmt_line = self.acc_bank_stmt_line_model.create(
{
"name": "testLine",
"journal_id": self.bank_journal_usd.id,
"statement_id": bank_stmt.id,
"amount": 100,
"date": time.strftime("%Y-07-15"),
}
)
with Form(
bank_stmt_line,
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
) as f:
self.assertFalse(f.can_reconcile)
f.manual_model_id = self.rule
self.assertTrue(f.can_reconcile)
number_of_lines = len(bank_stmt_line.reconcile_data_info["data"])
bank_stmt_line.reconcile_bank_line()
self.assertEqual(
number_of_lines, len(bank_stmt_line.reconcile_data_info["data"])
)
self.assertEqual(2, len(bank_stmt_line.move_id.line_ids))
self.assertTrue(
bank_stmt_line.move_id.line_ids.filtered(
lambda r: r.account_id == self.current_assets_account
)
)
expected_amount = bank_stmt_line._get_reconcile_currency()._convert(
bank_stmt_line.amount,
bank_stmt_line.company_id.currency_id,
bank_stmt_line.company_id,
bank_stmt_line.date,
)
self.assertEqual(
bank_stmt_line.move_id.line_ids[0].amount_currency, bank_stmt_line.amount
)
self.assertEqual(bank_stmt_line.move_id.line_ids[0].debit, expected_amount)
self.assertEqual(bank_stmt_line.move_id.line_ids[1].credit, expected_amount)

# Testing to check functionality

def test_reconcile_invoice_to_check_reconciled(self):
Expand Down

0 comments on commit a7308fc

Please sign in to comment.