Skip to content

Commit 272d9c2

Browse files
MiquelRForgeFlowmanuelregidor
authored andcommitted
[MIG] purchase_location_by_line: Migration to 12.0
1 parent 60a4ccf commit 272d9c2

File tree

8 files changed

+29
-23
lines changed

8 files changed

+29
-23
lines changed

purchase_location_by_line/README.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Purchase Location by Line
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
17-
:target: https://github.com/OCA/purchase-workflow/tree/11.0/purchase_location_by_line
17+
:target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_location_by_line
1818
:alt: OCA/purchase-workflow
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/purchase-workflow-11-0/purchase-workflow-11-0-purchase_location_by_line
20+
:target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_location_by_line
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/142/11.0
23+
:target: https://runbot.odoo-community.org/runbot/142/12.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -44,7 +44,7 @@ Bug Tracker
4444
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
4545
In case of trouble, please check there if your issue has already been reported.
4646
If you spotted it first, help us smashing it by providing a detailed and welcomed
47-
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_location_by_line%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
47+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_location_by_line%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
4848

4949
Do not contact contributors directly about support or help with technical issues.
5050

@@ -75,6 +75,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
7575
mission is to support the collaborative development of Odoo features and
7676
promote its widespread use.
7777

78-
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/11.0/purchase_location_by_line>`_ project on GitHub.
78+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/12.0/purchase_location_by_line>`_ project on GitHub.
7979

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

purchase_location_by_line/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
13
from . import models

purchase_location_by_line/__manifest__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"name": "Purchase Location by Line",
88
"summary": "Allows to define a specific destination location on each PO "
99
"line",
10-
"version": "11.0.1.0.0",
10+
"version": "12.0.1.0.0",
1111
"author": "Eficent, "
1212
"Odoo Community Association (OCA)",
1313
"website": "https://github.com/OCA/purchase-workflow",
1414
"category": "Purchase Management",
1515
"depends": [
16-
"purchase",
16+
"purchase_stock",
1717
"purchase_delivery_split_date"
1818
],
1919
"license": "AGPL-3",
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
13
from . import purchase
24
from . import stock_picking

purchase_location_by_line/models/purchase.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ class PurchaseOrderLine(models.Model):
1010
_inherit = 'purchase.order.line'
1111

1212
location_dest_id = fields.Many2one(
13-
'stock.location', 'Destination', domain=[('usage', 'in',
14-
['internal', 'transit'])])
13+
comodel_name='stock.location', string='Destination',
14+
domain=[('usage', 'in', ['internal', 'transit'])])
1515

1616
@api.model
1717
def _first_picking_copy_vals(self, key, lines):
1818
"""The data to be copied to new pickings is updated with data from the
1919
grouping key. This method is designed for extensibility, so that
2020
other modules can store more data based on new keys."""
21-
vals = super(PurchaseOrderLine, self)._first_picking_copy_vals(key,
22-
lines)
21+
vals = super(PurchaseOrderLine, self)._first_picking_copy_vals(
22+
key, lines)
2323
for key_element in key:
2424
if 'location_dest_id' in key_element.keys():
2525
vals['location_dest_id'] = key_element['location_dest_id'].id
@@ -32,8 +32,8 @@ def _get_group_keys(self, order, line, picking=False):
3232
dictionary element with the field that you want to group by. This
3333
method is designed for extensibility, so that other modules can add
3434
additional keys or replace them by others."""
35-
key = super(PurchaseOrderLine, self)._get_group_keys(order, line,
36-
picking=picking)
35+
key = super(PurchaseOrderLine, self)._get_group_keys(
36+
order, line, picking=picking)
3737
default_picking_location_id = line.order_id._get_destination_location()
3838
default_picking_location = self.env['stock.location'].browse(
3939
default_picking_location_id)

purchase_location_by_line/static/description/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">Purchase Location by Line</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<p><a class="reference external" 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" 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" href="https://github.com/OCA/purchase-workflow/tree/11.0/purchase_location_by_line"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/purchase-workflow-11-0/purchase-workflow-11-0-purchase_location_by_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/142/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
370+
<p><a class="reference external" 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" 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" href="https://github.com/OCA/purchase-workflow/tree/12.0/purchase_location_by_line"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_location_by_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/142/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
371371
<p>Allows to define a specific destination location on each Purchase Order line.
372372
When the PO is confirmed, it will generate one Incoming Shipment per
373373
combination of destination location and expected date indicated in the
@@ -391,7 +391,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
391391
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/issues">GitHub Issues</a>.
392392
In case of trouble, please check there if your issue has already been reported.
393393
If you spotted it first, help us smashing it by providing a detailed and welcomed
394-
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_location_by_line%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
394+
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_location_by_line%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
395395
<p>Do not contact contributors directly about support or help with technical issues.</p>
396396
</div>
397397
<div class="section" id="credits">
@@ -416,7 +416,7 @@ <h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
416416
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
417417
mission is to support the collaborative development of Odoo features and
418418
promote its widespread use.</p>
419-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/11.0/purchase_location_by_line">OCA/purchase-workflow</a> project on GitHub.</p>
419+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/12.0/purchase_location_by_line">OCA/purchase-workflow</a> project on GitHub.</p>
420420
<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>
421421
</div>
422422
</div>
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
13
from . import test_purchase_delivery

purchase_location_by_line/tests/test_purchase_delivery.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_check_single_date(self):
6363
"There must be 1 picking for the PO when confirmed")
6464

6565
self.assertEquals(
66-
self.po.picking_ids[0].scheduled_date[:10], self.date_sooner,
66+
str(self.po.picking_ids[0].scheduled_date)[:10], self.date_sooner,
6767
"The picking must be planned at the expected date")
6868

6969
def test_check_multiple_dates(self):
@@ -85,10 +85,10 @@ def test_check_multiple_dates(self):
8585
sorted_pickings = sorted(
8686
self.po.picking_ids, key=lambda x: x.scheduled_date)
8787
self.assertEquals(
88-
sorted_pickings[0].scheduled_date[:10], self.date_sooner,
88+
str(sorted_pickings[0].scheduled_date)[:10], self.date_sooner,
8989
"The first picking must be planned at the soonest date")
9090
self.assertEquals(
91-
sorted_pickings[1].scheduled_date[:10], self.date_later,
91+
str(sorted_pickings[1].scheduled_date)[:10], self.date_later,
9292
"The second picking must be planned at the latest date")
9393

9494
l2_picking = self.po.picking_ids.filtered(
@@ -145,10 +145,10 @@ def test_check_multiple_locations_multiple_dates(self):
145145
sorted_pickings = sorted(
146146
self.po.picking_ids, key=lambda x: x.scheduled_date)
147147
self.assertEquals(
148-
sorted_pickings[0].scheduled_date[:10], self.date_sooner,
148+
str(sorted_pickings[0].scheduled_date)[:10], self.date_sooner,
149149
"The first picking must be planned at the soonest date")
150150
self.assertEquals(
151-
sorted_pickings[2].scheduled_date[:10], self.date_later,
151+
str(sorted_pickings[2].scheduled_date)[:10], self.date_later,
152152
"The second picking must be planned at the latest date")
153153

154154
def test_check_multiple_locations_multiple_dates_02(self):
@@ -178,8 +178,8 @@ def test_check_multiple_locations_multiple_dates_02(self):
178178
sorted_pickings = sorted(
179179
self.po.picking_ids, key=lambda x: x.scheduled_date)
180180
self.assertEquals(
181-
sorted_pickings[0].scheduled_date[:10], self.date_sooner,
181+
str(sorted_pickings[0].scheduled_date)[:10], self.date_sooner,
182182
"The first picking must be planned at the soonest date")
183183
self.assertEquals(
184-
sorted_pickings[2].scheduled_date[:10], self.date_later,
184+
str(sorted_pickings[2].scheduled_date)[:10], self.date_later,
185185
"The second picking must be planned at the latest date")

0 commit comments

Comments
 (0)