Skip to content

Commit 68eff60

Browse files
[MIG] website_sale_secondary_unit: Migration to version 18.0
TT54395
1 parent 28986b7 commit 68eff60

File tree

6 files changed

+54
-39
lines changed

6 files changed

+54
-39
lines changed

website_sale_secondary_unit/README.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Website Sale Secondary Unit
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%2Fe--commerce-lightgray.png?logo=github
20-
:target: https://github.com/OCA/e-commerce/tree/17.0/website_sale_secondary_unit
20+
:target: https://github.com/OCA/e-commerce/tree/18.0/website_sale_secondary_unit
2121
:alt: OCA/e-commerce
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/e-commerce-17-0/e-commerce-17-0-website_sale_secondary_unit
23+
:target: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit
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/e-commerce&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -47,23 +47,23 @@ Usage
4747

4848
To use this module you need to:
4949

50-
- Go to *'Website > Products > Products'*.
51-
- Select a template.
52-
- Set the secondary units that you need.
53-
- Go to Website Shop and buy this product, you will see a selectable
54-
option with all secondary units defined in the product and visible in
55-
website.
56-
- If you do not want to sell in a base product unit and only allow sell
57-
in a secondary unit you can disable the option *'Allow to sell in unit
58-
of measure'* in a product sale tab.
50+
- Go to *'Website > Products > Products'*.
51+
- Select a template.
52+
- Set the secondary units that you need.
53+
- Go to Website Shop and buy this product, you will see a selectable
54+
option with all secondary units defined in the product and visible in
55+
website.
56+
- If you do not want to sell in a base product unit and only allow sell
57+
in a secondary unit you can disable the option *'Allow to sell in
58+
unit of measure'* in a product sale tab.
5959

6060
Bug Tracker
6161
===========
6262

6363
Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/issues>`_.
6464
In case of trouble, please check there if your issue has already been reported.
6565
If you spotted it first, help us to smash it by providing a detailed and welcomed
66-
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_secondary_unit%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
66+
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_secondary_unit%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6767

6868
Do not contact contributors directly about support or help with technical issues.
6969

@@ -78,12 +78,12 @@ Authors
7878
Contributors
7979
------------
8080

81-
- `Tecnativa <https://www.tecnativa.com>`__:
81+
- `Tecnativa <https://www.tecnativa.com>`__:
8282

83-
- Sergio Teruel
84-
- Carlos Roca
85-
- Pilar Vargas
86-
- Carlos Lopez
83+
- Sergio Teruel
84+
- Carlos Roca
85+
- Pilar Vargas
86+
- Carlos Lopez
8787

8888
Maintainers
8989
-----------
@@ -98,6 +98,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9898
mission is to support the collaborative development of Odoo features and
9999
promote its widespread use.
100100

101-
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/17.0/website_sale_secondary_unit>`_ project on GitHub.
101+
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_secondary_unit>`_ project on GitHub.
102102

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

website_sale_secondary_unit/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Website Sale Secondary Unit",
55
"summary": "Allow manage secondary units in website shop",
6-
"version": "17.0.1.0.0",
6+
"version": "18.0.1.0.0",
77
"development_status": "Beta",
88
"category": "Website",
99
"website": "https://github.com/OCA/e-commerce",

website_sale_secondary_unit/static/description/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Website Sale Secondary Unit</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:4c9fbdc1746932986528b0f08a484c172d0bfafed5fc111c1342a3b645ec4a11
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
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/e-commerce/tree/17.0/website_sale_secondary_unit"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/e-commerce-17-0/e-commerce-17-0-website_sale_secondary_unit"><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/e-commerce&amp;target_branch=17.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/e-commerce/tree/18.0/website_sale_secondary_unit"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit"><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/e-commerce&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module extends the functionality of saleorder_secondary_unit module
374374
to allow sell products in online store in secondary units defined.</p>
375375
<p><strong>Table of contents</strong></p>
@@ -402,16 +402,16 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
402402
option with all secondary units defined in the product and visible in
403403
website.</li>
404404
<li>If you do not want to sell in a base product unit and only allow sell
405-
in a secondary unit you can disable the option <em>‘Allow to sell in unit
406-
of measure’</em> in a product sale tab.</li>
405+
in a secondary unit you can disable the option <em>‘Allow to sell in
406+
unit of measure’</em> in a product sale tab.</li>
407407
</ul>
408408
</div>
409409
<div class="section" id="bug-tracker">
410410
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
411411
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/e-commerce/issues">GitHub Issues</a>.
412412
In case of trouble, please check there if your issue has already been reported.
413413
If you spotted it first, help us to smash it by providing a detailed and welcomed
414-
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_secondary_unit%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
414+
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_secondary_unit%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
415415
<p>Do not contact contributors directly about support or help with technical issues.</p>
416416
</div>
417417
<div class="section" id="credits">
@@ -443,7 +443,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
443443
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
444444
mission is to support the collaborative development of Odoo features and
445445
promote its widespread use.</p>
446-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/17.0/website_sale_secondary_unit">OCA/e-commerce</a> project on GitHub.</p>
446+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/18.0/website_sale_secondary_unit">OCA/e-commerce</a> project on GitHub.</p>
447447
<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>
448448
</div>
449449
</div>
Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/** @odoo-module */
21
/* Copyright 2019 Sergio Teruel
32
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
43

@@ -9,47 +8,60 @@ registry.category("web_tour.tours").add("website_sale_secondary_unit", {
98
steps: () => [
109
{
1110
trigger: "a:contains('Test product')",
11+
run: "click",
1212
},
1313
{
1414
trigger: "#secondary_uom",
15-
run: "text(Box 5 Units)",
15+
run: "selectByLabel Box 5 Units",
1616
},
1717
{
1818
trigger: "#add_to_cart",
19-
extra_trigger:
20-
".js_product:has(input[name='add_qty']:propValueContains(5)):has(.price_uom)",
19+
run: "click",
2120
},
2221
{
2322
trigger: "a[href='/shop/cart']",
23+
run: "click",
24+
},
25+
{
26+
trigger: "span:contains(Box 5 Units)",
2427
},
2528
{
2629
trigger: "a[href='/shop']",
27-
extra_trigger: "span:contains(Box 5 Units)",
30+
run: "click",
2831
},
2932
{
3033
trigger: "a:contains('Test product')",
34+
run: "click",
3135
},
3236
{
3337
trigger: "#add_to_cart",
34-
extra_trigger:
35-
".js_product:has(input[name='add_qty']:propValueContains(1))",
38+
run: "click",
3639
},
3740
{
3841
trigger: "a[href='/shop/cart']",
42+
run: "click",
43+
},
44+
{
45+
trigger: "span:contains(Units)",
46+
},
47+
{
48+
trigger: "a[name='website_sale_main_button']",
49+
run: "click",
3950
},
4051
{
41-
trigger: "a[href='/shop/checkout?express=1']",
42-
extra_trigger: "span:containsExact(Units)",
52+
trigger: "div[id='o_wsale_total_accordion_item'] button.accordion-button",
53+
run: "click",
4354
},
4455
{
45-
trigger: "div[id='o_wsale_total_accordion'] button.accordion-button",
56+
trigger: "h6[name='secondary_uom_qty'] span:contains(Box 5)",
57+
run: "click",
4658
},
4759
{
48-
trigger: "h6[name='secondary_uom_qty'] span:containsExact(Box 5)",
60+
trigger: "table:has(span:contains(Box 5)):has(span:contains(Units))",
4961
},
5062
{
5163
trigger: "a[href='/shop']",
52-
extra_trigger: "table:has(span:contains(Box 5)):has(span:contains(Units))",
64+
run: "click",
5365
},
5466
],
5567
});

website_sale_secondary_unit/tests/test_website_sale_secondary_unit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Copyright 2019 Tecnativa - Sergio Teruel
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3-
from odoo.tests.common import HttpCase
3+
from odoo.tests.common import HttpCase, tagged
44

55
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
66

77

8+
@tagged("post_install", "-at_install")
89
class WebsiteSaleSecondaryUnitHttpCase(HttpCase):
910
@classmethod
1011
def setUpClass(cls):
@@ -44,6 +45,8 @@ def setUpClass(cls):
4445
# Add group "Manage Multiple Units of Measure" to admin
4546
admin = cls.env.ref("base.user_admin")
4647
admin.groups_id |= cls.env.ref("uom.group_uom")
48+
# Force VAT to avoid error in the module that makes it required.
49+
admin.partner_id.vat = "TEST12345678"
4750

4851
def test_ui_website(self):
4952
"""Test frontend tour."""

website_sale_secondary_unit/views/product_secondary_unit_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
ref="product_secondary_unit.product_template_form_view"
1111
/>
1212
<field name="arch" type="xml">
13-
<xpath expr="//tree/field[@name='factor']" position="after">
13+
<xpath expr="//list/field[@name='factor']" position="after">
1414
<field name="website_published" />
1515
</xpath>
1616
</field>

0 commit comments

Comments
 (0)