Skip to content

Commit

Permalink
[IMP] sustainability: Allow supplerinfo to be used for purchase order
Browse files Browse the repository at this point in the history
  • Loading branch information
BonnetAdam committed Jan 16, 2025
1 parent c49df28 commit ac505b0
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 12 deletions.
1 change: 1 addition & 0 deletions sustainability/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"views/carbon_factor_database.xml",
"views/carbon_factor_contributor.xml",
"views/carbon_factor_type.xml",
"views/product_supplierinfo.xml",
"views/product_category.xml",
"views/res_country.xml",
"views/res_config_settings.xml",
Expand Down
1 change: 1 addition & 0 deletions sustainability/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from . import carbon_distribution_line
from . import carbon_factor
from . import carbon_factor_value
from . import product_supplierinfo
from . import product_category
from . import product_product
from . import product_template
Expand Down
2 changes: 1 addition & 1 deletion sustainability/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ProductProduct(models.Model):

def _get_carbon_in_fallback_records(self) -> list:
res = super()._get_carbon_in_fallback_records()
return res + [self.product_tmpl_id, self.categ_id]
return res + [self.seller_ids, self.product_tmpl_id, self.categ_id]

def _get_carbon_out_fallback_records(self) -> list:
res = super()._get_carbon_out_fallback_records()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ class ProductSupplierInfo(models.Model):
_name = "product.supplierinfo"
_inherit = ["product.supplierinfo", "carbon.mixin"]

def _get_carbon_in_fallback_records(self) -> list:
self.ensure_one()
res = super()._get_carbon_in_fallback_records()
return res + [self.partner_id]

@api.depends("partner_id.carbon_in_factor_id")
def _compute_carbon_in_mode(self):
return super()._compute_carbon_in_mode()

def _update_carbon_in_fields(self, vals):
"""
Helper method to update carbon_in_is_manual and carbon_in_mode based on carbon_in_factor_id.
Expand Down
1 change: 0 additions & 1 deletion sustainability_purchase/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# Data
"data/ir_cron.xml",
# Views
"views/product_supplierinfo.xml",
"views/carbon_factor.xml",
"views/carbon_line_origin.xml",
"views/purchase_order.xml",
Expand Down
1 change: 0 additions & 1 deletion sustainability_purchase/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from . import product_supplierinfo
from . import product_product
from . import account_move_line
from . import product_template
Expand Down

0 comments on commit ac505b0

Please sign in to comment.