Skip to content

Commit

Permalink
[MIG] delivery_price_method: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dreispt committed Jul 30, 2024
1 parent 032eb7b commit 004d4c5
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 17 deletions.
4 changes: 4 additions & 0 deletions delivery_price_method/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Contributors

- Marçal Isern

- `Open Source Integrators <https://opensourceintegrators.com>`__:

- Daniel Reis <[email protected]>

Maintainers
-----------

Expand Down
6 changes: 3 additions & 3 deletions delivery_price_method/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# 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",
"summary": "Force a fixed or rule price calculation on Delivery Methods"
", for example to override a webservice provided prices.",
"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": "16.0.1.0.0",
"version": "17.0.1.0.0",
"depends": ["delivery"],
"data": ["views/delivery_carrier_views.xml"],
}
34 changes: 34 additions & 0 deletions delivery_price_method/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * delivery_price_method
#

#. 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 "Baseado em Regras"

#. module: delivery_price_method
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__carrier
msgid "Carrier obtained price"
msgstr "Preço obtido do transportador"

#. module: delivery_price_method
#: model:ir.model.fields.selection,name:delivery_price_method.selection__delivery_carrier__price_method__fixed
msgid "Fixed price"
msgstr "Preço fixo"

#. 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 preço"

#. module: delivery_price_method
#: model_terms:ir.ui.view,arch_db:delivery_price_method.view_delivery_carrier_form
msgid "Pricing"
msgstr "Preços"

#. module: delivery_price_method
#: model:ir.model,name:delivery_price_method.model_delivery_carrier
msgid "Shipping Methods"
msgstr "Métodos de envio"
6 changes: 2 additions & 4 deletions delivery_price_method/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
class DeliveryCarrier(models.Model):
_inherit = "delivery.carrier"

# pylint: disable=W8113
price_method = fields.Selection(
selection=[
("carrier", "Carrier obtained price"),
Expand All @@ -19,9 +18,8 @@ class DeliveryCarrier(models.Model):
)

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.
"""
# 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
Expand Down
2 changes: 2 additions & 0 deletions delivery_price_method/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
- Pedro M. Baeza
- [QubiQ 2010](https://www.quibq.es):
- Marçal Isern
- [Open Source Integrators](https://opensourceintegrators.com):
- Daniel Reis \<<[email protected]>\>
4 changes: 4 additions & 0 deletions delivery_price_method/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Marçal Isern</li>
</ul>
</li>
<li><a class="reference external" href="https://opensourceintegrators.com">Open Source Integrators</a>:<ul>
<li>Daniel Reis &lt;<a class="reference external" href="mailto:dreis&#64;opensourceintegrators.com">dreis&#64;opensourceintegrators.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
18 changes: 8 additions & 10 deletions delivery_price_method/views/delivery_carrier_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
<field name="model">delivery.carrier</field>
<field name="inherit_id" ref="delivery.view_delivery_carrier_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='integration_level']" position="after">
<field name="integration_level" position="after">
<field
name="price_method"
attrs="{'invisible': [('delivery_type', 'in', ['fixed', 'base_on_rule'])], 'required': [('delivery_type', 'not in', ['fixed', 'base_on_rule'])]}"
invisible="delivery_type in ['fixed', 'base_on_rule']"
required="delivery_type not in ['fixed', 'base_on_rule']"
/>
</xpath>
</field>
<xpath expr="(//page)[1]" position="before">
<page
string="Pricing"
attrs="{'invisible': [('delivery_type', 'in', ['fixed', 'base_on_rule'])]}"
invisible="delivery_type in ['fixed', 'base_on_rule']"
>
<group attrs="{'invisible':[('price_method', '!=', 'fixed')]}">
<group invisible="price_method != 'fixed'">
<group>
<field name="fixed_price" />
</group>
</group>
<group
name="general"
attrs="{'invisible':[('price_method', '!=', 'base_on_rule')]}"
>
<field name="price_rule_ids" nolabel="1" />
<group name="general" invisible="price_method != 'base_on_rule'">
<field name="price_rule_ids" nolabel="1" colspan="2" />
</group>
</page>
</xpath>
Expand Down

0 comments on commit 004d4c5

Please sign in to comment.