From a100c4c33600bf2451eebeeef328e39cd452553f Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Thu, 2 Jul 2020 10:54:43 +0000 Subject: [PATCH] [FIX] l10n_cl: Correct document type domain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create an invoice, fill document type "(61) Nota de Crédito Electrònica". Save. Action will be blocked by a warning: document type is invalid. Some options in the document type should not be shown as they can not be used in the customer invoices and customer credit note. opw-2286623 closes odoo/odoo#53987 X-original-commit: 3b9738a394c4944b0c859f68f561e50d14b92942 Signed-off-by: Nicolas Martinelli (nim) --- addons/l10n_cl/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py index 249e155fca7..152d48e272e 100644 --- a/addons/l10n_cl/models/account_move.py +++ b/addons/l10n_cl/models/account_move.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.exceptions import ValidationError from odoo import models, fields, api, _ +from odoo.osv import expression class AccountMove(models.Model): @@ -37,7 +38,7 @@ class AccountMove(models.Model): 'base.cl') or self.partner_id.l10n_cl_sii_taxpayer_type == '4': partner_domain += [('code', 'in', [])] document_type_ids = self.env['l10n_latam.document.type'].search(partner_domain).ids - domain = [('id', 'in', document_type_ids)] + domain = expression.AND([domain, [('id', 'in', document_type_ids)]]) return domain def _check_document_types_post(self):