odoo.define('my_module', function (require)
{
"use strict";
function myFunction() {
var x = 'hello'
console.log(x)
});
i have my javascript in static/src/js folder
i want to get this "hello" in my form view char field .
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
odoo.define('my_module', function (require)
{
"use strict";
function myFunction() {
var x = 'hello'
console.log(x)
});
i have my javascript in static/src/js folder
i want to get this "hello" in my form view char field .
you can use field change trigger
var values ={}
values ['your_field'] = 'his value';
this.trigger_up('field_changed',
{
dataPointID: this.dataPointID,
changes: values,
viewType: this.viewType
});
Works well!!! viewType might not be necessary.
You can send values to python function and recieve return value like below
your_function: function(param1,param2) {
var variable = new instance.web.Model('model').call('test',[param1,param2]).then(function(result){
$(".class").text(result);
});
},.
//I haven't known your event, so i used "field changed" event.
odoo.define('my_module', function (require)
{
"use strict";
var FormRenderer = require('web.FormRenderer');
FormRenderer.include({
confirmChange: function (state, id, fields, e) {
if(this.state.model == 'your_model')
{
//your code here
}
return this._super.apply(this, arguments);
},
});
});
//https://pastebin.com/Ch0kJ0Kq
var data = e.data.changes.name;
//I haven't test this code