summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-04-19 12:58:55 +0200
committerChristophe Simonis <chs@odoo.com>2016-04-19 12:58:55 +0200
commit73fbadf8ae3377e2d16f5538a9feaab0d9f7d315 (patch)
treef08e309765d77d9d8e9455e88cf762ec42f0d974 /addons/web/static/src
parenteb443410ff0bd1bbec33a8d76dc9b279dbf34d70 (diff)
parent7c0442080295ca1add3fffcebb8014d2f0d72977 (diff)
[MERGE] forward port of branch 9.0 up to 7c04420
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/form_view.js5
-rw-r--r--addons/web/static/src/js/views/form_widgets.js19
-rw-r--r--addons/web/static/src/js/widgets/data_export.js3
-rw-r--r--addons/web/static/src/js/widgets/debug_manager.js4
-rw-r--r--addons/web/static/src/xml/base.xml4
5 files changed, 26 insertions, 9 deletions
diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js
index f5fcdea09a8..7be622c508c 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -833,7 +833,10 @@ var FormView = View.extend(common.FieldManagerMixin, {
def.reject();
},
};
- Dialog.confirm(this, message, options);
+ var dialog = Dialog.confirm(this, message, options);
+ dialog.$modal.on('hidden.bs.modal', function() {
+ def.reject();
+ });
return def;
},
/**
diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js
index 7f5e6c54da4..1214f6e2ce3 100644
--- a/addons/web/static/src/js/views/form_widgets.js
+++ b/addons/web/static/src/js/views/form_widgets.js
@@ -1530,13 +1530,20 @@ var FieldStatus = common.AbstractField.extend({
val = $li.data("id");
}
if (val != self.get('value')) {
- this.view.recursive_save().done(function() {
- var change = {};
- change[self.name] = val;
- self.view.dataset.write(self.view.datarecord.id, change).done(function() {
- self.view.reload();
+ if (!this.view.datarecord.id ||
+ this.view.datarecord.id.toString().match(data.BufferedDataSet.virtual_id_regex)) {
+ // don't save, only set value for not-yet-saved many2ones
+ self.set_value(val);
+ }
+ else {
+ this.view.recursive_save().done(function() {
+ var change = {};
+ change[self.name] = val;
+ self.view.dataset.write(self.view.datarecord.id, change).done(function() {
+ self.view.reload();
+ });
});
- });
+ }
}
},
});
diff --git a/addons/web/static/src/js/widgets/data_export.js b/addons/web/static/src/js/widgets/data_export.js
index a73020ce9b2..d1c10098586 100644
--- a/addons/web/static/src/js/widgets/data_export.js
+++ b/addons/web/static/src/js/widgets/data_export.js
@@ -6,6 +6,7 @@ var crash_manager = require('web.crash_manager');
var data = require('web.data');
var Dialog = require('web.Dialog');
var framework = require('web.framework');
+var pyeval = require('web.pyeval');
var QWeb = core.qweb;
var _t = core._t;
@@ -427,7 +428,7 @@ var DataExport = Dialog.extend({
fields: exported_fields,
ids: this.ids_to_export,
domain: this.domain,
- context: this.dataset.context,
+ context: pyeval.eval('contexts', [this.dataset._model.context()]),
import_compat: !!this.$el.find("#import_compat").val(),
})},
complete: framework.unblockUI,
diff --git a/addons/web/static/src/js/widgets/debug_manager.js b/addons/web/static/src/js/widgets/debug_manager.js
index 36a3a205632..5c6cfa60cfc 100644
--- a/addons/web/static/src/js/widgets/debug_manager.js
+++ b/addons/web/static/src/js/widgets/debug_manager.js
@@ -85,6 +85,10 @@ if (core.debug) {
},
get_metadata: function() {
var ds = this.dataset;
+ if (!this.view.get_selected_ids().length) {
+ console.warn(_t("No metadata available"));
+ return
+ }
ds.call('get_metadata', [this.view.get_selected_ids()]).done(function(result) {
new Dialog(this, {
title: _.str.sprintf(_t("Metadata (%s)"), ds.model),
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index f4e7e45740f..ff4b2afceba 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -204,7 +204,9 @@
</t>
<t t-name="WebClient.DebugDropdown">
<t t-if="active_view.type === 'form'">
- <li class="oe_metadata"><a href="#" data-action="get_metadata">View Metadata</a></li>
+ <t t-if="active_view.controller.get_selected_ids().length == 1">
+ <li class="oe_metadata"><a href="#" data-action="get_metadata">View Metadata</a></li>
+ </t>
<li class="oe_layout"><a href="#" data-action="toggle_layout_outline">Toggle Form Layout Outline</a></li>
<li class="oe_defaults"><a href="#" data-action="set_defaults">Set Defaults</a></li>
</t>