[merge]
bzr revid: nicolas.vanhoren@openerp.com-20110606114435-m14zpzhbwxgnruc0
This commit is contained in:
@@ -480,8 +480,8 @@ class View(openerpweb.Controller):
|
||||
else:
|
||||
xml = ElementTree.fromstring(fvg['arch'])
|
||||
fvg['arch'] = Xml2Json.convert_element(xml)
|
||||
for field in fvg["fields"].values():
|
||||
if field["views"]:
|
||||
for field in fvg['fields'].values():
|
||||
if field.has_key('views') and field['views']:
|
||||
for view in field["views"].values():
|
||||
self.process_view(session, view, None, transform)
|
||||
|
||||
@@ -496,11 +496,14 @@ class View(openerpweb.Controller):
|
||||
return {'result': True}
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def undo_custom(self, request, view_id):
|
||||
def undo_custom(self, request, view_id, reset=False):
|
||||
CustomView = request.session.model('ir.ui.view.custom')
|
||||
vcustom = CustomView.search([('user_id', '=', request.session._uid), ('ref_id' ,'=', view_id)])
|
||||
if vcustom:
|
||||
CustomView.unlink([vcustom[0]])
|
||||
if reset:
|
||||
CustomView.unlink(vcustom)
|
||||
else:
|
||||
CustomView.unlink([vcustom[0]])
|
||||
return {'result': True}
|
||||
return {'result': False}
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormV
|
||||
this.datarecord = record;
|
||||
for (var f in this.fields) {
|
||||
var field = this.fields[f];
|
||||
field.touched = false;
|
||||
field.set_value(this.datarecord[f] || false);
|
||||
field.validate();
|
||||
field.touched = false;
|
||||
}
|
||||
if (!record.id) {
|
||||
// New record: Second pass in order to trigger the onchanges
|
||||
@@ -750,6 +750,7 @@ openerp.base.form.FieldFloat = openerp.base.form.FieldChar.extend({
|
||||
set_value: function(value) {
|
||||
if (!value) {
|
||||
// As in GTK client, floats default to 0
|
||||
this.touched = this.view.touched = true;
|
||||
value = 0;
|
||||
}
|
||||
this._super.apply(this, [value]);
|
||||
|
||||
@@ -18,6 +18,7 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
|
||||
// Events
|
||||
this.$element.find('.oe-dashboard-link-undo').click(this.on_undo);
|
||||
this.$element.find('.oe-dashboard-link-reset').click(this.on_reset);
|
||||
this.$element.find('.oe-dashboard-link-add_widget').click(this.on_add_widget);
|
||||
this.$element.find('.oe-dashboard-link-change_layout').click(this.on_change_layout);
|
||||
this.$element.find('.oe-dashboard-column .ui-icon-minusthick').click(this.on_fold_action);
|
||||
@@ -42,6 +43,12 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
view_id: this.view.fields_view.view_id
|
||||
}, this.do_reload);
|
||||
},
|
||||
on_reset: function() {
|
||||
this.rpc('/base/view/undo_custom', {
|
||||
view_id: this.view.fields_view.view_id,
|
||||
reset: true
|
||||
}, this.do_reload);
|
||||
},
|
||||
on_add_widget: function() {
|
||||
},
|
||||
on_change_layout: function() {
|
||||
@@ -112,7 +119,7 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
view_id: this.view.fields_view.view_id,
|
||||
arch: arch
|
||||
}, function() {
|
||||
self.$element.find('.oe-dashboard-link-undo').show();
|
||||
self.$element.find('.oe-dashboard-link-undo, .oe-dashboard-link-reset').show();
|
||||
});
|
||||
},
|
||||
on_load_action: function(result) {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<t t-name="DashBoard">
|
||||
<div class="oe-dashboard-links">
|
||||
<button type="button" class="button oe-dashboard-link-reset" t-att-style="view.fields_view.custom_view_id ? null : 'display: none'">
|
||||
<img src="/base/static/src/img/icons/STOCK_GOTO_FIRST.png" width="16" height="16"/>
|
||||
<span>Reset</span>
|
||||
</button>
|
||||
<button type="button" class="button oe-dashboard-link-undo" t-att-style="view.fields_view.custom_view_id ? null : 'display: none'">
|
||||
<img src="/base/static/src/img/icons/gtk-undo.png" width="16" height="16"/>
|
||||
<span>Undo</span>
|
||||
|
||||
Reference in New Issue
Block a user