[IMP] syn_disable_quick_create: Allow selective skip_disable_quick_create option on relational fields

This commit is contained in:
younes 2025-11-11 09:07:09 +01:00
parent c74d160053
commit 439a28f345
1 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
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
*/
@ -12,6 +15,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
*/
init: function () {
this._super.apply(this, arguments);
if (shouldSkipField(this.nodeOptions)) {
return;
}
// Disable all create options for Many2One fields
this.can_create = false;
this.nodeOptions.no_create = true;
@ -29,6 +35,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
*/
init: function () {
this._super.apply(this, arguments);
if (shouldSkipField(this.nodeOptions)) {
return;
}
// Disable all create options for Many2Many Tags fields
this.can_create = false;
this.nodeOptions.no_create = true;
@ -45,6 +54,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
*/
init: function () {
this._super.apply(this, arguments);
if (shouldSkipField(this.nodeOptions)) {
return;
}
// Disable all create options for editable Many2Many Tags
this.can_create = false;
this.nodeOptions.no_create = true;
@ -62,6 +74,9 @@ odoo.define('syn_disable_quick_create.disable_relational_create', function (requ
*/
init: function () {
this._super.apply(this, arguments);
if (shouldSkipField(this.nodeOptions)) {
return;
}
// Disable all create options
this.can_create = false;
this.nodeOptions.no_create = true;