summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css120
-rw-r--r--addons/web/static/src/css/base.sass15
-rw-r--r--addons/web/static/src/js/data.js14
-rw-r--r--addons/web/static/src/js/view_form.js113
-rw-r--r--addons/web/static/src/js/view_list.js1
-rw-r--r--addons/web/static/src/js/view_list_editable.js20
-rw-r--r--addons/web/static/src/xml/base.xml3
7 files changed, 140 insertions, 146 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 67c42499e24..059b51b183e 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -217,7 +217,7 @@
background-clip: padding-box;
}
.openerp.ui-dialog .ui-dialog-content {
- padding: 0px;
+ padding: 0;
}
.openerp.ui-dialog .ui-dialog-titlebar, .openerp.ui-dialog .ui-dialog-content, .openerp.ui-dialog .ui-dialog-buttonpane {
padding: 16px;
@@ -1199,7 +1199,7 @@
color: white;
padding: 2px 4px;
margin: 1px 6px 0 0;
- border: 1px solid lightgrey;
+ border: 1px solid lightGray;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
@@ -1224,7 +1224,7 @@
transform: scale(1.1);
}
.openerp .oe_secondary_submenu .oe_active {
- border-top: 1px solid lightgrey;
+ border-top: 1px solid lightGray;
border-bottom: 1px solid #dedede;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2);
@@ -2149,7 +2149,7 @@
}
.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
font-size: 80%;
- color: darkgreen;
+ color: darkGreen;
vertical-align: top;
position: relative;
top: -4px;
@@ -2580,11 +2580,9 @@
.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
padding: 4px 6px 3px 6px;
}
-.openerp .oe_list.oe_list_editable td.oe_list_record_delete {
- position: absolute;
-}
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {
color: transparent;
+ text-shadow: none;
}
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {
visibility: hidden;
@@ -2892,73 +2890,75 @@
}
.openerp .oe_fileupload {
- display: inline-block;
- clear: both;
- width: 100%;
+ display: inline-block;
+ clear: both;
+ width: 100%;
}
.openerp .oe_fileupload .oe_add {
- float: left;
- position: relative;
- width: 100%;
- left: +2px;
- top: +7px;
-}
-.openerp .oe_fileupload .oe_add button{
- display: inline;
- height: 24px;
- font-size: 12px;
- line-height: 12px;
- vertical-align: middle;
+ float: left;
+ position: relative;
+ width: 100%;
+ left: 2px;
+ top: 7px;
+}
+.openerp .oe_fileupload .oe_add button {
+ display: inline;
+ height: 24px;
+ font-size: 12px;
+ line-height: 12px;
+ vertical-align: middle;
}
.openerp .oe_fileupload .oe_add button.oe_attach {
- width: 24px;
- overflow: hidden;
- background: transparent;
- color: #7C7BAD;
- box-shadow: none;
- border: none;
- text-shadow: none;
+ width: 24px;
+ overflow: hidden;
+ width: 24px;
+ overflow: hidden;
+ background: transparent;
+ color: #7c7bad;
+ box-shadow: none;
+ border: none;
+ text-shadow: none;
}
-.openerp .oe_fileupload .oe_add .oe_attach_label{
- color: #7C7BAD;
- margin-left: -3px;
+.openerp .oe_fileupload .oe_add button.oe_attach .oe_e {
+ position: relative;
+ top: -1px;
+ left: -9px;
}
-.openerp .oe_fileupload .oe_add button.oe_attach .oe_e{
- position: relative;
- top: -1px;
- left: -9px;
+.openerp .oe_fileupload .oe_add input.oe_form_binary_file {
+ display: inline-block;
+ margin-left: -5px;
+ height: 28px;
+ width: 52px;
+ margin-top: -26px;
}
-.openerp .oe_fileupload .oe_add input.oe_form_binary_file{
- display: inline-block;
- margin-left: -5px;
- height: 28px;
- width: 52px;
- margin-top: -26px;
+.openerp .oe_fileupload .oe_add .oe_attach_label {
+ color: #7c7bad;
+ margin-left: -3px;
}
.openerp .oe_fileupload .oe_attachments {
- margin-bottom: 4px;
- margin-right: 0px;
- font-size: 12px;
- border-radius: 2px;
- border: solid 1px rgba(124,123,173,0.14);
+ margin-bottom: 4px;
+ margin-right: 0px;
+ font-size: 12px;
+ border-radius: 2px;
+ border: solid 1px rgba(124, 123, 173, 0.14);
}
-.openerp .oe_fileupload .oe_attachments .oe_attachment{
- padding: 2px;
- padding-left: 4px;
- padding-right: 4px;
+.openerp .oe_fileupload .oe_attachments .oe_attachment {
+ padding: 2px;
+ padding-left: 4px;
+ padding-right: 4px;
}
-.openerp .oe_fileupload .oe_attachments .oe_attachment .oe_e{
- font-size: 23px;
- margin-top: -5px;
+.openerp .oe_fileupload .oe_attachments .oe_attachment .oe_e {
+ font-size: 23px;
+ margin-top: -5px;
}
-.openerp .oe_fileupload .oe_attachments .oe_attachment .oe_e:hover{
- text-decoration: none;
+.openerp .oe_fileupload .oe_attachments .oe_attachment .oe_e:hover {
+ text-decoration: none;
}
-.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(odd){
- background:white;
+.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(odd) {
+ background: white;
}
-.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(even){
- background: #F4F5FA;
+.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(even) {
+ background: #f4f5fa;
}
.kitten-mode-activated {
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index 5d2f0517dde..b96321a78f4 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -258,6 +258,7 @@ $sheet-padding: 16px
// so remove position:relative
.ui-tabs
position: static
+
// Modal box
&.ui-dialog
display: none
@@ -271,7 +272,7 @@ $sheet-padding: 16px
@include box-shadow(0 1px 12px rgba(0, 0, 0, 0.6))
@include background-clip()
.ui-dialog-content
- padding: 0px
+ padding: 0
.ui-dialog-titlebar, .ui-dialog-content, .ui-dialog-buttonpane
padding: 16px
.ui-dialog-titlebar
@@ -316,7 +317,7 @@ $sheet-padding: 16px
text-decoration: none
.oe_about
background-color: white
- background-image: url(data:image/pngbase64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
@include radius(0 0 2px 2px)
a
color: $link-color
@@ -692,7 +693,7 @@ $sheet-padding: 16px
// }}}
// Login {{{
.oe_login
- background-image: url(data:image/pngbase64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
text-align: center
font-size: 14px
height: 100%
@@ -1039,7 +1040,7 @@ $sheet-padding: 16px
// About openerp {{{
.oe_about
background-color: white
- background-image: url(data:image/pngbase64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
@include radius(0 0 2px 2px)
a
color: $link-color
@@ -2044,14 +2045,12 @@ $sheet-padding: 16px
.oe_list_content
td.oe_list_field_cell
padding: 4px 6px 3px 6px
- .oe_list.oe_list_editable
- td.oe_list_record_delete
- position: absolute
.oe_list.oe_list_editable.oe_editing
.oe_edition .oe_list_field_cell:not(.oe_readonly)
*
visibility: hidden
color: transparent
+ text-shadow: none
.oe_m2o_drop_down_button
top: 5px
.oe_m2o_cm_button
@@ -2347,7 +2346,7 @@ $sheet-padding: 16px
.oe_e:hover
text-decoration: none
.oe_attachment:nth-child(odd)
- background:white
+ background: white
.oe_attachment:nth-child(even)
background: #F4F5FA
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index e279ade6fb3..63c90f53758 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -471,7 +471,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
default_get: function(fields, options) {
options = options || {};
return this._model.call('default_get',
- [fields], {context: this._model.context(options.context)});
+ [fields], {context: this.get_context(options.context)});
},
/**
* Creates a new record in db
@@ -480,7 +480,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred}
*/
create: function(data) {
- return this._model.call('create', [data], {context: this._model.context()});
+ return this._model.call('create', [data], {context: this.get_context()});
},
/**
* Saves the provided data in an existing db record
@@ -493,7 +493,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
*/
write: function (id, data, options) {
options = options || {};
- return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options));
+ return this._model.call('write', [[id], data], {context: this.get_context(options.context)}).then(this.trigger('dataset_changed', id, data, options));
},
/**
* Deletes an existing record from the database
@@ -501,7 +501,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Number|String} ids identifier of the record to delete
*/
unlink: function(ids) {
- return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids));
+ return this._model.call('unlink', [ids], {context: this.get_context()}).then(this.trigger('dataset_changed', ids));
},
/**
* Calls an arbitrary RPC method
@@ -532,7 +532,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred}
*/
name_get: function(ids) {
- return this._model.call('name_get', [ids], {context: this._model.context()});
+ return this._model.call('name_get', [ids], {context: this.get_context()});
},
/**
*
@@ -556,7 +556,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param name
*/
name_create: function(name) {
- return this._model.call('name_create', [name], {context: this._model.context()});
+ return this._model.call('name_create', [name], {context: this.get_context()});
},
exec_workflow: function (id, signal) {
return this._model.exec_workflow(id, signal);
@@ -606,7 +606,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
return instance.session.rpc('/web/dataset/resequence', {
model: this.model,
ids: ids,
- context: this._model.context(options.context),
+ context: this.get_context(options.context),
}).pipe(function (results) {
return results;
});
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index a1c85f6c996..ed088e50d96 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -441,7 +441,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var onchange = _.str.trim(on_change);
var call = onchange.match(/^\s?(.*?)\((.*?)\)\s?$/);
if (!call) {
- return null;
+ throw new Error("Wrong on change format: " + onchange);
}
var method = call[1];
@@ -508,71 +508,59 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var self = this;
return this.on_change_mutex.exec(function() {
try {
- var response = {}, can_process_onchange = $.Deferred();
+ var def;
processed = processed || [];
processed.push(widget.name);
var on_change = widget.node.attrs.on_change;
if (on_change) {
var change_spec = self.parse_on_change(on_change, widget);
- if (change_spec) {
- var ajax = {
- url: '/web/dataset/onchange',
- async: false
- };
- can_process_onchange = self.rpc(ajax, {
- model: self.dataset.model,
- method: change_spec.method,
- args: [(self.datarecord.id == null ? [] : [self.datarecord.id])].concat(change_spec.args),
- context_id: change_spec.context_index == undefined ? null : change_spec.context_index + 1
- }).then(function(r) {
- _.extend(response, r);
- });
- } else {
- console.warn("Wrong on_change format", on_change);
- }
- }
- // fail if onchange failed
- if (can_process_onchange.isRejected()) {
- return can_process_onchange;
+ def = self.rpc('/web/dataset/onchange', {
+ model: self.dataset.model,
+ method: change_spec.method,
+ args: [(self.datarecord.id == null ? [] : [self.datarecord.id])].concat(change_spec.args),
+ context_id: change_spec.context_index == undefined ? null : change_spec.context_index + 1
+ });
+ } else {
+ def = $.when({});
}
-
- if (widget.field['change_default']) {
- var fieldname = widget.name, value_;
- if (response.value && (fieldname in response.value)) {
- // Use value from onchange if onchange executed
- value_ = response.value[fieldname];
- } else {
- // otherwise get form value for field
- value_ = self.fields[fieldname].get_value();
- }
- var condition = fieldname + '=' + value_;
-
- if (value_) {
- can_process_onchange = self.rpc({
- url: '/web/dataset/call',
- async: false
- }, {
- model: 'ir.values',
- method: 'get_defaults',
- args: [self.model, condition]
- }).then(function (results) {
- if (!results.length) { return; }
- if (!response.value) {
- response.value = {};
- }
- for(var i=0; i<results.length; ++i) {
- // [whatever, key, value]
- var triplet = results[i];
- response.value[triplet[1]] = triplet[2];
- }
- });
+ return def.pipe(function(response) {
+ if (widget.field['change_default']) {
+ var fieldname = widget.name
+ var value_;
+ if (response.value && (fieldname in response.value)) {
+ // Use value from onchange if onchange executed
+ value_ = response.value[fieldname];
+ } else {
+ // otherwise get form value for field
+ value_ = self.fields[fieldname].get_value();
+ }
+ var condition = fieldname + '=' + value_;
+
+ if (value_) {
+ return self.rpc('/web/dataset/call', {
+ model: 'ir.values',
+ method: 'get_defaults',
+ args: [self.model, condition]
+ }).pipe(function (results) {
+ if (!results.length) {
+ return response;
+ }
+ if (!response.value) {
+ response.value = {};
+ }
+ for(var i=0; i<results.length; ++i) {
+ // [whatever, key, value]
+ var triplet = results[i];
+ response.value[triplet[1]] = triplet[2];
+ }
+ return response;
+ });
+ }
}
- }
- if (can_process_onchange.isRejected()) {
- return can_process_onchange;
- }
-
- return self.on_processed_onchange(response, processed);
+ return response;
+ }).pipe(function(response) {
+ return self.on_processed_onchange(response, processed);
+ });
} catch(e) {
console.error(e);
instance.webclient.crashmanager.show_message(e);
@@ -2981,7 +2969,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
self.uned_def = $.Deferred();
var ed_delay = 200;
var ed_duration = 15000;
- var anyoneLoosesFocus = function() {
+ var anyoneLoosesFocus = function (e) {
var used = false;
if (self.floating) {
if (self.last_search.length > 0) {
@@ -3005,7 +2993,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
self.ed_def = $.Deferred();
self.ed_def.then(function() {
self.show_error_displayer();
+ ignore_blur = false;
+ self.trigger('focused');
});
+ ignore_blur = true;
setTimeout(function() {
self.ed_def.resolve();
self.uned_def.reject();
@@ -3335,7 +3326,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
e.cancel = true;
});
_(controller.columns).find(function (column) {
- if (!column instanceof instance.web.list.Handle) {
+ if (!(column instanceof instance.web.list.Handle)) {
return false;
}
column.modifiers.invisible = true;
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 5546105e901..fd74fd8922b 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -1100,7 +1100,6 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
}, this);
if (!this.$current) { return; }
this.$current.remove();
- this.$current = null;
},
get_records: function () {
return this.records.map(function (record) {
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index acc1d781976..021e5549c18 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -252,9 +252,10 @@ openerp.web.list_editable = function (instance) {
var position = $cell.position();
field.set_dimensions($cell.outerHeight(), $cell.outerWidth());
- field.$el.css({
- top: position.top,
- left: position.left,
+ field.$el.position({
+ my: 'left top',
+ at: 'left top',
+ of: $cell
});
},
/**
@@ -410,15 +411,15 @@ openerp.web.list_editable = function (instance) {
});
this.editor.$el.on('keyup keydown', function (e) {
- if (!self.editor.is_editing()) { return; }
+ if (!self.editor.is_editing()) { return true; }
var key = _($.ui.keyCode).chain()
.map(function (v, k) { return {name: k, code: v}; })
.find(function (o) { return o.code === e.which; })
.value();
- if (!key) { return; }
+ if (!key) { return true; }
var method = e.type + '_' + key.name;
- if (!(method in self)) { return; }
- self[method](e);
+ if (!(method in self)) { return true; }
+ return self[method](e);
});
},
/**
@@ -446,7 +447,10 @@ openerp.web.list_editable = function (instance) {
keyup_ENTER: function () {
return this._next();
},
- keyup_ESCAPE: function () {
+ keydown_ESCAPE: function (e) {
+ return false;
+ },
+ keyup_ESCAPE: function (e) {
return this.cancel_edition();
},
/**
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index bdb21952e23..a08fc9dc78c 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1190,7 +1190,8 @@
<input type="hidden" name="session_id" value=""/>
<input type="hidden" name="callback" t-att-value="fileupload_id"/>
<t t-raw="__content__"/>
- <input type="file" class="oe_form_binary_file" name="ufile"/>
+ <input type="file" class="oe_form_binary_file" name="ufile" t-if="widget.widget!='image'"/>
+ <input type="file" class="oe_form_binary_file" name="ufile" accept="image/*" t-if="widget.widget=='image'"/>
</form>
<iframe t-att-id="fileupload_id" t-att-name="fileupload_id" style="display: none"/>
</div>