[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 <jco@odoo.com>
This commit is contained in:
Pablo Montenegro
2023-05-02 14:47:10 +02:00
parent 209e2ebb04
commit 4ff9458dc7
2 changed files with 4 additions and 3 deletions
@@ -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',
@@ -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}"
/>
</field>