答案 0 :(得分:1)
您可以在文件calendar.py中创建字段many2one
到'hr.employee'。
更改文件后转到目录\ addons \ calendar \ static \ src \ js \ base_calendar.js:
initialize_m2o: function() {
var self = this;
this.dfm = new form_common.DefaultFieldManager(self);
this.dfm.extend_field_desc({
employee_id: {
relation: "hr.employee",
},
});
var FieldMany2One = core.form_widget_registry.get('many2one');
this.ir_model_m2o = new FieldMany2One(self.dfm, {
attrs: {
class: 'o_add_favorite_calendar',
name: "employee_id",
type: "many2one",
options: '{"no_open": True}',
placeholder: _t("Add Favorite Calendar"),
},
});
this.ir_model_m2o.appendTo(this.$el);
this.ir_model_m2o.on('change:value', self, function() {
// once selected, we reset the value to false.
if (self.ir_model_m2o.get_value()) {
self.add_filter();
}
});
},
我只应该显示员工名单。
P.S。我使用Odoo 9。