From 3e6604e96486810a4cb5e1b4d0f0dd22dacd1a40 Mon Sep 17 00:00:00 2001 From: Andreu Orensanz Date: Mon, 11 Mar 2024 16:20:52 +0100 Subject: [PATCH] [MIG] product_harmonized_system: Migration to 17.0 --- product_harmonized_system/__manifest__.py | 2 +- product_harmonized_system/models/hs_code.py | 18 ++++++++---------- .../static/description/index.html | 1 - product_harmonized_system/views/hs_code.xml | 4 ++-- .../views/product_category.xml | 2 +- .../views/product_template.xml | 17 ++++++++++------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/product_harmonized_system/__manifest__.py b/product_harmonized_system/__manifest__.py index 32033a3..443c552 100644 --- a/product_harmonized_system/__manifest__.py +++ b/product_harmonized_system/__manifest__.py @@ -10,7 +10,7 @@ { "name": "Product Harmonized System Codes", - "version": "16.0.1.1.0", + "version": "17.0.1.0.0", "category": "Reporting", "license": "AGPL-3", "summary": "Base module for Product Import/Export reports", diff --git a/product_harmonized_system/models/hs_code.py b/product_harmonized_system/models/hs_code.py index 2bb3de4..c7b1221 100644 --- a/product_harmonized_system/models/hs_code.py +++ b/product_harmonized_system/models/hs_code.py @@ -65,32 +65,30 @@ class HSCode(models.Model): @api.depends("product_categ_ids") def _compute_product_categ_count(self): - rg_res = self.env["product.category"].read_group( - [("hs_code_id", "in", self.ids)], ["hs_code_id"], ["hs_code_id"] + rg_res = self.env["product.category"]._read_group( + [("hs_code_id", "in", self.ids)], ["hs_code_id"], ["id:count"] ) - mapped_data = {x["hs_code_id"][0]: x["hs_code_id_count"] for x in rg_res} + mapped_data = {rec.id: count for (rec, count) in rg_res} for code in self: code.product_categ_count = mapped_data.get(code.id, 0) @api.depends("product_tmpl_ids") def _compute_product_tmpl_count(self): - rg_res = self.env["product.template"].read_group( - [("hs_code_id", "in", self.ids)], ["hs_code_id"], ["hs_code_id"] + rg_res = self.env["product.template"]._read_group( + [("hs_code_id", "in", self.ids)], ["hs_code_id"], ["id:count"] ) - mapped_data = {x["hs_code_id"][0]: x["hs_code_id_count"] for x in rg_res} + mapped_data = {rec.id: count for (rec, count) in rg_res} for code in self: code.product_tmpl_count = mapped_data.get(code.id, 0) @api.depends("local_code", "description") - def name_get(self): - res = [] + def _compute_display_name(self): for this in self: name = this.local_code if this.description: name += " " + this.description name = shorten(name, 55) - res.append((this.id, name)) - return res + this.display_name = name _sql_constraints = [ ( diff --git a/product_harmonized_system/static/description/index.html b/product_harmonized_system/static/description/index.html index f65f7a6..e7933c5 100644 --- a/product_harmonized_system/static/description/index.html +++ b/product_harmonized_system/static/description/index.html @@ -1,4 +1,3 @@ - diff --git a/product_harmonized_system/views/hs_code.xml b/product_harmonized_system/views/hs_code.xml index 21f2ccb..9080a58 100644 --- a/product_harmonized_system/views/hs_code.xml +++ b/product_harmonized_system/views/hs_code.xml @@ -1,6 +1,6 @@ @@ -65,7 +65,7 @@ name="web_ribbon" title="Archived" bg_color="bg-danger" - attrs="{'invisible': [('active', '=', True)]}" + invisible="active" />