odoo-addon-delivery-multi-destination 16.0.1.0.0.3__py3-none-any.whl → 16.0.2.0.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. odoo/addons/delivery_multi_destination/README.rst +6 -2
  2. odoo/addons/delivery_multi_destination/__init__.py +1 -0
  3. odoo/addons/delivery_multi_destination/__manifest__.py +1 -1
  4. odoo/addons/delivery_multi_destination/demo/delivery_carrier_demo.xml +1 -0
  5. odoo/addons/delivery_multi_destination/i18n/cs_CZ.po +30 -16
  6. odoo/addons/delivery_multi_destination/i18n/de.po +30 -16
  7. odoo/addons/delivery_multi_destination/i18n/delivery_multi_destination.pot +29 -0
  8. odoo/addons/delivery_multi_destination/i18n/es.po +32 -15
  9. odoo/addons/delivery_multi_destination/i18n/fr.po +30 -16
  10. odoo/addons/delivery_multi_destination/i18n/it.po +48 -30
  11. odoo/addons/delivery_multi_destination/i18n/nl.po +30 -16
  12. odoo/addons/delivery_multi_destination/i18n/nl_NL.po +30 -16
  13. odoo/addons/delivery_multi_destination/i18n/pt_BR.po +34 -17
  14. odoo/addons/delivery_multi_destination/i18n/sl.po +32 -18
  15. odoo/addons/delivery_multi_destination/i18n/zh_CN.po +30 -16
  16. odoo/addons/delivery_multi_destination/migrations/16.0.2.0.0/pre-migration.py +15 -0
  17. odoo/addons/delivery_multi_destination/models/delivery_carrier.py +101 -69
  18. odoo/addons/delivery_multi_destination/readme/newsfragments/540.feature.rst +4 -0
  19. odoo/addons/delivery_multi_destination/static/description/index.html +26 -17
  20. odoo/addons/delivery_multi_destination/tests/test_delivery_multi_destination.py +16 -2
  21. odoo/addons/delivery_multi_destination/wizards/__init__.py +5 -0
  22. odoo/addons/delivery_multi_destination/wizards/choose_delivery_carrier.py +27 -0
  23. {odoo_addon_delivery_multi_destination-16.0.1.0.0.3.dist-info → odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info}/METADATA +9 -8
  24. odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info/RECORD +35 -0
  25. {odoo_addon_delivery_multi_destination-16.0.1.0.0.3.dist-info → odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info}/WHEEL +1 -1
  26. odoo_addon_delivery_multi_destination-16.0.1.0.0.3.dist-info/RECORD +0 -31
  27. {odoo_addon_delivery_multi_destination-16.0.1.0.0.3.dist-info → odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info}/top_level.txt +0 -0
@@ -16,11 +16,21 @@ msgstr ""
16
16
  "Plural-Forms: nplurals=1; plural=0;\n"
17
17
  "X-Generator: Weblate 3.8\n"
18
18
 
19
+ #. module: delivery_multi_destination
20
+ #: model:ir.model.fields.selection,name:delivery_multi_destination.selection__delivery_carrier__delivery_type__base_on_destination
21
+ msgid "Based on Destination"
22
+ msgstr ""
23
+
19
24
  #. module: delivery_multi_destination
20
25
  #: model:delivery.carrier,name:delivery_multi_destination.delivery_carrier_multi_child_1
21
26
  msgid "Belgium"
22
27
  msgstr "比利时"
23
28
 
29
+ #. module: delivery_multi_destination
30
+ #: model:ir.model,name:delivery_multi_destination.model_choose_delivery_carrier
31
+ msgid "Delivery Carrier Selection Wizard"
32
+ msgstr ""
33
+
24
34
  #. module: delivery_multi_destination
25
35
  #: model:ir.model.fields,field_description:delivery_multi_destination.field_delivery_carrier__destination_type
26
36
  msgid "Destination Type"
@@ -36,6 +46,20 @@ msgstr "目标网格"
36
46
  msgid "Destinations"
37
47
  msgstr "目的地"
38
48
 
49
+ #. module: delivery_multi_destination
50
+ #. odoo-python
51
+ #: code:addons/delivery_multi_destination/wizards/choose_delivery_carrier.py:0
52
+ #, python-format
53
+ msgid "Error"
54
+ msgstr ""
55
+
56
+ #. module: delivery_multi_destination
57
+ #. odoo-python
58
+ #: code:addons/delivery_multi_destination/models/delivery_carrier.py:0
59
+ #, python-format
60
+ msgid "Error: this delivery method is not available for this address."
61
+ msgstr ""
62
+
39
63
  #. module: delivery_multi_destination
40
64
  #: model:delivery.carrier,name:delivery_multi_destination.delivery_carrier_multi_child_2
41
65
  msgid "France"
@@ -43,25 +67,21 @@ msgstr "法国"
43
67
 
44
68
  #. module: delivery_multi_destination
45
69
  #: model:delivery.carrier,name:delivery_multi_destination.delivery_carrier_multi
46
- #: model:product.product,name:delivery_multi_destination.product_product_delivery_carrier_multi
47
70
  #: model:product.template,name:delivery_multi_destination.product_product_delivery_carrier_multi_product_template
48
71
  msgid "International Carrier Inc."
49
72
  msgstr "国际航空公司。"
50
73
 
51
74
  #. module: delivery_multi_destination
52
- #: model:product.product,name:delivery_multi_destination.product_product_delivery_carrier_multi_child_1
53
75
  #: model:product.template,name:delivery_multi_destination.product_product_delivery_carrier_multi_child_1_product_template
54
76
  msgid "International Carrier Inc., Belgium"
55
77
  msgstr "比利时国际航空公司"
56
78
 
57
79
  #. module: delivery_multi_destination
58
- #: model:product.product,name:delivery_multi_destination.product_product_delivery_carrier_multi_child_2
59
80
  #: model:product.template,name:delivery_multi_destination.product_product_delivery_carrier_multi_child_2_product_template
60
81
  msgid "International Carrier Inc., France"
61
82
  msgstr "法国国际航空公司"
62
83
 
63
84
  #. module: delivery_multi_destination
64
- #: model:product.product,name:delivery_multi_destination.product_product_delivery_carrier_multi_child_3
65
85
  #: model:product.template,name:delivery_multi_destination.product_product_delivery_carrier_multi_child_3_product_template
66
86
  msgid "International Carrier Inc., United Kingdom"
67
87
  msgstr "英国国际航空公司"
@@ -81,12 +101,18 @@ msgstr "一个目的地"
81
101
  msgid "Parent carrier"
82
102
  msgstr "父承运商"
83
103
 
104
+ #. module: delivery_multi_destination
105
+ #: model:ir.model.fields,field_description:delivery_multi_destination.field_delivery_carrier__delivery_type
106
+ msgid "Provider"
107
+ msgstr ""
108
+
84
109
  #. module: delivery_multi_destination
85
110
  #: model:ir.model,name:delivery_multi_destination.model_delivery_carrier
86
111
  msgid "Shipping Methods"
87
112
  msgstr ""
88
113
 
89
114
  #. module: delivery_multi_destination
115
+ #. odoo-python
90
116
  #: code:addons/delivery_multi_destination/models/delivery_carrier.py:0
91
117
  #, python-format
92
118
  msgid "There is no matching delivery rule."
@@ -97,18 +123,6 @@ msgstr ""
97
123
  msgid "United Kingdom"
98
124
  msgstr "英国"
99
125
 
100
- #. module: delivery_multi_destination
101
- #: model:product.product,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi
102
- #: model:product.product,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_child_1
103
- #: model:product.product,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_child_2
104
- #: model:product.product,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_child_3
105
- #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_child_1_product_template
106
- #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_child_2_product_template
107
- #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_child_3_product_template
108
- #: model:product.template,uom_name:delivery_multi_destination.product_product_delivery_carrier_multi_product_template
109
- msgid "Units"
110
- msgstr ""
111
-
112
126
  #~ msgid "Delivery Methods"
113
127
  #~ msgstr "交货方式"
114
128
 
@@ -0,0 +1,15 @@
1
+ # Copyright 2022 Coop IT Easy SC
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ @openupgrade.migrate()
7
+ def migrate(env, version):
8
+ openupgrade.logged_query(
9
+ env.cr,
10
+ """
11
+ UPDATE delivery_carrier
12
+ SET delivery_type = 'base_on_destination'
13
+ WHERE destination_type = 'multi'
14
+ """,
15
+ )
@@ -21,10 +21,40 @@ class DeliveryCarrier(models.Model):
21
21
  ondelete="cascade",
22
22
  )
23
23
  destination_type = fields.Selection(
24
- selection=[("one", "One destination"), ("multi", "Multiple destinations")],
25
- default="one",
26
- required=True,
24
+ selection=[
25
+ ("one", "One destination"),
26
+ ("multi", "Multiple destinations"),
27
+ ],
28
+ compute="_compute_destination_type",
29
+ inverse="_inverse_destination_type",
30
+ store=True,
27
31
  )
32
+ delivery_type = fields.Selection(
33
+ selection_add=[("base_on_destination", "Based on Destination")],
34
+ ondelete={"base_on_destination": "set default"},
35
+ )
36
+
37
+ @api.depends("delivery_type")
38
+ def _compute_destination_type(self):
39
+ for carrier in self:
40
+ if carrier.delivery_type == "base_on_destination":
41
+ carrier.destination_type = "multi"
42
+ else:
43
+ carrier.destination_type = "one"
44
+
45
+ def _inverse_destination_type(self):
46
+ for carrier in self:
47
+ # Switch to multi
48
+ if carrier.destination_type == "multi":
49
+ carrier.delivery_type = "base_on_destination"
50
+ # Switch away from multi -> we know that destination_type is
51
+ # non-multi. However, in a hypothetical scenario where we switch
52
+ # from one non-multi destination_type to another, we don't want to
53
+ # forcibly reset delivery_type to 'fixed' each time, so we check
54
+ # whether delivery_type is invalid for a non-multi destination_type
55
+ # before we forcibly reset to 'fixed'.
56
+ elif carrier.delivery_type == "base_on_destination":
57
+ carrier.delivery_type = "fixed"
28
58
 
29
59
  @api.onchange("destination_type", "child_ids")
30
60
  def _onchange_destination_type(self):
@@ -32,14 +62,14 @@ class DeliveryCarrier(models.Model):
32
62
  if self.destination_type == "multi" and self.child_ids and not self.product_id:
33
63
  self.product_id = fields.first(self.child_ids.product_id)
34
64
 
35
- def search(self, args, offset=0, limit=None, order=None, count=False):
36
- """Don't show by default children carriers."""
65
+ def search(self, domain, offset=0, limit=None, order=None, count=False):
66
+ """Don't show children carriers by default."""
37
67
  if not self.env.context.get("show_children_carriers"):
38
- if args is None:
39
- args = []
40
- args += [("parent_id", "=", False)]
41
- return super(DeliveryCarrier, self).search(
42
- args,
68
+ if domain is None:
69
+ domain = []
70
+ domain += [("parent_id", "=", False)]
71
+ return super().search(
72
+ domain,
43
73
  offset=offset,
44
74
  limit=limit,
45
75
  order=order,
@@ -48,9 +78,17 @@ class DeliveryCarrier(models.Model):
48
78
 
49
79
  @api.model
50
80
  def name_search(self, name="", args=None, operator="ilike", limit=100):
51
- """Don't show by default children carriers."""
52
- domain = [("parent_id", "=", False)]
53
- return self.search(domain, limit=limit).name_get()
81
+ """Don't show children carriers by default."""
82
+ if not self.env.context.get("show_children_carriers"):
83
+ if args is None:
84
+ args = []
85
+ args += [("parent_id", "=", False)]
86
+ return super().name_search(
87
+ name=name,
88
+ args=args,
89
+ operator=operator,
90
+ limit=limit,
91
+ )
54
92
 
55
93
  def available_carriers(self, partner):
56
94
  """If the carrier is multi, we test the availability on children."""
@@ -65,60 +103,54 @@ class DeliveryCarrier(models.Model):
65
103
  available |= carrier
66
104
  return available
67
105
 
68
- def rate_shipment(self, order):
69
- """We have to override this method for getting the proper price
70
- according destination on sales orders.
71
- """
72
- if self.destination_type == "one":
73
- return super().rate_shipment(order)
74
- else:
75
- carrier = self.with_context(show_children_carriers=True)
76
- for subcarrier in carrier.child_ids:
77
- if subcarrier._match_address(order.partner_shipping_id):
78
- return super(
79
- DeliveryCarrier,
80
- subcarrier,
81
- ).rate_shipment(order)
106
+ def base_on_destination_rate_shipment(self, order):
107
+ carrier = self.with_context(show_children_carriers=True)
108
+ for subcarrier in carrier.child_ids:
109
+ if subcarrier._match_address(order.partner_shipping_id):
110
+ return subcarrier.rate_shipment(order)
111
+ # this should normally not happen, because the delivery carrier should
112
+ # be filtered out before, but in case it is somehow selected anyway,
113
+ # at least it will fail nicely.
114
+ return {
115
+ "success": False,
116
+ "price": 0.0,
117
+ "error_message": _(
118
+ "Error: this delivery method is not available for this address."
119
+ ),
120
+ "warning_message": False,
121
+ }
82
122
 
83
- def send_shipping(self, pickings):
84
- """We have to override this method for redirecting the result to the
85
- proper "child" carrier.
86
- """
87
- if self.destination_type == "one" or not self:
88
- return super().send_shipping(pickings)
89
- else:
90
- carrier = self.with_context(show_children_carriers=True)
91
- res = []
92
- for p in pickings:
93
- picking_res = False
94
- for subcarrier in carrier.child_ids.filtered(
95
- lambda x: not x.company_id or x.company_id == p.company_id
96
- ):
97
- if subcarrier.delivery_type == "fixed":
98
- if subcarrier._match_address(p.partner_id):
99
- picking_res = [
100
- {
101
- "exact_price": subcarrier.fixed_price,
102
- "tracking_number": False,
103
- }
104
- ]
105
- break
106
- else:
107
- try:
108
- # on base_on_rule_send_shipping, the method
109
- # _get_price_available is called using p.carrier_id,
110
- # ignoring the self arg, so we need to temporarily replace
111
- # it with the subcarrier
112
- p.carrier_id = subcarrier.id
113
- picking_res = super(
114
- DeliveryCarrier, subcarrier
115
- ).send_shipping(p)
116
- break
117
- except Exception: # pylint: disable=except-pass
118
- pass
119
- finally:
120
- p.carrier_id = carrier
121
- if not picking_res:
122
- raise ValidationError(_("There is no matching delivery rule."))
123
- res += picking_res
124
- return res
123
+ def base_on_destination_send_shipping(self, pickings):
124
+ carrier = self.with_context(show_children_carriers=True)
125
+ res = []
126
+ for p in pickings:
127
+ picking_res = False
128
+ for subcarrier in carrier.child_ids.filtered(
129
+ lambda x: not x.company_id or x.company_id == p.company_id
130
+ ):
131
+ if subcarrier.delivery_type == "fixed":
132
+ if subcarrier._match_address(p.partner_id):
133
+ picking_res = [
134
+ {
135
+ "exact_price": subcarrier.fixed_price,
136
+ "tracking_number": False,
137
+ }
138
+ ]
139
+ break
140
+ else:
141
+ try:
142
+ # on base_on_rule_send_shipping, the method
143
+ # _get_price_available is called using p.carrier_id,
144
+ # ignoring the self arg, so we need to temporarily replace
145
+ # it with the subcarrier
146
+ p.carrier_id = subcarrier.id
147
+ picking_res = subcarrier.send_shipping(p)
148
+ break
149
+ except Exception: # pylint: disable=except-pass
150
+ pass
151
+ finally:
152
+ p.carrier_id = carrier
153
+ if not picking_res:
154
+ raise ValidationError(_("There is no matching delivery rule."))
155
+ res += picking_res
156
+ return res
@@ -0,0 +1,4 @@
1
+ Introduced 'based on destination' delivery type. This is the delivery type used
2
+ by all multi-destination carriers instead of 'fixed'. Consequently, destination
3
+ type has been turned into a computed field that checks if the delivery type is
4
+ 'based on destination' or not.
@@ -3,15 +3,16 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
5
  <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6
- <title>Multiple destinations for the same delivery method</title>
6
+ <title>README.rst</title>
7
7
  <style type="text/css">
8
8
 
9
9
  /*
10
10
  :Author: David Goodger (goodger@python.org)
11
- :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11
+ :Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
12
12
  :Copyright: This stylesheet has been placed in the public domain.
13
13
 
14
14
  Default cascading style sheet for the HTML output of Docutils.
15
+ Despite the name, some widely supported CSS2 features are used.
15
16
 
16
17
  See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
17
18
  customize this style sheet.
@@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
274
275
  margin-left: 2em ;
275
276
  margin-right: 2em }
276
277
 
277
- pre.code .ln { color: grey; } /* line numbers */
278
+ pre.code .ln { color: gray; } /* line numbers */
278
279
  pre.code, code { background-color: #eeeeee }
279
280
  pre.code .comment, code .comment { color: #5C6576 }
280
281
  pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@ span.option {
300
301
  span.pre {
301
302
  white-space: pre }
302
303
 
303
- span.problematic {
304
+ span.problematic, pre.problematic {
304
305
  color: red }
305
306
 
306
307
  span.section-subtitle {
@@ -359,16 +360,21 @@ ul.auto-toc {
359
360
  </style>
360
361
  </head>
361
362
  <body>
362
- <div class="document" id="multiple-destinations-for-the-same-delivery-method">
363
- <h1 class="title">Multiple destinations for the same delivery method</h1>
363
+ <div class="document">
364
364
 
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="multiple-destinations-for-the-same-delivery-method">
370
+ <h1>Multiple destinations for the same delivery method</h1>
365
371
  <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
366
372
  !! This file is generated by oca-gen-addon-readme !!
367
373
  !! changes will be overwritten. !!
368
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369
- !! source digest: sha256:01da966e0e1ee6b31aaa5d0da6e4a614eec3e5fa0637dde2aeaf2096d1428b01
375
+ !! source digest: sha256:25e624cc13975bea90a7a3aadc32eef1f35fefa8ea2223ba32dc6dd702552b28
370
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371
- <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/delivery-carrier/tree/16.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 image-reference" href="https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&amp;target_branch=16.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/delivery-carrier/tree/16.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 image-reference" href="https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
378
  <p>This module allows to set different price rules depending on the destination.</p>
373
379
  <p>This module restores the concept of delivery grid, reusing the same model for
374
380
  nesting several “children” delivery methods, one per possible destination.
@@ -390,7 +396,7 @@ without the need to create a glue module for having multiple destinations.</p>
390
396
  </ul>
391
397
  </div>
392
398
  <div class="section" id="configuration">
393
- <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
399
+ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
394
400
  <p>To configure delivery methods with multiple destinations:</p>
395
401
  <ol class="arabic simple">
396
402
  <li>Go to Inventory &gt; Configuration &gt; Delivery &gt; Shipping Methods</li>
@@ -402,21 +408,21 @@ destinations.</li>
402
408
  </ol>
403
409
  </div>
404
410
  <div class="section" id="usage">
405
- <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
411
+ <h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
406
412
  <ol class="arabic simple">
407
413
  <li>When using the delivery method in a Sales order, delivery address will be
408
414
  used for computing the delivery price according introduced destinations.</li>
409
415
  </ol>
410
416
  </div>
411
417
  <div class="section" id="known-issues-roadmap">
412
- <h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
418
+ <h2><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h2>
413
419
  <ul class="simple">
414
420
  <li>Delivery prices for e-commerce (<cite>website_sale_delivery</cite> module) might need
415
421
  an extra module for handling everything properly.</li>
416
422
  </ul>
417
423
  </div>
418
424
  <div class="section" id="bug-tracker">
419
- <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
425
+ <h2><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h2>
420
426
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/delivery-carrier/issues">GitHub Issues</a>.
421
427
  In case of trouble, please check there if your issue has already been reported.
422
428
  If you spotted it first, help us to smash it by providing a detailed and welcomed
@@ -424,15 +430,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
424
430
  <p>Do not contact contributors directly about support or help with technical issues.</p>
425
431
  </div>
426
432
  <div class="section" id="credits">
427
- <h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
433
+ <h2><a class="toc-backref" href="#toc-entry-5">Credits</a></h2>
428
434
  <div class="section" id="authors">
429
- <h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
435
+ <h3><a class="toc-backref" href="#toc-entry-6">Authors</a></h3>
430
436
  <ul class="simple">
431
437
  <li>Tecnativa</li>
432
438
  </ul>
433
439
  </div>
434
440
  <div class="section" id="contributors">
435
- <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
441
+ <h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
436
442
  <ul class="simple">
437
443
  <li><cite>Tecnativa &lt;https://www.tecnativa.com&gt;__</cite>:<ul>
438
444
  <li>Pedro M. Baeza</li>
@@ -448,9 +454,11 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
448
454
  </ul>
449
455
  </div>
450
456
  <div class="section" id="maintainers">
451
- <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
457
+ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
452
458
  <p>This module is maintained by the OCA.</p>
453
- <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
459
+ <a class="reference external image-reference" href="https://odoo-community.org">
460
+ <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
461
+ </a>
454
462
  <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
455
463
  mission is to support the collaborative development of Odoo features and
456
464
  promote its widespread use.</p>
@@ -459,5 +467,6 @@ promote its widespread use.</p>
459
467
  </div>
460
468
  </div>
461
469
  </div>
470
+ </div>
462
471
  </body>
463
472
  </html>
@@ -72,6 +72,7 @@ class TestDeliveryMultiDestination(common.TransactionCase):
72
72
  {
73
73
  "name": "Test carrier single",
74
74
  "destination_type": "one",
75
+ "fixed_price": 100,
75
76
  "child_ids": False,
76
77
  }
77
78
  )
@@ -84,8 +85,7 @@ class TestDeliveryMultiDestination(common.TransactionCase):
84
85
  carrier_form = Form(self.env["delivery.carrier"])
85
86
  carrier_form.name = "Test carrier multi"
86
87
  carrier_form.product_id = self.product
87
- carrier_form.delivery_type = "fixed"
88
- carrier_form.fixed_price = 100
88
+ carrier_form.delivery_type = "base_on_destination"
89
89
  # this needs to be done in this order
90
90
  carrier_form.destination_type = "multi"
91
91
  for child_item in childs:
@@ -136,6 +136,20 @@ class TestDeliveryMultiDestination(common.TransactionCase):
136
136
  sale_order_line = order.order_line.filtered("is_delivery")
137
137
  self.assertAlmostEqual(sale_order_line.price_unit, 150, 2)
138
138
 
139
+ def test_compute(self):
140
+ self.carrier_multi.delivery_type = "fixed"
141
+ self.assertEqual(self.carrier_multi.destination_type, "one")
142
+ self.carrier_multi.delivery_type = "base_on_destination"
143
+ self.assertEqual(self.carrier_multi.destination_type, "multi")
144
+
145
+ def test_inverse(self):
146
+ self.carrier_multi.destination_type = "one"
147
+ self.assertEqual(self.carrier_multi.destination_type, "one")
148
+ self.assertEqual(self.carrier_multi.delivery_type, "fixed")
149
+ self.carrier_multi.destination_type = "multi"
150
+ self.assertEqual(self.carrier_multi.destination_type, "multi")
151
+ self.assertEqual(self.carrier_multi.delivery_type, "base_on_destination")
152
+
139
153
  def test_search(self):
140
154
  carriers = self.env["delivery.carrier"].search([])
141
155
  children_carrier = self.carrier_multi.with_context(
@@ -0,0 +1,5 @@
1
+ # SPDX-FileCopyrightText: 2024 Coop IT Easy SC
2
+ #
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ from . import choose_delivery_carrier
@@ -0,0 +1,27 @@
1
+ # SPDX-FileCopyrightText: 2024 Coop IT Easy SC
2
+ #
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ from odoo import _, api, models
6
+
7
+
8
+ class ChooseDeliveryCarrier(models.TransientModel):
9
+ _inherit = "choose.delivery.carrier"
10
+
11
+ @api.onchange("carrier_id")
12
+ def _onchange_carrier_id(self):
13
+ result = super()._onchange_carrier_id()
14
+ if self.delivery_type == "base_on_destination":
15
+ vals = self._get_shipment_rate()
16
+ # although ._onchange_carrier_id() in the delivery module can
17
+ # return a dict with an "error" key and a string value, this is
18
+ # not handled by the caller (see BaseModel._onchange_eval()),
19
+ # which only handles dicts with a "warning" key and a dict as a
20
+ # value.
21
+ if vals.get("error_message"):
22
+ return {
23
+ "warning": {"title": _("Error"), "message": vals["error_message"]}
24
+ }
25
+ if vals.get("warning_message"):
26
+ return {"warning": {"message": vals["warning_message"]}}
27
+ return result
@@ -1,18 +1,21 @@
1
1
  Metadata-Version: 2.1
2
- Name: odoo-addon-delivery-multi-destination
3
- Version: 16.0.1.0.0.3
2
+ Name: odoo-addon-delivery_multi_destination
3
+ Version: 16.0.2.0.0.6
4
4
  Summary: Multiple destinations for the same delivery method
5
5
  Home-page: https://github.com/OCA/delivery-carrier
6
6
  Author: Tecnativa, Odoo Community Association (OCA)
7
7
  Author-email: support@odoo-community.org
8
8
  License: AGPL-3
9
- Platform: UNKNOWN
10
9
  Classifier: Programming Language :: Python
11
10
  Classifier: Framework :: Odoo
12
11
  Classifier: Framework :: Odoo :: 16.0
13
12
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
14
13
  Requires-Python: >=3.10
15
- Requires-Dist: odoo <16.1dev,>=16.0a
14
+ Requires-Dist: odoo<16.1dev,>=16.0a
15
+
16
+ .. image:: https://odoo-community.org/readme-banner-image
17
+ :target: https://odoo-community.org/get-involved?utm_source=readme
18
+ :alt: Odoo Community Association
16
19
 
17
20
  ==================================================
18
21
  Multiple destinations for the same delivery method
@@ -23,13 +26,13 @@ Multiple destinations for the same delivery method
23
26
  !! This file is generated by oca-gen-addon-readme !!
24
27
  !! changes will be overwritten. !!
25
28
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26
- !! source digest: sha256:01da966e0e1ee6b31aaa5d0da6e4a614eec3e5fa0637dde2aeaf2096d1428b01
29
+ !! source digest: sha256:25e624cc13975bea90a7a3aadc32eef1f35fefa8ea2223ba32dc6dd702552b28
27
30
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28
31
 
29
32
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
30
33
  :target: https://odoo-community.org/page/development-status
31
34
  :alt: Beta
32
- .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
35
+ .. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
33
36
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
34
37
  :alt: License: AGPL-3
35
38
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
@@ -128,5 +131,3 @@ promote its widespread use.
128
131
  This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/16.0/delivery_multi_destination>`_ project on GitHub.
129
132
 
130
133
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
131
-
132
-
@@ -0,0 +1,35 @@
1
+ odoo/addons/delivery_multi_destination/README.rst,sha256=aiwO7yxzseVQ6ZLKa1vKyuFmYMP6tMCsIdygI6WVxtA,4418
2
+ odoo/addons/delivery_multi_destination/__init__.py,sha256=zI6OgKd-jvRibsvs40jL7kgXqg4cvbAufnC02Ac8Zvs,109
3
+ odoo/addons/delivery_multi_destination/__manifest__.py,sha256=yTSZaOuW6OnwvZLcy0DFj5Hvn_J2_NTCWCBgJZl7xkk,694
4
+ odoo/addons/delivery_multi_destination/demo/delivery_carrier_demo.xml,sha256=6k6ImN8f1e6UtuhUCNFXWVL-X0ROrOkUVXKSHnc_m30,3817
5
+ odoo/addons/delivery_multi_destination/i18n/cs_CZ.po,sha256=oJ93mx5Mvhe5jW6g_3wCZDGIVSlAFtQTECrlGLSxkzI,4761
6
+ odoo/addons/delivery_multi_destination/i18n/de.po,sha256=mnmL6qUHHQxpT-NTPccUeZkUb7jf-Ud0MUgj588mm1Y,4634
7
+ odoo/addons/delivery_multi_destination/i18n/delivery_multi_destination.pot,sha256=os7ybwX4dY0lrqjenS8m7mgYKmG9ZZJ-EHM4X_HHgUg,4152
8
+ odoo/addons/delivery_multi_destination/i18n/es.po,sha256=fQdQFDcpzbf0VhPhl9xLpoOlYEVS2F9VqFtTIgKPTUo,4885
9
+ odoo/addons/delivery_multi_destination/i18n/fr.po,sha256=LpVpZNFnz_r69PCL4VdJhhR-2EoTHHOnRZyc4fq-BME,4452
10
+ odoo/addons/delivery_multi_destination/i18n/it.po,sha256=usXBioDAeiR2WyuOcuaV_YXnk0yCatmL85hhiPVDRNA,4843
11
+ odoo/addons/delivery_multi_destination/i18n/nl.po,sha256=GECjjy8OwVi7nAlRqNCDo8us-NbSaYjS2rssK4sHIQU,4452
12
+ odoo/addons/delivery_multi_destination/i18n/nl_NL.po,sha256=BpwWz6PPORRtx7qQ_MZ4YgYGNek39RTJvyujBGagsLs,4461
13
+ odoo/addons/delivery_multi_destination/i18n/pt_BR.po,sha256=LaJ-56qOnsZf3_LFe00rMHD5a5ZYgSkobZrhVmXeaGk,5049
14
+ odoo/addons/delivery_multi_destination/i18n/sl.po,sha256=y7td5RwT0r_Rz9JM3N7uyBt7lT_JoesUOGsa2uq9GBc,4581
15
+ odoo/addons/delivery_multi_destination/i18n/zh_CN.po,sha256=F77ETzLT-Zdg4u5s1aDr2O3cxbg41tKBZaObOSegXTY,4617
16
+ odoo/addons/delivery_multi_destination/migrations/16.0.2.0.0/pre-migration.py,sha256=LssV1emY80IxVTUUyx8w6Skx2xgALvlxLyTBUOQNLOg,387
17
+ odoo/addons/delivery_multi_destination/models/__init__.py,sha256=-K4wh1XVA03SZzTTycr_kcgawLtJanP54sq4kwHL5eA,97
18
+ odoo/addons/delivery_multi_destination/models/delivery_carrier.py,sha256=fLtiiTbGSQnC7YJq5_HSnMPWMUF9dOEThsd1_jnRxSI,6299
19
+ odoo/addons/delivery_multi_destination/readme/CONFIGURE.rst,sha256=7ODOGLMD-pk4sqqbXT2EEvsJ-rafrnQz4Xwe3WeD9Xk,386
20
+ odoo/addons/delivery_multi_destination/readme/CONTRIBUTORS.rst,sha256=qYFJW8WItTLugT9t5wMcw4A9AVUrCAI5UPrKlwaNJnc,209
21
+ odoo/addons/delivery_multi_destination/readme/DESCRIPTION.rst,sha256=zGE7V1m8-nd6FcVva5rSgmnD1i8gOQoIP_4aMeHKEGE,383
22
+ odoo/addons/delivery_multi_destination/readme/ROADMAP.rst,sha256=mFUYDdJtYvVAOcxbnU3uIEAb5pCfyvKC-FoOFbx_9ko,129
23
+ odoo/addons/delivery_multi_destination/readme/USAGE.rst,sha256=1L4dwqAZ4L8oNQMO90fp64D4_IVf1AEpBGpun6HNFDo,153
24
+ odoo/addons/delivery_multi_destination/readme/newsfragments/540.feature.rst,sha256=HcMNzTYCiVEPVJM7nmzRf6Nl9uSO5iI8QY32tcYmB8o,270
25
+ odoo/addons/delivery_multi_destination/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
26
+ odoo/addons/delivery_multi_destination/static/description/index.html,sha256=XFmOKNy61Te44Ov8jeGZkQcF__cXPRxTbEZaLuk6lm0,14477
27
+ odoo/addons/delivery_multi_destination/tests/__init__.py,sha256=84QCPauC2-TkXZsq1euuy3oNLYJpiocgsAVkUqpUsLI,112
28
+ odoo/addons/delivery_multi_destination/tests/test_delivery_multi_destination.py,sha256=IX8m8fi6TeH3QiNTQGTPmlFrgmWALqlNTphpzRem8Tk,8149
29
+ odoo/addons/delivery_multi_destination/views/delivery_carrier_view.xml,sha256=EpJXlKQraYrvdjNnXEf28hWladF3ak0vbCyAnpQHPq4,4234
30
+ odoo/addons/delivery_multi_destination/wizards/__init__.py,sha256=WzkF-IFQ_LPMzbez5zfXFInhBYCYOjtu79Jrg7g5-2c,133
31
+ odoo/addons/delivery_multi_destination/wizards/choose_delivery_carrier.py,sha256=X8lmXdG2WYYLat-vHKWsUzJx7MevDzmRH9XREek8PUc,1072
32
+ odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info/METADATA,sha256=JldvZfBNqX3LDsNN3lPKgzGII_ppO6MUv48snsEiPms,4974
33
+ odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
34
+ odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
35
+ odoo_addon_delivery_multi_destination-16.0.2.0.0.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5