Skip to content

Commit 39ee5ce

Browse files
committed
[IMP] product_profile: pre-commit execution
1 parent e500bcc commit 39ee5ce

File tree

11 files changed

+179
-157
lines changed

11 files changed

+179
-157
lines changed

product_profile/README.rst

Lines changed: 84 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,42 @@ Product Profile
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
20-
:target: https://github.com/OCA/product-attribute/tree/16.0/product_profile
20+
:target: https://github.com/OCA/product-attribute/tree/17.0/product_profile
2121
:alt: OCA/product-attribute
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_profile
23+
:target: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_profile
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=17.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This module provides easier products configuration (in one click).
32-
It allows to configure a product template with only one field.
31+
This module provides easier products configuration (in one click). It
32+
allows to configure a product template with only one field.
3333

34-
.. figure:: https://raw.githubusercontent.com/OCA/product-attribute/16.0/product_profile/static/img/field.png
35-
:alt: profile field on product
36-
:width: 600 px
34+
|image1|
3735

38-
**Main use case**: a lot of modules are installed (mrp, purchase, sale, pos)
39-
and products configuration becomes harder for end users: too many fields to take care of.
36+
**Main use case**: a lot of modules are installed (mrp, purchase, sale,
37+
pos) and products configuration becomes harder for end users: too many
38+
fields to take care of.
4039

41-
You are concerned that at any time a product might be not configured correctly: this module is your friend.
40+
You are concerned that at any time a product might be not configured
41+
correctly: this module is your friend.
4242

43-
Thanks to this module, a lot of complexity becomes hidden (default behavior) to the end user and usability is optimal.
43+
Thanks to this module, a lot of complexity becomes hidden (default
44+
behavior) to the end user and usability is optimal.
4445

45-
It eases as well the data migration by only specifying the profile field instead of all fields which depend on it.
46+
It eases as well the data migration by only specifying the profile field
47+
instead of all fields which depend on it.
4648

47-
Note: This module is meant to be used by skilled people in database fields creation within the ERP framework.
49+
Note: This module is meant to be used by skilled people in database
50+
fields creation within the ERP framework.
4851

49-
Additional feature: a default value can be attached to a profile (see § Configuration, part 3)
52+
Additional feature: a default value can be attached to a profile (see §
53+
Configuration, part 3)
54+
55+
.. |image1| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_profile/static/img/field.png
5056

5157
**Table of contents**
5258

@@ -56,107 +62,113 @@ Additional feature: a default value can be attached to a profile (see § Configu
5662
Configuration
5763
=============
5864

59-
1. Create your own profile here:
60-
Sales > Configuration > Product > Product Profiles
65+
1. Create your own profile here: Sales > Configuration > Product >
66+
Product Profiles
67+
68+
|image2|
6169

62-
.. figure:: https://raw.githubusercontent.com/OCA/product-attribute/16.0/product_profile/static/img/list.png
63-
:alt: profile list
64-
:width: 600 px
70+
|image3|
6571

66-
.. figure:: https://raw.githubusercontent.com/OCA/product-attribute/16.0/product_profile/static/img/create.png
67-
:alt: profile create
68-
:width: 600 px
72+
2. Extend "product.profile" model to add fields from product.template,
73+
either in normal mode or default mode (see note section below). These
74+
fields should be identical to their original fields **(especially
75+
"required" field attribute)**.
6976

70-
2. Extend "product.profile" model to add fields from product.template, either in normal mode or default mode (see note section below). These fields should be identical to their original fields **(especially "required" field attribute)**.
77+
.. code:: python
7178
72-
.. code-block:: python
79+
class ProductProfile(models.Model):
80+
""" Require dependency on sale, purchase and point_of_sale modules
81+
"""
7382
74-
class ProductProfile(models.Model):
75-
""" Require dependency on sale, purchase and point_of_sale modules
76-
"""
83+
_inherit = "product.profile"
7784
78-
_inherit = "product.profile"
85+
def _get_types(self):
86+
return [("product", "Stockable Product"),
87+
("consu", 'Consumable'),
88+
("service", "Service")]
7989
80-
def _get_types(self):
81-
return [("product", "Stockable Product"),
82-
("consu", 'Consumable'),
83-
("service", "Service")]
90+
sale_ok = fields.Boolean(
91+
string="Can be Sold",
92+
help="Specify if the product can be selected in a sales order line.")
93+
purchase_ok = fields.Boolean(
94+
string="Can be Purchased")
95+
available_in_pos = fields.Boolean()
8496
85-
sale_ok = fields.Boolean(
86-
string="Can be Sold",
87-
help="Specify if the product can be selected in a sales order line.")
88-
purchase_ok = fields.Boolean(
89-
string="Can be Purchased")
90-
available_in_pos = fields.Boolean()
97+
3. Insert data (xml or csv) and define values for each field defined
98+
above for each configuration scenario
9199

92-
3. Insert data (xml or csv) and define values for each field defined above
93-
for each configuration scenario
100+
Note : You might want to declare profile fields as defaults. To do this,
101+
just prefix the field with "profile_default".
94102

95-
Note :
96-
You might want to declare profile fields as defaults. To do this, just prefix the field with "profile_default".
103+
.. code:: python
97104
98-
.. code-block:: python
105+
class ProductProfile(models.Model):
106+
profile_default_categ_id = fields.Many2one(
107+
"product.category",
108+
string="Default category",
109+
)
110+
profile_default_tag_ids = fields.Many2many(
111+
comodel_name="product.template.tag",
112+
string="Tags",
113+
)
99114
100-
class ProductProfile(models.Model):
101-
profile_default_categ_id = fields.Many2one(
102-
"product.category",
103-
string="Default category",
104-
)
105-
profile_default_tag_ids = fields.Many2many(
106-
comodel_name="product.template.tag",
107-
string="Tags",
108-
)
115+
Default fields only influence the records the first time they are set. -
116+
if the profile is modified, changes are not propagated to all the
117+
records that have this profile - if the record previously had another
118+
profile, changing profile will not influence default values
109119

110-
Default fields only influence the records the first time they are set.
111-
- if the profile is modified, changes are not propagated to all the records that have this profile
112-
- if the record previously had another profile, changing profile will not influence default values
120+
.. |image2| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_profile/static/img/list.png
121+
.. |image3| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_profile/static/img/create.png
113122

114123
Usage
115124
=====
116125

117-
Assign a value to the profile field in the product template form.
118-
Then, all fields which depend on this profile will be set to the right value at once.
126+
Assign a value to the profile field in the product template form. Then,
127+
all fields which depend on this profile will be set to the right value
128+
at once.
119129

120-
If you deselect the profile value, all these fields keep the same value and you can change them manually
121-
(back to standard behavior).
130+
If you deselect the profile value, all these fields keep the same value
131+
and you can change them manually (back to standard behavior).
122132

123133
Profiles are also defined as search filter and group.
124134

125135
Known issues / Roadmap
126136
======================
127137

128-
- Streamlined behaviour of default/nondefault fields in every situation
129-
- More robust/less error-prone functionality for required fields or fields implicated in workflows
130-
- More flexible/configurable behaviour for profile fields (instead of only default/nondefault fields)
138+
- Streamlined behaviour of default/nondefault fields in every situation
139+
- More robust/less error-prone functionality for required fields or
140+
fields implicated in workflows
141+
- More flexible/configurable behaviour for profile fields (instead of
142+
only default/nondefault fields)
131143

132144
Bug Tracker
133145
===========
134146

135147
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
136148
In case of trouble, please check there if your issue has already been reported.
137149
If you spotted it first, help us to smash it by providing a detailed and welcomed
138-
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_profile%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
150+
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_profile%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
139151

140152
Do not contact contributors directly about support or help with technical issues.
141153

142154
Credits
143155
=======
144156

145157
Authors
146-
~~~~~~~
158+
-------
147159

148160
* Akretion
149161

150162
Contributors
151-
~~~~~~~~~~~~
163+
------------
152164

153-
* David BEAL <david.beal@akretion.com>
154-
* Sébastien BEAU <sebastien.beau@akretion.com>
155-
* Abdessamad HILALI <abdessamad.hilali@akretion.com>
156-
* Kevin Khao <kevin.khao@akretion.com>
165+
- David BEAL <david.beal@akretion.com>
166+
- Sébastien BEAU <sebastien.beau@akretion.com>
167+
- Abdessamad HILALI <abdessamad.hilali@akretion.com>
168+
- Kevin Khao <kevin.khao@akretion.com>
157169

158170
Maintainers
159-
~~~~~~~~~~~
171+
-----------
160172

161173
This module is maintained by the OCA.
162174

@@ -182,6 +194,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
182194

183195
|maintainer-bealdav| |maintainer-sebastienbeau| |maintainer-kevinkhao|
184196

185-
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_profile>`_ project on GitHub.
197+
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/17.0/product_profile>`_ project on GitHub.
186198

187199
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

product_profile/models/product_profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def _refresh_products_vals(self):
102102
products = self.env["product.product"].search([("profile_id", "=", rec.id)])
103103
if products:
104104
_logger.info(
105-
" >>> %s Products updating after updated '%s' pro"
106-
"duct profile" % (len(products), rec.name)
105+
" >>> {} Products updating after updated '{}' pro"
106+
"duct profile".format(len(products), rec.name)
107107
)
108108
data = products._get_vals_from_profile(
109109
{"profile_id": rec.id}, ignore_defaults=True

product_profile/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
1. Create your own profile here: Sales \> Configuration \> Product \>
2+
Product Profiles
3+
4+
![](static/img/list.png)
5+
6+
![](static/img/create.png)
7+
8+
2. Extend "product.profile" model to add fields from product.template,
9+
either in normal mode or default mode (see note section below).
10+
These fields should be identical to their original fields
11+
**(especially "required" field attribute)**.
12+
13+
``` python
14+
class ProductProfile(models.Model):
15+
""" Require dependency on sale, purchase and point_of_sale modules
16+
"""
17+
18+
_inherit = "product.profile"
19+
20+
def _get_types(self):
21+
return [("product", "Stockable Product"),
22+
("consu", 'Consumable'),
23+
("service", "Service")]
24+
25+
sale_ok = fields.Boolean(
26+
string="Can be Sold",
27+
help="Specify if the product can be selected in a sales order line.")
28+
purchase_ok = fields.Boolean(
29+
string="Can be Purchased")
30+
available_in_pos = fields.Boolean()
31+
```
32+
33+
3. Insert data (xml or csv) and define values for each field defined
34+
above for each configuration scenario
35+
36+
Note : You might want to declare profile fields as defaults. To do this,
37+
just prefix the field with "profile_default".
38+
39+
> ``` python
40+
> class ProductProfile(models.Model):
41+
> profile_default_categ_id = fields.Many2one(
42+
> "product.category",
43+
> string="Default category",
44+
> )
45+
> profile_default_tag_ids = fields.Many2many(
46+
> comodel_name="product.template.tag",
47+
> string="Tags",
48+
> )
49+
> ```
50+
51+
Default fields only influence the records the first time they are set. -
52+
if the profile is modified, changes are not propagated to all the
53+
records that have this profile - if the record previously had another
54+
profile, changing profile will not influence default values

product_profile/readme/CONFIGURE.rst

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- David BEAL \<<david.beal@akretion.com>\>
2+
- Sébastien BEAU \<<sebastien.beau@akretion.com>\>
3+
- Abdessamad HILALI \<<abdessamad.hilali@akretion.com>\>
4+
- Kevin Khao \<<kevin.khao@akretion.com>\>

product_profile/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
This module provides easier products configuration (in one click). It
2+
allows to configure a product template with only one field.
3+
4+
> ![](static/img/field.png)
5+
6+
**Main use case**: a lot of modules are installed (mrp, purchase, sale,
7+
pos) and products configuration becomes harder for end users: too many
8+
fields to take care of.
9+
10+
You are concerned that at any time a product might be not configured
11+
correctly: this module is your friend.
12+
13+
Thanks to this module, a lot of complexity becomes hidden (default
14+
behavior) to the end user and usability is optimal.
15+
16+
It eases as well the data migration by only specifying the profile field
17+
instead of all fields which depend on it.
18+
19+
Note: This module is meant to be used by skilled people in database
20+
fields creation within the ERP framework.
21+
22+
Additional feature: a default value can be attached to a profile (see §
23+
Configuration, part 3)

0 commit comments

Comments
 (0)