Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] account_invoice_facturx: crash on HS code #838

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions account_invoice_facturx/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,18 +641,16 @@
product_charact, ns["ram"] + "Value"
)
product_charact_value.text = attrib_value
if (
hasattr(product, "hs_code_id")
and product.type in ("product", "consu")
and product.get_hs_code_recursively()
):
product_classification = etree.SubElement(
trade_product, ns["ram"] + "DesignatedProductClassification"
)
product_classification_code = etree.SubElement(
product_classification, ns["ram"] + "ClassCode", listID="HS"
)
product_classification_code.text = product.hs_code_id.local_code
if hasattr(product, "hs_code_id") and product.type in ("product", "consu"):
hs_code = product.get_hs_code_recursively()

Check warning on line 645 in account_invoice_facturx/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_facturx/models/account_move.py#L645

Added line #L645 was not covered by tests
if hs_code:
product_classification = etree.SubElement(

Check warning on line 647 in account_invoice_facturx/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_facturx/models/account_move.py#L647

Added line #L647 was not covered by tests
trade_product, ns["ram"] + "DesignatedProductClassification"
)
product_classification_code = etree.SubElement(

Check warning on line 650 in account_invoice_facturx/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_facturx/models/account_move.py#L650

Added line #L650 was not covered by tests
product_classification, ns["ram"] + "ClassCode", listID="HS"
)
product_classification_code.text = hs_code.local_code

Check warning on line 653 in account_invoice_facturx/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_facturx/models/account_move.py#L653

Added line #L653 was not covered by tests
# origin_country_id and hs_code_id are provided
# by the OCA module product_harmonized_system
if (
Expand Down
Loading