odoo/odoo#173024

Created by fw-bot
Merged at 2ecca8438a1f62ce830a6b380531fb1ca30c2bd4

Statuses:

label
odoo-dev:master-15.0-opw-3984143-myhy-HFyh-fw
head
0d2dc3d97c2e0a34e5e9fa0fc1c0d3b01e79b2bd
merged
2 years ago by Mylyna Hy (myhy)
odoo/odoo
15.0 #171687
16.0 #172576
17.0 #172591
saas-17.1 #172600
saas-17.2 #172864
saas-17.3 #172870
saas-17.4 #172875
18.0
saas-18.2
saas-18.3
saas-18.4
19.0
saas-19.1
saas-19.2
saas-19.3
master #173024

[FW][FIX] account_edi_ubl_cii: prevent crash on invoice with l10n_sg edi

Problem: When the customer invoice journal uses the l10n_sg electronic invoicing and the user creates an invoice, a traceback error will occur. The traceback error details a key error since 'tax_exemption_reason' is not a key in the dict from _get_invoice_line_item_vals.

Purpose: Only if the key 'tax_exemption_reason' exists in the dict, then it should get popped.

Steps to Reproduce on Runbot:
1. Install l10n_sg
2. Switch to SG Company
3. Go to the “Customer Invoices” Journal and check the “SG BIS Billing 3.0” option for the “Electronic Invoicing” field
4. Create an invoice with a product
5. Confirming the invoice will throw the error.

opw-3984143


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #172875
Forward-Port-Of: #171687