Skip to content

Commit 6f6e85d

Browse files
committed
Merge PR #518 into 14.0
Signed-off-by pedrobaeza
2 parents 8161267 + eda40a5 commit 6f6e85d

19 files changed

+972
-0
lines changed

delivery_price_method/README.rst

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
=====================
2+
Delivery Price Method
3+
=====================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Production/Stable
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
17+
:target: https://github.com/OCA/delivery-carrier/tree/14.0/delivery_price_method
18+
:alt: OCA/delivery-carrier
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/delivery-carrier-14-0/delivery-carrier-14-0-delivery_price_method
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/99/14.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module allows to force a local price rate computation for any delivery
29+
method, including those that have been created to query a webservice for
30+
fetching the rate.
31+
32+
It uses the existing fixed price or price based on rules computations.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
#. Go to *Sales > Configuration > Sales Orders > Delivery Methods*.
43+
#. Open or create a new one.
44+
#. On the "Price Method" field, select "Fixed Price" or "Based on Rules".
45+
#. You will see standard fields for selecting the price as if the delivery
46+
method isn't an integration carrier.
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
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:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
~~~~~~~
63+
64+
* Trey (www.trey.es)
65+
66+
Contributors
67+
~~~~~~~~~~~~
68+
69+
* `Trey <https://www.trey.es>`_:
70+
71+
* Roberto Lizana <roberto@trey.es>
72+
73+
* `Tecnativa <https://www.tecnativa.com>`_:
74+
75+
* Pedro M. Baeza
76+
77+
* `QubiQ 2010 <https://www.quibq.es>`_:
78+
79+
* Marçal Isern
80+
81+
Maintainers
82+
~~~~~~~~~~~
83+
84+
This module is maintained by the OCA.
85+
86+
.. image:: https://odoo-community.org/logo.png
87+
:alt: Odoo Community Association
88+
:target: https://odoo-community.org
89+
90+
OCA, or the Odoo Community Association, is a nonprofit organization whose
91+
mission is to support the collaborative development of Odoo features and
92+
promote its widespread use.
93+
94+
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/14.0/delivery_price_method>`_ project on GitHub.
95+
96+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

delivery_price_method/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2020 Trey, Kilobytes de Soluciones
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from . import models

delivery_price_method/__manifest__.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2020 Trey, Kilobytes de Soluciones
2+
# Copyright 2020 Tecnativa - Pedro M. Baeza
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
{
5+
"name": "Delivery Price Method",
6+
"summary": "Provides fields to be able to contemplate the tracking states"
7+
"and also adds a global fields",
8+
"author": "Trey (www.trey.es), " "Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/delivery-carrier",
10+
"license": "AGPL-3",
11+
"development_status": "Production/Stable",
12+
"category": "Delivery",
13+
"version": "14.0.1.0.0",
14+
"depends": ["delivery"],
15+
"data": ["views/delivery_carrier_views.xml"],
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * delivery_price_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 13.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: delivery_price_method
17+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule
18+
msgid "Based on Rules"
19+
msgstr ""
20+
21+
#. module: delivery_price_method
22+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier
23+
msgid "Carrier obtained price"
24+
msgstr ""
25+
26+
#. module: delivery_price_method
27+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed
28+
msgid "Fixed price"
29+
msgstr ""
30+
31+
#. module: delivery_price_method
32+
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method
33+
msgid "Price method"
34+
msgstr ""
35+
36+
#. module: delivery_price_method
37+
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form
38+
msgid "Pricing"
39+
msgstr ""
40+
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/i18n/es.po

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * delivery_price_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 13.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2022-05-24 05:34+0000\n"
10+
"Last-Translator: Leonardo J. Caballero G. <leonardocaballero@gmail.com>\n"
11+
"Language-Team: none\n"
12+
"Language: es\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.3.2\n"
18+
19+
#. module: delivery_price_method
20+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule
21+
msgid "Based on Rules"
22+
msgstr "Basado en reglas"
23+
24+
#. module: delivery_price_method
25+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier
26+
msgid "Carrier obtained price"
27+
msgstr "Precio obtenido por el transportista"
28+
29+
#. module: delivery_price_method
30+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed
31+
msgid "Fixed price"
32+
msgstr "Precio fijo"
33+
34+
#. module: delivery_price_method
35+
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method
36+
msgid "Price method"
37+
msgstr "Método de precio"
38+
39+
#. module: delivery_price_method
40+
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form
41+
msgid "Pricing"
42+
msgstr "Precios"
43+
44+
#. module: delivery_price_method
45+
#: model:ir.model,name:delivery_price_method.model_delivery_carrier
46+
msgid "Shipping Methods"
47+
msgstr "Métodos de envío"

delivery_price_method/i18n/es_CL.po

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * delivery_price_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 13.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2022-05-24 05:34+0000\n"
10+
"Last-Translator: Leonardo J. Caballero G. <leonardocaballero@gmail.com>\n"
11+
"Language-Team: none\n"
12+
"Language: es_CL\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.3.2\n"
18+
19+
#. module: delivery_price_method
20+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule
21+
msgid "Based on Rules"
22+
msgstr "Basado en reglas"
23+
24+
#. module: delivery_price_method
25+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier
26+
msgid "Carrier obtained price"
27+
msgstr "Precio obtenido por el transportista"
28+
29+
#. module: delivery_price_method
30+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed
31+
msgid "Fixed price"
32+
msgstr "Precio fijo"
33+
34+
#. module: delivery_price_method
35+
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method
36+
msgid "Price method"
37+
msgstr "Método de precio"
38+
39+
#. module: delivery_price_method
40+
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form
41+
msgid "Pricing"
42+
msgstr "Precios"
43+
44+
#. module: delivery_price_method
45+
#: model:ir.model,name:delivery_price_method.model_delivery_carrier
46+
msgid "Shipping Methods"
47+
msgstr "Métodos de envío"

delivery_price_method/i18n/es_VE.po

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * delivery_price_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 13.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: Automatically generated\n"
10+
"Language-Team: none\n"
11+
"Language: es_VE\n"
12+
"MIME-Version: 1.0\n"
13+
"Content-Type: text/plain; charset=UTF-8\n"
14+
"Content-Transfer-Encoding: \n"
15+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
16+
17+
#. module: delivery_price_method
18+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule
19+
msgid "Based on Rules"
20+
msgstr ""
21+
22+
#. module: delivery_price_method
23+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier
24+
msgid "Carrier obtained price"
25+
msgstr ""
26+
27+
#. module: delivery_price_method
28+
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed
29+
msgid "Fixed price"
30+
msgstr ""
31+
32+
#. module: delivery_price_method
33+
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method
34+
msgid "Price method"
35+
msgstr ""
36+
37+
#. module: delivery_price_method
38+
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form
39+
msgid "Pricing"
40+
msgstr ""
41+
42+
#. module: delivery_price_method
43+
#: model:ir.model,name:delivery_price_method.model_delivery_carrier
44+
msgid "Shipping Methods"
45+
msgstr ""
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2020 Trey, Kilobytes de Soluciones
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from . import delivery_carrier
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2020 Trey, Kilobytes de Soluciones
2+
# Copyright 2020 Tecnativa - Pedro M. Baeza
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
from odoo import fields, models
5+
6+
7+
class DeliveryCarrier(models.Model):
8+
_inherit = "delivery.carrier"
9+
10+
price_method = fields.Selection(
11+
selection=[
12+
("carrier", "Carrier obtained price"),
13+
("fixed", "Fixed price"),
14+
("base_on_rule", "Based on Rules"),
15+
],
16+
string="Price method",
17+
default="carrier",
18+
)
19+
20+
def rate_shipment(self, order):
21+
"""Trick the method for using all the upstream code for the
22+
price computation in case of using fixed or base_on_rule.
23+
"""
24+
previous_method = False
25+
if self.price_method in ("fixed", "base_on_rule"):
26+
previous_method = self.delivery_type
27+
self.sudo().delivery_type = self.price_method
28+
res = super().rate_shipment(order)
29+
if previous_method:
30+
self.sudo().delivery_type = previous_method
31+
return res
32+
33+
def send_shipping(self, pickings):
34+
res = super().send_shipping(pickings)
35+
if self.price_method in ("fixed", "base_on_rule"):
36+
rates = getattr(self, "%s_send_shipping" % self.price_method)(pickings)
37+
for index, rate in enumerate(rates):
38+
del rate["tracking_number"] # remove offending key
39+
res[index].update(rate)
40+
return res
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* `Trey <https://www.trey.es>`_:
2+
3+
* Roberto Lizana <roberto@trey.es>
4+
5+
* `Tecnativa <https://www.tecnativa.com>`_:
6+
7+
* Pedro M. Baeza
8+
9+
* `QubiQ 2010 <https://www.quibq.es>`_:
10+
11+
* Marçal Isern
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This module allows to force a local price rate computation for any delivery
2+
method, including those that have been created to query a webservice for
3+
fetching the rate.
4+
5+
It uses the existing fixed price or price based on rules computations.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#. Go to *Sales > Configuration > Sales Orders > Delivery Methods*.
2+
#. Open or create a new one.
3+
#. On the "Price Method" field, select "Fixed Price" or "Based on Rules".
4+
#. You will see standard fields for selecting the price as if the delivery
5+
method isn't an integration carrier.
Loading

0 commit comments

Comments
 (0)