odoo/enterprise#68775

Created by fw-bot
Merged at a2d5d7ed1976569057aa92c7eab833a92f032e5b

Statuses:

Linked pull requests
label
odoo-dev:17.0-16.0-opw-3993305-credit_note_document_ecuador-yosa-gljc-fw
head
0d4cd9b7f5c944c751edc494a5e7a9eec48e2c09
merged
1 year ago by Bugfix, Yolann Sabaux (yosa)
odoo/odoo odoo/enterprise
16.0 #174950 #67589
17.0 #177597 #68775
saas-17.1 #177954 #68940
saas-17.2 #177974 #68949
saas-17.4 #178315 #69117
18.0 #181450 #70673
saas-18.1 #191668 #76129
saas-18.2 #197975 #79484
saas-18.3
saas-18.4
19.0
master #178433 #69158

[FW][FIX] l10n_latam_invoice_document: prevent blocking foreign document number

Steps to reproduce:
[l10n_ec]
- Create a credit note from the Bill journal
- Set a foreign customer
- Set a customized document number

Issue:
An error will be raised saying that the format is not correct

But, as defined by VBE, "If a Credit Note is created from a Vendor Bill and the partner_id != "EC", [we should] allow the user to allocate any number without following the EC format."

Solution:
When we call _format_document_number we don't have any information about the initial move. Instead of using a context or adding new fields, we add a hook in which we can specify
certain conditions to bypass the document check/formatting for localisations.

We had to add partner_id to avoid the flow in wich the user set a foreign customer and a custom document type to change back the customer to an ecuadorian one; hence the second part of the test

opw-3993305

Forward-Port-Of: #67589