forked from Techsystech/web
[MIG] web_widget_dropdown_dynamic: Migration to 13.0
parent
83917145cb
commit
5ac2ce3e4f
|
@ -0,0 +1 @@
|
||||||
|
../../../../web_widget_dropdown_dynamic
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../web_widget_dropdown_dynamic_example
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
|
@ -1,10 +1,10 @@
|
||||||
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
# Copyright 2019-2020 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": "13.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Brainbean Apps OU, Odoo Community Association (OCA)",
|
"author": "Brainbean Apps OU, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/web/",
|
"website": "https://github.com/OCA/web/",
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
* In v13, ``$.when`` is going to become `Promise.resolve`
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
* Copyright 2019-2020 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) {
|
||||||
|
@ -24,7 +24,7 @@ odoo.define("web_widget_dropdown_dynamic.basic_model", function(require) {
|
||||||
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) {
|
||||||
return $.when();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
var context = record.getContext({fieldName: fieldName});
|
var context = record.getContext({fieldName: fieldName});
|
||||||
|
@ -34,7 +34,7 @@ odoo.define("web_widget_dropdown_dynamic.basic_model", function(require) {
|
||||||
context: context,
|
context: context,
|
||||||
});
|
});
|
||||||
if (!hasChanged) {
|
if (!hasChanged) {
|
||||||
return $.when();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._rpc({
|
return this._rpc({
|
||||||
|
|
|
@ -29,7 +29,7 @@ odoo.define("web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests", fun
|
||||||
"</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([["value", "Title"]]);
|
return Promise.resolve([["value", "Title"]]);
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
@ -61,7 +61,7 @@ odoo.define("web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests", fun
|
||||||
"</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([[0, "Title"]]);
|
return Promise.resolve([[0, "Title"]]);
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
@ -95,7 +95,7 @@ odoo.define("web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests", fun
|
||||||
"</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([["value", "Title"]]);
|
return Promise.resolve([["value", "Title"]]);
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
@ -130,14 +130,14 @@ odoo.define("web_widget_dropdown_dynamic.web_widget_dropdown_dynamic_tests", fun
|
||||||
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"]]);
|
return Promise.resolve([["value", "Title"]]);
|
||||||
} else if (args.kwargs.context.step === "step-2") {
|
} else if (args.kwargs.context.step === "step-2") {
|
||||||
return $.when([
|
return Promise.resolve([
|
||||||
["value", "Title"],
|
["value", "Title"],
|
||||||
["value_2", "Title 2"],
|
["value_2", "Title 2"],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $.when([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
# Copyright 2019-2020 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: Example",
|
"name": "Dynamic Dropdown Widget: Example",
|
||||||
"summary": "Demonstration of web_widget_dropdown_dynamic",
|
"summary": "Demonstration of web_widget_dropdown_dynamic",
|
||||||
"category": "Web",
|
"category": "Web",
|
||||||
"version": "12.0.1.0.0",
|
"version": "13.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Brainbean Apps OU, Odoo Community Association (OCA)",
|
"author": "Brainbean Apps OU, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/web/",
|
"website": "https://github.com/OCA/web/",
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
>
|
>
|
||||||
<field name="name">web_widget_dropdown_dynamic Demo</field>
|
<field name="name">web_widget_dropdown_dynamic Demo</field>
|
||||||
<field name="res_model">web.widget.dropdown.dynamic.example</field>
|
<field name="res_model">web.widget.dropdown.dynamic.example</field>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
</record>
|
</record>
|
||||||
<menuitem
|
<menuitem
|
||||||
|
|
Loading…
Reference in New Issue