From 37f1df724169714c1a59eb3304c5f2e19a695787 Mon Sep 17 00:00:00 2001 From: nguyenhk Date: Wed, 13 Oct 2021 17:15:37 +0700 Subject: [PATCH] [MIG] account_reconcile_model_strict_match_amount: Migration to 14.0 --- .../README.rst | 17 +++- .../__manifest__.py | 2 +- .../models/account_reconcile_model.py | 19 ++-- .../readme/CONTRIBUTORS.rst | 2 + .../readme/CREDITS.rst | 1 + .../static/description/index.html | 25 +++-- ...unt_reconcile_model_strict_match_amount.py | 98 +++++++++++-------- 7 files changed, 101 insertions(+), 63 deletions(-) create mode 100644 account_reconcile_model_strict_match_amount/readme/CREDITS.rst diff --git a/account_reconcile_model_strict_match_amount/README.rst b/account_reconcile_model_strict_match_amount/README.rst index 987660a1..a3135759 100644 --- a/account_reconcile_model_strict_match_amount/README.rst +++ b/account_reconcile_model_strict_match_amount/README.rst @@ -14,13 +14,13 @@ Account Reconciliation Model Strict Match Amount :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github - :target: https://github.com/OCA/account-reconcile/tree/13.0/account_reconcile_model_strict_match_amount + :target: https://github.com/OCA/account-reconcile/tree/14.0/account_reconcile_model_strict_match_amount :alt: OCA/account-reconcile .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-reconcile-13-0/account-reconcile-13-0-account_reconcile_model_strict_match_amount + :target: https://translation.odoo-community.org/projects/account-reconcile-14-0/account-reconcile-14-0-account_reconcile_model_strict_match_amount :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/98/13.0 + :target: https://runbot.odoo-community.org/runbot/98/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -41,7 +41,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -57,6 +57,13 @@ Contributors ~~~~~~~~~~~~ * Akim Juillerat +* `Trobz `_: + * Nguyen Ho + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp Maintainers ~~~~~~~~~~~ @@ -71,6 +78,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/account-reconcile `_ project on GitHub. +This module is part of the `OCA/account-reconcile `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_reconcile_model_strict_match_amount/__manifest__.py b/account_reconcile_model_strict_match_amount/__manifest__.py index b5ed811d..9dcc1875 100644 --- a/account_reconcile_model_strict_match_amount/__manifest__.py +++ b/account_reconcile_model_strict_match_amount/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Account Reconciliation Model Strict Match Amount", "summary": "Restrict reconciliation propositions to matching amount parameter", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "category": "Accounting", "website": "https://github.com/OCA/account-reconcile", "author": "Camptocamp, Odoo Community Association (OCA)", diff --git a/account_reconcile_model_strict_match_amount/models/account_reconcile_model.py b/account_reconcile_model_strict_match_amount/models/account_reconcile_model.py index 16e1a17d..ed46151b 100644 --- a/account_reconcile_model_strict_match_amount/models/account_reconcile_model.py +++ b/account_reconcile_model_strict_match_amount/models/account_reconcile_model.py @@ -28,11 +28,12 @@ class AccountReconcileModel(models.Model): substring(REGEXP_REPLACE(aml.name, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*') != '' AND regexp_split_to_array(substring(REGEXP_REPLACE(aml.name, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'),'\s+') - && regexp_split_to_array(substring(REGEXP_REPLACE(st_line.name, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'), '\s+') + && regexp_split_to_array(substring(REGEXP_REPLACE(st_line.payment_ref, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'), '\s+') ) OR regexp_split_to_array(substring(REGEXP_REPLACE(move.name, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'),'\s+') - && regexp_split_to_array(substring(REGEXP_REPLACE(st_line.name, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'), '\s+') + && + regexp_split_to_array(substring(REGEXP_REPLACE(st_line.payment_ref, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'), '\s+') OR ( move.ref IS NOT NULL @@ -40,7 +41,8 @@ class AccountReconcileModel(models.Model): substring(REGEXP_REPLACE(move.ref, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*') != '' AND regexp_split_to_array(substring(REGEXP_REPLACE(move.ref, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'),'\s+') - && regexp_split_to_array(substring(REGEXP_REPLACE(st_line.name, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'), '\s+') + && + regexp_split_to_array(substring(REGEXP_REPLACE(st_line.payment_ref, '[^0-9|^\s]', '', 'g'), '\S(?:.*\S)*'), '\s+') ) , FALSE) AND @@ -48,7 +50,7 @@ class AccountReconcileModel(models.Model): WHEN abs(st_line.amount) < abs(aml.balance) THEN abs(st_line.amount) / abs(aml.balance) * 100 WHEN abs(st_line.amount) > abs(aml.balance) THEN abs(aml.balance) / abs(st_line.amount) * 100 ELSE 100 - END >= {match_total_amount_param} AS communication_flag + END >= {match_total_amount_param} """.format( match_total_amount_param=self.match_total_amount_param ) @@ -58,19 +60,20 @@ class AccountReconcileModel(models.Model): return super()._get_select_payment_reference_flag() else: return r""" - -- Determine a matching or not with the statement line communication using the move.invoice_payment_ref. + -- Determine a matching or not with the statement line communication using the move.payment_reference. COALESCE ( - move.invoice_payment_ref IS NOT NULL + move.payment_reference IS NOT NULL AND - regexp_replace(move.invoice_payment_ref, '\s+', '', 'g') = regexp_replace(st_line.name, '\s+', '', 'g') + regexp_replace(move.payment_reference, '\s+', '', 'g') = + regexp_replace(st_line.payment_ref, '\s+', '', 'g') , FALSE) AND CASE WHEN abs(st_line.amount) < abs(aml.balance) THEN abs(st_line.amount) / abs(aml.balance) * 100 WHEN abs(st_line.amount) > abs(aml.balance) THEN abs(aml.balance) / abs(st_line.amount) * 100 ELSE 100 - END >= {match_total_amount_param} AS payment_reference_flag + END >= {match_total_amount_param} """.format( match_total_amount_param=self.match_total_amount_param ) diff --git a/account_reconcile_model_strict_match_amount/readme/CONTRIBUTORS.rst b/account_reconcile_model_strict_match_amount/readme/CONTRIBUTORS.rst index e31e2f0c..ff1c829b 100644 --- a/account_reconcile_model_strict_match_amount/readme/CONTRIBUTORS.rst +++ b/account_reconcile_model_strict_match_amount/readme/CONTRIBUTORS.rst @@ -1 +1,3 @@ * Akim Juillerat +* `Trobz `_: + * Nguyen Ho diff --git a/account_reconcile_model_strict_match_amount/readme/CREDITS.rst b/account_reconcile_model_strict_match_amount/readme/CREDITS.rst new file mode 100644 index 00000000..f37ebe75 --- /dev/null +++ b/account_reconcile_model_strict_match_amount/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp diff --git a/account_reconcile_model_strict_match_amount/static/description/index.html b/account_reconcile_model_strict_match_amount/static/description/index.html index 1ce527a7..22ee33c6 100644 --- a/account_reconcile_model_strict_match_amount/static/description/index.html +++ b/account_reconcile_model_strict_match_amount/static/description/index.html @@ -3,7 +3,7 @@ - + Account Reconciliation Model Strict Match Amount