Skip to content

Commit f936f6f

Browse files
committed
[MIG] website_sale_product_pack: Migration to 18.0
1 parent db0b2c6 commit f936f6f

File tree

10 files changed

+72
-102
lines changed

10 files changed

+72
-102
lines changed

website_sale_product_pack/README.rst

+22-22
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,29 @@ Website Sale Product Pack
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--pack-lightgray.png?logo=github
20-
:target: https://github.com/OCA/product-pack/tree/17.0/website_sale_product_pack
20+
:target: https://github.com/OCA/product-pack/tree/18.0/website_sale_product_pack
2121
:alt: OCA/product-pack
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/product-pack-17-0/product-pack-17-0-website_sale_product_pack
23+
:target: https://translation.odoo-community.org/projects/product-pack-18-0/product-pack-18-0-website_sale_product_pack
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-pack&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-pack&target_branch=18.0
2727
:alt: Try me on Runboat
2828

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

3131
This module introduces compatibility of product packs with e-commerce:
3232

33-
- In the cart summary, the components aren't editable and are shown
34-
hanging from the main pack reference.
35-
- When we remove a pack from the cart, their components are removed as
36-
well.
37-
- The cart popup summary only shows the main pack line and discards the
38-
sublines in the units count.
39-
- The cart summary shows the component lines hanging from the main one
40-
as well.
41-
- It's ensured the the prices are shown correctly for the whole pack
42-
and that they're correctly summarized depending on the pack type.
33+
- In the cart summary, the components aren't editable and are shown
34+
hanging from the main pack reference.
35+
- When we remove a pack from the cart, their components are removed as
36+
well.
37+
- The cart popup summary only shows the main pack line and discards the
38+
sublines in the units count.
39+
- The cart summary shows the component lines hanging from the main one
40+
as well.
41+
- It's ensured the the prices are shown correctly for the whole pack and
42+
that they're correctly summarized depending on the pack type.
4343

4444
**Table of contents**
4545

@@ -56,17 +56,17 @@ as if you do it in the backend.
5656
Known issues / Roadmap
5757
======================
5858

59-
- Improve pack cart display.
60-
- When we have subpacks (a pack inside a pack) we should improve
61-
visually how it's shown in the cart.
59+
- Improve pack cart display.
60+
- When we have subpacks (a pack inside a pack) we should improve
61+
visually how it's shown in the cart.
6262

6363
Bug Tracker
6464
===========
6565

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

7171
Do not contact contributors directly about support or help with technical issues.
7272

@@ -81,13 +81,13 @@ Authors
8181
Contributors
8282
------------
8383

84-
- `Tecnativa <https://www.tecnativa.com>`__:
84+
- `Tecnativa <https://www.tecnativa.com>`__:
8585

86-
- David Vidal
86+
- David Vidal
8787

88-
- `ADHOC SA <https://www.adhoc.com.ar>`__:
88+
- `ADHOC SA <https://www.adhoc.com.ar>`__:
8989

90-
- Nicolas Mac Rouillon
90+
- Nicolas Mac Rouillon
9191

9292
Maintainers
9393
-----------
@@ -102,6 +102,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
102102
mission is to support the collaborative development of Odoo features and
103103
promote its widespread use.
104104

105-
This module is part of the `OCA/product-pack <https://github.com/OCA/product-pack/tree/17.0/website_sale_product_pack>`_ project on GitHub.
105+
This module is part of the `OCA/product-pack <https://github.com/OCA/product-pack/tree/18.0/website_sale_product_pack>`_ project on GitHub.
106106

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

website_sale_product_pack/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Website Sale Product Pack",
55
"category": "E-Commerce",
66
"summary": "Compatibility module of product pack with e-commerce",
7-
"version": "17.0.2.0.1",
7+
"version": "18.0.1.0.0",
88
"license": "AGPL-3",
99
"depends": ["website_sale", "sale_product_pack"],
1010
"data": ["views/templates.xml"],

website_sale_product_pack/controllers/__init__.py

-2
This file was deleted.

website_sale_product_pack/controllers/main.py

-27
This file was deleted.

website_sale_product_pack/controllers/variant.py

-25
This file was deleted.

website_sale_product_pack/models/product_template.py

+33
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,36 @@ def check_website_published(self):
4848
"pack_parents": ", ".join(published.mapped("name")),
4949
}
5050
)
51+
52+
def _get_additionnal_combination_info(
53+
self, product_or_template, quantity, date, website
54+
):
55+
"""Override to add the information about renting for rental products"""
56+
res = super()._get_additionnal_combination_info(
57+
product_or_template, quantity, date, website
58+
)
59+
60+
if not product_or_template.pack_ok:
61+
return res
62+
63+
currency = website.currency_id
64+
pricelist = website.pricelist_id
65+
res["price"] = pricelist.with_context(whole_pack_price=True)._get_product_price(
66+
product=product_or_template,
67+
quantity=quantity,
68+
currency=currency,
69+
)
70+
71+
return res
72+
73+
def _get_sales_prices(self, website):
74+
prices = super()._get_sales_prices(website)
75+
pricelist = website.pricelist_id
76+
77+
for template in self:
78+
if not template.pack_ok:
79+
continue
80+
prices[template.id]["price_reduce"] = pricelist.with_context(
81+
whole_pack_price=True
82+
)._get_product_price(product=template, quantity=1.0)
83+
return prices

website_sale_product_pack/models/website.py

-12
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,3 @@
55

66
class Website(models.Model):
77
_inherit = "website"
8-
9-
def sale_get_order(self, force_create=False, update_pricelist=False):
10-
"""Communicate with product pack expansion method to check if it's necessary
11-
to expand the product pack lines or not via context"""
12-
if update_pricelist:
13-
return super(
14-
Website, self.with_context(update_pricelist=True)
15-
).sale_get_order(force_create, update_pricelist)
16-
return super().sale_get_order(
17-
force_create,
18-
update_pricelist,
19-
)

website_sale_product_pack/static/description/index.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Website Sale Product Pack</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:b253d0a32950c83c03fbde45ce4e7b7335fc773f15534306c65a0ec5344121b8
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/product-pack/tree/17.0/website_sale_product_pack"><img alt="OCA/product-pack" src="https://img.shields.io/badge/github-OCA%2Fproduct--pack-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-pack-17-0/product-pack-17-0-website_sale_product_pack"><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-pack&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/product-pack/tree/18.0/website_sale_product_pack"><img alt="OCA/product-pack" src="https://img.shields.io/badge/github-OCA%2Fproduct--pack-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-pack-18-0/product-pack-18-0-website_sale_product_pack"><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-pack&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 introduces compatibility of product packs with e-commerce:</p>
374374
<ul class="simple">
375375
<li>In the cart summary, the components aren’t editable and are shown
@@ -380,8 +380,8 @@ <h1 class="title">Website Sale Product Pack</h1>
380380
sublines in the units count.</li>
381381
<li>The cart summary shows the component lines hanging from the main one
382382
as well.</li>
383-
<li>It’s ensured the the prices are shown correctly for the whole pack
384-
and that they’re correctly summarized depending on the pack type.</li>
383+
<li>It’s ensured the the prices are shown correctly for the whole pack and
384+
that they’re correctly summarized depending on the pack type.</li>
385385
</ul>
386386
<p><strong>Table of contents</strong></p>
387387
<div class="contents local topic" id="contents">
@@ -416,7 +416,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
416416
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-pack/issues">GitHub Issues</a>.
417417
In case of trouble, please check there if your issue has already been reported.
418418
If you spotted it first, help us to smash it by providing a detailed and welcomed
419-
<a class="reference external" href="https://github.com/OCA/product-pack/issues/new?body=module:%20website_sale_product_pack%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
419+
<a class="reference external" href="https://github.com/OCA/product-pack/issues/new?body=module:%20website_sale_product_pack%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
420420
<p>Do not contact contributors directly about support or help with technical issues.</p>
421421
</div>
422422
<div class="section" id="credits">
@@ -449,7 +449,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
449449
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
450450
mission is to support the collaborative development of Odoo features and
451451
promote its widespread use.</p>
452-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-pack/tree/17.0/website_sale_product_pack">OCA/product-pack</a> project on GitHub.</p>
452+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-pack/tree/18.0/website_sale_product_pack">OCA/product-pack</a> project on GitHub.</p>
453453
<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>
454454
</div>
455455
</div>

website_sale_product_pack/static/tests/tours/website_sale_product_pack_tour.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,82 +3,85 @@
33
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
44

55
import {registry} from "@web/core/registry";
6-
import tourUtils from "@website_sale/js/tours/tour_utils";
6+
import * as tourUtils from "@website_sale/js/tours/tour_utils";
77

88
registry.category("web_tour.tours").add("create_components_price_order_line", {
9-
test: true,
109
url: "/shop",
1110
steps: () => [
1211
...tourUtils.searchProduct("Pack CPU (Detailed - Displayed Components Price)"),
1312
{
1413
content: "select Pack CPU (Detailed - Displayed Components Price)",
1514
trigger:
1615
'.oe_product_cart:first a:contains("Pack CPU (Detailed - Displayed Components Price)")',
16+
run: "click",
1717
},
1818
{
1919
content: "click on add to cart",
2020
trigger: '#product_detail form[action^="/shop/cart/update"] #add_to_cart',
21+
run: "click",
2122
},
2223
tourUtils.goToCart(),
2324
],
2425
});
2526

2627
registry.category("web_tour.tours").add("create_ignored_price_order_line", {
27-
test: true,
2828
url: "/shop",
2929
steps: () => [
3030
...tourUtils.searchProduct("Pack CPU (Detailed - Ignored Components Price)"),
3131
{
3232
content: "select Pack CPU (Detailed - Ignored Components Price)",
3333
trigger:
3434
'.oe_product_cart:first a:contains("Pack CPU (Detailed - Ignored Components Price)")',
35+
run: "click",
3536
},
3637
{
3738
content: "click on add to cart",
3839
trigger: '#product_detail form[action^="/shop/cart/update"] #add_to_cart',
40+
run: "click",
3941
},
4042
tourUtils.goToCart(),
4143
],
4244
});
4345

4446
registry.category("web_tour.tours").add("create_totalized_price_order_line", {
45-
test: true,
4647
url: "/shop",
4748
steps: () => [
4849
...tourUtils.searchProduct("Pack CPU (Detailed - Totalized Components Price)"),
4950
{
5051
content: "select Pack CPU (Detailed - Totalized Components Price)",
5152
trigger:
5253
'.oe_product_cart:first a:contains("Pack CPU (Detailed - Totalized Components Price)")',
54+
run: "click",
5355
},
5456
{
5557
content: "click on add to cart",
5658
trigger: '#product_detail form[action^="/shop/cart/update"] #add_to_cart',
59+
run: "click",
5760
},
5861
tourUtils.goToCart(),
5962
],
6063
});
6164

6265
registry.category("web_tour.tours").add("create_non_detailed_price_order_line", {
63-
test: true,
6466
url: "/shop",
6567
steps: () => [
6668
...tourUtils.searchProduct("Non Detailed - Totalized Components Price"),
6769
{
6870
content: "select Non Detailed - Totalized Components Price",
6971
trigger:
7072
'.oe_product_cart:first a:contains("Non Detailed - Totalized Components Price")',
73+
run: "click",
7174
},
7275
{
7376
content: "click on add to cart",
7477
trigger: '#product_detail form[action^="/shop/cart/update"] #add_to_cart',
78+
run: "click",
7579
},
7680
tourUtils.goToCart(),
7781
],
7882
});
7983

8084
registry.category("web_tour.tours").add("update_pack_qty", {
81-
test: true,
8285
url: "/shop",
8386
steps: () => [
8487
...tourUtils.searchProduct("Pack CPU (Detailed - Displayed Components Price)"),

website_sale_product_pack/views/templates.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class="js_quantity text-muted"
1212
t-att-data-line-id="line.id"
1313
t-att-data-product-id="line.product_id.id"
14-
t-esc="int(line.product_uom_qty)"
14+
t-out="int(line.product_uom_qty)"
1515
/>
1616
</xpath>
1717
<!-- We don't want to allow to delete pack components -->
@@ -29,7 +29,7 @@
2929
line.pack_parent_line_id
3030
</attribute>
3131
</xpath>
32-
<xpath expr="//div[@t-else='']" position="attributes">
32+
<xpath expr="//div[@t-field='line.product_id.image_128']" position="attributes">
3333
<attribute
3434
name="t-if"
3535
>line.product_id.image_128 and not line.pack_parent_line_id</attribute>

0 commit comments

Comments
 (0)