Allow to select country in a dropdown
Project description
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
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.. 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. 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.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
-
Sergio Teruel
Jairo Llopis
Alexandre Díaz
Carlos Roca
Ernesto Tejeda
Maintainers
This module is maintained by the OCA.
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 project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo_addon_website_snippet_country_dropdown-16.0.1.0.0.3-py3-none-any.whl
.
File metadata
- Download URL: odoo_addon_website_snippet_country_dropdown-16.0.1.0.0.3-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0fc81a0a167304ebce13fa5eedca2ac768c7de27a879b8a3d4ba6cebb8ecebe |
|
MD5 | 5b4736cdf97eb3df659a57afd4a1d574 |
|
BLAKE2b-256 | 823881d26e0d4c8283f6a1adb8b8efe302cccdd8f19d089fa3c9b4745a7ad204 |