diff --git a/delivery_multi_destination/README.rst b/delivery_multi_destination/README.rst index 5c66e018b4..ea749c60ee 100644 --- a/delivery_multi_destination/README.rst +++ b/delivery_multi_destination/README.rst @@ -94,6 +94,7 @@ Contributors - Luis M. Ontalba - Carlos Roca - Carolina Fernandez + - Víctor Martínez - \`Dinamiche Aziendali \_\_\`: diff --git a/delivery_multi_destination/__manifest__.py b/delivery_multi_destination/__manifest__.py index 94126db2d7..28c5ce17b0 100644 --- a/delivery_multi_destination/__manifest__.py +++ b/delivery_multi_destination/__manifest__.py @@ -6,13 +6,13 @@ { "name": "Multiple destinations for the same delivery method", - "version": "16.0.1.0.0", + "version": "17.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"], + "depends": ["stock_delivery"], "demo": ["demo/delivery_carrier_demo.xml"], "data": ["views/delivery_carrier_view.xml"], } diff --git a/delivery_multi_destination/i18n/de.po b/delivery_multi_destination/i18n/de.po index c459aa6a36..2650fe61a0 100644 --- a/delivery_multi_destination/i18n/de.po +++ b/delivery_multi_destination/i18n/de.po @@ -111,9 +111,3 @@ msgstr "Vereinigtes Königreich" #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_product_template msgid "Units" msgstr "" - -#~ msgid "Delivery Methods" -#~ msgstr "Liefermethoden" - -#~ msgid "kg" -#~ msgstr "kg" diff --git a/delivery_multi_destination/i18n/pt_BR.po b/delivery_multi_destination/i18n/pt_BR.po index 4094f0a347..56ef10a210 100644 --- a/delivery_multi_destination/i18n/pt_BR.po +++ b/delivery_multi_destination/i18n/pt_BR.po @@ -113,12 +113,3 @@ msgstr "Reino Unido" #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_product_template msgid "Units" msgstr "Unidades" - -#~ msgid "Delivery Methods" -#~ msgstr "Métodos de entrega" - -#~ msgid "Unit(s)" -#~ msgstr "Unidade(s)" - -#~ msgid "kg" -#~ msgstr "kg" diff --git a/delivery_multi_destination/i18n/sl.po b/delivery_multi_destination/i18n/sl.po index 0e7ac048ca..5ddf093f07 100644 --- a/delivery_multi_destination/i18n/sl.po +++ b/delivery_multi_destination/i18n/sl.po @@ -112,6 +112,3 @@ msgstr "" #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_product_template msgid "Units" msgstr "" - -#~ msgid "Delivery Methods" -#~ msgstr "Načini dostave" diff --git a/delivery_multi_destination/i18n/zh_CN.po b/delivery_multi_destination/i18n/zh_CN.po index 6e0ee2e2ec..81a746201a 100644 --- a/delivery_multi_destination/i18n/zh_CN.po +++ b/delivery_multi_destination/i18n/zh_CN.po @@ -108,12 +108,3 @@ msgstr "英国" #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_product_template msgid "Units" msgstr "" - -#~ msgid "Delivery Methods" -#~ msgstr "交货方式" - -#~ msgid "Unit(s)" -#~ msgstr "件" - -#~ msgid "kg" -#~ msgstr "千克" diff --git a/delivery_multi_destination/models/delivery_carrier.py b/delivery_multi_destination/models/delivery_carrier.py index d0858f9708..1062ab7afe 100644 --- a/delivery_multi_destination/models/delivery_carrier.py +++ b/delivery_multi_destination/models/delivery_carrier.py @@ -32,25 +32,21 @@ def _onchange_destination_type(self): if self.destination_type == "multi" and self.child_ids and not self.product_id: self.product_id = fields.first(self.child_ids.product_id) - def search(self, args, offset=0, limit=None, order=None, count=False): + @api.model + def search(self, domain, offset=0, limit=None, order=None): """Don't show by default children carriers.""" if not self.env.context.get("show_children_carriers"): - if args is None: - args = [] - args += [("parent_id", "=", False)] - return super().search( - args, - offset=offset, - limit=limit, - order=order, - count=count, - ) + if domain is None: + domain = [] + domain += [("parent_id", "=", False)] + return super().search(domain, offset=offset, limit=limit, order=order) @api.model def name_search(self, name="", args=None, operator="ilike", limit=100): """Don't show by default children carriers.""" - domain = [("parent_id", "=", False)] - return self.search(domain, limit=limit).name_get() + args = args or [] + args += [("parent_id", "=", False)] + return super().name_search(name, args, operator, limit) def available_carriers(self, partner): """If the carrier is multi, we test the availability on children.""" @@ -92,7 +88,7 @@ def send_shipping(self, pickings): for p in pickings: picking_res = False for subcarrier in carrier.child_ids.filtered( - lambda x: not x.company_id or x.company_id == p.company_id + lambda x, p=p: not x.company_id or x.company_id == p.company_id ): if subcarrier.delivery_type == "fixed": if subcarrier._match_address(p.partner_id): diff --git a/delivery_multi_destination/readme/CONTRIBUTORS.md b/delivery_multi_destination/readme/CONTRIBUTORS.md index d99d8ceae0..9bc6324484 100644 --- a/delivery_multi_destination/readme/CONTRIBUTORS.md +++ b/delivery_multi_destination/readme/CONTRIBUTORS.md @@ -3,5 +3,6 @@ - Luis M. Ontalba - Carlos Roca - Carolina Fernandez + - Víctor Martínez - \`Dinamiche Aziendali \<\>\_\_\`: - Gianmarco Conte diff --git a/delivery_multi_destination/static/description/index.html b/delivery_multi_destination/static/description/index.html index 8c83aba54e..f2369bb31d 100644 --- a/delivery_multi_destination/static/description/index.html +++ b/delivery_multi_destination/static/description/index.html @@ -443,6 +443,7 @@

Contributors

  • Luis M. Ontalba
  • Carlos Roca
  • Carolina Fernandez
  • +
  • Víctor Martínez
  • `Dinamiche Aziendali <https://www.dinamicheaziendali.it>__`:
      diff --git a/delivery_multi_destination/tests/test_delivery_multi_destination.py b/delivery_multi_destination/tests/test_delivery_multi_destination.py index 696c914db0..92a6f4b6ce 100644 --- a/delivery_multi_destination/tests/test_delivery_multi_destination.py +++ b/delivery_multi_destination/tests/test_delivery_multi_destination.py @@ -2,14 +2,19 @@ # Copyright 2019-2020 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo.tests import Form, common +from odoo.tests import Form +from odoo.tools import mute_logger +from odoo.addons.base.tests.common import BaseCommon -class TestDeliveryMultiDestination(common.TransactionCase): + +class TestDeliveryMultiDestination(BaseCommon): @classmethod def setUpClass(cls): super().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", "code": "T1"} + ) cls.pricelist = cls.env["product.pricelist"].create( {"name": "Test pricelist", "currency_id": cls.env.company.currency_id.id} ) @@ -20,7 +25,9 @@ def setUpClass(cls): "property_product_pricelist": cls.pricelist.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", "code": "T2"} + ) cls.state = cls.env["res.country.state"].create( {"name": "Test state", "code": "TS", "country_id": cls.country_2.id} ) @@ -76,7 +83,7 @@ def setUpClass(cls): } ) cls.product = cls.env["product.product"].create( - {"name": "Test product", "detailed_type": "product", "list_price": 1} + {"name": "Test product", "detailed_type": "consu", "list_price": 1} ) cls.sale_order = cls._create_sale_order(cls) @@ -118,6 +125,7 @@ def _choose_delivery_carrier(self, order, carrier): choose_delivery_carrier = wizard.save() choose_delivery_carrier.button_confirm() + @mute_logger("odoo.models.unlink") def test_delivery_multi_destination(self): order = self.sale_order order.carrier_id = self.carrier_single.id @@ -163,8 +171,8 @@ def test_picking_validation(self): self.sale_order.action_confirm() picking = self.sale_order.picking_ids self.assertEqual(picking.carrier_id, self.carrier_multi) - picking.move_ids.quantity_done = 1 - picking._action_done() + picking.move_ids.quantity = 1 + picking.button_validate() self.assertAlmostEqual(picking.carrier_price, 50) def test_delivery_carrier_multi_form(self): diff --git a/delivery_multi_destination/views/delivery_carrier_view.xml b/delivery_multi_destination/views/delivery_carrier_view.xml index 647d3bf3e6..a21c54bc85 100644 --- a/delivery_multi_destination/views/delivery_carrier_view.xml +++ b/delivery_multi_destination/views/delivery_carrier_view.xml @@ -16,45 +16,34 @@ - {'invisible': [('destination_type', '=', 'multi')]} + destination_type=='multi' -