[FIX] web: allow virtual ids for integer fields
Before this change, the redering throw an exception when we try to open a form view with a virtual id. eg: recurrent event in calendar
This commit is contained in:
@@ -1521,6 +1521,31 @@ QUnit.module('basic_fields', {
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('integer field in form view with virtual id', function(assert) {
|
||||
assert.expect(2);
|
||||
var params = {
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch:'<form string="Partners"><field name="id"/></form>',
|
||||
};
|
||||
|
||||
params.res_id = this.data.partner.records[1].id = "2-20170808020000";
|
||||
var form = createView(params);
|
||||
assert.strictEqual(form.$('.o_form_field').text(), "2-20170808020000",
|
||||
"Should display virtual id");
|
||||
form.destroy();
|
||||
|
||||
params.res_id = this.data.partner.records[1].id = "2.65-20170808020000";
|
||||
try {
|
||||
form = createView(params);
|
||||
} catch (error) {
|
||||
assert.strictEqual(error.message, '"2.65-20170808020000" is not an integer or a virtual id',
|
||||
"Should throw an exception because it's a wrong value");
|
||||
}
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('integer field in editable list view', function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user