summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-03-16 16:11:12 +0100
committerChristophe Simonis <chs@odoo.com>2016-03-16 16:11:12 +0100
commit1a3e807fc2117a8d0be00e2ced9dbbae6f3589ba (patch)
tree3cb1bab30b4aae3368febd4356aad67f29b04136 /addons/web/static
parentadddfa0d8b6f0b323c032409302b1b37d0b85601 (diff)
parent5238b77430bf42589a8772d55d9ebd8dde8e9cf5 (diff)
[MERGE] forward port of branch saas-7 up to 5238b77
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/framework/pyeval.js12
-rw-r--r--addons/web/static/src/js/views/form_view.js3
-rw-r--r--addons/web/static/src/js/views/form_widgets.js14
3 files changed, 29 insertions, 0 deletions
diff --git a/addons/web/static/src/js/framework/pyeval.js b/addons/web/static/src/js/framework/pyeval.js
index ce25e7af534..2b553d37e0f 100644
--- a/addons/web/static/src/js/framework/pyeval.js
+++ b/addons/web/static/src/js/framework/pyeval.js
@@ -757,6 +757,12 @@ var wrapping_dict = py.type('wrapping_dict', null, {
__getattr__: function (key) {
return this.__getitem__(py.str.fromJSON(key));
},
+ __len__: function () {
+ return Object.keys(this._store).length
+ },
+ __nonzero__: function () {
+ return py.PY_size(this) > 0 ? py.True : py.False;
+ },
get: function () {
var args = py.PY_parseArgs(arguments, ['k', ['d', py.None]]);
@@ -780,6 +786,12 @@ var wrapping_list = py.type('wrapping_list', null, {
__getitem__: function (index) {
return wrap(this._store[index.toJSON()]);
},
+ __len__: function () {
+ return this._store.length;
+ },
+ __nonzero__: function () {
+ return py.PY_size(this) > 0 ? py.True : py.False;
+ },
fromJSON: function (ar) {
var instance = py.PY_call(wrapping_list);
instance._store = ar;
diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js
index 8b5905897b5..3f03c288841 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -74,6 +74,7 @@ var FormView = View.extend(common.FieldManagerMixin, {
"footer_to_buttons": false,
});
this.is_initialized = $.Deferred();
+ this.record_loaded = $.Deferred();
this.mutating_mutex = new utils.Mutex();
this.save_list = [];
this.render_value_defs = [];
@@ -361,6 +362,7 @@ var FormView = View.extend(common.FieldManagerMixin, {
this._actualize_mode();
this.set({ 'title' : record.id ? record.display_name : _t("New") });
+ this.record_loaded = $.Deferred();
_(this.fields).each(function (field, f) {
field._dirty_flag = false;
field._inhibit_on_change_flag = true;
@@ -376,6 +378,7 @@ var FormView = View.extend(common.FieldManagerMixin, {
self.on_form_changed();
self.rendering_engine.init_fields();
self.is_initialized.resolve();
+ self.record_loaded.resolve();
self.do_update_pager(record.id === null || record.id === undefined);
if (self.sidebar) {
self.sidebar.do_attachement_update(self.dataset, self.datarecord.id);
diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js
index fbc8a28e375..92782b5923a 100644
--- a/addons/web/static/src/js/views/form_widgets.js
+++ b/addons/web/static/src/js/views/form_widgets.js
@@ -436,6 +436,20 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin,
this._super.apply(this, arguments);
this.debug = session.debug;
},
+ start: function() {
+ var self = this;
+ var tmp = this._super();
+ if (this.options.model_field){
+ this.field_manager.fields[this.options.model_field].on("change:value", this, function(){
+ if (self.view && self.view.record_loaded.state == "resolved" && self.view.onchanges_mutex){
+ self.view.onchanges_mutex.def.then(function(){
+ self.render_value();
+ });
+ }
+ });
+ }
+ return tmp;
+ },
render_value: function() {
var self = this;