Skip to content

Commit cdd2652

Browse files
[MIG] product_optional_product_quantity: Migration to 18.0
1 parent 8eb7914 commit cdd2652

File tree

8 files changed

+61
-46
lines changed

8 files changed

+61
-46
lines changed

product_optional_product_quantity/README.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Product Optional Product Quantity
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_optional_product_quantity
20+
:target: https://github.com/OCA/product-attribute/tree/18.0/product_optional_product_quantity
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_optional_product_quantity
23+
:target: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_optional_product_quantity
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=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -69,7 +69,7 @@ Bug Tracker
6969
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
7070
In case of trouble, please check there if your issue has already been reported.
7171
If you spotted it first, help us to smash it by providing a detailed and welcomed
72-
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_optional_product_quantity%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
72+
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_optional_product_quantity%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
7373

7474
Do not contact contributors directly about support or help with technical issues.
7575

@@ -81,6 +81,13 @@ Authors
8181

8282
* Cetmix
8383

84+
Contributors
85+
------------
86+
87+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
88+
89+
- Bhavesh Heliconia
90+
8491
Maintainers
8592
-----------
8693

@@ -94,6 +101,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
94101
mission is to support the collaborative development of Odoo features and
95102
promote its widespread use.
96103

97-
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_optional_product_quantity>`_ project on GitHub.
104+
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/18.0/product_optional_product_quantity>`_ project on GitHub.
98105

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

product_optional_product_quantity/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33
{
44
"name": "Product Optional Product Quantity",
5-
"version": "16.0.1.1.0",
5+
"version": "18.0.1.0.0",
66
"category": "Product",
77
"summary": "Specify optional products quantity for product",
88
"author": "Cetmix, Odoo Community Association (OCA)",
99
"website": "https://github.com/OCA/product-attribute",
1010
"license": "AGPL-3",
1111
"depends": [
12-
"sale_product_configurator",
12+
"sale",
1313
],
1414
"data": [
1515
"security/res_groups.xml",

product_optional_product_quantity/models/product_optional_line.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2024 Cetmix OÜ
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3-
from odoo import _, api, fields, models
3+
from odoo import api, fields, models
44

55

66
class ProductOptionalLine(models.Model):
@@ -39,7 +39,9 @@ def _check_same_product_as_related(self):
3939
and r.product_tmpl_id == r.optional_product_tmpl_id
4040
):
4141
raise models.ValidationError(
42-
_("You can't add product this line is related to as optional.")
42+
self.env._(
43+
"You can't add product this line is related to as optional."
44+
)
4345
)
4446

4547
@api.constrains("product_tmpl_id", "optional_product_tmpl_id")
@@ -56,5 +58,5 @@ def _check_unique_products_within_product(self):
5658
]
5759
):
5860
raise models.ValidationError(
59-
_("You can't add two same products as optional.")
61+
self.env._("You can't add two same products as optional.")
6062
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
2+
- Bhavesh Heliconia

product_optional_product_quantity/static/description/index.html

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
/*
1010
:Author: David Goodger (goodger@python.org)
11-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1516
1617
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1718
customize this style sheet.
@@ -274,7 +275,7 @@
274275
margin-left: 2em ;
275276
margin-right: 2em }
276277

277-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
278279
pre.code, code { background-color: #eeeeee }
279280
pre.code .comment, code .comment { color: #5C6576 }
280281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@
300301
span.pre {
301302
white-space: pre }
302303

303-
span.problematic {
304+
span.problematic, pre.problematic {
304305
color: red }
305306

306307
span.section-subtitle {
@@ -368,7 +369,7 @@ <h1 class="title">Product Optional Product Quantity</h1>
368369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369370
!! source digest: sha256:19c5748e08443684d61807c9a609fcd25cd03d10eb4a7420bd715a19eefb771f
370371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/16.0/product_optional_product_quantity"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_optional_product_quantity"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/18.0/product_optional_product_quantity"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_optional_product_quantity"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372373
<p>This module implements core&nbsp;functionality for the optional product
373374
quantity multipliers. You can depend on this module to implement further
374375
user features.</p>
@@ -381,7 +382,8 @@ <h1 class="title">Product Optional Product Quantity</h1>
381382
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-4">Bug Tracker</a></li>
382383
<li><a class="reference internal" href="#credits" id="toc-entry-5">Credits</a><ul>
383384
<li><a class="reference internal" href="#authors" id="toc-entry-6">Authors</a></li>
384-
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
385+
<li><a class="reference internal" href="#contributors" id="toc-entry-7">Contributors</a></li>
386+
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
385387
</ul>
386388
</li>
387389
</ul>
@@ -413,7 +415,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
413415
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-attribute/issues">GitHub Issues</a>.
414416
In case of trouble, please check there if your issue has already been reported.
415417
If you spotted it first, help us to smash it by providing a detailed and welcomed
416-
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_optional_product_quantity%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
418+
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_optional_product_quantity%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
417419
<p>Do not contact contributors directly about support or help with technical issues.</p>
418420
</div>
419421
<div class="section" id="credits">
@@ -424,14 +426,25 @@ <h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
424426
<li>Cetmix</li>
425427
</ul>
426428
</div>
429+
<div class="section" id="contributors">
430+
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
431+
<ul class="simple">
432+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
433+
<li>Bhavesh Heliconia</li>
434+
</ul>
435+
</li>
436+
</ul>
437+
</div>
427438
<div class="section" id="maintainers">
428-
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
439+
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
429440
<p>This module is maintained by the OCA.</p>
430-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
441+
<a class="reference external image-reference" href="https://odoo-community.org">
442+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
443+
</a>
431444
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
432445
mission is to support the collaborative development of Odoo features and
433446
promote its widespread use.</p>
434-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/16.0/product_optional_product_quantity">OCA/product-attribute</a> project on GitHub.</p>
447+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/18.0/product_optional_product_quantity">OCA/product-attribute</a> project on GitHub.</p>
435448
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
436449
</div>
437450
</div>

product_optional_product_quantity/tests/test_optional_product_quantity.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
# Copyright 2024 Cetmix OÜ
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33
from odoo import exceptions
4-
from odoo.tests.common import TransactionCase, tagged
4+
from odoo.tests.common import tagged
5+
6+
from odoo.addons.base.tests.common import BaseCommon
57

68

79
@tagged("post_install", "-at_install")
8-
class TestOptionalProductQuantity(TransactionCase):
10+
class TestOptionalProductQuantity(BaseCommon):
911
@classmethod
1012
def setUpClass(cls):
1113
super().setUpClass()
1214
cls.product_template_1 = cls.env["product.template"].create(
1315
{
1416
"name": "Product 1",
15-
"type": "product",
17+
"type": "consu",
1618
"categ_id": cls.env.ref("product.product_category_all").id,
1719
}
1820
)
1921
cls.product_template_2 = cls.env["product.template"].create(
2022
{
2123
"name": "Product 2",
22-
"type": "product",
24+
"type": "consu",
2325
"categ_id": cls.env.ref("product.product_category_all").id,
2426
}
2527
)
2628
cls.product_template_3 = cls.env["product.template"].create(
2729
{
2830
"name": "Product 3",
29-
"type": "product",
31+
"type": "consu",
3032
"categ_id": cls.env.ref("product.product_category_all").id,
3133
}
3234
)

product_optional_product_quantity/views/product_template_views.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,22 @@
33
<record id="product_template_view_form_inherit_optional_qty" model="ir.ui.view">
44
<field name="name">product.template.view.form.inherit.optional.qty</field>
55
<field name="model">product.template</field>
6-
<field
7-
name="inherit_id"
8-
ref="sale_product_configurator.product_template_view_form"
9-
/>
6+
<field name="inherit_id" ref="sale.product_template_view_form" />
107
<field name="arch" type="xml">
118
<field name="optional_product_ids" position="attributes">
129
<attribute name="invisible">1</attribute>
1310
</field>
1411
<field name="optional_product_ids" position="after">
1512
<field name="product_optional_line_ids">
16-
<tree editable="top">
17-
<field name="company_id" invisible="1" />
18-
<field name="product_tmpl_id" invisible="1" />
13+
<list editable="top">
14+
<field name="company_id" column_invisible="True" />
15+
<field name="product_tmpl_id" column_invisible="True" />
1916
<field name="optional_product_tmpl_id" />
2017
<field
2118
name="quantity"
2219
groups="product_optional_product_quantity.group_product_optional_quantity"
2320
/>
24-
</tree>
21+
</list>
2522
</field>
2623
</field>
2724
</field>

product_optional_product_quantity/views/res_config_settings_views.xml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@
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-
<div name="catalog_setting_container" position="inside">
9-
<div
10-
class="col-12 col-lg-6 o_setting_box"
8+
<xpath expr="//block[@name='catalog_setting_container']" position="inside">
9+
<setting
1110
id="optional_product_quantity_setting"
11+
help="Manage quantities of optional products"
1212
>
13-
<div class="o_setting_left_pane">
14-
<field name="group_product_optional_quantity" />
15-
</div>
16-
<div class="o_setting_right_pane">
17-
<label for="group_product_optional_quantity" />
18-
<div class="text-muted">
19-
Manage quantities of optional products
20-
</div>
21-
</div>
22-
</div>
23-
</div>
13+
<field name="group_product_optional_quantity" />
14+
</setting>
15+
</xpath>
2416
</field>
2517
</record>
2618
</odoo>

0 commit comments

Comments
 (0)