[IMP] rename method _is_action_enabled to is_action_enabled

bzr revid: rco@openerp.com-20120904141155-288vwhonbt07dfcs
This commit is contained in:
Raphael Collet 2012-09-04 16:11:55 +02:00
parent 440b8aabbd
commit 14e87c09f3
9 changed files with 20 additions and 20 deletions

View File

@ -148,12 +148,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
if (this.fields_view.toolbar) {
this.sidebar.add_toolbar(this.fields_view.toolbar);
}
if (self._is_action_enabled('delete')) {
if (self.is_action_enabled('delete')) {
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: self.on_button_delete }
]);
}
if (self._is_action_enabled('create')) {
if (self.is_action_enabled('create')) {
this.sidebar.add_items('other', [
{ label: _t('Duplicate'), callback: self.on_button_duplicate }
]);
@ -3485,7 +3485,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments);
},
form_view_options: {'not_interactible_on_create':true},
readonly: !this._is_action_enabled('edit') || self.o2m.get("effective_readonly")
readonly: !this.is_action_enabled('edit') || self.o2m.get("effective_readonly")
});
},
do_button_action: function (name, id, callback) {
@ -3573,7 +3573,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
});
instance.web.form.One2ManyList = instance.web.ListView.List.extend({
pad_table_to: function (count) {
this._super(this.view._is_action_enabled('create') ? (count > 0 ? count - 1 : 0) : this.records.length);
this._super(this.view.is_action_enabled('create') ? (count > 0 ? count - 1 : 0) : this.records.length);
// magical invocation of wtf does that do
if (this.view.o2m.get('effective_readonly')) {
@ -3586,7 +3586,7 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({
}).length;
if (this.options.selectable) { columns++; }
if (this.options.deletable) { columns++; }
if (this.view._is_action_enabled('create')) {
if (this.view.is_action_enabled('create')) {
var $cell = $('<td>', {
colspan: columns,
'class': 'oe_form_field_one2many_list_row_add'

View File

@ -252,13 +252,13 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.$el.addClass(this.fields_view.arch.attrs['class']);
// add css classes that reflect the (absence of) access rights
if (!this._is_action_enabled('create')) {
if (!this.is_action_enabled('create')) {
this.$el.addClass('oe_list_cannot_create');
}
if (!this._is_action_enabled('edit')) {
if (!this.is_action_enabled('edit')) {
this.$el.addClass('oe_list_cannot_edit');
}
if (!this._is_action_enabled('delete')) {
if (!this.is_action_enabled('delete')) {
this.$el.addClass('oe_list_cannot_delete');
}
@ -363,7 +363,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
if (!this.sidebar && this.options.$sidebar) {
this.sidebar = new instance.web.Sidebar(this);
this.sidebar.appendTo(this.options.$sidebar);
if (self._is_action_enabled('create')) {
if (self.is_action_enabled('create')) {
this.sidebar.add_items('other', [
{ label: _t("Import"), callback: this.on_sidebar_import }
]);
@ -371,7 +371,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.sidebar.add_items('other', [
{ label: _t("Export"), callback: this.on_sidebar_export }
]);
if (self._is_action_enabled('delete')) {
if (self.is_action_enabled('delete')) {
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: this.do_delete_selected }
]);

View File

@ -750,7 +750,7 @@ openerp.web.list_editable = function (instance) {
instance.web.ListView.List.include(/** @lends instance.web.ListView.List# */{
row_clicked: function (event) {
if (!this.view.editable() || ! this.view._is_action_enabled('edit')) {
if (!this.view.editable() || ! this.view.is_action_enabled('edit')) {
return this._super.apply(this, arguments);
}
var record_id = $(event.currentTarget).data('id');

View File

@ -1363,7 +1363,7 @@ instance.web.View = instance.web.Widget.extend({
* An action is disabled by setting the corresponding attribute in the view's main element,
* like: <form string="" create="false" edit="false" delete="false">
*/
_is_action_enabled: function(action) {
is_action_enabled: function(action) {
return (_.has(this.fields_view.arch.attrs, action)) ? JSON.parse(this.fields_view.arch.attrs[action]) : true;
}
});

View File

@ -649,7 +649,7 @@
</tfoot>
</table>
<div t-name="ListView.buttons" class="oe_list_buttons">
<t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable and widget._is_action_enabled('create')">
<t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable and widget.is_action_enabled('create')">
<button type="button" class="oe_button oe_list_add oe_highlight">
<t t-esc="widget.options.addable"/>
</button>
@ -725,12 +725,12 @@
<div t-name="FormView.buttons" class="oe_form_buttons">
<t t-if="widget.options.action_buttons !== false">
<span class="oe_form_buttons_view">
<t t-if="widget._is_action_enabled('edit')">
<t t-if="widget.is_action_enabled('edit')">
<div style="display: inline-block;"> <!-- required for the bounce effect on button -->
<button type="button" class="oe_button oe_form_button_edit" accesskey="E">Edit</button>
</div>
</t>
<t t-if="widget._is_action_enabled('create')">
<t t-if="widget.is_action_enabled('create')">
<button type="button" class="oe_button oe_form_button_create" accesskey="C">Create</button>
</t>
</span>

View File

@ -2,7 +2,7 @@
<t t-name="DiagramView">
<div class="oe_diagram_header" t-att-id="element_id + '_header'">
<h3 class="oe_diagram_title"/>
<t t-if="widget._is_action_enabled('create')">
<t t-if="widget.is_action_enabled('create')">
<div class="oe_diagram_buttons">
<button type="button" id="new_node" class="oe_button oe_diagram_button_new">New Node</button>
</div>

View File

@ -183,7 +183,7 @@ instance.web_gantt.GanttView = instance.web.View.extend({
self.on_task_display(task_info.internal_task);
}
});
if (this._is_action_enabled('create')) {
if (this.is_action_enabled('create')) {
// insertion of create button
var td = $($("table td", self.$el)[0]);
var rendered = QWeb.render("GanttView-create-button");

View File

@ -71,7 +71,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
return JSON.parse(this.fields_view.arch.attrs.quick_create);
return !! this.group_by;
},
_is_action_enabled: function(action) {
is_action_enabled: function(action) {
if (action === 'create' && !this.options.creatable)
return false;
return this._super(action);
@ -735,7 +735,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
var $action = $(this),
type = $action.data('type') || 'button',
method = 'do_action_' + (type === 'action' ? 'object' : type);
if ((type === 'edit' || type === 'delete') && ! self.view._is_action_enabled(type)) {
if ((type === 'edit' || type === 'delete') && ! self.view.is_action_enabled(type)) {
self.view.open_record(self.id);
} else if (_.str.startsWith(type, 'switch_')) {
self.view.do_switch_view(type.substr(7));

View File

@ -14,7 +14,7 @@
</t>
<div t-name="KanbanView.buttons" class="oe_kanban_buttons">
<t t-if="widget.options.action_buttons !== false">
<t t-if="widget._is_action_enabled('create')">
<t t-if="widget.is_action_enabled('create')">
<button type="button" class="oe_kanban_button_new oe_highlight">
<t t-esc="widget.options.create_text || _t('Create')"/>
</button>