I work with odoo 9. In the system exists render_value method for each type of field:
/odoo/addons/web/static/src/js/views/form_widgets.js
/odoo/addons/web/static/src/js/views/form_relational_widgets.js
How I can use my custom method render_value(for example in FieldChar) for all forms? And how I can use specific render_value for one form or one module?
I created form_widgets.js
in my module, but I not understand how properly override Field.
odoo.define('my_module.form_widgets', function (require) {
"use strict";
// what I should do here???
});
Can you provide small example? Thank in advance.
I found the solution.
The first thing you need to do it is create static for frontend. JS:
Templates for qWeb:
Second step - include our static files.
Create new view which will be add assets:
In openerp.py of your module add next sections:
After this will be work our FieldChar for all CHAR fields in the system. If we need to use
my_unique_char
we need just add attribute widget to field of our from like this:I hope it will help someone.