mirror of https://github.com/OCA/web.git
[IMP] web_widget_dropdown_dynamic: black, isort, prettier
parent
5f03f1b541
commit
b31c4382a0
|
@ -1,20 +1,14 @@
|
||||||
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
'name': 'Dynamic Dropdown Widget',
|
"name": "Dynamic Dropdown Widget",
|
||||||
'summary': 'This module adds support for dynamic dropdown widget',
|
"summary": "This module adds support for dynamic dropdown widget",
|
||||||
'category': 'Web',
|
"category": "Web",
|
||||||
'version': '12.0.1.0.0',
|
"version": "12.0.1.0.0",
|
||||||
'license': 'AGPL-3',
|
"license": "AGPL-3",
|
||||||
'author':
|
"author": "Brainbean Apps OU, Odoo Community Association (OCA)",
|
||||||
'Brainbean Apps OU, '
|
"website": "https://github.com/OCA/web/",
|
||||||
'Odoo Community Association (OCA)',
|
"depends": ["web"],
|
||||||
'website': 'https://github.com/OCA/web/',
|
"data": ["templates/assets.xml"],
|
||||||
'depends': [
|
"installable": True,
|
||||||
'web',
|
|
||||||
],
|
|
||||||
'data': [
|
|
||||||
'templates/assets.xml',
|
|
||||||
],
|
|
||||||
'installable': True,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
* Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
||||||
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
*/
|
*/
|
||||||
odoo.define('web_widget_dropdown_dynamic.basic_model', function (require) {
|
odoo.define("web_widget_dropdown_dynamic.basic_model", function(require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var BasicModel = require('web.BasicModel');
|
var BasicModel = require("web.BasicModel");
|
||||||
|
|
||||||
BasicModel.include({
|
BasicModel.include({
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@ odoo.define('web_widget_dropdown_dynamic.basic_model', function (require) {
|
||||||
* (for the given parameters), no RPC is done and the promise
|
* (for the given parameters), no RPC is done and the promise
|
||||||
* is resolved with the undefined value.
|
* is resolved with the undefined value.
|
||||||
*/
|
*/
|
||||||
_fetchDynamicDropdownValues: function (record, fieldName, fieldInfo) {
|
_fetchDynamicDropdownValues: function(record, fieldName, fieldInfo) {
|
||||||
var model = fieldInfo.options.model || record.model;
|
var model = fieldInfo.options.model || record.model;
|
||||||
var method = fieldInfo.values || fieldInfo.options.values;
|
var method = fieldInfo.values || fieldInfo.options.values;
|
||||||
if (!method) {
|
if (!method) {
|
||||||
|
@ -29,7 +29,7 @@ odoo.define('web_widget_dropdown_dynamic.basic_model', function (require) {
|
||||||
|
|
||||||
var context = record.getContext({fieldName: fieldName});
|
var context = record.getContext({fieldName: fieldName});
|
||||||
|
|
||||||
// avoid rpc if not necessary
|
// Avoid rpc if not necessary
|
||||||
var hasChanged = this._saveSpecialDataCache(record, fieldName, {
|
var hasChanged = this._saveSpecialDataCache(record, fieldName, {
|
||||||
context: context,
|
context: context,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
* Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
||||||
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
*/
|
*/
|
||||||
odoo.define('web_widget_dropdown_dynamic.field_dynamic_dropdown', function (require) {
|
odoo.define("web_widget_dropdown_dynamic.field_dynamic_dropdown", function(require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var core = require('web.core');
|
var core = require("web.core");
|
||||||
var AbstractField = require('web.AbstractField');
|
var AbstractField = require("web.AbstractField");
|
||||||
var field_registry = require('web.field_registry');
|
var field_registry = require("web.field_registry");
|
||||||
|
|
||||||
var _lt = core._lt;
|
var _lt = core._lt;
|
||||||
|
|
||||||
var FieldDynamicDropdown = AbstractField.extend({
|
var FieldDynamicDropdown = AbstractField.extend({
|
||||||
description: _lt('Dynamic Dropdown'),
|
description: _lt("Dynamic Dropdown"),
|
||||||
template: 'FieldSelection',
|
template: "FieldSelection",
|
||||||
specialData: '_fetchDynamicDropdownValues',
|
specialData: "_fetchDynamicDropdownValues",
|
||||||
supportedFieldTypes: ['selection', 'char', 'integer'],
|
supportedFieldTypes: ["selection", "char", "integer"],
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: _.extend({}, AbstractField.prototype.events, {
|
||||||
'change': '_onChange',
|
change: "_onChange",
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this._setValues();
|
this._setValues();
|
||||||
},
|
},
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Public
|
// Public
|
||||||
//--------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
* @returns {jQuery}
|
* @returns {jQuery}
|
||||||
*/
|
*/
|
||||||
getFocusableElement: function () {
|
getFocusableElement: function() {
|
||||||
return this.$el.is('select') ? this.$el : $();
|
return this.$el.is("select") ? this.$el : $();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
isSet: function () {
|
isSet: function() {
|
||||||
return this.value !== false;
|
return this.value !== false;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -50,25 +50,30 @@ odoo.define('web_widget_dropdown_dynamic.field_dynamic_dropdown', function (requ
|
||||||
*
|
*
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
updateModifiersValue: function () {
|
updateModifiersValue: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
if (!this.attrs.modifiersValue.invisible && this.mode !== 'readonly') {
|
if (!this.attrs.modifiersValue.invisible && this.mode !== "readonly") {
|
||||||
this._setValues();
|
this._setValues();
|
||||||
this._renderEdit();
|
this._renderEdit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Private
|
// Private
|
||||||
//--------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_formatValue: function (value) {
|
_formatValue: function(value) {
|
||||||
var options = _.extend({}, this.nodeOptions, { data: this.recordData }, this.formatOptions);
|
var options = _.extend(
|
||||||
var formattedValue = _.find(this.values, function (option) {
|
{},
|
||||||
|
this.nodeOptions,
|
||||||
|
{data: this.recordData},
|
||||||
|
this.formatOptions
|
||||||
|
);
|
||||||
|
var formattedValue = _.find(this.values, function(option) {
|
||||||
return option[0] === value;
|
return option[0] === value;
|
||||||
});
|
});
|
||||||
if (!formattedValue) {
|
if (!formattedValue) {
|
||||||
|
@ -84,13 +89,15 @@ odoo.define('web_widget_dropdown_dynamic.field_dynamic_dropdown', function (requ
|
||||||
* @override
|
* @override
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_renderEdit: function () {
|
_renderEdit: function() {
|
||||||
this.$el.empty();
|
this.$el.empty();
|
||||||
for (var i = 0 ; i < this.values.length ; i++) {
|
for (var i = 0; i < this.values.length; i++) {
|
||||||
this.$el.append($('<option/>', {
|
this.$el.append(
|
||||||
value: JSON.stringify(this.values[i][0]),
|
$("<option/>", {
|
||||||
text: this.values[i][1]
|
value: JSON.stringify(this.values[i][0]),
|
||||||
}));
|
text: this.values[i][1],
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.$el.val(JSON.stringify(this.value));
|
this.$el.val(JSON.stringify(this.value));
|
||||||
},
|
},
|
||||||
|
@ -98,13 +105,13 @@ odoo.define('web_widget_dropdown_dynamic.field_dynamic_dropdown', function (requ
|
||||||
* @override
|
* @override
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_renderReadonly: function () {
|
_renderReadonly: function() {
|
||||||
this.$el.empty().text(this._formatValue(this.value));
|
this.$el.empty().text(this._formatValue(this.value));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_reset: function () {
|
_reset: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this._setValues();
|
this._setValues();
|
||||||
},
|
},
|
||||||
|
@ -113,28 +120,30 @@ odoo.define('web_widget_dropdown_dynamic.field_dynamic_dropdown', function (requ
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_setValues: function () {
|
_setValues: function() {
|
||||||
this.values = _.reject(this.record.specialData[this.name], function (v) {
|
this.values = _.reject(this.record.specialData[this.name], function(v) {
|
||||||
return v[0] === false && v[1] === '';
|
return v[0] === false && v[1] === "";
|
||||||
});
|
});
|
||||||
if (!this.attrs.modifiersValue || !this.attrs.modifiersValue.required) {
|
if (!this.attrs.modifiersValue || !this.attrs.modifiersValue.required) {
|
||||||
this.values = [[false, this.attrs.placeholder || '']].concat(this.values);
|
this.values = [[false, this.attrs.placeholder || ""]].concat(
|
||||||
|
this.values
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Handlers
|
// Handlers
|
||||||
//--------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_onChange: function () {
|
_onChange: function() {
|
||||||
var value = JSON.parse(this.$el.val());
|
var value = JSON.parse(this.$el.val());
|
||||||
this._setValue(value.toString());
|
this._setValue(value.toString());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
field_registry.add('dynamic_dropdown', FieldDynamicDropdown);
|
field_registry.add("dynamic_dropdown", FieldDynamicDropdown);
|
||||||
|
|
||||||
return FieldDynamicDropdown;
|
return FieldDynamicDropdown;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,147 +1,143 @@
|
||||||
odoo.define('web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests', function (require) {
|
odoo.define("web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests", function(
|
||||||
|
require
|
||||||
|
) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var FormView = require('web.FormView');
|
|
||||||
var testUtils = require('web.test_utils');
|
|
||||||
|
|
||||||
QUnit.module('web_widget_dropdown_dynamic', {}, function () {
|
/* global QUnit*/
|
||||||
|
|
||||||
QUnit.test('values are fetched w/o context (char)', async function (assert) {
|
var FormView = require("web.FormView");
|
||||||
|
var testUtils = require("web.test_utils");
|
||||||
|
|
||||||
|
QUnit.module("web_widget_dropdown_dynamic", {}, function() {
|
||||||
|
QUnit.test("values are fetched w/o context (char)", async function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var form = await testUtils.createView({
|
var form = await testUtils.createView({
|
||||||
View: FormView,
|
View: FormView,
|
||||||
model: 'demo_entry',
|
model: "demo_entry",
|
||||||
data: {
|
data: {
|
||||||
demo_entry: {
|
demo_entry: {
|
||||||
fields: {
|
fields: {
|
||||||
test_field: {string: 'Test Field', type: 'char'},
|
test_field: {string: "Test Field", type: "char"},
|
||||||
},
|
},
|
||||||
records: [{id: 1, test_field: ''}],
|
records: [{id: 1, test_field: ""}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
arch:
|
arch:
|
||||||
'<form>' +
|
"<form>" +
|
||||||
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values"/>' +
|
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values"/>' +
|
||||||
'</form>',
|
"</form>",
|
||||||
mockRPC: function (route, args) {
|
mockRPC: function(route, args) {
|
||||||
if (args.method === '_get_test_field_values') {
|
if (args.method === "_get_test_field_values") {
|
||||||
return $.when([
|
return $.when([["value", "Title"]]);
|
||||||
['value', 'Title'],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.containsN(form, 'option', 2);
|
assert.containsN(form, "option", 2);
|
||||||
assert.containsOnce(form, 'option[value=\'"value"\']');
|
assert.containsOnce(form, "option[value='\"value\"']");
|
||||||
|
|
||||||
form.destroy();
|
form.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('values are fetched w/o context (integer)', async function (assert) {
|
QUnit.test("values are fetched w/o context (integer)", async function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var form = await testUtils.createView({
|
var form = await testUtils.createView({
|
||||||
View: FormView,
|
View: FormView,
|
||||||
model: 'demo_entry',
|
model: "demo_entry",
|
||||||
data: {
|
data: {
|
||||||
demo_entry: {
|
demo_entry: {
|
||||||
fields: {
|
fields: {
|
||||||
test_field: {string: 'Test Field', type: 'integer'},
|
test_field: {string: "Test Field", type: "integer"},
|
||||||
},
|
},
|
||||||
records: [{id: 1, test_field: 0}],
|
records: [{id: 1, test_field: 0}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
arch:
|
arch:
|
||||||
'<form>' +
|
"<form>" +
|
||||||
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values"/>' +
|
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values"/>' +
|
||||||
'</form>',
|
"</form>",
|
||||||
mockRPC: function (route, args) {
|
mockRPC: function(route, args) {
|
||||||
if (args.method === '_get_test_field_values') {
|
if (args.method === "_get_test_field_values") {
|
||||||
return $.when([
|
return $.when([[0, "Title"]]);
|
||||||
[0, 'Title'],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.containsN(form, 'option', 2);
|
assert.containsN(form, "option", 2);
|
||||||
assert.containsOnce(form, 'option[value=\'0\']');
|
assert.containsOnce(form, "option[value='0']");
|
||||||
|
|
||||||
form.destroy();
|
form.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('values are fetched w/o context (selection)', async function (assert) {
|
QUnit.test("values are fetched w/o context (selection)", async function(
|
||||||
|
assert
|
||||||
|
) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var form = await testUtils.createView({
|
var form = await testUtils.createView({
|
||||||
View: FormView,
|
View: FormView,
|
||||||
model: 'demo_entry',
|
model: "demo_entry",
|
||||||
data: {
|
data: {
|
||||||
demo_entry: {
|
demo_entry: {
|
||||||
fields: {
|
fields: {
|
||||||
test_field: {string: 'Test Field', type: 'selection'},
|
test_field: {string: "Test Field", type: "selection"},
|
||||||
},
|
},
|
||||||
records: [{id: 1, test_field: ''}],
|
records: [{id: 1, test_field: ""}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
arch:
|
arch:
|
||||||
'<form>' +
|
"<form>" +
|
||||||
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values"/>' +
|
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values"/>' +
|
||||||
'</form>',
|
"</form>",
|
||||||
mockRPC: function (route, args) {
|
mockRPC: function(route, args) {
|
||||||
if (args.method === '_get_test_field_values') {
|
if (args.method === "_get_test_field_values") {
|
||||||
return $.when([
|
return $.when([["value", "Title"]]);
|
||||||
['value', 'Title'],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.containsN(form, 'option', 2);
|
assert.containsN(form, "option", 2);
|
||||||
assert.containsOnce(form, 'option[value=\'"value"\']');
|
assert.containsOnce(form, "option[value='\"value\"']");
|
||||||
|
|
||||||
form.destroy();
|
form.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('values are fetched with changing context', async function (assert) {
|
QUnit.test("values are fetched with changing context", async function(assert) {
|
||||||
assert.expect(6);
|
assert.expect(6);
|
||||||
|
|
||||||
var form = await testUtils.createView({
|
var form = await testUtils.createView({
|
||||||
View: FormView,
|
View: FormView,
|
||||||
model: 'demo_entry',
|
model: "demo_entry",
|
||||||
data: {
|
data: {
|
||||||
demo_entry: {
|
demo_entry: {
|
||||||
fields: {
|
fields: {
|
||||||
other_field: {string: 'Other Field', type: 'char'},
|
other_field: {string: "Other Field", type: "char"},
|
||||||
test_field: {string: 'Test Field', type: 'char'},
|
test_field: {string: "Test Field", type: "char"},
|
||||||
},
|
},
|
||||||
records: [{id: 1, other_field: '', test_field: ''}],
|
records: [{id: 1, other_field: "", test_field: ""}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
arch:
|
arch:
|
||||||
'<form>' +
|
"<form>" +
|
||||||
'<field name="other_field" />' +
|
'<field name="other_field" />' +
|
||||||
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values" context="{\'step\': other_field}"/>' +
|
'<field name="test_field" widget="dynamic_dropdown" values="_get_test_field_values" context="{\'step\': other_field}"/>' +
|
||||||
'</form>',
|
"</form>",
|
||||||
mockRPC: function (route, args) {
|
mockRPC: function(route, args) {
|
||||||
if (args.method === '_get_test_field_values') {
|
if (args.method === "_get_test_field_values") {
|
||||||
if (args.kwargs.context.step === 'step-1') {
|
if (args.kwargs.context.step === "step-1") {
|
||||||
|
return $.when([["value", "Title"]]);
|
||||||
|
} else if (args.kwargs.context.step === "step-2") {
|
||||||
return $.when([
|
return $.when([
|
||||||
['value', 'Title'],
|
["value", "Title"],
|
||||||
|
["value_2", "Title 2"],
|
||||||
]);
|
]);
|
||||||
} else if (args.kwargs.context.step === 'step-2') {
|
|
||||||
return $.when([
|
|
||||||
['value', 'Title'],
|
|
||||||
['value_2', 'Title 2'],
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
return $.when([]);
|
|
||||||
}
|
}
|
||||||
|
return $.when([]);
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
@ -149,27 +145,27 @@ odoo.define('web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests', fun
|
||||||
|
|
||||||
await testUtils.fields.editAndTrigger(
|
await testUtils.fields.editAndTrigger(
|
||||||
form.$('.o_field_widget[name="other_field"]'),
|
form.$('.o_field_widget[name="other_field"]'),
|
||||||
'step-1',
|
"step-1",
|
||||||
['input']
|
["input"]
|
||||||
);
|
);
|
||||||
assert.containsN(form, 'option', 2);
|
assert.containsN(form, "option", 2);
|
||||||
assert.containsOnce(form, 'option[value=\'"value"\']');
|
assert.containsOnce(form, "option[value='\"value\"']");
|
||||||
|
|
||||||
await testUtils.fields.editAndTrigger(
|
await testUtils.fields.editAndTrigger(
|
||||||
form.$('.o_field_widget[name="other_field"]'),
|
form.$('.o_field_widget[name="other_field"]'),
|
||||||
'step-2',
|
"step-2",
|
||||||
['input']
|
["input"]
|
||||||
);
|
);
|
||||||
assert.containsN(form, 'option', 3);
|
assert.containsN(form, "option", 3);
|
||||||
assert.containsOnce(form, 'option[value=\'"value"\']');
|
assert.containsOnce(form, "option[value='\"value\"']");
|
||||||
assert.containsOnce(form, 'option[value=\'"value_2"\']');
|
assert.containsOnce(form, "option[value='\"value_2\"']");
|
||||||
|
|
||||||
await testUtils.fields.editAndTrigger(
|
await testUtils.fields.editAndTrigger(
|
||||||
form.$('.o_field_widget[name="other_field"]'),
|
form.$('.o_field_widget[name="other_field"]'),
|
||||||
'step-other',
|
"step-other",
|
||||||
['input']
|
["input"]
|
||||||
);
|
);
|
||||||
assert.containsN(form, 'option', 1);
|
assert.containsN(form, "option", 1);
|
||||||
|
|
||||||
form.destroy();
|
form.destroy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,19 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
||||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
-->
|
-->
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="assets_backend" name="web_widget_dropdown_dynamic assets" inherit_id="web.assets_backend">
|
<template
|
||||||
|
id="assets_backend"
|
||||||
|
name="web_widget_dropdown_dynamic assets"
|
||||||
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<script type="text/javascript" src="/web_widget_dropdown_dynamic/static/src/js/basic_model.js" />
|
<script
|
||||||
<script type="text/javascript" src="/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.js" />
|
type="text/javascript"
|
||||||
|
src="/web_widget_dropdown_dynamic/static/src/js/basic_model.js"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.js"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
<template
|
||||||
<template id="qunit_suite" name="web_widget_dropdown_dynamic tests" inherit_id="web.qunit_suite">
|
id="qunit_suite"
|
||||||
|
name="web_widget_dropdown_dynamic tests"
|
||||||
|
inherit_id="web.qunit_suite"
|
||||||
|
>
|
||||||
<xpath expr="//t[@t-set='head']" position="inside">
|
<xpath expr="//t[@t-set='head']" position="inside">
|
||||||
<script type="text/javascript" src="/web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.js" />
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.js"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
Loading…
Reference in New Issue