Skip to content

Commit 12b5cc0

Browse files
ALopez-Adhoclef-adhoc
authored andcommitted
[MIG] website_sale_product_pack: Migration to 18.0
1 parent 6a7fef3 commit 12b5cc0

File tree

13 files changed

+147
-130
lines changed

13 files changed

+147
-130
lines changed

website_sale_product_pack/README.rst

Lines changed: 22 additions & 22 deletions
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.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from . import models
2-
from . import controllers

website_sale_product_pack/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
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"],
1111
"assets": {
1212
"web.assets_tests": [
13-
"website_sale_product_pack/static/tests/tours/website_sale_product_pack_tour.js",
13+
"website_sale_product_pack/static/tests/tours/website_sale_product_pack_tour.esm.js",
1414
],
1515
},
1616
"author": "Tecnativa, Odoo Community Association (OCA)",

website_sale_product_pack/controllers/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

website_sale_product_pack/controllers/main.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

website_sale_product_pack/controllers/variant.py

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from . import sale_order
2-
from . import website
32
from . import product_product
43
from . import product_template

website_sale_product_pack/models/product_template.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,94 @@ def check_website_published(self):
4848
"pack_parents": ", ".join(published.mapped("name")),
4949
}
5050
)
51+
52+
def _get_combination_info(
53+
self,
54+
combination=False,
55+
product_id=False,
56+
add_qty=1.0,
57+
parent_combination=False,
58+
only_template=False,
59+
):
60+
"""Override to add the information about renting for rental products"""
61+
return super(
62+
ProductTemplate, self.with_context(whole_pack_price=True)
63+
)._get_combination_info(
64+
combination=combination,
65+
product_id=product_id,
66+
add_qty=add_qty,
67+
parent_combination=parent_combination,
68+
only_template=only_template,
69+
)
70+
71+
def _get_additionnal_combination_info(
72+
self, product_or_template, quantity, date, website
73+
):
74+
"""Override to add the information about renting for rental products"""
75+
res = super()._get_additionnal_combination_info(
76+
product_or_template, quantity, date, website
77+
)
78+
79+
if product_or_template.pack_ok:
80+
currency = website.currency_id
81+
pricelist = website.pricelist_id
82+
pack_price = pricelist.with_context(
83+
whole_pack_price=True
84+
)._get_product_price(
85+
product=product_or_template,
86+
quantity=quantity,
87+
currency=currency,
88+
)
89+
res["price"] = pack_price
90+
# Apply taxes
91+
fiscal_position = website.fiscal_position_id.sudo()
92+
product_taxes = (
93+
product_or_template.sudo().taxes_id._filter_taxes_by_company(
94+
self.env.company
95+
)
96+
)
97+
taxes = self.env["account.tax"]
98+
if product_taxes:
99+
taxes = fiscal_position.map_tax(product_taxes)
100+
res["price"] = self._apply_taxes_to_price(
101+
res["price"],
102+
currency,
103+
product_taxes,
104+
taxes,
105+
product_or_template,
106+
website=website,
107+
)
108+
109+
return res
110+
111+
def _get_sales_prices(self, website):
112+
"""Override to add the price of the pack itself"""
113+
packs, no_packs = self.with_context(whole_pack_price=True).split_pack_products()
114+
prices = super(ProductTemplate, no_packs)._get_sales_prices(website)
115+
if packs:
116+
pricelist = website.pricelist_id
117+
for pack in packs:
118+
price = {
119+
"price_reduce": pricelist.with_context(
120+
whole_pack_price=True
121+
)._get_product_price(product=pack, quantity=1.0)
122+
}
123+
# Apply taxes
124+
fiscal_position = website.fiscal_position_id.sudo()
125+
product_taxes = pack.sudo().taxes_id._filter_taxes_by_company(
126+
self.env.company
127+
)
128+
taxes = self.env["account.tax"]
129+
if product_taxes:
130+
currency = website.currency_id
131+
taxes = fiscal_position.map_tax(product_taxes)
132+
price["price_reduce"] = self._apply_taxes_to_price(
133+
price["price_reduce"],
134+
currency,
135+
product_taxes,
136+
taxes,
137+
pack,
138+
website=website,
139+
)
140+
prices[pack.id] = price
141+
return prices

website_sale_product_pack/models/website.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

website_sale_product_pack/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 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>

0 commit comments

Comments
 (0)