forked from Techsystech/web
Added option m2o_dialog in System parameters
parent
7a81b2fc32
commit
5dcd044a94
|
@ -77,6 +77,10 @@ If you disable one option, you can enable it for particular field by setting "cr
|
||||||
|
|
||||||
Whether to display "Create and Edit..." entry in dropdown panel for all fields in the odoo instance.
|
Whether to display "Create and Edit..." entry in dropdown panel for all fields in the odoo instance.
|
||||||
|
|
||||||
|
``web_m2x_options.m2o_dialog`` *boolean* (Default: depends if user have create rights)
|
||||||
|
|
||||||
|
Whether to display the many2one dialog in case of validation error for all fields in the odoo instance.
|
||||||
|
|
||||||
``web_m2x_options.limit`` *int* (Default: openerp default value is ``7``)
|
``web_m2x_options.limit`` *int* (Default: openerp default value is ``7``)
|
||||||
|
|
||||||
Number of displayed record in drop-down panel for all fields in the odoo instance
|
Number of displayed record in drop-down panel for all fields in the odoo instance
|
||||||
|
@ -89,6 +93,7 @@ To add these parameters go to Configuration -> Technical -> Parameters -> System
|
||||||
|
|
||||||
- web_m2x_options.create: False
|
- web_m2x_options.create: False
|
||||||
- web_m2x_options.create_edit: False
|
- web_m2x_options.create_edit: False
|
||||||
|
- web_m2x_options.m2o_dialog: False
|
||||||
- web_m2x_options.limit: 10
|
- web_m2x_options.limit: 10
|
||||||
- web_m2x_options.search_more: True
|
- web_m2x_options.search_more: True
|
||||||
|
|
||||||
|
|
|
@ -11,36 +11,37 @@ openerp.web_m2x_options = function (instance) {
|
||||||
var OPTIONS = ['web_m2x_options.create',
|
var OPTIONS = ['web_m2x_options.create',
|
||||||
'web_m2x_options.create_edit',
|
'web_m2x_options.create_edit',
|
||||||
'web_m2x_options.limit',
|
'web_m2x_options.limit',
|
||||||
'web_m2x_options.search_more',];
|
'web_m2x_options.search_more',
|
||||||
|
'web_m2x_options.m2o_dialog',];
|
||||||
|
|
||||||
instance.web.form.FieldMany2One = instance.web.form.FieldMany2One.extend({
|
instance.web.form.FieldMany2One = instance.web.form.FieldMany2One.extend({
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
return this.get_options();
|
return this.get_options();
|
||||||
},
|
},
|
||||||
|
|
||||||
get_options: function() {
|
get_options: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (!_.isUndefined(this.view) && _.isUndefined(this.view.ir_options_loaded)) {
|
if (!_.isUndefined(this.view) && _.isUndefined(this.view.ir_options_loaded)) {
|
||||||
this.view.ir_options_loaded = $.Deferred();
|
this.view.ir_options_loaded = $.Deferred();
|
||||||
this.view.ir_options = {};
|
this.view.ir_options = {};
|
||||||
(new instance.web.Model("ir.config_parameter"))
|
(new instance.web.Model("ir.config_parameter"))
|
||||||
.query(["key", "value"]).filter([['key', 'in', OPTIONS]])
|
.query(["key", "value"]).filter([['key', 'in', OPTIONS]])
|
||||||
.all().then(function(records) {
|
.all().then(function(records) {
|
||||||
_(records).each(function(record) {
|
_(records).each(function(record) {
|
||||||
self.view.ir_options[record.key] = record.value;
|
self.view.ir_options[record.key] = record.value;
|
||||||
});
|
});
|
||||||
self.view.ir_options_loaded.resolve();
|
self.view.ir_options_loaded.resolve();
|
||||||
});
|
});
|
||||||
return this.view.ir_options_loaded;
|
return this.view.ir_options_loaded;
|
||||||
}
|
}
|
||||||
return $.when();
|
return $.when();
|
||||||
},
|
},
|
||||||
|
|
||||||
show_error_displayer: function () {
|
show_error_displayer: function () {
|
||||||
if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) ||
|
if (((typeof this.options.m2o_dialog === 'undefined' && this.can_create) ||
|
||||||
this.options.m2o_dialog) {
|
this.options.m2o_dialog) && (!this.view.ir_options['web_m2x_options.search_more'] === "False")) {
|
||||||
new instance.web.form.M2ODialog(this).open();
|
new instance.web.form.M2ODialog(this).open();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue