[ADD] account_multicompany_ux: block inter-company reconciliation option#289
Open
rov-adhoc wants to merge 1 commit into
Open
[ADD] account_multicompany_ux: block inter-company reconciliation option#289rov-adhoc wants to merge 1 commit into
rov-adhoc wants to merge 1 commit into
Conversation
Add `block_intercompany_conciliation` boolean field to `res.company` to allow blocking reconciliation between journal items from different companies or branches. - New field on `res.company`, visible only when the company has child companies (branches). - Inherit `account.reconcile.wizard` to raise a `UserError` when reconciling move lines from different companies if the flag is enabled on any of the parent companies involved.
Contributor
There was a problem hiding this comment.
Pull request overview
Este PR introduce una configuración a nivel compañía para impedir la conciliación de apuntes contables entre compañías/ramas distintas, y la aplica en el wizard de conciliación para bloquear la operación cuando corresponda.
Changes:
- Agrega el booleano
block_intercompany_conciliationenres.companyy lo muestra en el formulario de compañía (solo si hay sucursales). - Hereda
account.reconcile.wizardpara levantar unUserErroral intentar conciliar líneas de distintas compañías cuando el flag está activo. - Registra el nuevo archivo de wizard en
wizards/__init__.py.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| account_multicompany_ux/wizards/account_reconcilice_wizard.py | Override del reconcile para bloquear conciliaciones inter-compañía según configuración. |
| account_multicompany_ux/wizards/init.py | Import del nuevo wizard para que se cargue el override. |
| account_multicompany_ux/views/res_company_views.xml | Añade el campo de configuración en la vista de compañía con visibilidad condicional. |
| account_multicompany_ux/models/res_company.py | Define el nuevo campo booleano en res.company. |
Comments suppressed due to low confidence (2)
account_multicompany_ux/wizards/account_reconcilice_wizard.py:11
- La condición para bloquear la conciliación no está mirando las compañías “padre” de las compañías involucradas.
companiessale demove_line_ids.company_id, pero el checkc.child_ids and c.block_intercompany_conciliationsolo detecta el flag si una de esas compañías (la de los apuntes) tiene hijos; si el flag se activa en la compañía padre y se concilian líneas de sucursales, esto no se va a bloquear. Sugerencia: calcular el conjunto de compañías a evaluar incluyendocompanies.mapped('parent_id')(y/oparent_of) y validar el booleano sobre esas compañías, sin depender dechild_ids.
companies = wizard.move_line_ids.mapped("company_id")
if len(companies) > 1 and companies.filtered(lambda c: c.child_ids and c.block_intercompany_conciliation):
account_multicompany_ux/wizards/account_reconcilice_wizard.py:16
- El
UserErrorusa texto literal sin envolver en_(), por lo que no es traducible. Además, el mensaje referencia el nombre de la opción en inglés ('Block inter-company reconciliation') pero el label del campo está en español, lo que puede confundir. Sugerencia: importar_desdeodooy envolver el mensaje en_(), evitando hardcodear el nombre de la opción o usando el mismo texto traducible que se muestra en UI.
raise UserError(
"Cannot reconcile journal items from different companies. "
"Please verify that the 'Block inter-company reconciliation' option "
"is not enabled in the settings of the companies involved."
)
| @@ -1 +1 @@ | |||
| from . import account_change_company | |||
| from . import account_change_company, account_reconcilice_wizard | |||
Comment on lines
+8
to
+11
| def reconcile(self): | ||
| for wizard in self: | ||
| companies = wizard.move_line_ids.mapped("company_id") | ||
| if len(companies) > 1 and companies.filtered(lambda c: c.child_ids and c.block_intercompany_conciliation): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add
block_intercompany_conciliationboolean field tores.companyto allow blocking reconciliation between journal items from different companies or branches.res.company, visible only when the company has child companies (branches).account.reconcile.wizardto raise aUserErrorwhen reconciling move lines from different companies if the flag is enabled on any of the parent companies involved.