Skip to content

[ADD] account_multicompany_ux: block inter-company reconciliation option#289

Open
rov-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-67802-rov
Open

[ADD] account_multicompany_ux: block inter-company reconciliation option#289
rov-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-67802-rov

Conversation

@rov-adhoc
Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI review requested due to automatic review settings May 26, 2026 18:31
@roboadhoc
Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_conciliation en res.company y lo muestra en el formulario de compañía (solo si hay sucursales).
  • Hereda account.reconcile.wizard para levantar un UserError al 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. companies sale de move_line_ids.company_id, pero el check c.child_ids and c.block_intercompany_conciliation solo 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 incluyendo companies.mapped('parent_id') (y/o parent_of) y validar el booleano sobre esas compañías, sin depender de child_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 UserError usa 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 _ desde odoo y 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):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants