forked from Techsystech/web
Merge PR #2901 into 15.0
Signed-off-by CarlosRoca1315.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
commit
1bb95c2dd4
|
@ -29,6 +29,11 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
|
||||||
init: function (parent, name, value) {
|
init: function (parent, name, value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
// Define methods for the dialog binding the parent Object to make the
|
||||||
|
// actions on the correct context.
|
||||||
|
this.quickCreate = parent._quickCreate.bind(parent);
|
||||||
|
this.searchCreatePopup = parent._searchCreatePopup.bind(parent);
|
||||||
|
this.createContext = parent._createContext.bind(parent);
|
||||||
this._super(parent, {
|
this._super(parent, {
|
||||||
title: _.str.sprintf(_t("Create a %s"), this.name),
|
title: _.str.sprintf(_t("Create a %s"), this.name),
|
||||||
size: "medium",
|
size: "medium",
|
||||||
|
@ -37,14 +42,8 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
|
||||||
text: _t("Create"),
|
text: _t("Create"),
|
||||||
classes: "btn-primary",
|
classes: "btn-primary",
|
||||||
click: function () {
|
click: function () {
|
||||||
if (this.$("input").val()) {
|
this.quickCreate(this.value);
|
||||||
this.trigger_up("quick_create", {
|
this.close(true);
|
||||||
value: this.$("input").val(),
|
|
||||||
});
|
|
||||||
this.close(true);
|
|
||||||
} else {
|
|
||||||
this.$("input").focus();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -52,10 +51,8 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
|
||||||
classes: "btn-primary",
|
classes: "btn-primary",
|
||||||
close: true,
|
close: true,
|
||||||
click: function () {
|
click: function () {
|
||||||
this.trigger_up("search_create_popup", {
|
const valueContext = this.createContext(this.value);
|
||||||
view_type: "form",
|
this.searchCreatePopup("form", false, valueContext);
|
||||||
value: this.$("input").val(),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue