Saturday, May 10, 2025
1 change · 17.0
Miscellaneous changes
This is a fix-of-fix. #### Explanation of the first fix Before the fix abd6cc063e86ed6adc5559ff7cd09d605bbbecb9 the invoice date was controlling the date that appears in the `Fecha` field of the CFDI, except if the invoice date was set to today or was in the future: in that case, the current time would be used. However, there would be cases where the CFDI would be successfully sent to the PAC but not registered as successfully sent in Odoo because of a timeout or disconnection. In those c
Original PR description
This is a fix-of-fix. #### Explanation of the first fix Before the fix abd6cc063e86ed6adc5559ff7cd09d605bbbecb9 the invoice date was controlling the date that appears in the `Fecha` field of the…
This is a fix-of-fix. #### Explanation of the first fix Before the fix abd6cc063e86ed6adc5559ff7cd09d605bbbecb9 the invoice date was controlling the date that appears in the `Fecha` field of the CFDI, except if the invoice date was set to today or was in the future: in that case, the current time would be used. However, there would be cases where the CFDI would be successfully sent to the PAC but not registered as successfully sent in Odoo because of a timeout or disconnection. In those cases, using the current time is a problem because we will try to retry sending the CFDI to the PAC, with a new time, which would be recognised as a new invoice. To solve that issue, that fix set the Fecha to always be the `l10n_mx_edi_post_time` which is the time of posting of the invoice. However, that isn't okay for many Mexican users who expect that the CFDI date must be the same as the invoice date on the PDF (of course, except if the invoice date is in the future). #### The fix-of-fix (this PR) To solve both those issues, here is what we do: - now, the `l10n_mx_edi_post_time` is set when we first try to *send* the CFDI (rather than when we post it), and then stays the same unless the invoice is reset to draft (which ensures that if we must retry several times to resend the CFDI, the sending time won't change). - if the invoice date is older than the `l10n_mx_edi_post_time`, it will be used as the CFDI's Fecha. This ensures that users can control the Fecha using the invoice date. If the user modifies the invoice date, they will need to reset the invoice to draft, so the `l10n_mx_edi_post_time` will be reset too. task-none Forward-Port-Of: odoo/enterprise#85026