Skip to content

Commit 719707d

Browse files
[MIG] purchase_representative: Migration to 19.0
1 parent 792a2cc commit 719707d

5 files changed

Lines changed: 47 additions & 38 deletions

File tree

purchase_representative/README.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Purchase Representative
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%2Fpurchase--workflow-lightgray.png?logo=github
24-
:target: https://github.com/OCA/purchase-workflow/tree/18.0/purchase_representative
24+
:target: https://github.com/OCA/purchase-workflow/tree/19.0/purchase_representative
2525
:alt: OCA/purchase-workflow
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-purchase_representative
27+
:target: https://translation.odoo-community.org/projects/purchase-workflow-19-0/purchase-workflow-19-0-purchase_representative
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/purchase-workflow&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=19.0
3131
:alt: Try me on Runboat
3232

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

5959
Do not contact contributors directly about support or help with technical issues.
6060

@@ -70,6 +70,9 @@ Contributors
7070
------------
7171

7272
- Lois Rilo <lois.rilo@forgeflow.com>
73+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
74+
75+
- Bhavesh Heliconia
7376

7477
Maintainers
7578
-----------
@@ -84,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8487
mission is to support the collaborative development of Odoo features and
8588
promote its widespread use.
8689

87-
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/18.0/purchase_representative>`_ project on GitHub.
90+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/19.0/purchase_representative>`_ project on GitHub.
8891

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

purchase_representative/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Purchase Representative",
55
"summary": "Purchase Representatives will be the point of contact for "
66
"RFQ's and PO's",
7-
"version": "18.0.1.0.0",
7+
"version": "19.0.1.0.0",
88
"category": "Purchases",
99
"website": "https://github.com/OCA/purchase-workflow",
1010
"author": "ForgeFlow, Odoo Community Association (OCA)",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
- Lois Rilo \<lois.rilo@forgeflow.com\>
2+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
3+
- Bhavesh Heliconia

purchase_representative/static/description/index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Purchase Representative</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:c3c1ec9335e5b0afa9656edfba111c93467e0e0334ac02b21f895b74fdfb8b3f
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/purchase-workflow/tree/18.0/purchase_representative"><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_representative"><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>
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/purchase-workflow/tree/19.0/purchase_representative"><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-19-0/purchase-workflow-19-0-purchase_representative"><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=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 makes the field <em>Purchase Representative</em> in Purchase Orders
379379
default to the user doing a procurement to overcome the known flaw of
380380
Odoo user in the transaction when using SUPERUSER_ID.</p>
@@ -402,7 +402,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
402402
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/issues">GitHub Issues</a>.
403403
In case of trouble, please check there if your issue has already been reported.
404404
If you spotted it first, help us to smash it by providing a detailed and welcomed
405-
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_representative%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
405+
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_representative%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
406406
<p>Do not contact contributors directly about support or help with technical issues.</p>
407407
</div>
408408
<div class="section" id="credits">
@@ -417,6 +417,10 @@ <h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
417417
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
418418
<ul class="simple">
419419
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
420+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
421+
<li>Bhavesh Heliconia</li>
422+
</ul>
423+
</li>
420424
</ul>
421425
</div>
422426
<div class="section" id="maintainers">
@@ -428,7 +432,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
428432
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
429433
mission is to support the collaborative development of Odoo features and
430434
promote its widespread use.</p>
431-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/18.0/purchase_representative">OCA/purchase-workflow</a> project on GitHub.</p>
435+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/19.0/purchase_representative">OCA/purchase-workflow</a> project on GitHub.</p>
432436
<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>
433437
</div>
434438
</div>

purchase_representative/tests/test_purchase_representative.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
from odoo import fields
2-
from odoo.tests.common import TransactionCase
1+
# Copyright 2020 ForgeFlow S.L.
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

4+
from odoo import Command, fields
5+
from odoo.tests import new_test_user
46

5-
class TestPurchaseRepresentative(TransactionCase):
6-
def setUp(self):
7-
super().setUp()
8-
self.user_test = self.env["res.users"].create(
9-
{
10-
"email": "testuser@testuser.com",
11-
"name": "Test User",
12-
"login": "test_user",
13-
"password": "test_user",
14-
}
15-
)
16-
self.partner = self.env["res.partner"].create(
17-
{
18-
"name": "Partner Test",
19-
"supplier_rank": 1,
20-
}
7+
from odoo.addons.base.tests.common import BaseCommon
8+
9+
10+
class TestPurchaseRepresentative(BaseCommon):
11+
@classmethod
12+
def setUpClass(cls):
13+
super().setUpClass()
14+
cls.user_test = new_test_user(
15+
cls.env,
16+
login="test_user",
17+
groups="purchase.group_purchase_user",
18+
name="Test User",
19+
email="testuser@testuser.com",
2120
)
2221

23-
self.product = self.env["product.product"].create(
22+
cls.product = cls.env["product.product"].create(
2423
{
2524
"name": "Product Test",
2625
"is_storable": True,
2726
"route_ids": [
28-
(6, 0, [self.env.ref("purchase_stock.route_warehouse0_buy").id])
27+
Command.set([cls.env.ref("purchase_stock.route_warehouse0_buy").id])
2928
],
3029
"standard_price": 50.0,
3130
}
3231
)
3332

34-
self.env["product.supplierinfo"].create(
33+
cls.env["product.supplierinfo"].create(
3534
{
36-
"partner_id": self.partner.id,
37-
"product_tmpl_id": self.product.product_tmpl_id.id,
35+
"partner_id": cls.partner.id,
36+
"product_tmpl_id": cls.product.product_tmpl_id.id,
3837
"min_qty": 1.0,
3938
"price": 45.0,
4039
}
4140
)
4241

43-
self.location = self.env.ref("stock.stock_location_stock")
44-
self.picking_type = self.env.ref("stock.picking_type_in")
42+
cls.location = cls.env.ref("stock.stock_location_stock")
43+
cls.picking_type = cls.env.ref("stock.picking_type_in")
4544

4645
def test_create_procurement(self):
4746
"""Test that the user_id field is filled automatically"""
48-
procurement = self.env["procurement.group"].Procurement(
47+
procurement = self.env["stock.rule"].Procurement(
4948
self.product,
5049
10,
5150
self.product.uom_id,
@@ -60,9 +59,10 @@ def test_create_procurement(self):
6059
"procure_method": "make_to_order",
6160
},
6261
)
63-
self.env["stock.rule"].with_user(self.user_test)._run_buy(
64-
[(procurement, self.env["stock.rule"].search([], limit=1))]
65-
)
62+
rule = self.env["stock.rule"].search([("action", "=", "buy")], limit=1)
63+
if not rule:
64+
rule = self.env["stock.rule"].search([], limit=1)
65+
self.env["stock.rule"].with_user(self.user_test)._run_buy([(procurement, rule)])
6666

6767
purchase_orders = self.env["purchase.order"].search(
6868
[("origin", "=", "Test Origin")]

0 commit comments

Comments
 (0)