-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
19 changed files
with
972 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
===================== | ||
Delivery Price Method | ||
===================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Production/Stable | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
: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/14.0/delivery_price_method | ||
: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-14-0/delivery-carrier-14-0-delivery_price_method | ||
: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/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to force a local price rate computation for any delivery | ||
method, including those that have been created to query a webservice for | ||
fetching the rate. | ||
|
||
It uses the existing fixed price or price based on rules computations. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
#. Go to *Sales > Configuration > Sales Orders > Delivery Methods*. | ||
#. Open or create a new one. | ||
#. On the "Price Method" field, select "Fixed Price" or "Based on Rules". | ||
#. You will see standard fields for selecting the price as if the delivery | ||
method isn't an integration carrier. | ||
|
||
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_price_method%0Aversion:%2014.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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Trey (www.trey.es) | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Trey <https://www.trey.es>`_: | ||
|
||
* Roberto Lizana <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Pedro M. Baeza | ||
|
||
* `QubiQ 2010 <https://www.quibq.es>`_: | ||
|
||
* Marçal Isern | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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/14.0/delivery_price_method>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright 2020 Trey, Kilobytes de Soluciones | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2020 Trey, Kilobytes de Soluciones | ||
# Copyright 2020 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Delivery Price Method", | ||
"summary": "Provides fields to be able to contemplate the tracking states" | ||
"and also adds a global fields", | ||
"author": "Trey (www.trey.es), " "Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/delivery-carrier", | ||
"license": "AGPL-3", | ||
"development_status": "Production/Stable", | ||
"category": "Delivery", | ||
"version": "14.0.1.0.0", | ||
"depends": ["delivery"], | ||
"data": ["views/delivery_carrier_views.xml"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * delivery_price_method | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule | ||
msgid "Based on Rules" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier | ||
msgid "Carrier obtained price" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed | ||
msgid "Fixed price" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method | ||
msgid "Price method" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form | ||
msgid "Pricing" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model,name:delivery_price_method.model_delivery_carrier | ||
msgid "Shipping Methods" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * delivery_price_method | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2022-05-24 05:34+0000\n" | ||
"Last-Translator: Leonardo J. Caballero G. <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.3.2\n" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule | ||
msgid "Based on Rules" | ||
msgstr "Basado en reglas" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier | ||
msgid "Carrier obtained price" | ||
msgstr "Precio obtenido por el transportista" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed | ||
msgid "Fixed price" | ||
msgstr "Precio fijo" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method | ||
msgid "Price method" | ||
msgstr "Método de precio" | ||
|
||
#. module: delivery_price_method | ||
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form | ||
msgid "Pricing" | ||
msgstr "Precios" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model,name:delivery_price_method.model_delivery_carrier | ||
msgid "Shipping Methods" | ||
msgstr "Métodos de envío" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * delivery_price_method | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2022-05-24 05:34+0000\n" | ||
"Last-Translator: Leonardo J. Caballero G. <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: es_CL\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.3.2\n" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule | ||
msgid "Based on Rules" | ||
msgstr "Basado en reglas" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier | ||
msgid "Carrier obtained price" | ||
msgstr "Precio obtenido por el transportista" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed | ||
msgid "Fixed price" | ||
msgstr "Precio fijo" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method | ||
msgid "Price method" | ||
msgstr "Método de precio" | ||
|
||
#. module: delivery_price_method | ||
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form | ||
msgid "Pricing" | ||
msgstr "Precios" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model,name:delivery_price_method.model_delivery_carrier | ||
msgid "Shipping Methods" | ||
msgstr "Métodos de envío" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * delivery_price_method | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: Automatically generated\n" | ||
"Language-Team: none\n" | ||
"Language: es_VE\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__base_on_rule | ||
msgid "Based on Rules" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier | ||
msgid "Carrier obtained price" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed | ||
msgid "Fixed price" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier__price_method | ||
msgid "Price method" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form | ||
msgid "Pricing" | ||
msgstr "" | ||
|
||
#. module: delivery_price_method | ||
#: model:ir.model,name:delivery_price_method.model_delivery_carrier | ||
msgid "Shipping Methods" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright 2020 Trey, Kilobytes de Soluciones | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from . import delivery_carrier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2020 Trey, Kilobytes de Soluciones | ||
# Copyright 2020 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class DeliveryCarrier(models.Model): | ||
_inherit = "delivery.carrier" | ||
|
||
price_method = fields.Selection( | ||
selection=[ | ||
("carrier", "Carrier obtained price"), | ||
("fixed", "Fixed price"), | ||
("base_on_rule", "Based on Rules"), | ||
], | ||
string="Price method", | ||
default="carrier", | ||
) | ||
|
||
def rate_shipment(self, order): | ||
"""Trick the method for using all the upstream code for the | ||
price computation in case of using fixed or base_on_rule. | ||
""" | ||
previous_method = False | ||
if self.price_method in ("fixed", "base_on_rule"): | ||
previous_method = self.delivery_type | ||
self.sudo().delivery_type = self.price_method | ||
res = super().rate_shipment(order) | ||
if previous_method: | ||
self.sudo().delivery_type = previous_method | ||
return res | ||
|
||
def send_shipping(self, pickings): | ||
res = super().send_shipping(pickings) | ||
if self.price_method in ("fixed", "base_on_rule"): | ||
rates = getattr(self, "%s_send_shipping" % self.price_method)(pickings) | ||
for index, rate in enumerate(rates): | ||
del rate["tracking_number"] # remove offending key | ||
res[index].update(rate) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
* `Trey <https://www.trey.es>`_: | ||
|
||
* Roberto Lizana <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Pedro M. Baeza | ||
|
||
* `QubiQ 2010 <https://www.quibq.es>`_: | ||
|
||
* Marçal Isern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This module allows to force a local price rate computation for any delivery | ||
method, including those that have been created to query a webservice for | ||
fetching the rate. | ||
|
||
It uses the existing fixed price or price based on rules computations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#. Go to *Sales > Configuration > Sales Orders > Delivery Methods*. | ||
#. Open or create a new one. | ||
#. On the "Price Method" field, select "Fixed Price" or "Based on Rules". | ||
#. You will see standard fields for selecting the price as if the delivery | ||
method isn't an integration carrier. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.