Skip to content
Open
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
103 changes: 103 additions & 0 deletions website_sale_address_format/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
===========================
Website Sale Address Format
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1d43f035402cfb8a42784b5a5db90d63d8779bac9d12413f81c9b43daa409e73
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/18.0/website_sale_address_format
:alt: OCA/e-commerce
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_address_format
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

The eCommerce address presentation (in /shop/address) of vanilla Odoo
does not cover the format of some countries.

This module adds the capability to change the address field sequence in
the eCommerce address page.

**Table of contents**

.. contents::
:local:

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

Go to Contacts > Configuration > Localization > Countries, and open the
country for which the address field sequence should be adjusted in the
eCommerce address page.

Update 'Layout in eCommerce Address Forms' field with something like the
below (an example for Japan):

::

%(country_name)s
%(zip)s
%(state_code)s
%(city)s
%(street)s
%(street2)s

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_address_format%0Aversion:%2018.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
-------

* Quartile

Contributors
------------

- `Quartile <https://www.quartile.co>`__:

- Yoshi Tashiro
- Tim Lai
- Aung Ko Ko Lin

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/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_address_format>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions website_sale_address_format/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
18 changes: 18 additions & 0 deletions website_sale_address_format/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020-2022 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Address Format",
"version": "18.0.1.0.0",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/e-commerce",
"category": "Website/Website",
"license": "AGPL-3",
"depends": ["website_sale"],
"data": ["views/res_country_views.xml"],
"assets": {
"web.assets_frontend": [
"website_sale_address_format/static/src/js/website_sale_address_format.esm.js",
],
},
"installable": True,
}
1 change: 1 addition & 0 deletions website_sale_address_format/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
15 changes: 15 additions & 0 deletions website_sale_address_format/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import http

from odoo.addons.website_sale.controllers.main import WebsiteSale


class WebsiteSale(WebsiteSale):
@http.route()
def shop_country_info(self, country, address_type, **kw):
res = super().shop_country_info(country, address_type, **kw)
if country.online_address_format:
res["fields"] = country.get_online_address_fields()
return res
61 changes: 61 additions & 0 deletions website_sale_address_format/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_address_format
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-20 20:36+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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.17\n"

#. module: website_sale_address_format
#: model_terms:ir.ui.view,arch_db:website_sale_address_format.view_country_form
msgid "Change the way addresses are displayed in eCommerce address forms"
msgstr ""
"Cambiar la forma en que se muestran las direcciones en los formularios de "
"direcciones de comercio electrónico"

#. module: website_sale_address_format
#: model:ir.model,name:website_sale_address_format.model_res_country
msgid "Country"
msgstr "País"

#. module: website_sale_address_format
#: model:ir.model.fields,help:website_sale_address_format.field_res_country__online_address_format
msgid ""
"Display format to use for addresses belonging to this country in eCommerce address forms.\n"
"\n"
"You can use python-style string pattern with all the fields of the address (for example, use '%(street)s' to display the field 'street') plus\n"
"%(state_name)s: the name of the state\n"
"%(state_code)s: the code of the state\n"
"%(country_name)s: the name of the country\n"
"%(country_code)s: the code of the country"
msgstr ""
"Formato de visualización que se utilizará para las direcciones "
"pertenecientes a este país en los formularios de dirección de eCommerce.\n"
"\n"
"Puede utilizar el patrón de cadenas estilo python con todos los campos de la "
"dirección (por ejemplo, utilice '%(street)s' para mostrar el campo 'street') "
"más\n"
"%(state_name)s: el nombre del estado\n"
"%(state_code)s: el código del estado\n"
"%(country_name)s: el nombre del país\n"
"%(country_code)s: el código del país"

#. module: website_sale_address_format
#: model:ir.model.fields,field_description:website_sale_address_format.field_res_country__online_address_format
msgid "Layout in eCommerce Address Forms"
msgstr "Diseño de formularios de direcciones de comercio electrónico"

#. module: website_sale_address_format
#: model_terms:ir.ui.view,arch_db:website_sale_address_format.view_country_form
msgid "eCommerce address format..."
msgstr "Formato de dirección de eCommerce..."
46 changes: 46 additions & 0 deletions website_sale_address_format/i18n/website_sale_address_format.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_address_format
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: website_sale_address_format
#: model_terms:ir.ui.view,arch_db:website_sale_address_format.view_country_form
msgid "Change the way addresses are displayed in eCommerce address forms"
msgstr ""

#. module: website_sale_address_format
#: model:ir.model,name:website_sale_address_format.model_res_country
msgid "Country"
msgstr ""

#. module: website_sale_address_format
#: model:ir.model.fields,help:website_sale_address_format.field_res_country__online_address_format
msgid ""
"Display format to use for addresses belonging to this country in eCommerce address forms.\n"
"\n"
"You can use python-style string pattern with all the fields of the address (for example, use '%(street)s' to display the field 'street') plus\n"
"%(state_name)s: the name of the state\n"
"%(state_code)s: the code of the state\n"
"%(country_name)s: the name of the country\n"
"%(country_code)s: the code of the country"
msgstr ""

#. module: website_sale_address_format
#: model:ir.model.fields,field_description:website_sale_address_format.field_res_country__online_address_format
msgid "Layout in eCommerce Address Forms"
msgstr ""

#. module: website_sale_address_format
#: model_terms:ir.ui.view,arch_db:website_sale_address_format.view_country_form
msgid "eCommerce address format..."
msgstr ""
1 change: 1 addition & 0 deletions website_sale_address_format/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_country
26 changes: 26 additions & 0 deletions website_sale_address_format/models/res_country.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2022-2022 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import re

from odoo import fields, models


class ResCountry(models.Model):
_inherit = "res.country"

online_address_format = fields.Text(
string="Layout in eCommerce Address Forms",
help="Display format to use for addresses belonging to this country in "
"eCommerce address forms.\n\n"
"You can use python-style string pattern with all the fields of the address "
"(for example, use '%(street)s' to display the field 'street') plus"
"\n%(state_name)s: the name of the state"
"\n%(state_code)s: the code of the state"
"\n%(country_name)s: the name of the country"
"\n%(country_code)s: the code of the country",
)

def get_online_address_fields(self):
self.ensure_one()
return re.findall(r"\((.+?)\)", self.online_address_format)
3 changes: 3 additions & 0 deletions website_sale_address_format/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
15 changes: 15 additions & 0 deletions website_sale_address_format/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Go to Contacts \> Configuration \> Localization \> Countries, and open
the country for which the address field sequence should be adjusted in
the eCommerce address page.

Update 'Layout in eCommerce Address Forms' field with something like the
below (an example for Japan):

```
%(country_name)s
%(zip)s
%(state_code)s
%(city)s
%(street)s
%(street2)s
```
4 changes: 4 additions & 0 deletions website_sale_address_format/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Quartile](https://www.quartile.co):
- Yoshi Tashiro
- Tim Lai
- Aung Ko Ko Lin
5 changes: 5 additions & 0 deletions website_sale_address_format/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The eCommerce address presentation (in /shop/address) of vanilla Odoo
does not cover the format of some countries.

This module adds the capability to change the address field sequence in
the eCommerce address page.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading