[FIX] l10n_cl: Correct document type domain

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) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-07-02 13:03:08 +00:00
parent 2761a2a127
commit a100c4c336
+2 -1
View File
@@ -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):