Skip to content

Commit c4d0201

Browse files
committed
[MIG] purchase_product_pack: Migration to 19.0
1 parent 67c77f4 commit c4d0201

File tree

7 files changed

+20
-35
lines changed

7 files changed

+20
-35
lines changed

purchase_product_pack/README.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Purchase Product Pack
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--pack-lightgray.png?logo=github
24-
:target: https://github.com/OCA/product-pack/tree/18.0/purchase_product_pack
24+
:target: https://github.com/OCA/product-pack/tree/19.0/purchase_product_pack
2525
:alt: OCA/product-pack
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/product-pack-18-0/product-pack-18-0-purchase_product_pack
27+
:target: https://translation.odoo-community.org/projects/product-pack-19-0/product-pack-19-0-purchase_product_pack
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-pack&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-pack&target_branch=19.0
3131
:alt: Try me on Runboat
3232

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

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

@@ -89,11 +89,7 @@ Contributors
8989
Other credits
9090
-------------
9191

92-
Inspired by *sale_product_pack*
9392

94-
The development of this module has been financially supported by:
95-
96-
- Camptocamp
9793

9894
Maintainers
9995
-----------
@@ -108,6 +104,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
108104
mission is to support the collaborative development of Odoo features and
109105
promote its widespread use.
110106

111-
This module is part of the `OCA/product-pack <https://github.com/OCA/product-pack/tree/18.0/purchase_product_pack>`_ project on GitHub.
107+
This module is part of the `OCA/product-pack <https://github.com/OCA/product-pack/tree/19.0/purchase_product_pack>`_ project on GitHub.
112108

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

purchase_product_pack/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
33
{
44
"name": "Purchase Product Pack",
5-
"version": "18.0.1.0.1",
5+
"version": "19.0.1.0.0",
66
"category": "Purchase",
77
"summary": "This module allows you to buy product packs",
88
"website": "https://github.com/OCA/product-pack",

purchase_product_pack/models/product_pack_line.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def get_purchase_order_line_vals(self, line, order):
2121
"product_qty": quantity,
2222
}
2323
pol = line.new(line_vals)
24-
pol.onchange_product_id_warning()
2524
vals = pol._convert_to_write(pol._cache)
2625
pack_price_types = {"totalized", "ignored"}
2726
if (

purchase_product_pack/models/purchase_order.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Copyright 2023 Camptocamp SA
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
33

4-
from odoo import _, api, models
4+
from odoo import api, models
55
from odoo.exceptions import UserError
6+
from odoo.fields import Domain
67

78

89
class PurchaseOrder(models.Model):
@@ -37,7 +38,7 @@ def check_pack_line_unlink(self):
3738
and not x.pack_parent_line_id.product_id.pack_modifiable
3839
):
3940
raise UserError(
40-
_(
41+
self.env._(
4142
"You cannot delete this line because is part of a pack in"
4243
" this purchase order. In order to delete this line you need to"
4344
" delete the pack itself"
@@ -60,7 +61,7 @@ def _check_deleted_line(self, vals):
6061
subpacks_to_delete_ids = (
6162
self.env["purchase.order.line"]
6263
.search(
63-
[("id", "child_of", to_delete_ids), ("id", "not in", to_delete_ids)]
64+
Domain("id", "child_of", to_delete_ids), ("id", "not in", to_delete_ids)
6465
)
6566
.ids
6667
)

purchase_product_pack/models/purchase_order_line.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright 2023 Camptocamp SA
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55
from odoo.exceptions import UserError
6-
from odoo.fields import first
6+
from odoo.fields import Domain, first
77
from odoo.tools.float_utils import float_round
88

99

@@ -114,23 +114,22 @@ def check_pack_line_modify(self):
114114
"""Do not let to edit a purchase order line if this one belongs to pack"""
115115
if self._origin.pack_parent_line_id and not self._origin.pack_modifiable:
116116
raise UserError(
117-
_(
117+
self.env._(
118118
"You can not change this line because is part of a pack"
119119
" included in this order"
120120
)
121121
)
122122

123123
def action_open_parent_pack_product_view(self):
124-
domain = [
125-
("id", "in", self.mapped("pack_parent_line_id").mapped("product_id").ids)
126-
]
124+
pack_parent_lines = self.mapped("pack_parent_line_id")
125+
products = pack_parent_lines.mapped("product_id")
127126
return {
128-
"name": _("Parent Product"),
127+
"name": self.env._("Parent Product"),
129128
"type": "ir.actions.act_window",
130129
"res_model": "product.product",
131130
"view_type": "form",
132131
"view_mode": "list,form",
133-
"domain": domain,
132+
"domain": Domain("id", "in", products.ids),
134133
}
135134

136135
@api.depends("product_qty", "product_uom")
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
Inspired by *sale_product_pack*
2-
3-
The development of this module has been financially supported by:
4-
5-
- Camptocamp

purchase_product_pack/static/description/index.html

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Purchase Product Pack</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:174830ce41fbd8cb9d00dc617945dbe3dbdf80407c03659afcd2516798284699
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-pack/tree/18.0/purchase_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-purchase_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>
377+
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-pack/tree/19.0/purchase_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-19-0/product-pack-19-0-purchase_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=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>This module adds <em>Product Pack</em> functionality to purchase orders. You
379379
can choose a <em>Pack</em> in <em>purchase order lines</em> and see different
380380
behaviors depending on “Pack type” and “Pack component price” fields
@@ -417,7 +417,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
417417
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-pack/issues">GitHub Issues</a>.
418418
In case of trouble, please check there if your issue has already been reported.
419419
If you spotted it first, help us to smash it by providing a detailed and welcomed
420-
<a class="reference external" href="https://github.com/OCA/product-pack/issues/new?body=module:%20purchase_product_pack%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
420+
<a class="reference external" href="https://github.com/OCA/product-pack/issues/new?body=module:%20purchase_product_pack%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
421421
<p>Do not contact contributors directly about support or help with technical issues.</p>
422422
</div>
423423
<div class="section" id="credits">
@@ -439,11 +439,6 @@ <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
439439
</div>
440440
<div class="section" id="other-credits">
441441
<h3><a class="toc-backref" href="#toc-entry-6">Other credits</a></h3>
442-
<p>Inspired by <em>sale_product_pack</em></p>
443-
<p>The development of this module has been financially supported by:</p>
444-
<ul class="simple">
445-
<li>Camptocamp</li>
446-
</ul>
447442
</div>
448443
<div class="section" id="maintainers">
449444
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
@@ -454,7 +449,7 @@ <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
454449
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
455450
mission is to support the collaborative development of Odoo features and
456451
promote its widespread use.</p>
457-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-pack/tree/18.0/purchase_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/19.0/purchase_product_pack">OCA/product-pack</a> project on GitHub.</p>
458453
<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>
459454
</div>
460455
</div>

0 commit comments

Comments
 (0)