Website Snippet Country Code Dropdownby Tecnativa https://github.com/OCA/website , Odoo Community Association (OCA) https://github.com/OCA/website
Website Builder (website)
|Also available in version||v 14.0 v 10.0 v 15.0 v 13.0 v 8.0|
Website Snippet Country Code Dropdown
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.
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.
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.
You can view an example in website_sale_checkout_country_vat in OCA/e-commerce.
Known issues / Roadmap
- Add tests.
- Flag images should be lazy-loaded to optimize loading.
- 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.
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 smashing it by providing a detailed and welcomed feedback.
- Odoo Community Association: Icon.
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.
To contribute to this module, please visit https://odoo-community.org.
Please log in to comment on this module
- The author can leave a single reply to each comment.
- This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
- If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.