Skip to content

Commit

Permalink
Merge PR #536 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 11, 2022
2 parents 2642b85 + 18953fb commit 02d4b6d
Show file tree
Hide file tree
Showing 20 changed files with 990 additions and 2 deletions.
96 changes: 96 additions & 0 deletions delivery_price_method/README.rst
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/15.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-15-0/delivery-carrier-15-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/15.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:%2015.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 <roberto@trey.es>

* `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/15.0/delivery_price_method>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions delivery_price_method/__init__.py
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
16 changes: 16 additions & 0 deletions delivery_price_method/__manifest__.py
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": "15.0.1.0.0",
"depends": ["delivery"],
"data": ["views/delivery_carrier_views.xml"],
}
59 changes: 59 additions & 0 deletions delivery_price_method/i18n/delivery_price_method.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * delivery_price_method
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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,field_description:delivery_price_method.field_delivery_carrier__display_name
msgid "Display Name"
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__id
msgid "ID"
msgstr ""

#. module: delivery_price_method
#: model:ir.model.fields,field_description:delivery_price_method.field_delivery_carrier____last_update
msgid "Last Modified on"
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 ""
47 changes: 47 additions & 0 deletions delivery_price_method/i18n/es.po
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. <leonardocaballero@gmail.com>\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"
47 changes: 47 additions & 0 deletions delivery_price_method/i18n/es_CL.po
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. <leonardocaballero@gmail.com>\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"
45 changes: 45 additions & 0 deletions delivery_price_method/i18n/es_VE.po
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 ""
3 changes: 3 additions & 0 deletions delivery_price_method/models/__init__.py
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
41 changes: 41 additions & 0 deletions delivery_price_method/models/delivery_carrier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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"

# pylint: disable=W8113
price_method = fields.Selection(
selection=[
("carrier", "Carrier obtained price"),
("fixed", "Fixed price"),
("base_on_rule", "Based on Rules"),
],
default="carrier",
string="Price method",
)

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
11 changes: 11 additions & 0 deletions delivery_price_method/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* `Trey <https://www.trey.es>`_:

* Roberto Lizana <roberto@trey.es>

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

* Pedro M. Baeza

* `QubiQ 2010 <https://www.quibq.es>`_:

* Marçal Isern
5 changes: 5 additions & 0 deletions delivery_price_method/readme/DESCRIPTION.rst
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.
5 changes: 5 additions & 0 deletions delivery_price_method/readme/USAGE.rst
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.
Binary file added delivery_price_method/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 02d4b6d

Please sign in to comment.