summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2015-08-21 11:09:25 +0200
committerqsm-odoo <qsm@odoo.com>2015-08-21 14:31:11 +0200
commit99faa6addd245e661fe5af4ffbec74c3fba809a5 (patch)
tree76b2a5f733a91e5a71f02bc1132a2a1ade0c6f2e /addons/web/static
parent2a3f359ae85ee5bdbdfc84c2bc383430a26526e5 (diff)
[FIX] web: M2ODialog, adaptation to new Dialog API
(backport from the enterprise version) The M2ODialog still used the old Dialog API.
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js39
-rw-r--r--addons/web/static/src/xml/base.xml5
2 files changed, 19 insertions, 25 deletions
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js
index 6b4f79541f4..d1d1378b92b 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -26,30 +26,29 @@ var M2ODialog = Dialog.extend({
this._super(parent, {
title: _.str.sprintf(_t("Create a %s"), parent.string),
size: 'medium',
+ buttons: [
+ {text: _t('Create'), classes: 'btn-primary', click: function() {
+ if (this.$("input").val() !== ''){
+ this.getParent()._quick_create(this.$("input").val());
+ this.close();
+ } else {
+ e.preventDefault();
+ this.$("input").focus();
+ }
+ }},
+
+ {text: _t('Create and edit'), classes: 'btn-primary', close: true, click: function() {
+ this.getParent()._search_create_popup("form", undefined, this.getParent()._create_context(this.$("input").val()));
+ }},
+
+ {text: _t('Cancel'), close: true}
+ ]
});
},
start: function() {
- var self = this;
- var text = _.str.sprintf(_t("You are creating a new %s, are you sure it does not exist yet?"), self.name);
- this.$("p").text( text );
- this.$buttons.html(QWeb.render("M2ODialog.buttons"));
+ var text = _.str.sprintf(_t("You are creating a new %s, are you sure it does not exist yet?"), this.name);
+ this.$("p").text(text);
this.$("input").val(this.getParent().$input.val());
- this.$buttons.find(".oe_form_m2o_qc_button").click(function(e){
- if (self.$("input").val() !== ''){
- self.getParent()._quick_create(self.$("input").val());
- self.destroy();
- } else{
- e.preventDefault();
- self.$("input").focus();
- }
- });
- this.$buttons.find(".oe_form_m2o_sc_button").click(function(){
- self.getParent()._search_create_popup("form", undefined, self.getParent()._create_context(self.$("input").val()));
- self.destroy();
- });
- this.$buttons.find(".oe_form_m2o_cancel_button").click(function(){
- self.destroy();
- });
},
});
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 7c560c3557f..dc67b36381e 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1380,11 +1380,6 @@
Name: <input class="oe_form_m2o_input_name" type="text"/>
</div>
</t>
-<t t-name="M2ODialog.buttons">
- <button class="oe_form_m2o_qc_button btn btn-primary">Create</button>
- <button class="oe_form_m2o_sc_button btn btn-default">Create and edit</button>
- <button class="oe_form_m2o_cancel_button btn btn-default"><span>Cancel</span></button>
-</t>
<t t-name="FieldMonetary" t-extend="FieldChar">
<t t-jquery="t:first" t-operation="before">
<t t-if="widget.get('currency_info') and widget.get('currency_info').position === 'before'">