Commit Graph

315 Commits (872f875225df6cfb3a7a6f53823f4d79a344c35c)

Author SHA1 Message Date
Enric Tobella 872f875225 [FIX] account_reconcile_oca: Use reconcile_form widget. Remove reconcile_manual widget 2025-04-13 07:00:25 +02:00
Enric Tobella 8de2a3e09d [FIX] account_reconcile_oca: orm is no longer defined on the controller 2025-04-13 06:59:28 +02:00
OCA-git-bot 8c644b1232 [BOT] post-merge updates 2025-04-11 10:30:30 +00:00
OCA-git-bot 7212ac1595 Merge PR #827 into 18.0
Signed-off-by etobella
2025-04-11 10:27:33 +00:00
Enric Tobella d26c8c8643 [FIX] account_reconcile_oca: Apply matching of partners on reconciliation models 2025-04-11 10:53:23 +02:00
OCA-git-bot b5dadace18 [BOT] post-merge updates 2025-04-08 04:18:21 +00:00
OCA-git-bot 9179285c3f Merge PR #823 into 18.0
Signed-off-by etobella
2025-04-08 04:15:35 +00:00
Enric Tobella 0602ba2e14 [IMP] account_reconcile_oca: Allow an option to avoid a function 2025-04-07 08:39:59 +02:00
OCA-git-bot 43a9ce7a17 [BOT] post-merge updates 2025-04-01 15:25:56 +00:00
OCA-git-bot 8dfb47944e Merge PR #819 into 18.0
Signed-off-by pedrobaeza
2025-04-01 15:23:05 +00:00
Víctor Martínez f7e30d1401 [FIX] account_reconcile_model_oca: Suggest amls candidates correctly filtering as defined in the reconciliation model
Reconciliation model use case:
- No auto-validate
- No Match Invoice/bill fields set.

Expected result:
- The amls suggested should be as expected, i.e., do not filter for data that
is not defined in the reconciliation model.

TT52146

Related to 1db826b3c4
2025-04-01 12:33:04 +02:00
Víctor Martínez f9078dc573 [PERF] account_reconcile_model_oca: add CTE to invoice amls candidates query
Backport of odoo/enterprise#64754.

This commit adds a CTE at the beginning of the invoice matching
amls candidate to speedup the whole query. More info and speedup
in PR above

Related to f396bc2f1f
2025-04-01 12:32:15 +02:00
Víctor Martínez 6d53fcd7f8 [FIX] account_reconcile_model_oca: only pre-mount true matches with reconcile models
Before, when using reconcile models that wanted to match invoice/bills
to statement based on the Label and/or Note and/or Reference, if there
is no real match with the statement label, the bank reco model would
mount/suggest another entry from the same partner.

This is misleading as we expect to be suggested with lines that actually
match with the statement, as stated in the reconciliation model.

Now, if any of the Invoices/bills matching rule is toggled, it will
suggest *only* matching amls. If no rule is toggled, it will behave like
before (mounting a match if any, or an aml from the same partner).

Related to 8948b31407
2025-04-01 12:30:44 +02:00
Víctor Martínez 13f438d320 [FIX] account_reconcile_model_oca: Fix matching rules with no partner
The orm doesn't match monetary amounts using the related currency.
It means, -208.73 != 208.730000000000002.
Let's match the amount using an sql query instead.

Related to ae848e9981
2025-04-01 12:30:23 +02:00
Víctor Martínez 0510276a36 [FIX] account_reconcile_model_oca: Fix unassigned variable 'balance'
It seems some people are getting an "unassigned variable 'balance'".
This shouldn't happen with the standard code because _get_write_off_move_lines_dict is only
called from the manual reconciliation widget in which, you only have access to models having
strictly lines being percentage or fixed (see get_reconcile_modelds_for_manual_reconciliation).
This method is not called from the bank reco widget pointed by "RECONCILE x ITEMS" on the accounting dashboard.
It probably comes from some customization but I don't know which ones.

Related to 99525f8dac
2025-04-01 12:25:31 +02:00
Víctor Martínez c533e46623 [FIX] account_reconcile_model_oca: rounding issue reconciliation
Fix a decimal issue on reconciliation.

Steps:

- Set a reconciliation model with payment tolerance of 2%
- Create an invoice for $1210
- Create a bank stmt with a line for $1185.80
-> Reconciliation model is not apply

This is because of a decimal issue when calculating
the residual balance after reconciliation, leading to
the difference being 2.000000000000004% instead of 2%.

Related to d33e98b141
2025-04-01 12:24:48 +02:00
Víctor Martínez 92580c31aa [FIX] account_reconcile_model_oca: Fix reco model matching on exact_token
When the payment label is a single word, we try to match the full value and not only the alphanumeric values.
However, the matching was made on the token that was already sanitized using the [0-9a-zA-Z\s] regex.
Instead, let's match the full value.

Related to bccc0ae0e8
2025-04-01 12:24:04 +02:00
Víctor Martínez 31915863ab [FIX] account_reconcile_model_oca: bank rec match with empty name
It can be that the name field on the account_move_line is an empty
string (as opposed to NULL). This can happen, for instance, when
generating the payment term line for Switzerland without the appropriate
fields on the company.

Since there are instances when the payment term's name is an empty
string, we can retrieve these lines and automatically match them with
payments from  the bank reconciliation model. This can happen
automatically, with exact matches between a payment with a near-empty
reference (when the payment ref is just "/" or "?", this is sanitized
and ends up as an empty string for the purposes of comparison), and
these empty string payment term invoice lines.

The query that fetches the candidate lines for exact matches already
excludes those lines with a NULL move_line name, move ref, move name.
The natural extension of this behav

Related to ee22c02b1f
2025-04-01 12:23:21 +02:00
Víctor Martínez bd711b03a6 [FIX] account_reconcile_model_oca: Add textual tokens to improve matching rules
Making `SUBSTRING(REGEXP_REPLACE(LOWER(...), '[^0-9a-z\s]', '', 'g'), '\S(?:.*\S)*')` is costly in sql.
To avoid that, the tokens are computed python-side to avoid this extra processing.
Also, we want to avoid extra conditions on the tokens before executing the queries (and avoid it if necessary).
For example, we want to execute the query matching the sale orders only if at least one token is prefixed correctly by 'SO'.

Related to 76da4b055f
2025-04-01 12:22:37 +02:00
Víctor Martínez bdfc430bf6 [FIX] account_reconcile_model_oca: reconciliation models
Some behavior were incorrect with reconciliation
rules:

1) Whit invoice_matching rule, no match_text_location
  and no match partner set. Nothing was matching, even
  by filling the right fields.
2) We were taking into account only the digits of the
   payment reference of the invoice, by removing all
   non digits characters. It has been decided to also
   taking non digit strings from 'payment_ref' and 'ref'
   into account, as long as they don't exceed one word.

Steps for point 1:

- Reco model with invoice_atching rule, payment_tolerance 0%,
  no match_text_location and no match_partner
- An invoice for 100$ with name of the invoice as payment reference
  (eg 'INV/2023/00001')
- A statement line of 100$ with either 'payment_ref, 'ref' or 'narration'
  set as 'INV/2023/00001', and no partner
-> No match

Steps for point 2:

- Same reco model but with match_text_location_label set to True
- An invoice for 100$ with eg 'abcdef' as payment reference
- A  statement line of 100$ with payment_reference (label) set
  as 'abcdef' and no partner
-> No match

Related to cddea14954
2025-04-01 12:21:49 +02:00
Víctor Martínez 02ccd70dc0 [FIX] account_reconcile_model_oca: fix partner category reconciliation when partner has multiple categories
* Create a reconciliation model that matches partners that have a
  category `C`
* Create a bank statement and a partner that has *multiple* categories,
  including C.
* Validate and reconcile

The reconciliation model you created should be used, but it is not.

Related to a0016fc6c9
2025-04-01 12:17:05 +02:00
OCA-git-bot 8de3e4485d [BOT] post-merge updates 2025-03-02 11:51:28 +00:00
oca-ci d0cf63b5e2 [UPD] Update account_reconcile_oca.pot 2025-03-02 11:48:29 +00:00
OCA-git-bot 093beb0ad2 Merge PR #808 into 18.0
Signed-off-by pedrobaeza
2025-03-02 11:45:45 +00:00
Víctor Martínez cff464e5ac [FIX] account_reconcile_oca: Avoiding the singleton error related to _get_reconcile_line()
Example use case:
 File "/opt/odoo/auto/addons/account_reconcile_oca/models/account_bank_statement_line.py", line 541, in _compute_reconcile_data_info
    record.reconcile_data_info = record._default_reconcile_data(
  File "/opt/odoo/auto/addons/account_reconcile_oca/models/account_bank_statement_line.py", line 698, in _default_reconcile_data
    reconcile_auxiliary_id, lines = self._get_reconcile_line(
  File "/opt/odoo/auto/addons/account_reconcile_oca/models/account_bank_statement_line.py", line 1164, in _get_reconcile_line
    new_vals = super()._get_reconcile_line(
  File "/opt/odoo/auto/addons/account_reconcile_oca/models/account_reconcile_abstract.py", line 49, in _get_reconcile_line
    original_amount = amount = net_amount = line.debit - line.credit
  File "/opt/odoo/custom/src/odoo/odoo/fields.py", line 1154, in __get__
    record.ensure_one()
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 5204, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: account.move.line(208, 211, 212)

TT55221
2025-02-28 14:43:53 +01:00
mymage 366f368c78 Translated using Weblate (Italian)
Currently translated at 100.0% (3 of 3 strings)

Translation: account-reconcile-18.0/account-reconcile-18.0-account_reconcile_model_oca
Translate-URL: https://translation.odoo-community.org/projects/account-reconcile-18-0/account-reconcile-18-0-account_reconcile_model_oca/it/
2025-02-26 11:06:33 +00:00
Weblate 9177dc021a Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-reconcile-18.0/account-reconcile-18.0-account_reconcile_model_oca
Translate-URL: https://translation.odoo-community.org/projects/account-reconcile-18-0/account-reconcile-18-0-account_reconcile_model_oca/
2025-02-25 19:52:39 +00:00
Jordi Ballester Alomar 584632f6b8 [FIX] account_reconcile_oca: remove lint errors 2025-02-25 18:43:49 +01:00
Jordi Ballester Alomar d4b9d8f83d [FIX] account_reconcile_oca: use lazy translation 2025-02-25 18:33:35 +01:00
Jordi Ballester Alomar f81e2e5ec9 [FIX] account_reconcile_oca: force update of data in posted journal entry 2025-02-25 18:30:57 +01:00
Jordi Ballester Alomar edd06e734f [IMP] pylint 2025-02-25 18:30:57 +01:00
Alexis de Lattre fee65b9d9e [MIG] account_reconcile_oca from v17 to v18 2025-02-25 18:30:57 +01:00
OCA-git-bot dc28337385 [BOT] post-merge updates 2025-02-25 18:30:56 +01:00
Víctor Martínez 908daaaa01 [FIX] account_reconcile_oca: Set the appropriate value for partner_id to avoid warning log
WARNING prod py.warnings: /opt/odoo/auto/addons/account/models/account_move.py:4651: UserWarning: unsupported operand type(s) for "==": 'res.partner()' == '403'
2025-02-25 18:30:56 +01:00
Víctor Martínez e8dee468ca [FIX] account_reconcile_oca: Replace name_get() to delete the warning log
WARNING prod py.warnings: /opt/odoo/auto/addons/account_reconcile_oca/models/account_bank_statement_line.py:616: DeprecationWarning: Since 17.0, deprecated method, read display_name instead
2025-02-25 18:30:56 +01:00
mymage e36c516d25 Translated using Weblate (Italian)
Currently translated at 100.0% (122 of 122 strings)

Translation: account-reconcile-17.0/account-reconcile-17.0-account_reconcile_oca
Translate-URL: https://translation.odoo-community.org/projects/account-reconcile-17-0/account-reconcile-17-0-account_reconcile_oca/it/
2025-02-25 18:30:56 +01:00
Weblate 5508f31e8f Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-reconcile-17.0/account-reconcile-17.0-account_reconcile_oca
Translate-URL: https://translation.odoo-community.org/projects/account-reconcile-17-0/account-reconcile-17-0-account_reconcile_oca/
2025-02-25 18:30:56 +01:00
OCA-git-bot 3d38e87c3a [BOT] post-merge updates 2025-02-25 18:30:56 +01:00
Enric Tobella 90262374d8 [IMP] account_reconcile_oca: Allow to select all lines at once 2025-02-25 18:30:56 +01:00
OCA-git-bot 7a27012bdd [BOT] post-merge updates 2025-02-25 18:30:56 +01:00
Florian da Costa 2155c5a08d [FIX] Replace removed compute method by _convert 2025-02-25 18:30:56 +01:00
Florian da Costa dbd55e8fa5 [FIX] partner update from reconciliation widget
We cant to avoid to change amounts on accounting entries during the reconciliation process. One of the goal is to avoid a following case :
The statement line is created in a foreign currency journal, later, the rate is updated in Odoo.
During reconciliation process, the partner is set on liquidity line, the accounting entries are synchronized and the balance changes.
2025-02-25 18:30:56 +01:00
Florian da Costa a42eae4fab [FIX] Synchronise partner from statement line to accounting entries
We need to look at the reconcile_data to find the partner as the manual_partner_id can contain the information of an auxiliary line
2025-02-25 18:30:56 +01:00
Víctor Martínez dbd81a38c7 [FIX] account_reconcile_oca: Synchronize manual_partner_id with partner_id without onchange or subsequent changes with the _synchronize_to_moves() method.
We do not define partner_id with the value of manual_partner_id to prevent _synchronize_to_moves()
from making changes to the account.move.line leaving unintended values and/or data.

Re-define the value of reconcile_data_info if the _synchronize_to_moves() method has changed
anything on the lines.

Related to https://github.com/OCA/account-reconcile/issues/779

TT52634
2025-02-25 18:30:56 +01:00
Sergio Bustamante 7da5bc0d24 [FIX] account_reconcile_oca: Fix currency and amount when using reconciliation models 2025-02-25 18:30:56 +01:00
Florian da Costa eae996e13f [FIX] Wrong amount currency compute in case of change in liquidity line 2025-02-25 18:30:56 +01:00
Florian da Costa 0e4f79c908 [FIX] fix _check_line_changed partner check 2025-02-25 18:30:56 +01:00
Enric Tobella 20f60cfe62 [FIX] account_reconcile_oca: Update currency_amount 2025-02-25 18:30:56 +01:00
Florian da Costa 4fe0125cc9 [FIX] account_reconcile_oca : exchange rate gain/loss currency and amount
If currency amount is not 0, the suspense line will have wrong amount
2025-02-25 18:30:56 +01:00
Florian da Costa 829299dffe [FIX] account_reconcile_oca : max_amount rounding error leading to unwanted currency conversion 2025-02-25 18:30:56 +01:00