Skip to content

Commit e852436

Browse files
committed
[18.0][MIG] purchase_line_procurement_group: Migration to 18.0
1 parent 2d68955 commit e852436

File tree

8 files changed

+65
-35
lines changed

8 files changed

+65
-35
lines changed

purchase_line_procurement_group/README.rst

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

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -49,7 +49,7 @@ Bug Tracker
4949
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
5050
In case of trouble, please check there if your issue has already been reported.
5151
If you spotted it first, help us to smash it by providing a detailed and welcomed
52-
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_line_procurement_group%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
52+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_line_procurement_group%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5353

5454
Do not contact contributors directly about support or help with technical issues.
5555

@@ -64,24 +64,27 @@ Authors
6464
Contributors
6565
------------
6666

67-
- Akim Juillerat <[email protected]>
67+
- Akim Juillerat <[email protected]>
6868

69-
- Kitti Upariphutthiphong <[email protected]>
69+
- Kitti Upariphutthiphong <[email protected]>
7070

71-
- `Trobz <https://trobz.com>`__:
71+
- `Trobz <https://trobz.com>`__:
7272

73-
- Phuc Tran <[email protected]>
74-
- Jack Le <[email protected]>
73+
- Phuc Tran <[email protected]>
74+
- Jack Le <[email protected]>
7575

76-
- `Binhex <https://binhex.cloud/>`__:
76+
- `Binhex <https://binhex.cloud/>`__:
7777

78-
- Deriman Alonso
78+
- Deriman Alonso
79+
80+
- `DEC <https://decgroupe.com/>`__:
81+
82+
- Yann Papouin <[email protected]>
7983

8084
Other credits
8185
-------------
8286

83-
The migration of this module from 14.0 to 16.0 was financially supported
84-
by Camptocamp
87+
8588

8689
Maintainers
8790
-----------
@@ -96,6 +99,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9699
mission is to support the collaborative development of Odoo features and
97100
promote its widespread use.
98101

99-
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/17.0/purchase_line_procurement_group>`_ project on GitHub.
102+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/18.0/purchase_line_procurement_group>`_ project on GitHub.
100103

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

purchase_line_procurement_group/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Purchase Line Procurement Group",
55
"summary": "Group purchase order line according to procurement group",
6-
"version": "17.0.1.0.0",
6+
"version": "18.0.1.0.0",
77
"category": "Purchase",
88
"website": "https://github.com/OCA/purchase-workflow",
99
"author": "Camptocamp, Odoo Community Association (OCA)",

purchase_line_procurement_group/models/purchase_order_line.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,36 @@ def _find_candidate(
3939

4040
def _prepare_stock_moves(self, picking):
4141
res = super()._prepare_stock_moves(picking)
42-
if res and res[0] and "group_id" in res[0]:
43-
res[0]["group_id"] = (
44-
self.procurement_group_id.id or self.order_id.group_id.id
45-
)
42+
if self.procurement_group_id:
43+
for vals in res:
44+
if vals and "group_id" in vals:
45+
# override the procurement group with the one from the PO line
46+
vals["group_id"] = self.procurement_group_id.id
4647
return res
4748

4849
def _prepare_purchase_order_line_from_procurement(
49-
self, product_id, product_qty, product_uom, company_id, values, po
50+
self,
51+
product_id,
52+
product_qty,
53+
product_uom,
54+
location_dest_id,
55+
name,
56+
origin,
57+
company_id,
58+
values,
59+
po,
5060
):
5161
"""Add procurement group to values"""
5262
res = super()._prepare_purchase_order_line_from_procurement(
53-
product_id, product_qty, product_uom, company_id, values, po
63+
product_id,
64+
product_qty,
65+
product_uom,
66+
location_dest_id,
67+
name,
68+
origin,
69+
company_id,
70+
values,
71+
po,
5472
)
5573
procurement_group = values.get("group_id")
5674
if procurement_group:

purchase_line_procurement_group/readme/CONTRIBUTORS.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
- Kitti Upariphutthiphong \<<[email protected]>\>
44

5-
- [Trobz](https://trobz.com):
5+
- [Trobz](https://trobz.com):
6+
67
- Phuc Tran \<<[email protected]>\>
78
- Jack Le \<<[email protected]>\>
89

9-
- [Binhex](https://binhex.cloud/):
10-
- Deriman Alonso
10+
- [Binhex](https://binhex.cloud/):
11+
- Deriman Alonso
12+
13+
- [DEC](https://decgroupe.com/):
14+
- Yann Papouin \<<[email protected]>\>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
The migration of this module from 14.0 to 16.0 was financially supported
2-
by Camptocamp

purchase_line_procurement_group/static/description/index.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Purchase Line Procurement Group</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:b684c8e5da20b7ea4fc93d22766564269ca83f6e875df7e8e431b81cd82b7edc
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/purchase-workflow/tree/17.0/purchase_line_procurement_group"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-17-0/purchase-workflow-17-0-purchase_line_procurement_group"><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/purchase-workflow&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/purchase-workflow/tree/18.0/purchase_line_procurement_group"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-purchase_line_procurement_group"><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/purchase-workflow&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 changes the way procurements generate purchase order lines.
374374
If some procurements are run for the same products and locations, but
375375
have different procurement groups, these won’t be merged in the same
@@ -396,7 +396,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
396396
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/issues">GitHub Issues</a>.
397397
In case of trouble, please check there if your issue has already been reported.
398398
If you spotted it first, help us to smash it by providing a detailed and welcomed
399-
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_line_procurement_group%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
399+
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_line_procurement_group%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
400400
<p>Do not contact contributors directly about support or help with technical issues.</p>
401401
</div>
402402
<div class="section" id="credits">
@@ -421,12 +421,14 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
421421
<li>Deriman Alonso</li>
422422
</ul>
423423
</li>
424+
<li><a class="reference external" href="https://decgroupe.com/">DEC</a>:<ul>
425+
<li>Yann Papouin &lt;<a class="reference external" href="mailto:ypa&#64;decgroupe.com">ypa&#64;decgroupe.com</a>&gt;</li>
426+
</ul>
427+
</li>
424428
</ul>
425429
</div>
426430
<div class="section" id="other-credits">
427431
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
428-
<p>The migration of this module from 14.0 to 16.0 was financially supported
429-
by Camptocamp</p>
430432
</div>
431433
<div class="section" id="maintainers">
432434
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
@@ -437,7 +439,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
437439
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
438440
mission is to support the collaborative development of Odoo features and
439441
promote its widespread use.</p>
440-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/17.0/purchase_line_procurement_group">OCA/purchase-workflow</a> project on GitHub.</p>
442+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/18.0/purchase_line_procurement_group">OCA/purchase-workflow</a> project on GitHub.</p>
441443
<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>
442444
</div>
443445
</div>

purchase_line_procurement_group/tests/test_po_line_proc_group.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def _create_orderpoint(product, qty_min, qty_max, location):
1313
orderpoint_model = cls.env["stock.warehouse.orderpoint"]
1414
return orderpoint_model.create(
1515
{
16-
"name": "OP/%s" % product.name,
16+
"name": f"OP/{product.name}",
1717
"product_id": product.id,
1818
"product_min_qty": qty_min,
1919
"product_max_qty": qty_max,
@@ -32,7 +32,8 @@ def _create_orderpoint(product, qty_min, qty_max, location):
3232
.create(
3333
{
3434
"name": "Lighter",
35-
"type": "product",
35+
"type": "consu",
36+
"is_storable": True,
3637
"purchase_ok": True,
3738
"seller_ids": [
3839
(

purchase_line_procurement_group/views/purchase.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
<field name="inherit_id" ref="purchase.purchase_order_form" />
77
<field name="arch" type="xml">
88
<xpath
9-
expr="//notebook//field[@name='order_line']/tree/field[@name='date_planned']"
9+
expr="//notebook//field[@name='order_line']/list/field[@name='date_planned']"
1010
position="after"
1111
>
12-
<field name="procurement_group_id" group_id="base.group_no_one" />
12+
<field
13+
name="procurement_group_id"
14+
group_id="base.group_no_one"
15+
optional="hide"
16+
/>
1317
</xpath>
1418
<xpath
1519
expr="//notebook//field[@name='order_line']/form//field[@name='date_planned']"

0 commit comments

Comments
 (0)