When editing the form, I want to get current model field value in js, and through Ajax post to the controller, and then print the controller response result.
But now I can't get the fields and values of the current module in JS. How can I access them? i need access the current form value,not database data.
odoo.define('jy.abc2', function(require) {
'use strict';
var self=this;
function tab1(){
console.log('in setInterval');
var checkDate = $('#checkDate').val();
var orderNo = $('#orderNo').val();
//var tmpmodel= self.model; //cann't access that
//console.log(tmpmodel);
$.ajax({
type: "POST",
dataType: "json",
url:"/jy/abc/testjson",
data: {
params:{
'hotelSeq': 111,
'orderNo': 'orderNo',
//'tmpmodel':tmpmodel,
}
},
success: function (msg) {
console.log(msg);
},
error: function () {
//alert("false")
}
});
}
$(document).ready(function() {
var init = setInterval(tab1,5000);
});
})