[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:
Christophe Matthieu
2017-04-20 17:07:37 +02:00
parent 86af036ea1
commit 19eef5d658
3 changed files with 59 additions and 1 deletions
@@ -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);