Skip to content

Commit 1623f89

Browse files
misern2victoralmau
authored andcommitted
[MIG] delivery_price_method: Migration to 13.0
[UPD] Update delivery_price_method.pot [UPD] README.rst
1 parent 53a0107 commit 1623f89

File tree

6 files changed

+61
-30
lines changed

6 files changed

+61
-30
lines changed

delivery_price_method/README.rst

+9-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Delivery Price Method
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%2Fdelivery--carrier-lightgray.png?logo=github
17-
:target: https://github.com/OCA/delivery-carrier/tree/12.0/delivery_price_method
17+
:target: https://github.com/OCA/delivery-carrier/tree/13.0/delivery_price_method
1818
:alt: OCA/delivery-carrier
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_price_method
20+
:target: https://translation.odoo-community.org/projects/delivery-carrier-13-0/delivery-carrier-13-0-delivery_price_method
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/99/12.0
23+
:target: https://runbot.odoo-community.org/runbot/99/13.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -51,7 +51,7 @@ Bug Tracker
5151
Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/issues>`_.
5252
In case of trouble, please check there if your issue has already been reported.
5353
If you spotted it first, help us smashing it by providing a detailed and welcomed
54-
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_price_method%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
54+
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_price_method%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5555

5656
Do not contact contributors directly about support or help with technical issues.
5757

@@ -74,6 +74,10 @@ Contributors
7474

7575
* Pedro M. Baeza
7676

77+
* `QubiQ 2010 <https://www.quibq.es>`_:
78+
79+
* Marçal Isern
80+
7781
Maintainers
7882
~~~~~~~~~~~
7983

@@ -87,6 +91,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8791
mission is to support the collaborative development of Odoo features and
8892
promote its widespread use.
8993

90-
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/12.0/delivery_price_method>`_ project on GitHub.
94+
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/13.0/delivery_price_method>`_ project on GitHub.
9195

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

delivery_price_method/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"website": "https://github.com/OCA/delivery-carrier",
1010
"license": "AGPL-3",
1111
"category": "Delivery",
12-
"version": "12.0.1.0.0",
12+
"version": "13.0.1.0.0",
1313
"depends": ["delivery"],
1414
"data": ["views/delivery_carrier_views.xml"],
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
11
# Translation of Odoo Server.
22
# This file contains the translation of the following modules:
3-
# * delivery_price_method
3+
# * delivery_price_method
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 12.0\n"
7+
"Project-Id-Version: Odoo Server 13.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"Last-Translator: <>\n"
9+
"Last-Translator: \n"
1010
"Language-Team: \n"
1111
"MIME-Version: 1.0\n"
1212
"Content-Type: text/plain; charset=UTF-8\n"
1313
"Content-Transfer-Encoding: \n"
1414
"Plural-Forms: \n"
1515

1616
#. module: delivery_price_method
17-
#: selection:delivery.carrier,price_method:0
17+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule
1818
msgid "Based on Rules"
1919
msgstr ""
2020

2121
#. module: delivery_price_method
22-
#: selection:delivery.carrier,price_method:0
22+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier
2323
msgid "Carrier obtained price"
2424
msgstr ""
2525

2626
#. module: delivery_price_method
27-
#: model:ir.model,name:delivery_price_method.model_delivery_carrier
28-
msgid "Delivery Methods"
29-
msgstr ""
30-
31-
#. module: delivery_price_method
32-
#: selection:delivery.carrier,price_method:0
27+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed
3328
msgid "Fixed price"
3429
msgstr ""
3530

@@ -43,3 +38,7 @@ msgstr ""
4338
msgid "Pricing"
4439
msgstr ""
4540

41+
#. module: delivery_price_method
42+
#: model:ir.model,name:delivery_price_method.model_delivery_carrier
43+
msgid "Shipping Methods"
44+
msgstr ""

delivery_price_method/readme/CONTRIBUTORS.rst

+4
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
* `Tecnativa <https://www.tecnativa.com>`_:
66

77
* Pedro M. Baeza
8+
9+
* `QubiQ 2010 <https://www.quibq.es>`_:
10+
11+
* Marçal Isern

delivery_price_method/static/description/index.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">Delivery Price Method</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/delivery-carrier/tree/12.0/delivery_price_method"><img alt="OCA/delivery-carrier" src="https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_price_method"><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/99/12.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/delivery-carrier/tree/13.0/delivery_price_method"><img alt="OCA/delivery-carrier" src="https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/delivery-carrier-13-0/delivery-carrier-13-0-delivery_price_method"><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/99/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
371371
<p>This module allows to force a local price rate computation for any delivery
372372
method, including those that have been created to query a webservice for
373373
fetching the rate.</p>
@@ -400,7 +400,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
400400
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/delivery-carrier/issues">GitHub Issues</a>.
401401
In case of trouble, please check there if your issue has already been reported.
402402
If you spotted it first, help us smashing it by providing a detailed and welcomed
403-
<a class="reference external" href="https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_price_method%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
403+
<a class="reference external" href="https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_price_method%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
404404
<p>Do not contact contributors directly about support or help with technical issues.</p>
405405
</div>
406406
<div class="section" id="credits">
@@ -422,6 +422,10 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
422422
<li>Pedro M. Baeza</li>
423423
</ul>
424424
</li>
425+
<li><a class="reference external" href="https://www.quibq.es">QubiQ 2010</a>:<ul>
426+
<li>Marçal Isern</li>
427+
</ul>
428+
</li>
425429
</ul>
426430
</div>
427431
<div class="section" id="maintainers">
@@ -431,7 +435,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
431435
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
432436
mission is to support the collaborative development of Odoo features and
433437
promote its widespread use.</p>
434-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/12.0/delivery_price_method">OCA/delivery-carrier</a> project on GitHub.</p>
438+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/13.0/delivery_price_method">OCA/delivery-carrier</a> project on GitHub.</p>
435439
<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>
436440
</div>
437441
</div>

delivery_price_method/tests/test_delivery_price_method.py

+30-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright 2020 Trey, Kilobytes de Soluciones
22
# Copyright 2020 Tecnativa - Pedro M. Baeza
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
from odoo.tests import Form
45
from odoo.tests.common import SavepointCase
6+
from odoo.tools import float_compare
57

68

79
class TestDeliveryPriceMethod(SavepointCase):
@@ -44,12 +46,23 @@ def setUpClass(cls):
4446
}
4547
)
4648

49+
def _add_delivery(self):
50+
sale = self.sale
51+
delivery_wizard = Form(
52+
self.env["choose.delivery.carrier"].with_context(
53+
{"default_order_id": sale.id, "default_carrier_id": self.carrier}
54+
)
55+
)
56+
choose_delivery_carrier = delivery_wizard.save()
57+
choose_delivery_carrier.button_confirm()
58+
4759
def test_delivery_price_fixed(self):
4860
sale = self.sale
49-
sale.get_delivery_price()
50-
self.assertEquals(sale.delivery_price, 99.99)
51-
sale.set_delivery_line()
52-
self.assertEquals(len(sale.order_line), 2)
61+
self._add_delivery()
62+
delivery_lines = sale.order_line.filtered(lambda r: r.is_delivery)
63+
delivery_price = sum(delivery_lines.mapped("price_unit"))
64+
self.assertEqual(float_compare(delivery_price, 99.99, precision_digits=2), 0)
65+
self.assertEquals(len(delivery_lines), 1)
5366
sale.action_confirm()
5467
picking = sale.picking_ids[0]
5568
self.assertEquals(len(picking.move_lines), 1)
@@ -63,11 +76,16 @@ def test_delivery_price_fixed(self):
6376
def test_delivery_price_method(self):
6477
self.carrier.write({"price_method": "fixed", "fixed_price": 99.99})
6578
sale = self.sale
66-
sale.get_delivery_price()
67-
self.assertEquals(sale.delivery_price, 99.99)
79+
self._add_delivery()
80+
delivery_lines = sale.order_line.filtered(lambda r: r.is_delivery)
81+
delivery_price = sum(delivery_lines.mapped("price_unit"))
82+
self.assertEqual(float_compare(delivery_price, 99.99, precision_digits=2), 0)
83+
self.assertEquals(len(delivery_lines), 1)
6884
self.carrier.write({"price_method": "fixed", "fixed_price": 5})
69-
sale.get_delivery_price()
70-
self.assertEquals(sale.delivery_price, 5)
85+
self._add_delivery()
86+
delivery_lines = sale.order_line.filtered(lambda r: r.is_delivery)
87+
delivery_price = sum(delivery_lines.mapped("price_unit"))
88+
self.assertEquals(delivery_price, 5)
7189
self.carrier.write(
7290
{
7391
"price_method": "base_on_rule",
@@ -85,5 +103,7 @@ def test_delivery_price_method(self):
85103
],
86104
}
87105
)
88-
sale.get_delivery_price()
89-
self.assertEquals(sale.delivery_price, 11.11)
106+
self._add_delivery()
107+
delivery_lines = sale.order_line.filtered(lambda r: r.is_delivery)
108+
delivery_price = sum(delivery_lines.mapped("price_unit"))
109+
self.assertEquals(delivery_price, 11.11)

0 commit comments

Comments
 (0)