Skip to content

[18.0][ADD] product_trade_compliance: Manage trade compliance codes#253

Open
bosd wants to merge 1 commit into
OCA:18.0from
bosd:18.0-add-product_trade_compliance
Open

[18.0][ADD] product_trade_compliance: Manage trade compliance codes#253
bosd wants to merge 1 commit into
OCA:18.0from
bosd:18.0-add-product_trade_compliance

Conversation

@bosd
Copy link
Copy Markdown
Contributor

@bosd bosd commented Dec 7, 2025

This module enables tracking of dual-use and export control codes for products in Odoo, supporting both US Export Administration Regulations (EAR) ECCN codes and EU Dual-Use Regulation codes.

Features:

  • Manage multiple trade compliance regimes (US-EAR, EU-DUAL)
  • Define compliance codes with descriptions
  • Set default codes at product category level
  • Automatic inheritance from category to product
  • Related fields showing regime and code description
  • Search and filter by regime
  • Pre-loaded with 2,672 official compliance codes

Data included:

  • EU: 2,652 codes from EU Dual-Use Regulation (EU) 2021/821 (Sept 2024)
  • US: 21 common ECCN codes from Commerce Control List

Official sources:

Technical implementation:

  • Models: trade.compliance.regime, trade.compliance.code
  • Inherits: product.category, product.template
  • Data format: CSV for efficient bulk loading
  • Utility scripts for data refresh (scripts/)
  • Comprehensive test suite (10 tests)
  • Full OCA compliance (README, i18n, security)

This module enables tracking of dual-use and export control codes
for products in Odoo, supporting both US Export Administration
Regulations (EAR) ECCN codes and EU Dual-Use Regulation codes.

Features:
- Manage multiple trade compliance regimes (US-EAR, EU-DUAL)
- Define compliance codes with descriptions
- Set default codes at product category level
- Automatic inheritance from category to product
- Related fields showing regime and code description
- Search and filter by regime
- Pre-loaded with 2,672 official compliance codes

Data included:
- EU: 2,652 codes from EU Dual-Use Regulation (EU) 2021/821 (Sept 2024)
- US: 21 common ECCN codes from Commerce Control List

Official sources:
- EU: https://policy.trade.ec.europa.eu/help-exporters-and-importers/exporting-dual-use-items_en
- US: https://www.ecfr.gov/current/title-15/part-774

Technical implementation:
- Models: trade.compliance.regime, trade.compliance.code
- Inherits: product.category, product.template
- Data format: CSV for efficient bulk loading
- Utility scripts for data refresh (scripts/)
- Comprehensive test suite (10 tests)
- Full OCA compliance (README, i18n, security)
@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 12, 2026
@bosd
Copy link
Copy Markdown
Contributor Author

bosd commented Apr 15, 2026

please keep open

@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 19, 2026
Copy link
Copy Markdown

@rrebollo rrebollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review. LGTM!
Would U be so kind to review mine in return? #241

Comment on lines +44 to +54
for product in self:
if not product.compliance_code_id and category.compliance_code_id:
# Add compliance_code_id to vals for this specific product
if len(self) == 1:
# Single record update
vals["compliance_code_id"] = category.compliance_code_id.id
else:
# Multiple records - update individually
super(ProductTemplate, product).write(
{"compliance_code_id": category.compliance_code_id.id}
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for product in self:
if not product.compliance_code_id and category.compliance_code_id:
# Add compliance_code_id to vals for this specific product
if len(self) == 1:
# Single record update
vals["compliance_code_id"] = category.compliance_code_id.id
else:
# Multiple records - update individually
super(ProductTemplate, product).write(
{"compliance_code_id": category.compliance_code_id.id}
)
if category.compliance_code_id:
for product in self.filtered(lambda prod: not prod.compliance_code_id):
# Add compliance_code_id to vals for this specific product
if len(self) == 1:
# Single record update
vals["compliance_code_id"] = category.compliance_code_id.id
else:
# Multiple records - update individually
product.compliance_code_id = category.compliance_code_id.id}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants