[FIX] web: Form: display button box in create mode
Before this rev., the button box wasn't displayed on new (not saved yet) records. This wasn't the case before the new views. This is a problem in lunch, as the lunch.order form view is opened in create mode, and the balance is displayed in the button box.
This commit is contained in:
@@ -246,10 +246,6 @@ var FormRenderer = BasicRenderer.extend({
|
||||
_renderButtonBox: function (node) {
|
||||
var self = this;
|
||||
var $result = $('<' + node.tag + '>', { 'class': 'o_not_full' });
|
||||
// Avoid to show buttons if we are in create mode (edit mode without res_id)
|
||||
if (this.mode === 'edit' && !this.state.res_id) {
|
||||
return $result;
|
||||
}
|
||||
var buttons = _.map(node.children, function (child) {
|
||||
if (child.tag === 'button') {
|
||||
return self._renderStatButton(child);
|
||||
|
||||
@@ -2642,7 +2642,7 @@ QUnit.module('Views', {
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('button box is not rendered in create mode', function (assert) {
|
||||
QUnit.test('button box is rendered in create mode', function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
var form = createView({
|
||||
@@ -2672,8 +2672,8 @@ QUnit.module('Views', {
|
||||
// create mode (leave edition first!)
|
||||
form.$buttons.find('.o_form_button_cancel').click();
|
||||
form.$buttons.find('.o_form_button_create').click();
|
||||
assert.strictEqual(form.$('.oe_stat_button').length, 0,
|
||||
"button box should not be displayed when creating a new record");
|
||||
assert.strictEqual(form.$('.oe_stat_button').length, 1,
|
||||
"button box should be displayed when creating a new record as well");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user