I want to inherit this file, odoo16/addons/product/staic/src/xml/price_report.xml, and change the one of labels
<div class="form-check">
<input class="form-check-input o_is_visible_title ms-2" type="checkbox"/>
<label class="form-check-label">Display Pricelist</label>
</div>
I tried using jQuery but it's working in Chrome console only, not in odoo. Let me share my JS
odoo.define('aretx_product_pricelist.custom', function (require) {
"use strict";
var core = require('web.core');
var Widget = require('web.Widget');
var test = $('.form-check-label').text('newText');
$('html body .form-check-label').text('newText123');
$('.form-check-label').text('newText123');
$('html .form-check-label').text('newText123');
$('body .form-check-label').text('newText132');
});
I want to simply change the label from any method.
You can inherit/extend/change QWeb templates.
Source: Odoo Dev Documentation
Template inheritance
Template inheritance is used to either:
Template inheritance is performed via the use of two directives:
t-inheritwhich is the name of the template to inherit from,t-inherit-modewhich is the behaviour of the inheritance: it can either be set toprimaryto create a new child template from the parented one or toextensionto alter the parent template in place.An optional
t-namedirective can also be specified. It will be the name of the newly created template if used in primary mode, else it will be added as a comment on the transformed template to help retrace inheritances.For the inheritance itself, the changes are done using xpaths directives. See the XPATH documentation for the complete set of available instructions.
Primary inheritance (child template):
Extension inheritance (in-place transformation):