Search 1.9 billion lines of Odoo code on GitHub

web_custom_label

Author: Numigi
License: LGPL-3
Branch: TA#47984
Repository: Numigi/odoo-web-addons
Dependencies: base
Languages: Markdown (60, 10.7%), PO File (68, 12.1%), Python (388, 69.3%), and XML (44, 7.9%)
Other branches: 11.0, 11.0-website_sale_sanitized, 12.0, 12.0-web_list_column_text_align, 14.0, TA#48575, and TA#48575-1

<h1>Web Custom Label</h1> <p>This module allows to easily modify the labels of a view without any development.</p> <h2>Customizing Labels</h2> <p>In order to edit a label, you need to:</p> <ul> <li>Go to <code>Settings / Translations / Application Terms / Custom Labels</code>.</li> <li>Add a new custom label.</li> <li>Refresh your browser session in order to see the new label in your view.</li> </ul> <p>Here is an example for products. We rename the field <code>Internal Reference</code> (default_code) with <code>SKU</code>.</p> <p><img src="static/description/custom_field_list.png?raw=true" alt="Custom Field List"></p> <p>Note that we selected 2 models to modify; <code>Product</code> and <code>Product Template</code>. This means we are modifying the label for both product templates and variants.</p> <p>Now, if we go to any for product form view, we get the new label <code>SKU</code>.</p> <p><img src="static/description/product_list.png?raw=true" alt="Product List"></p> <p><img src="static/description/product_form.png?raw=true" alt="Product Form"></p> <p>custom<em>field</em>list.png</p> <h2>Customizing Placeholers</h2> <p>The module also allows to modify the placeholders of a form view.</p> <p>Here, we set custom placeholders on the street fields of partners / addresses.</p> <p><img src="static/description/custom_placeholder_list.png?raw=true" alt="Placeholder List"></p> <p>Partners have multiple form views in Odoo.</p> <p>Here, we did not have to specify which form view to edit. The new placeholders are set in both the main partner form and the contact address form.</p> <p><img src="static/description/partner_form_with_placeholders.png?raw=true" alt="Partner Form"></p> <p><img src="static/description/address_form_with_placeholders.png?raw=true" alt="Address Form"></p> <h2>Customizing Helpers</h2> <p>It is possible to customize a field helper.</p> <p><img src="static/description/custom_field_help.png?raw=true" alt="Custom Field Help"></p> <p><img src="static/description/contact_field_help.png?raw=true" alt="Contact Field Help"></p> <h2>Customizing Selection Fields</h2> <p>Fields of type <code>Selection</code> can be customized.</p> <p>In the list view of custom labels, a new position <code>Selection</code> and a column <code>Key</code> were added. The <code>Key</code> contains the technical value of the selection option to rename.</p> <p><img src="static/description/custom_selection_option.png?raw=true" alt="Custom Selection Option"></p> <p>In the example above, the option <code>contact</code> of the field <code>type</code> of <code>res.partner</code> was renamed to <code>Personne</code> (in french).</p> <p>In the form view of a contact, the term <code>Contact</code> is replaced with <code>Personne</code>.</p> <p><img src="static/description/partner_contact_type.png?raw=true" alt="Partner Contact Type"></p> <h2>Customizing Buttons</h2> <p>In order to customize an element of the view that is not a field, we need to target the element with an Xpath expression.</p> <p>Let&#39;s say we want to customize the stock picking view and change the <code>VALIDATE</code> button to <code>TRANSFER</code>.</p> <p><img src="static/description/picking_form_before.png?raw=true" alt="Picking Form Before"></p> <p>We add the custom label using an Xpath expression.</p> <p><img src="static/description/picking_custom_label.png?raw=true" alt="Picking Custom Label"></p> <p>Then, the label is updated on the button.</p> <p><img src="static/description/picking_form_after.png?raw=true" alt="Picking Form After"></p> <h2>Comparison with Odoo Studio</h2> <p>When using Odoo Studio to modify a label, an inherited view is created behind the scene. Thus, each label added using Odoo Studio is coupled with the code. It adds complexity to deployments, because if the inherited view changes, the Studio customization may become incompatible.</p> <p>Another downside is that when using Studio, you will need to edit every view of your model. For example, products and partners have multiple form views. If you change one label, you will need to change at multiple places.</p> <p>The module <code>Web Custom Label</code> does not add additionnal XML. It modifies the view at the rendering, according to the language of the user. If the inherited view changes, the system will not fail. You may however end up with a wrong label inside a view and have to adjust the custom label entry.</p> <h2>Contributors</h2> <ul> <li>Numigi (tm) and all its contributors (https://bit.ly/numigiens)</li> </ul>