Skip to content
Snippets Groups Projects
Commit 3b29b23e authored by Gustavo Valverde's avatar Gustavo Valverde Committed by GitHub
Browse files

[FIX] l10n_latam_invoice_document: Do not restrict additional use cases


If the account.move already has a `l10n_latam_document_number` set on it, the post() method should not try to consume a sequence again by any means. The validation filtering is also done with `l10n_latam_document_number` as this is the field which give the `account.move.name` the desired value; this makes a stronger validation while making it more flexible for other localizations which do not depend on the `account.move.name` to post an invoice.

On vendor invoices it allows to manually assign a `l10n_latam_document_number` and posting it without needing an ir.sequence assigned to the specific consuming a sequence from ir.sequence (and it does not even need to have one) as the value is already in the account.move.

**Context**: Not all latam localizations use the `l10n_latam_document_number` as the move `name`. This is basically for auditing purposes, as some countries (like Dominican Republic, Honduras, etc) do not always have **continuity** in their sequences, requiring to keep Odoo's base behavior on the move.name

closes odoo/odoo#43850

Signed-off-by: default avatarJosse Colpaert <jco@openerp.com>
parent ba6206ba
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,7 @@ class AccountMove(models.Model):
return super(AccountMove, self - with_latam_document_number)._compute_invoice_sequence_number_next()
def post(self):
for rec in self.filtered(lambda x: x.l10n_latam_use_documents and (not x.name or x.name == '/')):
for rec in self.filtered(lambda x: x.l10n_latam_use_documents and not x.l10n_latam_document_number):
if not rec.l10n_latam_sequence_id:
raise UserError(_('No sequence or document number linked to invoice id %s') % rec.id)
if rec.type in ('in_receipt', 'out_receipt'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment