[IMP] syn_disable_quick_create: Allow selective skip_disable_quick_create option on relational fields
This commit is contained in:
parent
c74d160053
commit
439a28f345
|
|
@ -3,6 +3,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
|
||||||
|
|
||||||
var relational_fields = require('web.relational_fields');
|
var relational_fields = require('web.relational_fields');
|
||||||
|
|
||||||
|
function shouldSkipField(nodeOptions) {
|
||||||
|
return nodeOptions && nodeOptions.skip_disable_quick_create === true;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Extend FieldMany2One to disable all create options
|
* Extend FieldMany2One to disable all create options
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,6 +15,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
if (shouldSkipField(this.nodeOptions)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Disable all create options for Many2One fields
|
// Disable all create options for Many2One fields
|
||||||
this.can_create = false;
|
this.can_create = false;
|
||||||
this.nodeOptions.no_create = true;
|
this.nodeOptions.no_create = true;
|
||||||
|
|
@ -29,6 +35,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
if (shouldSkipField(this.nodeOptions)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Disable all create options for Many2Many Tags fields
|
// Disable all create options for Many2Many Tags fields
|
||||||
this.can_create = false;
|
this.can_create = false;
|
||||||
this.nodeOptions.no_create = true;
|
this.nodeOptions.no_create = true;
|
||||||
|
|
@ -45,6 +54,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
if (shouldSkipField(this.nodeOptions)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Disable all create options for editable Many2Many Tags
|
// Disable all create options for editable Many2Many Tags
|
||||||
this.can_create = false;
|
this.can_create = false;
|
||||||
this.nodeOptions.no_create = true;
|
this.nodeOptions.no_create = true;
|
||||||
|
|
@ -62,6 +74,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
if (shouldSkipField(this.nodeOptions)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Disable all create options
|
// Disable all create options
|
||||||
this.can_create = false;
|
this.can_create = false;
|
||||||
this.nodeOptions.no_create = true;
|
this.nodeOptions.no_create = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue