From 40ef551079aff1ac7e67291be797886df118221d Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 16 Dec 2021 17:23:37 +0100 Subject: [PATCH] product_harmonized_system_delivery: hs_code is now store=True This commit is the "followup" of the change to company_dependent=False on the fields hs_code_id on product.template and product.category. Add groupby on hs_code_id on product.template search view hs.code is now company_id=False by default --- product_harmonized_system/models/hs_code.py | 2 +- .../views/product_template.xml | 13 +++++++++++++ .../models/product.py | 3 +-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/product_harmonized_system/models/hs_code.py b/product_harmonized_system/models/hs_code.py index 245cb3d..da8cf11 100644 --- a/product_harmonized_system/models/hs_code.py +++ b/product_harmonized_system/models/hs_code.py @@ -53,7 +53,7 @@ class HSCode(models.Model): @api.model def _default_company_id(self): - return self.env.company + return False @api.depends("local_code") def _compute_hs_code(self): diff --git a/product_harmonized_system/views/product_template.xml b/product_harmonized_system/views/product_template.xml index 8cdfd2e..59fa83e 100644 --- a/product_harmonized_system/views/product_template.xml +++ b/product_harmonized_system/views/product_template.xml @@ -23,4 +23,17 @@ + + product.template + + + + + + + diff --git a/product_harmonized_system_delivery/models/product.py b/product_harmonized_system_delivery/models/product.py index 5b65cf2..eab6887 100644 --- a/product_harmonized_system_delivery/models/product.py +++ b/product_harmonized_system_delivery/models/product.py @@ -7,5 +7,4 @@ from odoo import fields, models class ProductTemplate(models.Model): _inherit = "product.template" - # this field cannot be stored because hs_code_id is company dependent - hs_code = fields.Char(related="hs_code_id.hs_code", readonly=True, store=False) + hs_code = fields.Char(related="hs_code_id.hs_code", store=True)