From 4ff9458dc71963c73a000799229c2bc4e09aaf97 Mon Sep 17 00:00:00 2001 From: Pablo Montenegro Date: Fri, 14 Apr 2023 19:18:45 +0000 Subject: [PATCH] [FIX] l10n_latam_check: prevent selecting checks on payments belonging to other company Task: 30336 Description of the issue/feature this PR addresses: In a payment when selecting checks it is allowed to select checks belonging to different companies but it is necessary to allow only to select companies from the same company (the company of the payment). Current behavior before PR: In a payment when selecting checks it is allowed to select checks belonging to different companies. Desired behavior after PR is merged: In a payment not allow to select checks belonging to different companies closes odoo/odoo#119755 X-original-commit: 6d6e385a37fa23597bc58a0e14cfcf08df13d57a Signed-off-by: Josse Colpaert --- addons/l10n_latam_check/models/account_payment.py | 1 + addons/l10n_latam_check/views/account_payment_view.xml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/l10n_latam_check/models/account_payment.py b/addons/l10n_latam_check/models/account_payment.py index fee1f483393..e5d76a5377c 100644 --- a/addons/l10n_latam_check/models/account_payment.py +++ b/addons/l10n_latam_check/models/account_payment.py @@ -15,6 +15,7 @@ class AccountPayment(models.Model): string='Check', readonly=True, states={'draft': [('readonly', False)]}, copy=False, + check_company=True, ) l10n_latam_check_operation_ids = fields.One2many( comodel_name='account.payment', diff --git a/addons/l10n_latam_check/views/account_payment_view.xml b/addons/l10n_latam_check/views/account_payment_view.xml index 11b15d8b9a9..96b10eb5c3b 100644 --- a/addons/l10n_latam_check/views/account_payment_view.xml +++ b/addons/l10n_latam_check/views/account_payment_view.xml @@ -51,11 +51,11 @@ 'invisible': [('payment_method_code', 'not in', ['in_third_party_checks', 'out_third_party_checks']), ('l10n_latam_check_id', '=', False)], 'required': [('payment_method_code', 'in', ['in_third_party_checks', 'out_third_party_checks'])]}" domain=" - [('payment_method_code', '=', 'new_third_party_checks'), ('l10n_latam_check_current_journal_id', '=', journal_id), ('state', '=', 'posted')] + [('payment_method_code', '=', 'new_third_party_checks'), ('l10n_latam_check_current_journal_id', '=', journal_id), ('state', '=', 'posted'), ('company_id', '=', company_id)] if payment_type == 'outbound' else - [('payment_method_code', '=', 'new_third_party_checks'), ('l10n_latam_check_current_journal_id', '=', destination_journal_id), ('state', '=', 'posted')] + [('payment_method_code', '=', 'new_third_party_checks'), ('l10n_latam_check_current_journal_id', '=', destination_journal_id), ('state', '=', 'posted'), ('company_id', '=', company_id)] if is_internal_transfer else - [('payment_method_code', '=', 'new_third_party_checks'), ('l10n_latam_check_current_journal_id', '=', False), ('state', '=', 'posted')]" + [('payment_method_code', '=', 'new_third_party_checks'), ('l10n_latam_check_current_journal_id', '=', False), ('state', '=', 'posted'), ('company_id', '=', company_id)]" options="{'no_create': True}" />