[IMP] DOWNCASE ALL THE THINGS
apparently and contrary to what I remembered, we're still supposed to use underscore_separated method names, not camelCase bzr revid: xmo@openerp.com-20120717132308-wvpldtprt33heee3
This commit is contained in:
parent
c3368bf2bb
commit
01e6e3ec07
|
@ -3122,7 +3122,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
|
|||
}
|
||||
return res;
|
||||
} else if (this.viewmanager.active_view === "list") {
|
||||
var res = $.when(view.ensureSaved());
|
||||
var res = $.when(view.ensure_saved());
|
||||
if (!res.isResolved() && !res.isRejected()) {
|
||||
console.warn("Asynchronous get_value() is not supported in list view.");
|
||||
}
|
||||
|
@ -3209,22 +3209,22 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
|||
this._super(parent, dataset, view_id, _.extend(options || {}, {
|
||||
ListType: instance.web.form.One2ManyList
|
||||
}));
|
||||
this.on('edit:before', this, this.proxy('_beforeEdit'));
|
||||
this.on('save:before cancel:before', this, this.proxy('_beforeUnEdit'));
|
||||
this.on('edit:before', this, this.proxy('_before_edit'));
|
||||
this.on('save:before cancel:before', this, this.proxy('_before_unedit'));
|
||||
|
||||
this.records
|
||||
.bind('add', this.proxy("changedRecords"))
|
||||
.bind('edit', this.proxy("changedRecords"))
|
||||
.bind('remove', this.proxy("changedRecords"));
|
||||
.bind('add', this.proxy("changed_records"))
|
||||
.bind('edit', this.proxy("changed_records"))
|
||||
.bind('remove', this.proxy("changed_records"));
|
||||
},
|
||||
start: function () {
|
||||
var ret = this._super();
|
||||
this.$element
|
||||
.off('mousedown.handleButtons')
|
||||
.on('mousedown.handleButtons', 'table button', this.proxy('_buttonDown'));
|
||||
.on('mousedown.handleButtons', 'table button', this.proxy('_button_down'));
|
||||
return ret;
|
||||
},
|
||||
changedRecords: function () {
|
||||
changed_records: function () {
|
||||
this.o2m.trigger_on_change();
|
||||
},
|
||||
is_valid: function () {
|
||||
|
@ -3308,21 +3308,21 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
|||
}
|
||||
var parent_form = this.o2m.view;
|
||||
var self = this;
|
||||
this.ensureSaved().pipe(function () {
|
||||
this.ensure_saved().pipe(function () {
|
||||
return parent_form.do_save();
|
||||
}).then(function () {
|
||||
self.handleButton(name, id, callback);
|
||||
self.handle_button(name, id, callback);
|
||||
});
|
||||
},
|
||||
|
||||
_beforeEdit: function () {
|
||||
_before_edit: function () {
|
||||
this.__ignore_blur = false;
|
||||
this.editor.form.on('blurred', this, this._onFormBlur);
|
||||
this.editor.form.on('blurred', this, this._on_form_blur);
|
||||
},
|
||||
_beforeUnEdit: function () {
|
||||
this.editor.form.off('blurred', this, this._onFormBlur);
|
||||
_before_unedit: function () {
|
||||
this.editor.form.off('blurred', this, this._on_form_blur);
|
||||
},
|
||||
_buttonDown: function () {
|
||||
_button_down: function () {
|
||||
// If a button is clicked (usually some sort of action button), it's
|
||||
// the button's responsibility to ensure the editable list is in the
|
||||
// correct state -> ignore form blurring
|
||||
|
@ -3332,12 +3332,12 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
|||
* Handles blurring of the nested form (saves the currently edited row),
|
||||
* unless the flag to ignore the event is set to ``true``
|
||||
*/
|
||||
_onFormBlur: function () {
|
||||
_on_form_blur: function () {
|
||||
if (this.__ignore_blur) {
|
||||
this.__ignore_blur = false;
|
||||
return;
|
||||
}
|
||||
this.saveEdition();
|
||||
this.save_edition();
|
||||
},
|
||||
keyup_ENTER: function () {
|
||||
// blurring caused by hitting the [Return] key, should skip the
|
||||
|
|
|
@ -676,7 +676,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
|||
* @param {Function} callback should be called after the action is executed, if non-null
|
||||
*/
|
||||
do_button_action: function (name, id, callback) {
|
||||
this.handleButton(name, id, callback);
|
||||
this.handle_button(name, id, callback);
|
||||
},
|
||||
/**
|
||||
* Base handling of buttons, can be called when overriding do_button_action
|
||||
|
@ -688,7 +688,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
|||
* @param {Object} id id of the record the action should be called on
|
||||
* @param {Function} callback should be called after the action is executed, if non-null
|
||||
*/
|
||||
handleButton: function (name, id, callback) {
|
||||
handle_button: function (name, id, callback) {
|
||||
var action = _.detect(this.columns, function (field) {
|
||||
return field.name === name;
|
||||
});
|
||||
|
|
|
@ -12,11 +12,11 @@ openerp.web.list_editable = function (instance) {
|
|||
var self = this;
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
this.editor = this.makeEditor();
|
||||
this.editor = this.make_editor();
|
||||
// Stores records of {field, cell}, allows for re-rendering fields
|
||||
// depending on cell state during and after resize events
|
||||
this.fields_for_resize = [];
|
||||
instance.web.bus.on('resize', this, this.resizeFields);
|
||||
instance.web.bus.on('resize', this, this.resize_fields);
|
||||
|
||||
$(this.groups).bind({
|
||||
'edit': function (e, id, dataset) {
|
||||
|
@ -39,7 +39,7 @@ openerp.web.list_editable = function (instance) {
|
|||
});
|
||||
},
|
||||
destroy: function () {
|
||||
instance.web.bus.off('resize', this, this.resizeFields);
|
||||
instance.web.bus.off('resize', this, this.resize_fields);
|
||||
this._super();
|
||||
},
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ openerp.web.list_editable = function (instance) {
|
|||
if (this.options.editable) {
|
||||
this.$element.find('table:first').show();
|
||||
this.$element.find('.oe_view_nocontent').remove();
|
||||
this.startEdition();
|
||||
this.start_edition();
|
||||
} else {
|
||||
this._super();
|
||||
}
|
||||
|
@ -103,24 +103,24 @@ openerp.web.list_editable = function (instance) {
|
|||
// FIXME: any hook available to ensure this is only done once?
|
||||
this.$buttons
|
||||
.off('click', '.oe_list_save')
|
||||
.on('click', '.oe_list_save', this.proxy('saveEdition'))
|
||||
.on('click', '.oe_list_save', this.proxy('save_edition'))
|
||||
.off('click', '.oe_list_discard')
|
||||
.on('click', '.oe_list_discard', function (e) {
|
||||
e.preventDefault();
|
||||
self.cancelEdition();
|
||||
self.cancel_edition();
|
||||
});
|
||||
this.$element
|
||||
.off('click', 'tbody td:not(.oe_list_field_cell)')
|
||||
.on('click', 'tbody td:not(.oe_list_field_cell)', function () {
|
||||
if (!self.editor.isEditing()) {
|
||||
self.startEdition();
|
||||
if (!self.editor.is_editing()) {
|
||||
self.start_edition();
|
||||
}
|
||||
});
|
||||
// Editor is not restartable due to formview not being
|
||||
// restartable
|
||||
this.editor = this.makeEditor();
|
||||
this.editor = this.make_editor();
|
||||
var editor_ready = this.editor.prependTo(this.$element)
|
||||
.then(this.proxy('setupEvents'));
|
||||
.then(this.proxy('setup_events'));
|
||||
|
||||
return $.when(result, editor_ready);
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ openerp.web.list_editable = function (instance) {
|
|||
*
|
||||
* @return {instance.web.list.Editor}
|
||||
*/
|
||||
makeEditor: function () {
|
||||
make_editor: function () {
|
||||
return new instance.web.list.Editor(this);
|
||||
},
|
||||
do_button_action: function () {
|
||||
var self = this, args = arguments;
|
||||
this.ensureSaved().then(function () {
|
||||
self.handleButton.apply(self, args);
|
||||
this.ensure_saved().then(function () {
|
||||
self.handle_button.apply(self, args);
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
@ -149,11 +149,11 @@ openerp.web.list_editable = function (instance) {
|
|||
*
|
||||
* @returns {$.Deferred}
|
||||
*/
|
||||
ensureSaved: function () {
|
||||
if (!this.editor.isEditing()) {
|
||||
ensure_saved: function () {
|
||||
if (!this.editor.is_editing()) {
|
||||
return $.when();
|
||||
}
|
||||
return this.saveEdition();
|
||||
return this.save_edition();
|
||||
},
|
||||
/**
|
||||
* Set up the edition of a record of the list view "inline"
|
||||
|
@ -161,7 +161,7 @@ openerp.web.list_editable = function (instance) {
|
|||
* @param {instance.web.list.Record} [record] record to edit, leave empty to create a new record
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
startEdition: function (record) {
|
||||
start_edition: function (record) {
|
||||
var self = this;
|
||||
var item = false;
|
||||
if (record) {
|
||||
|
@ -174,14 +174,14 @@ openerp.web.list_editable = function (instance) {
|
|||
.each(function (field) { attrs[field] = false; });
|
||||
record = new instance.web.list.Record(attrs);
|
||||
this.records.add(record, {
|
||||
at: this.isPrependOnCreate() ? 0 : null});
|
||||
at: this.prepends_on_create() ? 0 : null});
|
||||
}
|
||||
var $recordRow = this.groups.getRowFor(record);
|
||||
var cells = this.getCellsFor($recordRow);
|
||||
var $recordRow = this.groups.get_row_for(record);
|
||||
var cells = this.get_cells_for($recordRow);
|
||||
|
||||
return this.ensureSaved().pipe(function () {
|
||||
return this.ensure_saved().pipe(function () {
|
||||
self.fields_for_resize.splice(0, self.fields_for_resize.length);
|
||||
return self.withEvent('edit', {
|
||||
return self.with_event('edit', {
|
||||
record: record.attributes,
|
||||
cancel: false
|
||||
}, function () {
|
||||
|
@ -197,13 +197,13 @@ openerp.web.list_editable = function (instance) {
|
|||
self.fields_for_resize.push({field: field, cell: cell});
|
||||
}).pipe(function () {
|
||||
$recordRow.addClass('oe_edition');
|
||||
self.resizeFields();
|
||||
self.resize_fields();
|
||||
return record.attributes;
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
getCellsFor: function ($row) {
|
||||
get_cells_for: function ($row) {
|
||||
var cells = {};
|
||||
$row.children('td').each(function (index, el) {
|
||||
cells[el.getAttribute('data-field')] = el
|
||||
|
@ -214,11 +214,11 @@ openerp.web.list_editable = function (instance) {
|
|||
* If currently editing a row, resizes all registered form fields based
|
||||
* on the corresponding row cell
|
||||
*/
|
||||
resizeFields: function () {
|
||||
if (!this.editor.isEditing()) { return; }
|
||||
resize_fields: function () {
|
||||
if (!this.editor.is_editing()) { return; }
|
||||
for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {
|
||||
var item = this.fields_for_resize[i];
|
||||
this.resizeField(item.field, item.cell);
|
||||
this.resize_field(item.field, item.cell);
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
@ -228,7 +228,7 @@ openerp.web.list_editable = function (instance) {
|
|||
* @param {instance.web.form.AbstractField} field
|
||||
* @param {jQuery} cell
|
||||
*/
|
||||
resizeField: function (field, cell) {
|
||||
resize_field: function (field, cell) {
|
||||
var $cell = $(cell);
|
||||
var position = $cell.position();
|
||||
|
||||
|
@ -242,9 +242,9 @@ openerp.web.list_editable = function (instance) {
|
|||
/**
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
saveEdition: function () {
|
||||
save_edition: function () {
|
||||
var self = this;
|
||||
return this.withEvent('save', {
|
||||
return this.with_event('save', {
|
||||
editor: this.editor,
|
||||
form: this.editor.form,
|
||||
cancel: false
|
||||
|
@ -262,7 +262,7 @@ openerp.web.list_editable = function (instance) {
|
|||
// onwrite callback could be altering & reloading the
|
||||
// record which has *just* been saved, so first perform all
|
||||
// onwrites then do a final reload of the record
|
||||
return self.handleOnWrite(record)
|
||||
return self.handle_onwrite(record)
|
||||
.pipe(function () {
|
||||
return self.reload_record(record); })
|
||||
.pipe(function () {
|
||||
|
@ -273,9 +273,9 @@ openerp.web.list_editable = function (instance) {
|
|||
/**
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
cancelEdition: function () {
|
||||
cancel_edition: function () {
|
||||
var self = this;
|
||||
return this.withEvent('cancel', {
|
||||
return this.with_event('cancel', {
|
||||
editor: this.editor,
|
||||
form: this.editor.form,
|
||||
cancel: false
|
||||
|
@ -310,7 +310,7 @@ openerp.web.list_editable = function (instance) {
|
|||
* @param {Array} [trigger_params] supplementary arguments provided to the ``:after`` sub-event, before anything fetched by the ``action`` function
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
withEvent: function (event_name, event, action) {
|
||||
with_event: function (event_name, event, action) {
|
||||
var self = this;
|
||||
event = event || {};
|
||||
this.trigger(event_name + ':before', event);
|
||||
|
@ -324,7 +324,7 @@ openerp.web.list_editable = function (instance) {
|
|||
.concat(_.toArray(arguments)));
|
||||
});
|
||||
},
|
||||
editionView: function (editor) {
|
||||
edition_view: function (editor) {
|
||||
var view = $.extend(true, {}, this.fields_view);
|
||||
view.arch.tag = 'form';
|
||||
_.extend(view.arch.attrs, {
|
||||
|
@ -341,7 +341,7 @@ openerp.web.list_editable = function (instance) {
|
|||
});
|
||||
return view;
|
||||
},
|
||||
handleOnWrite: function (source_record) {
|
||||
handle_onwrite: function (source_record) {
|
||||
var self = this;
|
||||
var on_write_callback = self.fields_view.arch.attrs.on_write;
|
||||
if (!on_write_callback) { return $.when(); }
|
||||
|
@ -349,10 +349,10 @@ openerp.web.list_editable = function (instance) {
|
|||
.pipe(function (ids) {
|
||||
return $.when.apply(
|
||||
null, _(ids).map(
|
||||
_.bind(self.handleOnWriteRecord, self, source_record)));
|
||||
_.bind(self.handle_onwrite_record, self, source_record)));
|
||||
});
|
||||
},
|
||||
handleOnWriteRecord: function (id, source_record) {
|
||||
handle_onwrite_record: function (id, source_record) {
|
||||
var record = this.records.get(id);
|
||||
if (!record) {
|
||||
// insert after the source record
|
||||
|
@ -363,10 +363,10 @@ openerp.web.list_editable = function (instance) {
|
|||
}
|
||||
return this.reload_record(record);
|
||||
},
|
||||
isPrependOnCreate: function () {
|
||||
prepends_on_create: function () {
|
||||
return this.options.editable === 'top';
|
||||
},
|
||||
setupEvents: function () {
|
||||
setup_events: function () {
|
||||
var self = this;
|
||||
this.editor.$element.on('keyup', function (e) {
|
||||
var key = _($.ui.keyCode).chain()
|
||||
|
@ -380,19 +380,19 @@ openerp.web.list_editable = function (instance) {
|
|||
});
|
||||
},
|
||||
keyup_ENTER: function () {
|
||||
if (!this.editor.isEditing()) { return; }
|
||||
if (!this.editor.is_editing()) { return; }
|
||||
var self = this;
|
||||
return this.saveEdition().pipe(function (saveInfo) {
|
||||
return this.save_edition().pipe(function (saveInfo) {
|
||||
if (saveInfo.created) {
|
||||
return self.startEdition();
|
||||
return self.start_edition();
|
||||
}
|
||||
return self.startEdition(
|
||||
return self.start_edition(
|
||||
self.records.succ(saveInfo.record, {wraparound: true}));
|
||||
});
|
||||
},
|
||||
keyup_ESCAPE: function () {
|
||||
if (!this.editor.isEditing()) { return; }
|
||||
return this.cancelEdition();
|
||||
if (!this.editor.is_editing()) { return; }
|
||||
return this.cancel_edition();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -429,32 +429,32 @@ openerp.web.list_editable = function (instance) {
|
|||
start: function () {
|
||||
var self = this;
|
||||
var _super = this._super();
|
||||
this.form.embedded_view = this._validateView(
|
||||
this.delegate.editionView(this));
|
||||
this.form.embedded_view = this._validate_view(
|
||||
this.delegate.edition_view(this));
|
||||
var form_ready = this.form.appendTo(this.$element).then(
|
||||
self.form.proxy('do_hide'));
|
||||
return $.when(_super, form_ready);
|
||||
},
|
||||
_validateView: function (edition_view) {
|
||||
_validate_view: function (edition_view) {
|
||||
if (!edition_view) {
|
||||
throw new Error("editor delegate's #editionView must return "
|
||||
throw new Error("editor delegate's #edition_view must return "
|
||||
+ "a view descriptor");
|
||||
}
|
||||
var arch = edition_view.arch;
|
||||
if (!(arch && arch.children instanceof Array)) {
|
||||
throw new Error("Editor delegate's #editionView must have a" +
|
||||
throw new Error("Editor delegate's #edition_view must have a" +
|
||||
" non-empty arch")
|
||||
}
|
||||
if (!(arch.tag === "form")) {
|
||||
throw new Error("Editor delegate's #editionView must have a" +
|
||||
throw new Error("Editor delegate's #edition_view must have a" +
|
||||
" 'form' root node");
|
||||
}
|
||||
if (!(arch.attrs && arch.attrs.version === "7.0")) {
|
||||
throw new Error("Editor delegate's #editionView must be a" +
|
||||
throw new Error("Editor delegate's #edition_view must be a" +
|
||||
" version 7 view");
|
||||
}
|
||||
if (!/\boe_form_container\b/.test(arch.attrs['class'])) {
|
||||
throw new Error("Editor delegate's #editionView must have the" +
|
||||
throw new Error("Editor delegate's #edition_view must have the" +
|
||||
" class 'oe_form_container' on its root" +
|
||||
" element");
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ openerp.web.list_editable = function (instance) {
|
|||
return edition_view;
|
||||
},
|
||||
|
||||
isEditing: function () {
|
||||
is_editing: function () {
|
||||
return !!this.record;
|
||||
},
|
||||
edit: function (record, configureField) {
|
||||
|
@ -496,7 +496,7 @@ openerp.web.list_editable = function (instance) {
|
|||
save: function () {
|
||||
var self = this;
|
||||
return this.form
|
||||
.do_save(null, this.delegate.isPrependOnCreate())
|
||||
.do_save(null, this.delegate.prepends_on_create())
|
||||
.pipe(function (result) {
|
||||
var created = result.created && !self.record.id;
|
||||
if (created) {
|
||||
|
@ -519,9 +519,9 @@ openerp.web.list_editable = function (instance) {
|
|||
|
||||
instance.web.ListView.Groups.include(/** @lends instance.web.ListView.Groups# */{
|
||||
passtrough_events: instance.web.ListView.Groups.prototype.passtrough_events + " edit saved",
|
||||
getRowFor: function (record) {
|
||||
get_row_for: function (record) {
|
||||
return _(this.children).chain()
|
||||
.invoke('getRowFor', record)
|
||||
.invoke('get_row_for', record)
|
||||
.compact()
|
||||
.first()
|
||||
.value();
|
||||
|
@ -534,7 +534,7 @@ openerp.web.list_editable = function (instance) {
|
|||
return this._super.apply(this, arguments);
|
||||
}
|
||||
var record_id = $(event.currentTarget).data('id');
|
||||
this.view.startEdition(record_id ? this.records.get(record_id) : null);
|
||||
this.view.start_edition(record_id ? this.records.get(record_id) : null);
|
||||
},
|
||||
/**
|
||||
* If a row mapping to the record (@data-id matching the record's id or
|
||||
|
@ -544,7 +544,7 @@ openerp.web.list_editable = function (instance) {
|
|||
* @param {Record} record the record to get a row for
|
||||
* @return {jQuery|null}
|
||||
*/
|
||||
getRowFor: function (record) {
|
||||
get_row_for: function (record) {
|
||||
var id;
|
||||
var $row = this.$current.children('[data-id=' + record.get('id') + ']');
|
||||
if ($row.length) {
|
||||
|
|
|
@ -73,7 +73,7 @@ $(document).ready(function () {
|
|||
asyncTest('base-state', 2, function () {
|
||||
var e = new instance.web.list.Editor({
|
||||
dataset: {},
|
||||
editionView: function () {
|
||||
edition_view: function () {
|
||||
return makeFormView();
|
||||
}
|
||||
});
|
||||
|
@ -81,7 +81,7 @@ $(document).ready(function () {
|
|||
.always(start)
|
||||
.fail(function (error) { ok(false, error && error.message); })
|
||||
.done(function () {
|
||||
ok(!e.isEditing(), "should not be editing");
|
||||
ok(!e.is_editing(), "should not be editing");
|
||||
ok(e.form instanceof instance.web.FormView,
|
||||
"should use default form type");
|
||||
});
|
||||
|
@ -100,8 +100,8 @@ $(document).ready(function () {
|
|||
};
|
||||
var e = new instance.web.list.Editor({
|
||||
dataset: new instance.web.DataSetSearch(),
|
||||
isPrependOnCreate: function () { return false; },
|
||||
editionView: function () {
|
||||
prepends_on_create: function () { return false; },
|
||||
edition_view: function () {
|
||||
return makeFormView([ field('a'), field('b'), field('c') ]);
|
||||
}
|
||||
});
|
||||
|
@ -113,14 +113,14 @@ $(document).ready(function () {
|
|||
});
|
||||
})
|
||||
.pipe(function (form) {
|
||||
ok(e.isEditing(), "should be editing");
|
||||
ok(e.is_editing(), "should be editing");
|
||||
equal(counter, 3, "should have configured all fields");
|
||||
return e.save();
|
||||
})
|
||||
.always(start)
|
||||
.fail(function (error) { ok(false, error && error.message); })
|
||||
.done(function (record) {
|
||||
ok(!e.isEditing(), "should have stopped editing");
|
||||
ok(!e.is_editing(), "should have stopped editing");
|
||||
equal(record.id, 42, "should have newly created id");
|
||||
})
|
||||
});
|
||||
|
@ -130,8 +130,8 @@ $(document).ready(function () {
|
|||
};
|
||||
var e = new instance.web.list.Editor({
|
||||
dataset: new instance.web.DataSetSearch(),
|
||||
isPrependOnCreate: function () { return false; },
|
||||
editionView: function () {
|
||||
prepends_on_create: function () { return false; },
|
||||
edition_view: function () {
|
||||
return makeFormView([ field('a'), field('b'), field('c') ]);
|
||||
}
|
||||
});
|
||||
|
@ -148,7 +148,7 @@ $(document).ready(function () {
|
|||
.always(start)
|
||||
.fail(function (error) { ok(false, error && error.message); })
|
||||
.done(function (record) {
|
||||
ok(!e.isEditing(), "should have stopped editing");
|
||||
ok(!e.is_editing(), "should have stopped editing");
|
||||
ok(!record.id, "should have no id");
|
||||
})
|
||||
});
|
||||
|
@ -161,8 +161,8 @@ $(document).ready(function () {
|
|||
warnings++;
|
||||
},
|
||||
dataset: new instance.web.DataSetSearch(),
|
||||
isPrependOnCreate: function () { return false; },
|
||||
editionView: function () {
|
||||
prepends_on_create: function () { return false; },
|
||||
edition_view: function () {
|
||||
return makeFormView([
|
||||
field('a', {required: true}), field('b'), field('c') ]);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ $(document).ready(function () {
|
|||
.done(function () { ok(false, "cancel should not succeed"); })
|
||||
.fail(function () {
|
||||
equal(warnings, 1, "should have been warned");
|
||||
ok(e.isEditing(), "should have kept editing");
|
||||
ok(e.is_editing(), "should have kept editing");
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -246,12 +246,12 @@ $(document).ready(function () {
|
|||
l.appendTo($fix)
|
||||
.pipe(l.proxy('reload_content'))
|
||||
.pipe(function () {
|
||||
return l.startEdition();
|
||||
return l.start_edition();
|
||||
})
|
||||
.always(start)
|
||||
.pipe(function () {
|
||||
ok(got_defaults, "should have fetched default values for form");
|
||||
return l.saveEdition();
|
||||
return l.save_edition();
|
||||
})
|
||||
.pipe(function (result) {
|
||||
ok(result.created, "should yield newly created record");
|
||||
|
@ -314,10 +314,10 @@ $(document).ready(function () {
|
|||
.pipe(function () {
|
||||
ok(l.options.editable, "should be editable");
|
||||
equal(o.counter, 0, "should have seen no event yet");
|
||||
return l.startEdition(l.records.get(1));
|
||||
return l.start_edition(l.records.get(1));
|
||||
})
|
||||
.pipe(function () {
|
||||
ok(l.editor.isEditing(), "should be editing");
|
||||
ok(l.editor.is_editing(), "should be editing");
|
||||
equal(o.counter, 2, "should have seen two edition events");
|
||||
})
|
||||
.fail(function (e) { ok(false, e && e.message); });
|
||||
|
@ -339,11 +339,11 @@ $(document).ready(function () {
|
|||
.always(start)
|
||||
.pipe(function () {
|
||||
ok(l.options.editable, "should be editable");
|
||||
return l.startEdition();
|
||||
return l.start_edition();
|
||||
})
|
||||
// cancelling an event rejects the deferred
|
||||
.pipe($.Deferred().reject(), function () {
|
||||
ok(!l.editor.isEditing(), "should not be editing");
|
||||
ok(!l.editor.is_editing(), "should not be editing");
|
||||
ok(!edit_after, "should not have fired the edit:after event");
|
||||
return $.when();
|
||||
})
|
||||
|
|
|
@ -122,7 +122,7 @@ view, on top of implementing the :js:class:`EditorDelegate` protocol:
|
|||
Interaction Methods
|
||||
+++++++++++++++++++
|
||||
|
||||
.. js:function:: openerp.web.ListView.ensureSaved
|
||||
.. js:function:: openerp.web.ListView.ensure_saved
|
||||
|
||||
Attempts to resolve the pending edition, if any, by saving the
|
||||
edited row's current state.
|
||||
|
@ -131,7 +131,7 @@ Interaction Methods
|
|||
rejected if a pending edition could not be saved
|
||||
(e.g. validation failure)
|
||||
|
||||
.. js:function:: openerp.web.ListView.startEdition([record])
|
||||
.. js:function:: openerp.web.ListView.start_edition([record])
|
||||
|
||||
Starts editing the provided record inline, through an overlay form
|
||||
view of editable fields in the record.
|
||||
|
@ -145,7 +145,7 @@ Interaction Methods
|
|||
:type record: :js:class:`~openerp.web.list.Record`
|
||||
:returns: delegate to the form used for the edition
|
||||
|
||||
.. js:function:: openerp.web.ListView.saveEdition
|
||||
.. js:function:: openerp.web.ListView.save_edition
|
||||
|
||||
Resolves the pending edition.
|
||||
|
||||
|
@ -155,7 +155,7 @@ Interaction Methods
|
|||
updated) and ``record`` the reloaded record having been
|
||||
edited.
|
||||
|
||||
.. js:function:: openerp.web.ListView.cancelEdition
|
||||
.. js:function:: openerp.web.ListView.cancel_edition
|
||||
|
||||
Cancels pending edition, cleans up the list view in case of
|
||||
creation (removes the empty record being created).
|
||||
|
@ -163,7 +163,7 @@ Interaction Methods
|
|||
Utility Methods
|
||||
+++++++++++++++
|
||||
|
||||
.. js:function:: openerp.web.ListView.getCellsFor(row)
|
||||
.. js:function:: openerp.web.ListView.get_cells_for(row)
|
||||
|
||||
Extracts the cells from a listview row, and puts them in a
|
||||
{fieldname: cell} mapping for analysis and manipulation.
|
||||
|
@ -171,7 +171,7 @@ Utility Methods
|
|||
:param jQuery row:
|
||||
:rtype: Object
|
||||
|
||||
.. js:function:: openerp.web.ListView.withEvent(event_name, event, action[, args][, trigger_params])
|
||||
.. js:function:: openerp.web.ListView.with_event(event_name, event, action[, args][, trigger_params])
|
||||
|
||||
Executes ``action`` in the context of the view's editor,
|
||||
bracketing it with cancellable event signals.
|
||||
|
@ -193,7 +193,7 @@ Utility Methods
|
|||
Behavioral Customizations
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
.. js:function:: openerp.web.ListView.handleOnWrite(record)
|
||||
.. js:function:: openerp.web.ListView.handle_onwrite(record)
|
||||
|
||||
Implements the handling of the ``onwrite`` listview attribute:
|
||||
calls the RPC methods specified by ``@onwrite``, and if that
|
||||
|
@ -287,7 +287,7 @@ formview, delegating instead to its
|
|||
:type parent: :js:class:`~openerp.web.Widget`
|
||||
:param EditorOptions options:
|
||||
|
||||
.. js:function:: openerp.web.list.Editor.isEditing
|
||||
.. js:function:: openerp.web.list.Editor.is_editing
|
||||
|
||||
Indicates whether the editor is currently in the process of
|
||||
providing edition for a field.
|
||||
|
@ -356,7 +356,7 @@ formview, delegating instead to its
|
|||
The dataset passed to the form view to synchronize the form
|
||||
view and the outer widget.
|
||||
|
||||
.. js:function:: EditorDelegate.editionView(editor)
|
||||
.. js:function:: EditorDelegate.edition_view(editor)
|
||||
|
||||
Called by the :js:class:`~openerp.web.list.Editor` object to
|
||||
get a form view (JSON) to pass along to the form view it
|
||||
|
@ -371,7 +371,7 @@ formview, delegating instead to its
|
|||
:returns: form view
|
||||
:rtype: Object
|
||||
|
||||
.. js:function:: EditorDelegate.isPrependOnCreate
|
||||
.. js:function:: EditorDelegate.prepends_on_create
|
||||
|
||||
By default, the :js:class:`~openerp.web.list.Editor` will
|
||||
append the ids of newly created records to the
|
||||
|
@ -395,21 +395,18 @@ Changes from 6.1
|
|||
:js:func:`~openerp.web.ListView.List.row_clicked` is still
|
||||
overridden.
|
||||
|
||||
* A new method ``getRowFor(record) -> jQuery(tr) | null`` has been
|
||||
* A new method ``get_row_for(record) -> jQuery(tr) | null`` has been
|
||||
added to both ListView.List and ListView.Group, it can be called
|
||||
from the list view to get the table row matching a record (if such
|
||||
a row exists).
|
||||
|
||||
* ``ListView#ensure_saved`` has been re-capitalized to
|
||||
:js:func:`~openerp.web.ListView.ensureSaved`
|
||||
|
||||
* :js:func:`~openerp.web.ListView.do_button_action`'s core behavior
|
||||
has been split away to
|
||||
:js:func:`~openerp.web.ListView.handleButton`. This allows bypassing
|
||||
:js:func:`~openerp.web.ListView.handle_button`. This allows bypassing
|
||||
overrides of :js:func:`~openerp.web.ListView.do_button_action` in a
|
||||
parent class.
|
||||
|
||||
Ideally, :js:func:`~openerp.web.ListView.handleButton` should not be
|
||||
Ideally, :js:func:`~openerp.web.ListView.handle_button` should not be
|
||||
overridden.
|
||||
|
||||
* Modifiers handling has been improved (all modifiers information
|
||||
|
|
Loading…
Reference in New Issue