Skip to content

Commit

Permalink
[WIP] rename product_nfe40_esp
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoParadeda committed Sep 20, 2024
1 parent 8f67a64 commit af201a6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion l10n_br_delivery_nfe/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ProductProduct(models.Model):
_inherit = "product.product"

product_nfe40_esp = fields.Char(
product_volume_type = fields.Char(
string="Volume Type",
help="Type of transported volumes: This field corresponds to 'nfe40_esp',"
" which specifies the type of transported volumes (e.g., crates, pallets)"
Expand Down
10 changes: 6 additions & 4 deletions l10n_br_delivery_nfe/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ProductTemplate(models.Model):
_inherit = "product.template"

product_nfe40_esp = fields.Char(
product_volume_type = fields.Char(
string="Volume Type",
help="Type of transported volumes: This field corresponds to 'nfe40_esp',"
" which specifies the type of transported volumes (e.g., crates, pallets)"
Expand All @@ -23,13 +23,15 @@ def _compute_nfe40_esp(self):
lambda template: len(template.product_variant_ids) == 1
)
for template in unique_variants:
template.product_nfe40_esp = template.product_variant_ids.product_nfe40_esp
template.product_volume_type = (
template.product_variant_ids.product_nfe40_esp
)
for template in self - unique_variants:
template.product_nfe40_esp = ""
template.product_volume_type = ""

def _inverse_nfe40_esp(self):
for template in self:
if len(template.product_variant_ids) == 1:
template.product_variant_ids.product_nfe40_esp = (
template.product_variant_ids.product_volume_type = (
template.product_nfe40_esp
)
8 changes: 4 additions & 4 deletions l10n_br_delivery_nfe/tests/test_delivery_nfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def test_invoicing_picking_volume_lucro_presumido(self):
self.brand_id2 = self.env["product.brand"].create({"name": "marca2 teste"})

# Set product volume data
self.prod1.product_nfe40_esp = ""
self.prod1.product_volume_type = ""
self.prod1.product_brand_id = self.brand_id1
self.prod2.product_nfe40_esp = "esp2 teste"
self.prod2.product_volume_type = "esp2 teste"
self.prod2.product_brand_id = self.brand_id2
self.prod1.weight = 1
self.prod2.weight = 3
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_invoicing_picking_volume_with_package_lucro_presumido(self):
self.brand_id1 = self.env["product.brand"].create({"name": "marca teste"})

# Set product volume data
self.prod1.product_nfe40_esp = "esp teste"
self.prod1.product_volume_type = "esp teste"
self.prod1.product_brand_id = self.brand_id1
self.prod1.weight = 2
self.prod2.weight = 4
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_pre_generate_nfe_volume(self):
self.brand_id1 = self.env["product.brand"].create({"name": "marca teste"})

# Set product volume data
self.prod1.product_nfe40_esp = "esp teste"
self.prod1.product_volume_type = "esp teste"
self.prod1.product_brand_id = self.brand_id1
self.prod1.weight = 2
self.prod2.weight = 4
Expand Down

0 comments on commit af201a6

Please sign in to comment.