تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4288 أدوات العرض

In Odoo 11.0 i use this method to write a field of a model.
How can i achieve the same in odoo 10?
Is good a link with a good explanation.

function update_line_value(checklist_line_id, checklist_line_view_id) {

//Take the id of the checklist line
var checklist_line_id_int = Number(checklist_line_id);
var value = $('#' + checklist_line_view_id).val();
var task_id_int = Number($("input[name='task_id']").val());
//Search and hr.expense with this product_id
rpc.query({
model: "sale.order.checklist.line",
method: "write",
args: [checklist_line_id_int, {answer_yes: value}],
}).then(setTimeout(function () {
//Set a delay or the update is not visible
window.location.reload(true);
}, 300));
}
الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Founded the solution by my self.
The code below call a write that update the boolean value of a field into database and reload the page

//call method that write the new value for checkbox
var Checklists = new Model('sale.order.checklist.line');
Checklists.call('write', [checklist_line_id_int, {answer_yes: checkboxValue}]
).then(function () {
window.location.reload();
});
الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يناير 23
5268
0
فبراير 21
3396
1
يوليو 23
21024
1
أغسطس 23
411
1
سبتمبر 21
20489