summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2017-03-29 17:25:18 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit920df597d3d7174723736a395e94dc8ff413c70b (patch)
treeba6a333c245f097d9d64d0d2dc0b8babfa63c64d /addons/web/static/src/js
parentc5cf445462f43222a1982b613bd532018d6cad8e (diff)
[REF] barcode, *: update code to new JS framework
With the new views, the barcode mechanisms were completely broken, because the view and widget JS code was totally changed. This commit update and refactor all that code to make it work with the new design philosophy. Also, it update the coding style.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/core/mixins.js8
-rw-r--r--addons/web/static/src/js/services/data_manager.js2
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js8
3 files changed, 12 insertions, 6 deletions
diff --git a/addons/web/static/src/js/core/mixins.js b/addons/web/static/src/js/core/mixins.js
index 8a5038557c2..ae513b0b506 100644
--- a/addons/web/static/src/js/core/mixins.js
+++ b/addons/web/static/src/js/core/mixins.js
@@ -508,11 +508,11 @@ var ServicesMixin = {
this.trigger_up('do_action', {'action': action, options: options});
return def;
},
- do_notify: function (title, message, sticky) {
- this.trigger_up('notification', {title: title, message: message, sticky: sticky});
+ do_notify: function (title, message, sticky, className) {
+ this.trigger_up('notification', {title: title, message: message, sticky: sticky, className: className});
},
- do_warn: function (title, message, sticky) {
- this.trigger_up('warning', {title: title, message: message, sticky: sticky});
+ do_warn: function (title, message, sticky, className) {
+ this.trigger_up('warning', {title: title, message: message, sticky: sticky, className: className});
},
};
diff --git a/addons/web/static/src/js/services/data_manager.js b/addons/web/static/src/js/services/data_manager.js
index 1a4cebdc955..5d2bf18f1de 100644
--- a/addons/web/static/src/js/services/data_manager.js
+++ b/addons/web/static/src/js/services/data_manager.js
@@ -271,7 +271,7 @@ return core.Class.extend({
field.onChange = "1";
}
- if (field.views) {
+ if (!_.isEmpty(field.views)) {
// process the inner fields_view as well to find the fields they use.
// register those fields' description directly on the view.
// for those inner views, the list of all fields isn't necessary, so
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index f59cf96a881..ced26fb7cb2 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -1052,7 +1052,13 @@ var BasicModel = AbstractModel.extend({
defs.push(def);
break;
case 'CREATE':
- defs.push(this.addDefaultRecord(list.id));
+ if (command.data) {
+ defs.push(this.addDefaultRecord(list.id).then(function (id) {
+ return this.notifyChanges(id, command.data);
+ }));
+ } else {
+ defs.push(this.addDefaultRecord(list.id));
+ }
break;
case 'UPDATE':
defs.push(this._applyChange(command.id, command.data));