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

[16.0][MIG] website_snippet_country_dropdown: Migration to 16.0 #986

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5ec3416
[NEW][8.0] website_snippet_country_dropdown: New base module for coun…
sergio-teruel Jun 8, 2016
c5f94b1
[IMP] website_snippet_country_dropdown: Several things:
yajo Jul 5, 2016
7c2c618
[MIG] website_snippet_country_dropdown: Migrate to v9 + imp
yajo Jul 15, 2016
dc34519
[MIG] website_snippet_country_dropdown: Migration to 10.0
adr9 May 30, 2017
1b34316
[MIG] website_snippet_country_dropdown: Migration to 12.0
Tardo May 13, 2019
5cbd52d
[IMP] website_snippet_country_dropdown: custom input field classes
ernestotejeda Oct 8, 2019
1dbd652
[IMP] website_snippet_country_dropdown: readonly mode
May 13, 2020
4ee0dcb
Translated using Weblate (Spanish)
claudiagn Oct 6, 2020
5cdd3f2
[IMP] website_snippet_country_dropdown: black, isort, prettier
CarlosRoca13 Feb 16, 2021
f8663d6
[MIG] website_snippet_country_dropdown: Migration to v13.0
CarlosRoca13 Feb 17, 2021
0de1e02
[IMP] website_snippet_country_dropdown: black, isort, prettier
ernestotejeda Oct 21, 2021
fc26d04
[MIG] website_snippet_country_dropdown: Migration to 14.0
ernestotejeda Oct 21, 2021
2c59425
[MIG] website_snippet_country_dropdown: Migration to 15.0
CarlosRoca13 May 11, 2022
b4a6573
[UPD] Update website_snippet_country_dropdown.pot
May 23, 2022
0dd07b1
[UPD] README.rst
OCA-git-bot May 23, 2022
f41f6ca
[FIX] website_snippet_country_dropdown: test-folder-imported
ioans73 Nov 24, 2022
57620a3
Added translation using Weblate (Italian)
mymage Dec 27, 2022
3c78f0d
Translated using Weblate (Italian)
mymage Dec 27, 2022
e7d9a31
[FIX] Update copier template + remove offending en.po
pedrobaeza Feb 1, 2023
6c9e70d
[IMP] website_snippet_country_dropdown: black, isort, prettier
kaynnan Jun 27, 2023
cf3cac4
[MIG] website_snippet_country_dropdown: Migration to 16.0
kaynnan Jun 27, 2023
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
6 changes: 6 additions & 0 deletions setup/website_snippet_country_dropdown/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
132 changes: 132 additions & 0 deletions website_snippet_country_dropdown/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
=====================================
Website Snippet Country Code Dropdown
=====================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
:target: https://github.com/OCA/website/tree/15.0/website_snippet_country_dropdown
:alt: OCA/website
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/website-15-0/website-15-0-website_snippet_country_dropdown
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/186/15.0
:alt: Try me on Runbot

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

This module adds a snippet with a dropdown and an input text field, is a base
for be inherited by others modules into an HTML form.

This can be inserted into form elements.

**Table of contents**

.. contents::
:local:

Usage
=====

To extend this template you need to inherit ``country_dropdown`` template and
add your personal code.

The template have three input text:

#. ``no_country_field``: Field without code country.
#. ``country_code_field``: Field with only country code (read only)
#. ``complete_field``: Field with the previous two joined (hidden)

The name of the complete field is customizable when user insert the snippet
into a form element with the website editor.

Development
~~~~~~~~~~~

You can call the reusable Qweb template called
``website_snippet_country_dropdown.country_dropdown`` in your views to add a
sensible country-combined field, ideal for *VATs*.

The default country will be the first match among:

#. Extract it from the ``default_country`` variable.
#. Extract it from the first 2 letters of the ``default_value`` variable.
#. The current user's country.
#. The current website's company's country.
#. The first country in the list.

All variables you can use to modify its behavior:

* ``complete_field`` to give it a name. Usually it will match the field name.
* ``default_value`` for the ``complete_field``.
* ``countries`` as a ``res.country`` ORM recordset.
* ``default_country`` as a ``res.country`` record.
* ``no_country_placeholder``.

You can view an example in ``website_sale_checkout_country_vat`` in
OCA/e-commerce.

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

* Add tests.
* Snippet drag and drop `seems to be blocked by Odoo for some unknown reason.
<https://github.com/OCA/website/pull/230#issuecomment-236681777>`_.
Given the main purpose of this module is to provide a reusable template for
other modules to use, did not take the time to fix that use case.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/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/website/issues/new?body=module:%20website_snippet_country_dropdown%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
~~~~~~~

* Tecnativa

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

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

* Sergio Teruel
* Jairo Llopis
* Alexandre Díaz
* Carlos Roca
* Ernesto Tejeda

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/website <https://github.com/OCA/website/tree/15.0/website_snippet_country_dropdown>`_ 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_snippet_country_dropdown/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2016 Jairo Llopis <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
32 changes: 32 additions & 0 deletions website_snippet_country_dropdown/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2016 Sergio Teruel <[email protected]>
# Copyright 2016 Jairo Llopis <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Website Snippet Country Code Dropdown",
"summary": "Allow to select country in a dropdown",
"version": "16.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/website",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["website"],
"data": ["views/snippets.xml"],
"demo": ["demo/pages.xml"],
"assets": {
"web.assets_tests": [
"/website_snippet_country_dropdown/static/src/js/"
"web_tour_country_dropdown.js"
],
"web.assets_frontend": [
"/website_snippet_country_dropdown/static/src/css/style.scss",
"/website_snippet_country_dropdown/static/src/js/"
"website_snippet_country_dropdown.js",
],
"web.assets_qweb": [
"/website_snippet_country_dropdown/static/src/xml/country_dropdown.xml"
],
},
}
92 changes: 92 additions & 0 deletions website_snippet_country_dropdown/demo/pages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2016 Jairo Llopis <[email protected]>
Copyright 2019 Alexandre Díaz <[email protected]>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<odoo>
<template id="country_dropdown_demo_view" name="Country dropdown snippet test">
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
<section>
<div class="container readable mt32 mb32">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">This is a form</h1>
<h3 class="text-muted text-center">
Test here the country dropdown snippet behavior
</h3>
<form action="" class="form-horizontal">
<div
class="js_enabled"
t-call="website_snippet_country_dropdown.dropdown_element_form"
>
<t
t-set="label_class"
t-value="'col-sm-5 col-form-label'"
/>
<t
t-set="input_container_class"
t-value="'col-sm-7'"
/>
<t t-set="label_country_dropdown">
Other label
</t>
</div>
<div
class="js_disabled"
t-call="website_snippet_country_dropdown.dropdown_element_form"
>
<t
t-set="label_class"
t-value="'col-sm-5 col-form-label'"
/>
<t
t-set="input_container_class"
t-value="'col-sm-7'"
/>
<t
t-set="complete_field"
t-value="'disabled_complete_field'"
/>
<t
t-set="country_code_field"
t-value="'disabled_country_code_field'"
/>
<t
t-set="no_country_field"
t-value="'disabled_no_country_field'"
/>
<t t-set="readonly" t-value="True" />
<t
t-set="default_value"
t-value="'FRA123456789'"
/>
<t t-set="label_country_dropdown">
A readonly country dropdown input
</t>
</div>
<div class="col-12 d-flex justify-content-center">
<button type="submit" class="btn btn-default">
Submit (you will see the GET parameters in the URL)
</button>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
</t>
</template>
<record id="country_dropdown_demo_page" model="website.page">
<field name="website_published">True</field>
<field name="url">/website_snippet_country_dropdown.demo_page</field>
<field name="view_id" ref="country_dropdown_demo_view" />
</record>
<record id="country_dropdown_demo_page_link" model="website.menu">
<field name="name">Country dropdown demo</field>
<field name="url">/website_snippet_country_dropdown.demo_page</field>
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">50</field>
<field name="page_id" ref="country_dropdown_demo_page" />
</record>
</odoo>
76 changes: 76 additions & 0 deletions website_snippet_country_dropdown/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_snippet_country_dropdown
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-09 02:51+0000\n"
"PO-Revision-Date: 2020-10-06 17:16+0000\n"
"Last-Translator: claudiagn <[email protected]>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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 3.10\n"

#. module: website_snippet_country_dropdown
#: model_terms:ir.ui.view,arch_db:website_snippet_country_dropdown.country_dropdown_demo_view
#: model_terms:website.page,arch_db:website_snippet_country_dropdown.country_dropdown_demo_page
msgid "A readonly country dropdown input"
msgstr "Una entrada desplegable de país de solo lectura"

#. module: website_snippet_country_dropdown
#: model:website.menu,name:website_snippet_country_dropdown.country_dropdown_demo_page_link
msgid "Country dropdown demo"
msgstr "Demo del desplegable de países"

#. module: website_snippet_country_dropdown
#: model_terms:ir.ui.view,arch_db:website_snippet_country_dropdown.country_dropdown_demo_view
#: model_terms:website.page,arch_db:website_snippet_country_dropdown.country_dropdown_demo_page
msgid "Other label"
msgstr "Otra etiqueta"

#. module: website_snippet_country_dropdown
#: model_terms:ir.ui.view,arch_db:website_snippet_country_dropdown.country_dropdown_demo_view
#: model_terms:website.page,arch_db:website_snippet_country_dropdown.country_dropdown_demo_page
msgid "Submit (you will see the GET parameters in the URL)"
msgstr "Enviar (verá los parámetros GET en la URL)"

#. module: website_snippet_country_dropdown
#: model_terms:ir.ui.view,arch_db:website_snippet_country_dropdown.country_dropdown_demo_view
#: model_terms:website.page,arch_db:website_snippet_country_dropdown.country_dropdown_demo_page
msgid "Test here the country dropdown snippet behavior"
msgstr "Pruebe aquí el comportamiento del snippet desplegable de países"

#. module: website_snippet_country_dropdown
#: model_terms:ir.ui.view,arch_db:website_snippet_country_dropdown.country_dropdown_demo_view
#: model_terms:website.page,arch_db:website_snippet_country_dropdown.country_dropdown_demo_page
msgid "This is a form"
msgstr "Esto es un formulario"

#. module: website_snippet_country_dropdown
#. openerp-web
#: code:addons/website_snippet_country_dropdown/static/src/xml/country_dropdown.xml:0
#, python-format
msgid ""
"Write the \"name\" attribute for the input what will be sent with the form."
msgstr ""
"Escriba el atributo \"name\" para el campo que se mandará al formulario."

#. module: website_snippet_country_dropdown
#. openerp-web
#: code:addons/website_snippet_country_dropdown/static/src/xml/country_dropdown.xml:0
#, python-format
msgid "You can modify the label directly with the website editor."
msgstr "Puede modificar la etiqueta directamente desde el editor web."

#. module: website_snippet_country_dropdown
#: model_terms:ir.ui.view,arch_db:website_snippet_country_dropdown.dropdown_element_form
msgid "Your Label"
msgstr "Su etiqueta"
Loading
Loading