form ro by default fix namespace
bzr revid: al@openerp.com-20120409233615-u13xttozjdmzqqcr
This commit is contained in:
parent
d7d69a26c9
commit
bd579db499
|
@ -831,12 +831,11 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.openerp2 .oe-view-manager-header .button-group .active {
|
.openerp2 .oe-view-manager-header .button-group .active {
|
||||||
|
width: 100%;
|
||||||
background: #999999;
|
background: #999999;
|
||||||
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
|
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
|
||||||
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
|
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
|
||||||
-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
|
-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
|
||||||
}
|
|
||||||
.openerp2 .oe-view-manager-header .button-group .active a {
|
|
||||||
color: white;
|
color: white;
|
||||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
|
@ -928,78 +927,30 @@
|
||||||
.openerp2 .oe_view_manager_header .oe_view_manager_pager {
|
.openerp2 .oe_view_manager_header .oe_view_manager_pager {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch {
|
.openerp2 .oe_view_manager_switch li {
|
||||||
float: right;
|
padding-left: 1px;
|
||||||
margin: 2px 0 0 0;
|
text-align: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_form,
|
.openerp2 .oe_view_manager_switch .oe_vm_switch_list:after, .openerp2 .oe_view_manager_switch .oe_vm_switch_tree:after {
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_page,
|
content: "ö";
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_tree,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_list,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_graph,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_gantt,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_calendar,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_kanban,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_diagram {
|
|
||||||
background: url("/web/static/src/img/views-icons-a.png") repeat-x scroll left top transparent;
|
|
||||||
overflow: hidden;
|
|
||||||
width: 22px;
|
|
||||||
height: 21px;
|
|
||||||
border: none;
|
|
||||||
background-position: 0px 0px;
|
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_form span,
|
.openerp2 .oe_view_manager_switch .oe_vm_switch_graph:after {
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_page span,
|
content: "ó";
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_tree span,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_list span,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_graph span,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_gantt span,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_calendar span,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_kanban span,
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_diagram span {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_list, .openerp2 .oe_view_manager_switch .oe_vm_switch_tree {
|
.openerp2 .oe_view_manager_switch .oe_vm_switch_gantt:after {
|
||||||
background-position: 0px 0px;
|
content: "y";
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_list:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_list:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_list:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_list.oe_view_manager_switch_selected, .openerp2 .oe_view_manager_switch .oe_vm_switch_tree:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_tree:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_tree:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_tree.oe_view_manager_switch_selected {
|
.openerp2 .oe_view_manager_switch .oe_vm_switch_calendar:after {
|
||||||
background-position: 0px -21px;
|
content: "b";
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_form, .openerp2 .oe_view_manager_switch .oe_vm_switch_page {
|
.openerp2 .oe_view_manager_switch .oe_vm_switch_kanban:after {
|
||||||
background-position: -22px 0px;
|
content: "ó";
|
||||||
}
|
}
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_form:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_form:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_form:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_form.oe_view_manager_switch_selected, .openerp2 .oe_view_manager_switch .oe_vm_switch_page:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_page:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_page:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_page.oe_view_manager_switch_selected {
|
.openerp2 .oe_view_manager_switch .oe_vm_switch_diagram:after {
|
||||||
background-position: -22px -21px;
|
content: "}";
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_graph {
|
|
||||||
background-position: -44px 0px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_graph:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_graph:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_graph:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_graph.oe_view_manager_switch_selected {
|
|
||||||
background-position: -44px -21px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_gantt {
|
|
||||||
background-position: -66px 0px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_gantt:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_gantt:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_gantt:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_gantt.oe_view_manager_switch_selected {
|
|
||||||
background-position: -66px -21px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_calendar {
|
|
||||||
background-position: -88px 0px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_calendar:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_calendar:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_calendar:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_calendar.oe_view_manager_switch_selected {
|
|
||||||
background-position: -88px -21px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_kanban {
|
|
||||||
background-position: -110px 0px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_kanban:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_kanban:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_kanban:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_kanban.oe_view_manager_switch_selected {
|
|
||||||
background-position: -110px -21px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_diagram {
|
|
||||||
background-position: 0px 0px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_view_manager_switch .oe_vm_switch_diagram:active, .openerp2 .oe_view_manager_switch .oe_vm_switch_diagram:hover, .openerp2 .oe_view_manager_switch .oe_vm_switch_diagram:focus, .openerp2 .oe_view_manager_switch .oe_vm_switch_diagram.oe_view_manager_switch_selected {
|
|
||||||
background-position: 0px -21px;
|
|
||||||
}
|
}
|
||||||
.openerp2 .oe_form_dropdown_section {
|
.openerp2 .oe_form_dropdown_section {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -1606,28 +1557,6 @@
|
||||||
.openerp2 .oe_form .oe_form_field_progressbar.ui-progressbar .ui-widget-header {
|
.openerp2 .oe_form .oe_form_field_progressbar.ui-progressbar .ui-widget-header {
|
||||||
background: #cccccc url(/web/static/lib/jquery.ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
|
background: #cccccc url(/web/static/lib/jquery.ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
|
||||||
}
|
}
|
||||||
.openerp2 .oe_form .oe_form_field_progressbar.ui-progressbar {
|
|
||||||
height: 22px;
|
|
||||||
font-size: 10px;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
-ms-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid #999999;
|
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
background: white;
|
|
||||||
min-width: 90px;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_form .oe_form_field_progressbar.ui-progressbar span {
|
|
||||||
position: absolute;
|
|
||||||
margin-left: 10px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_form .oe_form_field_progressbar.ui-progressbar .ui-widget-header {
|
|
||||||
background: #cccccc url(/web/static/lib/jquery.ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
|
|
||||||
}
|
|
||||||
.openerp2 .oe_form .oe_view_manager_row:first-child {
|
.openerp2 .oe_form .oe_view_manager_row:first-child {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
openerp.web.form = function (openerp) {
|
openerp.web.form = function (openerp) {
|
||||||
|
|
||||||
var _t = openerp.web._t,
|
var _t = openerp.web._t,
|
||||||
_lt = openerp.web._lt;
|
_lt = openerp.web._lt;
|
||||||
var QWeb = openerp.web.qweb;
|
var QWeb = openerp.web.qweb;
|
||||||
|
|
||||||
|
/** @namespace */
|
||||||
|
openerp.web.form = {};
|
||||||
|
|
||||||
openerp.web.views.add('form', 'openerp.web.FormView');
|
openerp.web.views.add('form', 'openerp.web.FormView');
|
||||||
openerp.web.FormView = openerp.web.View.extend({
|
openerp.web.FormView = openerp.web.View.extend({
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +51,8 @@ openerp.web.FormView = openerp.web.View.extend({
|
||||||
this.mutating_mutex = new $.Mutex();
|
this.mutating_mutex = new $.Mutex();
|
||||||
this.on_change_mutex = new $.Mutex();
|
this.on_change_mutex = new $.Mutex();
|
||||||
this.reload_mutex = new $.Mutex();
|
this.reload_mutex = new $.Mutex();
|
||||||
this.rendering_engine = new openerp.web.FormRenderingEngine(this);
|
this.mode = null;
|
||||||
|
this.rendering_engine = new openerp.web.form.FormRenderingEngineReadonly(this);
|
||||||
},
|
},
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
_.each(this.get_widgets(), function(w) {
|
_.each(this.get_widgets(), function(w) {
|
||||||
|
@ -103,6 +106,7 @@ openerp.web.FormView = openerp.web.View.extend({
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
this.do_switch_mode("view");
|
||||||
this.has_been_loaded.resolve();
|
this.has_been_loaded.resolve();
|
||||||
return $.when();
|
return $.when();
|
||||||
},
|
},
|
||||||
|
@ -432,31 +436,30 @@ openerp.web.FormView = openerp.web.View.extend({
|
||||||
},
|
},
|
||||||
do_switch_mode: function(mode) {
|
do_switch_mode: function(mode) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if(mode) {
|
if(mode=="view") {
|
||||||
self.$buttons.find('.oe_form_buttons_edit').show();
|
|
||||||
self.$buttons.find('.oe_form_buttons_view').hide();
|
|
||||||
_.each(this.fields,function(field){
|
|
||||||
field.set({"force_readonly": false});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
self.$buttons.find('.oe_form_buttons_edit').hide();
|
self.$buttons.find('.oe_form_buttons_edit').hide();
|
||||||
self.$buttons.find('.oe_form_buttons_view').show();
|
self.$buttons.find('.oe_form_buttons_view').show();
|
||||||
_.each(this.fields,function(field){
|
_.each(this.fields,function(field){
|
||||||
field.set({"force_readonly": true});
|
field.set({"force_readonly": true});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
self.$buttons.find('.oe_form_buttons_edit').show();
|
||||||
|
self.$buttons.find('.oe_form_buttons_view').hide();
|
||||||
|
_.each(this.fields,function(field){
|
||||||
|
field.set({"force_readonly": false});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
self.mode = mode;
|
||||||
},
|
},
|
||||||
on_button_save: function() {
|
on_button_save: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
return this.do_save().then(function(result) {
|
return this.do_save().then(function(result) {
|
||||||
self.do_switch_mode(0);
|
self.do_switch_mode("view");
|
||||||
self.do_prev_view({'created': result.created, 'default': 'form'});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
on_button_cancel: function() {
|
on_button_cancel: function() {
|
||||||
if (this.can_be_discarded()) {
|
if (this.can_be_discarded()) {
|
||||||
this.do_switch_mode(0);
|
this.do_switch_mode("view");
|
||||||
return this.do_prev_view({'default': 'form'});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_button_new: function() {
|
on_button_new: function() {
|
||||||
|
@ -479,11 +482,12 @@ openerp.web.FormView = openerp.web.View.extend({
|
||||||
return def.promise();
|
return def.promise();
|
||||||
},
|
},
|
||||||
on_button_edit: function() {
|
on_button_edit: function() {
|
||||||
return this.do_switch_mode(1);
|
return this.do_switch_mode("edit");
|
||||||
},
|
},
|
||||||
on_button_create: function() {
|
on_button_create: function() {
|
||||||
this.dataset.index = null;
|
this.dataset.index = null;
|
||||||
return this.do_switch_mode(1);
|
this.do_switch_mode("edit");
|
||||||
|
this.do_show();
|
||||||
},
|
},
|
||||||
on_button_duplicate: function() {
|
on_button_duplicate: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -637,10 +641,10 @@ openerp.web.FormView = openerp.web.View.extend({
|
||||||
reload: function() {
|
reload: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
return this.reload_mutex.exec(function() {
|
return this.reload_mutex.exec(function() {
|
||||||
//if (this.dataset.index == null) {
|
if (this.dataset.index == null) {
|
||||||
// this.do_prev_view();
|
this.do_prev_view();
|
||||||
// return $.Deferred().reject().promise();
|
return $.Deferred().reject().promise();
|
||||||
//}
|
}
|
||||||
if (self.dataset.index == null || self.dataset.index < 0) {
|
if (self.dataset.index == null || self.dataset.index < 0) {
|
||||||
return $.when(self.on_button_new());
|
return $.when(self.on_button_new());
|
||||||
} else {
|
} else {
|
||||||
|
@ -779,7 +783,7 @@ openerp.web.FormView = openerp.web.View.extend({
|
||||||
/**
|
/**
|
||||||
* Interface to be implemented by rendering engines for the form view.
|
* Interface to be implemented by rendering engines for the form view.
|
||||||
*/
|
*/
|
||||||
openerp.web.FormRenderingEngineInterface = {
|
openerp.web.form.FormRenderingEngineInterface = {
|
||||||
set_fields_view: function(fields_view) {},
|
set_fields_view: function(fields_view) {},
|
||||||
render_to: function($element) {},
|
render_to: function($element) {},
|
||||||
};
|
};
|
||||||
|
@ -789,7 +793,7 @@ openerp.web.FormRenderingEngineInterface = {
|
||||||
*
|
*
|
||||||
* It is necessary to set the view using set_view() before usage.
|
* It is necessary to set the view using set_view() before usage.
|
||||||
*/
|
*/
|
||||||
openerp.web.FormRenderingEngine = openerp.web.Class.extend({
|
openerp.web.form.FormRenderingEngine = openerp.web.Class.extend({
|
||||||
init: function(view) {
|
init: function(view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.legacy_mode = false;
|
this.legacy_mode = false;
|
||||||
|
@ -1104,7 +1108,13 @@ openerp.web.FormRenderingEngine = openerp.web.Class.extend({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.FormDialog = openerp.web.Dialog.extend({
|
openerp.web.form.FormRenderingEngineReadonly = openerp.web.form.FormRenderingEngine.extend({
|
||||||
|
alter_field: function(field) {
|
||||||
|
field.set({"force_readonly": true});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
openerp.web.form.FormDialog = openerp.web.Dialog.extend({
|
||||||
init: function(parent, options, view_id, dataset) {
|
init: function(parent, options, view_id, dataset) {
|
||||||
this._super(parent, options);
|
this._super(parent, options);
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
|
@ -1135,15 +1145,12 @@ openerp.web.FormDialog = openerp.web.Dialog.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @namespace */
|
|
||||||
openerp.web.form = {};
|
|
||||||
|
|
||||||
openerp.web.form.SidebarAttachments = openerp.web.OldWidget.extend({
|
openerp.web.form.SidebarAttachments = openerp.web.Widget.extend({
|
||||||
init: function(parent, form_view) {
|
init: function(parent, form_view) {
|
||||||
//var $section = parent.add_section(_t('Attachments'), 'attachments');
|
//var $section = parent.add_section(_t('Attachments'), 'attachments');
|
||||||
//this.$div = $('<div class="oe-sidebar-attachments"></div>');
|
//this.$div = $('<div class="oe-sidebar-attachments"></div>');
|
||||||
//$section.append(this.$div);
|
//$section.append(this.$div);
|
||||||
|
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
this.view = form_view;
|
this.view = form_view;
|
||||||
},
|
},
|
||||||
|
|
|
@ -23,7 +23,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
||||||
records : {}
|
records : {}
|
||||||
};
|
};
|
||||||
this.groups = [];
|
this.groups = [];
|
||||||
this.form_dialog = new openerp.web.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start();
|
this.form_dialog = new openerp.web.form.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start();
|
||||||
this.form_dialog.on_form_dialog_saved.add_last(this.do_reload);
|
this.form_dialog.on_form_dialog_saved.add_last(this.do_reload);
|
||||||
this.aggregates = {};
|
this.aggregates = {};
|
||||||
this.group_operators = ['avg', 'max', 'min', 'sum', 'count'];
|
this.group_operators = ['avg', 'max', 'min', 'sum', 'count'];
|
||||||
|
|
Loading…
Reference in New Issue