Skip to Content

Name: [FIX] l10n_vn_edi_viettel: fetch only the missing SInvoice files on re-send

State: Killed finished in 310m

PR State: merged

PR Author: David Tran

PR Author Email:

PR: #1330

Committer: David Tran

Committer Email: david.tran@tvtmarine.com

Commit: 2cd94b9d9f40b37f9ad30eacca253b0b50650a1b

Description:

                                            [FIX] l10n_vn_edi_viettel: fetch only the missing SInvoice files on re-send

Steps to reproduce:
- Send & Print a posted customer invoice with "Send to SInvoice" ticked:
  the invoice is issued and its PDF and XML files are fetched from
  SInvoice and stored on the invoice.
- Send & Print the same invoice again, for instance to email it to the
  customer.

Current behavior:
`_call_web_service_after_invoice_pdf_render` calls
`_l10n_vn_edi_fetch_invoice_files` for every invoice already sent, so
both files are fetched from SInvoice again on every Send & Print. Each
run creates a second attachment on the same binary field and posts a
new "Invoice sent to SInvoice" note in the chatter.

Besides, when SInvoice answers with an empty `fileToBytes`, the retry
loop gives up and the empty content is stored as the PDF file; a reply
without the `fileToBytes` key raises a KeyError in that loop, and a
reply that is not a ZIP archive raises zipfile.BadZipFile out of
`_l10n_vn_edi_fetch_invoice_xml_file_data`.

After this commit:
A file already stored on the invoice is not fetched again; only a
missing one is. An empty reply, a reply without the file key and a
non-ZIP reply are returned as error messages, which Send & Print shows
on the invoice like the other SInvoice errors. The two new messages are
added to the translation template and the Vietnamese catalog.

Closes Viindoo/odoo#1328
                                            

Branch: 18.0

Age:

Up-time:

Subbuilds Name State Detail
Build 431187 At install tests: from account to website_sms 124m Succeed Log
Build 431188 Post install tests: step install all modules 48m Succeed Log
Build 431189 Post install tests: from account to hr_recruitment_survey 125m Succeed Log
Build 431190 Post install tests: from hr_skills to phone_validation 260m Succeed Log
Build 431191 Post install tests: from point_of_sale to purchase_requisition_stock 119m Succeed Log
Build 431192 Post install tests: from purchase_stock to test_limits 94m Succeed Log
Build 431193 Post install tests: from test_mail to to_purchase_line_numbering 145m Succeed Log
Build 431194 Post install tests: from to_purchase_order_advance to viin_approval_purpose_routing 115m Succeed Log
Build 431195 Post install tests: from viin_approval_sale to viin_product_approval_marketplace 260m Succeed Log
Build 431196 Post install tests: from viin_product_approval_marketplace_website_sale to web_unsplash 59m Succeed Log
Build 431197 Post install tests: from website to website_sms 100m Succeed Log
Create Date Level Message
11/01/2026 05:30:10 PM INFO
Updated repository Viindoo-tvtmaaddons
11/01/2026 05:30:10 PM INFO
Updated repository Viindoo-erponline-enterprise
11/01/2026 05:30:10 PM INFO
Updated repository Viindoo-branding
11/01/2026 05:30:10 PM INFO
Cloned repository Viindoo-odoo
11/01/2026 05:30:10 PM INFO
At install tests: this pull request changes no frontend file, so it runs without /web:WebSuite.test_unit_desktop, /web:WebSuite.test_hoot, /web:WebSuite.test_qunit_desktop, /web:MobileWebSuite.test_unit_mobile, /web:MobileWebSuite.test_qunit_mobile, /web_editor:TestOdooEditor.test_odoo_editor_suite, /im_livechat:ExternalTestSuite.test_external_livechat
11/01/2026 05:30:10 PM INFO
Post install tests: this pull request changes no frontend file, so it runs without /web:WebSuite.test_unit_desktop, /web:WebSuite.test_hoot, /web:WebSuite.test_qunit_desktop, /web:MobileWebSuite.test_unit_mobile, /web:MobileWebSuite.test_qunit_mobile, /web_editor:TestOdooEditor.test_odoo_editor_suite, /im_livechat:ExternalTestSuite.test_external_livechat