[FIX] l10n_latam_invoice_document: only trigger constraint when partner_id is set
Before, when importing twice the same invoice, or even with the more theoretical possibility of having the same number for different partners, the constraint would be triggered, giving unnecessary problems when importing vendor bills with an uncertain partner_id. If we check the logic followed in the regular accounting on the ref field, it only triggers when a partner is set, so we can follow the same logic here. closes odoo/odoo#68408 X-original-commit: 9cbf63bd644d6d6d629266fe31edc91b44f22aa6 Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
@@ -272,7 +272,8 @@ class AccountMove(models.Model):
|
||||
""" The constraint _check_unique_sequence_number is valid for customer bills but not valid for us on vendor
|
||||
bills because the uniqueness must be per partner """
|
||||
for rec in self.filtered(
|
||||
lambda x: x.name and x.name != '/' and x.is_purchase_document() and x.l10n_latam_use_documents):
|
||||
lambda x: x.name and x.name != '/' and x.is_purchase_document() and x.l10n_latam_use_documents
|
||||
and x.commercial_partner_id):
|
||||
domain = [
|
||||
('move_type', '=', rec.move_type),
|
||||
# by validating name we validate l10n_latam_document_type_id
|
||||
|
||||
Reference in New Issue
Block a user