Skip to content

Commit 0ac334c

Browse files
[MIG] purchase_order_supplierinfo_update: Migration to 19.0
1 parent e69d909 commit 0ac334c

6 files changed

Lines changed: 51 additions & 32 deletions

File tree

purchase_order_supplierinfo_update/README.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
==================================
26
Purchase Order Supplierinfo Update
37
==================================
@@ -13,17 +17,17 @@ Purchase Order Supplierinfo Update
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Beta
16-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1822
:alt: License: AGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
20-
:target: https://github.com/OCA/purchase-workflow/tree/18.0/purchase_order_supplierinfo_update
24+
:target: https://github.com/OCA/purchase-workflow/tree/19.0/purchase_order_supplierinfo_update
2125
:alt: OCA/purchase-workflow
2226
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-purchase_order_supplierinfo_update
27+
:target: https://translation.odoo-community.org/projects/purchase-workflow-19-0/purchase-workflow-19-0-purchase_order_supplierinfo_update
2428
:alt: Translate me on Weblate
2529
.. |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=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=19.0
2731
:alt: Try me on Runboat
2832

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

7377
Do not contact contributors directly about support or help with technical issues.
7478

@@ -90,6 +94,9 @@ Contributors
9094

9195
- Daniel Reis <dreis@opensourceintegrators.com>, `Open Source
9296
Integrators <https://www.opensourceintegrators.eu>`__:
97+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
98+
99+
- Bhavesh Heliconia
93100

94101
Maintainers
95102
-----------
@@ -112,6 +119,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
112119

113120
|maintainer-ernestotejeda|
114121

115-
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/18.0/purchase_order_supplierinfo_update>`_ project on GitHub.
122+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/19.0/purchase_order_supplierinfo_update>`_ project on GitHub.
116123

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

purchase_order_supplierinfo_update/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Purchase Order Supplierinfo Update",
55
"summary": "Update product supplierinfo with the last purchase price",
6-
"version": "18.0.1.0.1",
6+
"version": "19.0.1.0.0",
77
"category": "Purchase",
88
"website": "https://github.com/OCA/purchase-workflow",
99
"author": "Tecnativa, Odoo Community Association (OCA)",

purchase_order_supplierinfo_update/models/purchase_order.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def update_supplierinfo_price(self):
4545
partner_id=line.partner_id,
4646
quantity=line.product_qty,
4747
date=line.order_id.date_order and line.order_id.date_order.date(),
48-
uom_id=line.product_uom,
48+
uom_id=line.product_uom_id,
4949
params=params,
5050
)
5151
if seller:
@@ -63,9 +63,9 @@ def _update_supplierinfo(self, seller):
6363
self.date_order or fields.Date.today(),
6464
)
6565
# convert according to the UoM if necessary
66-
if self.product_uom and self.product_uom != seller.product_uom:
67-
new_seller_price = self.product_uom._compute_price(
68-
new_seller_price, seller.product_uom
66+
if self.product_uom_id and self.product_uom_id != seller.product_uom_id:
67+
new_seller_price = self.product_uom_id._compute_price(
68+
new_seller_price, seller.product_uom_id
6969
)
7070
# Set price
7171
if new_seller_price != seller.price:

purchase_order_supplierinfo_update/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
- Carlos Dauden
44
- Daniel Reis \<<dreis@opensourceintegrators.com>\>, [Open Source
55
Integrators](https://www.opensourceintegrators.eu):
6+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
7+
- Bhavesh Heliconia

purchase_order_supplierinfo_update/static/description/index.html

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Purchase Order Supplierinfo Update</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
@@ -360,16 +360,21 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="purchase-order-supplierinfo-update">
364-
<h1 class="title">Purchase Order Supplierinfo Update</h1>
363+
<div class="document">
365364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="purchase-order-supplierinfo-update">
370+
<h1>Purchase Order Supplierinfo Update</h1>
366371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367372
!! This file is generated by oca-gen-addon-readme !!
368373
!! changes will be overwritten. !!
369374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370375
!! source digest: sha256:7e804f3344c4e3f15a5415eab410a29ebf023c707aa02ca6903a7434dbb8f277
371376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
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_order_supplierinfo_update"><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_order_supplierinfo_update"><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_order_supplierinfo_update"><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_order_supplierinfo_update"><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>
373378
<p>This module extends the functionality of purchase to allow the price and
374379
the discount of the supplier-info to be updated automatically for each
375380
product of the purchase when it is confirmed. This will allow that when
@@ -390,7 +395,7 @@ <h1 class="title">Purchase Order Supplierinfo Update</h1>
390395
</ul>
391396
</div>
392397
<div class="section" id="usage">
393-
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
398+
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
394399
<p>To use this module, you need to:</p>
395400
<ol class="arabic simple">
396401
<li>Go to <em>Purchase &gt; Orders &gt; Requests for Quotation</em> and create a new
@@ -407,30 +412,30 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
407412
</ol>
408413
</div>
409414
<div class="section" id="known-issues-roadmap">
410-
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
415+
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
411416
<ul class="simple">
412417
<li>Refactor that module to share algorithm with similar module
413418
account_invoice_supplierinfo_update.</li>
414419
</ul>
415420
</div>
416421
<div class="section" id="bug-tracker">
417-
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
422+
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
418423
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/issues">GitHub Issues</a>.
419424
In case of trouble, please check there if your issue has already been reported.
420425
If you spotted it first, help us to smash it by providing a detailed and welcomed
421-
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_supplierinfo_update%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
426+
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_supplierinfo_update%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
422427
<p>Do not contact contributors directly about support or help with technical issues.</p>
423428
</div>
424429
<div class="section" id="credits">
425-
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
430+
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
426431
<div class="section" id="authors">
427-
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
432+
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
428433
<ul class="simple">
429434
<li>Tecnativa</li>
430435
</ul>
431436
</div>
432437
<div class="section" id="contributors">
433-
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
438+
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
434439
<ul class="simple">
435440
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
436441
<li>Ernesto Tejeda</li>
@@ -439,10 +444,14 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
439444
</li>
440445
<li>Daniel Reis &lt;<a class="reference external" href="mailto:dreis&#64;opensourceintegrators.com">dreis&#64;opensourceintegrators.com</a>&gt;, <a class="reference external" href="https://www.opensourceintegrators.eu">Open Source
441446
Integrators</a>:</li>
447+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
448+
<li>Bhavesh Heliconia</li>
449+
</ul>
450+
</li>
442451
</ul>
443452
</div>
444453
<div class="section" id="maintainers">
445-
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
454+
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
446455
<p>This module is maintained by the OCA.</p>
447456
<a class="reference external image-reference" href="https://odoo-community.org">
448457
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -452,10 +461,11 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
452461
promote its widespread use.</p>
453462
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
454463
<p><a class="reference external image-reference" href="https://github.com/ernestotejeda"><img alt="ernestotejeda" src="https://github.com/ernestotejeda.png?size=40px" /></a></p>
455-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/18.0/purchase_order_supplierinfo_update">OCA/purchase-workflow</a> project on GitHub.</p>
464+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/19.0/purchase_order_supplierinfo_update">OCA/purchase-workflow</a> project on GitHub.</p>
456465
<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>
457466
</div>
458467
</div>
459468
</div>
469+
</div>
460470
</body>
461471
</html>

purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dateutil.relativedelta import relativedelta
55

66
from odoo import fields
7-
from odoo.models import Command
7+
from odoo.fields import Command
88
from odoo.tests import Form
99

1010
from odoo.addons.base.tests.common import BaseCommon
@@ -44,7 +44,7 @@ def test_confirn_purchase_order(self):
4444
po_line_form.product_id = self.product
4545
self.assertEqual(po_line_form.price_unit, 100)
4646
po_line_form.price_unit = 150
47-
po_line_form.taxes_id.clear()
47+
po_line_form.tax_ids.clear()
4848
purchase_order = po_form.save()
4949
purchase_order.button_confirm()
5050
self.assertEqual(self.supplierinfo.price, 150)
@@ -55,7 +55,7 @@ def test_confirn_purchase_order(self):
5555
po_line_form.product_id = self.product
5656
self.assertEqual(po_line_form.price_unit, 150)
5757
po_line_form.price_unit = 200
58-
po_line_form.taxes_id.clear()
58+
po_line_form.tax_ids.clear()
5959
purchase_order = po_form.save()
6060
purchase_order.button_confirm()
6161
self.assertEqual(self.supplierinfo.price, 200)
@@ -68,7 +68,7 @@ def test_change_price_in_confirmed_po(self):
6868
po_form_1.date_order = now - relativedelta(days=1)
6969
with po_form_1.order_line.new() as po_line_form:
7070
po_line_form.product_id = self.product
71-
po_line_form.taxes_id.clear()
71+
po_line_form.tax_ids.clear()
7272
purchase_order_1 = po_form_1.save()
7373
purchase_order_1.button_confirm()
7474
# Create second purchase
@@ -77,7 +77,7 @@ def test_change_price_in_confirmed_po(self):
7777
with po_form_2.order_line.new() as po_line_form:
7878
po_line_form.product_id = self.product
7979
po_line_form.price_unit = 200
80-
po_line_form.taxes_id.clear()
80+
po_line_form.tax_ids.clear()
8181
purchase_order_2 = po_form_2.save()
8282
purchase_order_2.button_confirm()
8383
# Change price in second purchase
@@ -98,7 +98,7 @@ def test_create_new_line_in_a_confirmed_po(self):
9898
po_form_1.partner_id = self.supplier
9999
with po_form_1.order_line.new() as po_line_form:
100100
po_line_form.product_id = self.product
101-
po_line_form.taxes_id.clear()
101+
po_line_form.tax_ids.clear()
102102
purchase_order_1 = po_form_1.save()
103103
purchase_order_1.button_confirm()
104104
# Create second purchase
@@ -107,7 +107,7 @@ def test_create_new_line_in_a_confirmed_po(self):
107107
with po_form_2.order_line.new() as po_line_form:
108108
po_line_form.product_id = self.product
109109
po_line_form.price_unit = 200
110-
po_line_form.taxes_id.clear()
110+
po_line_form.tax_ids.clear()
111111
purchase_order_2 = po_form_2.save()
112112
purchase_order_2.button_confirm()
113113
# Create a new line in the first purchase (that is already confirmed)
@@ -120,7 +120,7 @@ def test_create_new_line_in_a_confirmed_po(self):
120120
Command.create(
121121
{
122122
"product_id": self.product_2.id,
123-
"product_uom": self.product_2.uom_po_id.id,
123+
"product_uom_id": self.product_2.uom_id.id,
124124
"price_unit": 20.00,
125125
"discount": 10.00,
126126
}

0 commit comments

Comments
 (0)