mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[MIG] product_harmonized_system: Migration to 17.0
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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 = [
|
||||
(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2010-2021 Akretion France (http://www.akretion.com/)
|
||||
Copyright 2010-2024 Akretion France (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
@@ -65,7 +65,7 @@
|
||||
name="web_ribbon"
|
||||
title="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
invisible="active"
|
||||
/>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2010-2022 Akretion (http://www.akretion.com/)
|
||||
Copyright 2010-2024 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2010-2022 Akretion France (http://www.akretion.com/)
|
||||
Copyright 2010-2024 Akretion France (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
@@ -11,19 +11,17 @@
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<group name="group_standard_price" position="inside">
|
||||
<field
|
||||
name="hs_code_id"
|
||||
attrs="{'invisible': [('type', '=', 'service')]}"
|
||||
/>
|
||||
<group name="group_general" position="inside">
|
||||
<field name="hs_code_id" invisible="type == 'service'" />
|
||||
<field
|
||||
name="origin_country_id"
|
||||
attrs="{'invisible': [('type', '=', 'service')]}"
|
||||
invisible="type == 'service'"
|
||||
options="{'no_create': True}"
|
||||
/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_template_search_view" model="ir.ui.view">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view" />
|
||||
@@ -34,6 +32,11 @@
|
||||
name="hs_code_groupby"
|
||||
context="{'group_by': 'hs_code_id'}"
|
||||
/>
|
||||
<filter
|
||||
string="Country of Origin"
|
||||
name="origin_country_groupby"
|
||||
context="{'group_by': 'origin_country_id'}"
|
||||
/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user