Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Hide create/edit dropdown list m2o fields that was declarated in JS

By
Nil Torrano
on 10/17/16, 8:05 AM 195 views

Hi, its possible to hide the "create/edit" option in timesheets widget dropdown list?? I know the modifiers 'no_create'; 'no_create_edit';... This modifiers works fine in xml but not works in js. 

The field is declarated in "addons/hr_timesheet_sheet/static/src/js/timesheet.js":

ORIGINAL CODE:

self.account_m2o = new instance.web.form.FieldMany2One(self.dfm, {

attrs: {

name: "account",

type: "many2one",

domain: [ ['type','in',['normal', 'contract']], ['state', '<>', 'close'], ['use_timesheets','=',1], ['id', 'not in', _.pluck(self.accounts, "account")], ],

context: { default_use_timesheets: 1, default_type: "contract", },

modifiers: '{"required": true},

});


I WANT THIS CODE:

self.account_m2o = new instance.web.form.FieldMany2One(self.dfm, {

attrs: { name: "account", type: "many2one",

domain: [ ['type','in',['normal', 'contract']], ['state', '<>', 'close'], ['use_timesheets','=',1], ['id', 'not in', _.pluck(self.accounts, "account")], ],

context: { default_use_timesheets: 1, default_type: "contract", },

modifiers: '{"required": true, "no_create_edit": true}',

}, });


Thanks regards!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/17/16, 8:05 AM
Seen: 195 times
Last updated: 10/17/16, 8:08 AM