Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][MIG] delivery_carrier_multi_zip: Migration to 14.0 #539

Merged
merged 3 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions delivery_carrier_multi_zip/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
===================================================
Multiple ZIP intervals for the same delivery method
===================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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_carrier_multi_zip
: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_carrier_multi_zip
: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 set more than one interval of zip codes for matching each
shipping method.

**Table of contents**

.. contents::
:local:

Installation
============

This module generates the initial ZIP interval entry from existing "ZIP from"
and "ZIP to", filling one of the two interval parts with wildcard strings.

Configuration
=============

To configure delivery methods with multiple ZIPs:

#. Go to Inventory > Configuration > Delivery > Shipping Methods
#. Create or edit an existing record.
#. Introduce a line for each interval of zip codes.

Known issues / Roadmap
======================

- There's some code for proxying the standard values to the new intervals, for
covering cases like automatisms or other modules that touch such fields, but
there are still non covered cases like multiple consecutive writings creating
weird ZIP interval tables.

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_carrier_multi_zip%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
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

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

* Pedro M. Baeza

* Philipp Zimmer

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_carrier_multi_zip>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions delivery_carrier_multi_zip/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
from .hooks import post_init_hook
14 changes: 14 additions & 0 deletions delivery_carrier_multi_zip/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2022 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Multiple ZIP intervals for the same delivery method",
"version": "14.0.1.0.0",
"category": "Delivery",
"website": "https://github.com/OCA/delivery-carrier",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["delivery"],
"data": ["security/ir.model.access.csv", "views/delivery_carrier_view.xml"],
"post_init_hook": "post_init_hook",
}
18 changes: 18 additions & 0 deletions delivery_carrier_multi_zip/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2022 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
"""Convert current ZIP field values to ZIP entries"""
env = api.Environment(cr, SUPERUSER_ID, dict())
carriers = (
env["delivery.carrier"]
.with_context(
show_children_carriers=True # compatibility with delivery_multi_destination
)
.search(["|", ("zip_from", "!=", False), ("zip_to", "!=", False)])
)
for carrier in carriers:
carrier.write({"zip_from": carrier.zip_from, "zip_to": carrier.zip_to})
env.cr.execute("UPDATE delivery_carrier SET zip_from=NULL, zip_to=NULL")
91 changes: 91 additions & 0 deletions delivery_carrier_multi_zip/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * delivery_carrier_multi_zip
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-26 23:39+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.4\n"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__carrier_id
msgid "Carrier"
msgstr "Spediteur"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__create_uid
msgid "Created by"
msgstr "Angelegt durch"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__create_date
msgid "Created on"
msgstr "Angelegt am"

#. module: delivery_carrier_multi_zip
#: model:ir.model,name:delivery_carrier_multi_zip.model_delivery_carrier_zip
msgid "Delivery destination availability ZIP interval line"
msgstr "Verfügbarer Postleitzahlenbereich für das Lieferziel"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier__display_name
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__display_name
msgid "Display Name"
msgstr "Anzeigebezeichnung"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier__id
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__id
msgid "ID"
msgstr "ID"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier____last_update
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip____last_update
msgid "Last Modified on"
msgstr "Letzte Änderung am"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__write_uid
msgid "Last Updated by"
msgstr "Zuletzt aktualisiert durch"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__write_date
msgid "Last Updated on"
msgstr "Zuletzt aktualisiert am"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__name
msgid "Name"
msgstr "Bezeichnung"

#. module: delivery_carrier_multi_zip
#: model:ir.model,name:delivery_carrier_multi_zip.model_delivery_carrier
msgid "Shipping Methods"
msgstr "Versandmethoden"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier__zip_range_ids
msgid "ZIP codes"
msgstr "Postleitzahlen"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__zip_from
msgid "Zip From"
msgstr "Postleitzahl ab"

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__zip_to
msgid "Zip To"
msgstr "Postleitzahl bis"
89 changes: 89 additions & 0 deletions delivery_carrier_multi_zip/i18n/delivery_carrier_multi_zip.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * delivery_carrier_multi_zip
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-26 23:39+0000\n"
"PO-Revision-Date: 2022-08-26 23:39+0000\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_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__carrier_id
msgid "Carrier"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__create_uid
msgid "Created by"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__create_date
msgid "Created on"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model,name:delivery_carrier_multi_zip.model_delivery_carrier_zip
msgid "Delivery destination availability ZIP interval line"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier__display_name
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__display_name
msgid "Display Name"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier__id
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__id
msgid "ID"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier____last_update
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip____last_update
msgid "Last Modified on"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__write_uid
msgid "Last Updated by"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__write_date
msgid "Last Updated on"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__name
msgid "Name"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model,name:delivery_carrier_multi_zip.model_delivery_carrier
msgid "Shipping Methods"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier__zip_range_ids
msgid "ZIP codes"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__zip_from
msgid "Zip From"
msgstr ""

#. module: delivery_carrier_multi_zip
#: model:ir.model.fields,field_description:delivery_carrier_multi_zip.field_delivery_carrier_zip__zip_to
msgid "Zip To"
msgstr ""
Loading