Skip to content

Commit e38fad2

Browse files
fgaviiriaOCA-git-bot
authored andcommitted
[MIG] product_abc_classification: Migration to 17.0
1 parent 633d759 commit e38fad2

File tree

7 files changed

+25
-20
lines changed

7 files changed

+25
-20
lines changed

product_abc_classification/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Product Abc Classification",
77
"summary": """
88
ABC classification for sales and warehouse management""",
9-
"version": "16.0.1.0.1",
9+
"version": "17.0.1.0.0",
1010
"license": "AGPL-3",
1111
"author": "ACSONE SA/NV, ForgeFlow, Odoo Community Association (OCA)",
1212
"website": "https://github.com/OCA/product-attribute",

product_abc_classification/models/abc_classification_product_level.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ def write(self, vals):
167167
else:
168168
# If profile is not modified, filter levels per profile
169169
# if it has auto_apply_computed_value True and modify only
170-
# those ones
170+
# those
171171
auto_applied_profiles_levels = self.filtered(
172-
lambda l: l.profile_id.auto_apply_computed_value
172+
lambda level: level.profile_id.auto_apply_computed_value
173173
)
174174
new_self = self - auto_applied_profiles_levels
175175
super(

product_abc_classification/models/abc_classification_profile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class AbcClassificationProfile(models.Model):
4040

4141
auto_apply_computed_value = fields.Boolean(
4242
default=False,
43-
help="Check this if you want to apply the computed level on each product that has this "
43+
help="Check this if you want to apply "
44+
"the computed level on each product that has this "
4445
"profile.",
4546
)
4647

@@ -105,7 +106,7 @@ def _cron_compute_abc_classification(self):
105106
self.search([])._compute_abc_classification()
106107

107108
def write(self, vals):
108-
res = super(AbcClassificationProfile, self).write(vals)
109+
res = super().write(vals)
109110
if "auto_apply_computed_value" in vals and vals["auto_apply_computed_value"]:
110111
self._auto_apply_computed_value_for_product_levels()
111112
return res

product_abc_classification/tests/common.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def setUpClass(cls):
5050
)
5151

5252
levels = cls.classification_profile.level_ids
53-
cls.classification_level_a = levels.filtered(lambda l: l.name == "a")
54-
cls.classification_level_b = levels.filtered(lambda l: l.name == "b")
53+
cls.classification_level_a = levels.filtered(lambda level: level.name == "a")
54+
cls.classification_level_b = levels.filtered(lambda level: level.name == "b")
5555
cls.classification_profile_bis = cls.ABCClassificationProfile.create(
5656
{
5757
"name": "Profile test bis",
@@ -79,11 +79,15 @@ def setUpClass(cls):
7979
}
8080
)
8181
levels = cls.classification_profile_bis.level_ids
82-
cls.classification_level_bis_a = levels.filtered(lambda l: l.name == "a")
82+
cls.classification_level_bis_a = levels.filtered(
83+
lambda level: level.name == "a"
84+
)
8385

84-
cls.classification_level_bis_b = levels.filtered(lambda l: l.name == "b")
86+
cls.classification_level_bis_b = levels.filtered(
87+
lambda level: level.name == "b"
88+
)
8589
# create a template with one variant adn declare attributes to create
86-
# an other variant on demand
90+
# another variant on demand
8791
cls.size_attr = cls.env["product.attribute"].create(
8892
{
8993
"name": "Size",

product_abc_classification/views/abc_classification_product_level.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div
1414
class="alert alert-danger"
1515
role="alert"
16-
attrs="{'invisible': [('flag','=',False)]}"
16+
invisible="not flag"
1717
>Computed level differs from the specified level</div>
1818
<group name="main_info">
1919
<field name="display_name" />
@@ -45,11 +45,11 @@
4545
<field name="model">abc.classification.product.level</field>
4646
<field name="arch" type="xml">
4747
<tree decoration-danger="flag == True" editable="bottom">
48-
<field name="profile_id" invisible="1" />
48+
<field name="profile_id" column_invisible="1" />
4949
<field name="product_id" />
5050
<field name="manual_level_id" />
5151
<field name="computed_level_id" />
52-
<field name="flag" invisible="1" />
52+
<field name="flag" column_invisible="1" />
5353
</tree>
5454
</field>
5555
</record>

product_abc_classification/views/product_product.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<field name="abc_classification_product_level_ids" position="attributes">
1111
<attribute
1212
name="context"
13-
>{'default_product_id': active_id, 'default_profile_id': abc_classification_profile_ids and abc_classification_profile_ids[0] or False}</attribute>
14-
<attribute name="attrs">{'read_only': False}</attribute>
15-
<attribute name="domain">[('product_id', '=', active_id)]</attribute>
13+
>{'default_product_id': id, 'default_profile_id': abc_classification_profile_ids and abc_classification_profile_ids[0] or False}</attribute>
14+
<attribute name="readonly">context</attribute>
15+
<attribute name="domain">[('product_id', '=', id)]</attribute>
1616
</field>
1717
</field>
1818
</record>

product_abc_classification/views/product_template.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
<page
1212
string="ABC Classification"
1313
name="abc_classification"
14-
attrs="{'invisible':[('type','!=','product')]}"
14+
invisible="type != 'product'"
1515
>
1616
<group>
1717
<group>
1818
<field
1919
name="abc_classification_product_level_ids"
2020
widget="many2many_tags"
21-
context="{'default_product_tmpl_id': active_id, 'default_profile_id': abc_classification_profile_ids and abc_classification_profile_ids[0] or False}"
22-
attrs="{'readonly': [('product_variant_count', '&gt;', 1)]}"
23-
domain="[('product_tmpl_id', '=', active_id)]"
21+
context="{'default_product_tmpl_id': id, 'default_profile_id': abc_classification_profile_ids and abc_classification_profile_ids[0] or False}"
22+
readonly="product_variant_count &gt; 1"
23+
domain="[('product_tmpl_id', '=', id)]"
2424
/>
2525
<field name="abc_classification_profile_ids" widget="many2many_tags" />
2626
</group>

0 commit comments

Comments
 (0)