Skip to content

Commit c3deb6e

Browse files
committed
[MIG] product_profile: Migration to 17.0
Update product_profile.py refactor for V17 way [IMP] product_profile: pre-commit execution Fixup product_profile.py
1 parent 39ee5ce commit c3deb6e

File tree

4 files changed

+26
-27
lines changed

4 files changed

+26
-27
lines changed

product_profile/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ profile, changing profile will not influence default values
120120
.. |image2| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_profile/static/img/list.png
121121
.. |image3| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_profile/static/img/create.png
122122

123+
123124
Usage
124125
=====
125126

product_profile/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "Product Profile",
6-
"version": "16.0.1.0.0",
6+
"version": "17.0.1.0.0",
77
"author": "Akretion, Odoo Community Association (OCA)",
88
"summary": "Allow to configure a product in 1 click",
99
"category": "product",

product_profile/models/product_profile.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,16 @@ def write(self, vals):
9898

9999
def _refresh_products_vals(self):
100100
"""Reapply profile values on products"""
101+
by_profile = dict(
102+
self.env["product.product"]._read_group(
103+
[("profile_id", "in", self.ids)],
104+
groupby=["profile_id"],
105+
aggregates=["id:recordset"],
106+
)
107+
)
108+
101109
for rec in self:
102-
products = self.env["product.product"].search([("profile_id", "=", rec.id)])
110+
products = by_profile.get(rec)
103111
if products:
104112
_logger.info(
105113
" >>> {} Products updating after updated '{}' pro"

product_profile/views/config_view.xml

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,22 @@
55
<field name="model">res.config.settings</field>
66
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
77
<field name="arch" type="xml">
8-
<xpath
9-
expr="//div[@data-key='sale_management']//div[hasclass('o_settings_container')]"
10-
position="inside"
11-
>
12-
<div class="col-12 col-lg-6 o_setting_box">
13-
<div class="o_setting_left_pane">
14-
<field name="group_product_profile" />
8+
<xpath expr="//block[@name='catalog_setting_container']" position="inside">
9+
<setting>
10+
<field name="group_product_profile" />
11+
<div
12+
class="content-group"
13+
groups="product_profile.group_product_profile_manager"
14+
>
15+
<button
16+
name="%(product_profile.product_profile_action)d"
17+
icon="fa-arrow-right"
18+
type="action"
19+
string="Product Profiles"
20+
class="btn-link"
21+
/>
1522
</div>
16-
<div class="o_setting_right_pane">
17-
<label for="group_product_profile" />
18-
<div
19-
class="content-group"
20-
groups="product_profile.group_product_profile_manager"
21-
>
22-
<div class="mt16">
23-
<button
24-
name="%(product_profile.product_profile_action)d"
25-
icon="fa-arrow-right"
26-
type="action"
27-
string="Product Profiles"
28-
class="btn-link"
29-
/>
30-
</div>
31-
</div>
32-
</div>
33-
</div>
23+
</setting>
3424
</xpath>
3525
</field>
3626
</record>

0 commit comments

Comments
 (0)