Skip to content

Commit

Permalink
[MIG] delivery_multi_destination: Migration to v13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosRoca13 authored and jado95 committed Jun 4, 2021
1 parent 15cc4fd commit d164f37
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 38 deletions.
17 changes: 9 additions & 8 deletions delivery_multi_destination/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Multiple destinations for the same delivery method
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
:target: https://github.com/OCA/delivery-carrier/tree/12.0/delivery_multi_destination
:target: https://github.com/OCA/delivery-carrier/tree/13.0/delivery_multi_destination
:alt: OCA/delivery-carrier
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_multi_destination
:target: https://translation.odoo-community.org/projects/delivery-carrier-13-0/delivery-carrier-13-0-delivery_multi_destination
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/99/12.0
:target: https://runbot.odoo-community.org/runbot/99/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -42,7 +42,7 @@ Configuration

To configure delivery methods with multiple destinations:

#. Go to Inventory > Configuration > Delivery > Delivery Methods
#. Go to Inventory > Configuration > Delivery > Shipping Methods
#. Create or edit an existing record.
#. Select "Destination type" = "Multiple destinations".
#. Introduce a line for each destination in the new tab "Destinations"
Expand All @@ -67,7 +67,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_multi_destination%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_multi_destination%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -84,8 +84,9 @@ Contributors

* `Tecnativa <https://www.tecnativa.com>__`:

* Pedro M. Baeza <[email protected]>
* Luis M. Ontalba <[email protected]>
* Pedro M. Baeza
* Luis M. Ontalba
* Carlos Roca

Maintainers
~~~~~~~~~~~
Expand All @@ -100,6 +101,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 4 additions & 4 deletions delivery_multi_destination/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

{
"name": "Multiple destinations for the same delivery method",
"version": "12.0.1.1.0",
"version": "13.0.1.0.0",
"category": "Delivery",
"website": "https://github.com/OCA/delivery-carrier",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["delivery",],
"demo": ["demo/delivery_carrier_demo.xml",],
"data": ["views/delivery_carrier_view.xml",],
"depends": ["delivery"],
"demo": ["demo/delivery_carrier_demo.xml"],
"data": ["views/delivery_carrier_view.xml"],
}
2 changes: 1 addition & 1 deletion delivery_multi_destination/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DeliveryCarrier(models.Model):
comodel_name="delivery.carrier", string="Parent carrier",
)
destination_type = fields.Selection(
selection=[("one", "One destination"), ("multi", "Multiple destinations"),],
selection=[("one", "One destination"), ("multi", "Multiple destinations")],
default="one",
required=True,
)
Expand Down
2 changes: 1 addition & 1 deletion delivery_multi_destination/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
To configure delivery methods with multiple destinations:

#. Go to Inventory > Configuration > Delivery > Delivery Methods
#. Go to Inventory > Configuration > Delivery > Shipping Methods
#. Create or edit an existing record.
#. Select "Destination type" = "Multiple destinations".
#. Introduce a line for each destination in the new tab "Destinations"
Expand Down
5 changes: 3 additions & 2 deletions delivery_multi_destination/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* `Tecnativa <https://www.tecnativa.com>__`:

* Pedro M. Baeza <[email protected]>
* Luis M. Ontalba <[email protected]>
* Pedro M. Baeza
* Luis M. Ontalba
* Carlos Roca
15 changes: 8 additions & 7 deletions delivery_multi_destination/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Multiple destinations for the same delivery method</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Multiple destinations for the same delivery method</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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_multi_destination"><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_multi_destination"><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>
<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_multi_destination"><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_multi_destination"><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>
<p>This module allows to set different price rules depending on the destination.</p>
<p>This module restores the concept of delivery grid, reusing the same model for
nesting several “children” delivery methods, one per possible destination.
Expand All @@ -392,7 +392,7 @@ <h1 class="title">Multiple destinations for the same delivery method</h1>
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>To configure delivery methods with multiple destinations:</p>
<ol class="arabic simple">
<li>Go to Inventory &gt; Configuration &gt; Delivery &gt; Delivery Methods</li>
<li>Go to Inventory &gt; Configuration &gt; Delivery &gt; Shipping Methods</li>
<li>Create or edit an existing record.</li>
<li>Select “Destination type” = “Multiple destinations”.</li>
<li>Introduce a line for each destination in the new tab “Destinations”</li>
Expand All @@ -419,7 +419,7 @@ <h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/delivery-carrier/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_multi_destination%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_multi_destination%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -434,8 +434,9 @@ <h2><a class="toc-backref" href="#id6">Authors</a></h2>
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
<ul class="simple">
<li><cite>Tecnativa &lt;https://www.tecnativa.com&gt;__</cite>:<ul>
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;tecnativa.com">pedro.baeza&#64;tecnativa.com</a>&gt;</li>
<li>Luis M. Ontalba &lt;<a class="reference external" href="mailto:luis.martinez&#64;tecnativa.com">luis.martinez&#64;tecnativa.com</a>&gt;</li>
<li>Pedro M. Baeza</li>
<li>Luis M. Ontalba</li>
<li>Carlos Roca</li>
</ul>
</li>
</ul>
Expand All @@ -447,7 +448,7 @@ <h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/12.0/delivery_multi_destination">OCA/delivery-carrier</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/13.0/delivery_multi_destination">OCA/delivery-carrier</a> project on GitHub.</p>
<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>
</div>
</div>
Expand Down
62 changes: 47 additions & 15 deletions delivery_multi_destination/tests/test_delivery_multi_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# Copyright 2019-2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.tests import common
from odoo.tests import Form, common


class TestDeliveryMultiDestination(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestDeliveryMultiDestination, cls).setUpClass()
cls.country_1 = cls.env["res.country"].create({"name": "Test country 1",})
cls.country_1 = cls.env["res.country"].create({"name": "Test country 1"})
cls.partner_1 = cls.env["res.partner"].create(
{"name": "Test partner 1", "country_id": cls.country_1.id,}
{"name": "Test partner 1", "country_id": cls.country_1.id}
)
cls.country_2 = cls.env["res.country"].create({"name": "Test country 2",})
cls.country_2 = cls.env["res.country"].create({"name": "Test country 2"})
cls.state = cls.env["res.country.state"].create(
{"name": "Test state", "code": "TS", "country_id": cls.country_2.id,}
{"name": "Test state", "code": "TS", "country_id": cls.country_2.id}
)
cls.partner_2 = cls.env["res.partner"].create(
{
Expand All @@ -34,13 +34,13 @@ def setUpClass(cls):
}
)
cls.product = cls.env["product.product"].create(
{"name": "Test carrier multi", "type": "service",}
{"name": "Test carrier multi", "type": "service"}
)
cls.product_child_1 = cls.env["product.product"].create(
{"name": "Test child 1", "type": "service",}
{"name": "Test child 1", "type": "service"}
)
cls.product_child_2 = cls.env["product.product"].create(
{"name": "Test child 2", "type": "service",}
{"name": "Test child 2", "type": "service"}
)
cls.carrier_multi = cls.env["delivery.carrier"].create(
{
Expand Down Expand Up @@ -91,7 +91,7 @@ def setUpClass(cls):
}
)
cls.product = cls.env["product.product"].create(
{"name": "Test product", "type": "product",}
{"name": "Test product", "type": "product"}
)
cls.pricelist = cls.env["product.pricelist"].create(
{
Expand Down Expand Up @@ -132,15 +132,47 @@ def setUpClass(cls):
def test_delivery_multi_destination(self):
order = self.sale_order
order.carrier_id = self.carrier_single.id
order.get_delivery_price()
self.assertAlmostEqual(order.delivery_price, 100, 2)
delivery_wizard = Form(
self.env["choose.delivery.carrier"].with_context(
{
"default_order_id": order.id,
"default_carrier_id": order.carrier_id.id,
}
)
)
choose_delivery_carrier = delivery_wizard.save()
choose_delivery_carrier.button_confirm()
sale_order_line = order.order_line.filtered("is_delivery")
self.assertAlmostEqual(sale_order_line.price_unit, 100, 2)
self.assertTrue(sale_order_line.is_delivery)
order.carrier_id = self.carrier_multi.id
order.partner_shipping_id = self.partner_2.id
order.get_delivery_price()
self.assertAlmostEqual(order.delivery_price, 50, 2)
delivery_wizard = Form(
self.env["choose.delivery.carrier"].with_context(
{
"default_order_id": order.id,
"default_carrier_id": order.carrier_id.id,
}
)
)
choose_delivery_carrier = delivery_wizard.save()
choose_delivery_carrier.button_confirm()
sale_order_line = order.order_line.filtered("is_delivery")
self.assertAlmostEqual(sale_order_line.price_unit, 50, 2)
self.assertTrue(sale_order_line.is_delivery)
order.partner_shipping_id = self.partner_3.id
order.get_delivery_price()
self.assertAlmostEqual(order.delivery_price, 150, 2)
delivery_wizard = Form(
self.env["choose.delivery.carrier"].with_context(
{
"default_order_id": order.id,
"default_carrier_id": order.carrier_id.id,
}
)
)
choose_delivery_carrier = delivery_wizard.save()
choose_delivery_carrier.button_confirm()
sale_order_line = order.order_line.filtered("is_delivery")
self.assertAlmostEqual(sale_order_line.price_unit, 150, 2)

def test_search(self):
carriers = self.env["delivery.carrier"].search([])
Expand Down

0 comments on commit d164f37

Please sign in to comment.