-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] module product_harmonized_system_per_country
- Loading branch information
1 parent
12a4beb
commit 945af0c
Showing
4 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
from . import hs_code | ||
from . import product_category | ||
from . import product_product | ||
from . import product_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,27 +2,7 @@ | |
# @author Emilie SOUTIRAS <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
hs_code = fields.Char(compute="_compute_hs_code", store=False) | ||
|
||
@api.depends( | ||
"hs_code_id", "hs_code_id.parent_id", "hs_code_id.child_ids", "categ_id" | ||
) | ||
def _compute_hs_code(self): | ||
for pdt_tmpl in self: | ||
if pdt_tmpl.hs_code_id: | ||
pdt_tmpl.hs_code = ( | ||
pdt_tmpl.hs_code_id.filter_per_country().hs_code or "" | ||
) | ||
else: | ||
pdt_tmpl.hs_code = ( | ||
pdt_tmpl.categ_id.get_hs_code_recursively().hs_code or "" | ||
) | ||
from odoo import models | ||
|
||
|
||
class ProductProduct(models.Model): | ||
|
25 changes: 25 additions & 0 deletions
25
product_harmonized_system_per_country/models/product_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2024 Groupe Voltaire | ||
# @author Emilie SOUTIRAS <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
hs_code = fields.Char(compute="_compute_hs_code", store=False) | ||
|
||
@api.depends( | ||
"hs_code_id", "hs_code_id.parent_id", "hs_code_id.child_ids", "categ_id" | ||
) | ||
def _compute_hs_code(self): | ||
for pdt_tmpl in self: | ||
if pdt_tmpl.hs_code_id: | ||
pdt_tmpl.hs_code = ( | ||
pdt_tmpl.hs_code_id.filter_per_country().hs_code or "" | ||
) | ||
else: | ||
pdt_tmpl.hs_code = ( | ||
pdt_tmpl.categ_id.get_hs_code_recursively().hs_code or "" | ||
) |