Thursday, April 14, 2022
1 change · master
Resolved issues and error corrections
Canceled Mexican invoices will now keep their electronic invoice attachment instead of deleting it. This preserves the information needed to confirm the cancellation status with the tax authority, preventing invoices from incorrectly appearing as not found.
Original PR description
#### The issue: At the moment, when we successfully request the cancellation of an invoice in Mexico, the cfdi attachment is deleted. However, several stored computed fields depend on this…
#### The issue: At the moment, when we successfully request the cancellation of an invoice in Mexico, the cfdi attachment is deleted. However, several stored computed fields depend on this attachment, notably the Fiscal Folio uuid. Without this uuid, we can't query the invoice’s status from the SAT. As a result, the invoice’s status is ‘Not Found’ when it really should be ‘Canceled’. See this video by @vbe-odoo demonstrating the problem functionally: https://us02web.zoom.us/rec/play/7kRPfbcM1YixbiezgtHV0C9KAP6AwAmEzf05WtBJO2j3cLMpvSXznOad0qT2u0NoJsisH5ICFLfcxrNN.NjyNJHvBxfK2TNf3?continueMode=true&_x_zm_rtaid=xzBnPaTGTZiTv53zobKqqg.1646836564724.d211a63c07c388cdef9dfb832d780831&_x_zm_rhtaid=552 password: ?wgK1c$N See this explanation of where the issue occurs in the source code: https://drive.google.com/file/d/1z8GhsSk6nphmhB46C0wiDHMZjV7_QSZ8/view?usp=sharing #### The solution: In stable: Retrieve the uuid from the attachment when querying the SAT status. (https://github.com/odoo/enterprise/pull/25533) In master: Don’t delete the attachment when the invoice is successfully canceled. (this PR) #### Does it work? Yes. (See this video where I do the testing): https://drive.google.com/file/d/1IIV7_kntYaUlXF5IarE5FEJaRwTW83qq/view?usp=sharing #### Does it break any other EDIs? No. - only Colombia and Peru use the cancellation workflow - in Colombia, the attachment isn’t used to populate fields - in Peru, the only time the attachment is used is in _l10n_pe_edi_get_extra_report_values (see https://github.com/odoo/enterprise/blob/28554d66478a8d884e618e35406c1ad9ac2dd646/l10n_pe_edi/models/account_move.py#L213-L214 ) which is used to create the invoice PDF. It’s not a problem if the values are correctly populated for a cancelled invoice. See this video: https://drive.google.com/file/d/1GUoQ-4HAVf1fNRWlNNkRxYWP538Jc230/view?usp=sharing #### Related support tickets: opw-2790491 opw-2716731\