summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-04-19 18:06:12 +0200
committerqsm-odoo <qsm@odoo.com>2017-05-04 12:07:30 +0200
commit250e716c3a12e88acb4a199b427dc47d4ec55d5d (patch)
tree0be849fd0af8d54f556af5f1274e641200ec82ef /addons/web/static/tests/fields
parent8943aae665ea906aa03bc30cada884c571738b7c (diff)
[REF] web, *: restore views design
Since the new views merge, a lot of design elements were broken. This was particularly impacting the fields in the editable list view; indeed the editable list view is not using an inline form view anymore so the fields in the list were not properly styled as the LESS was still defined assuming the form view environment (for example the invalid fields were red for o2m fields in form view but not in editable list view even though they got the right CSS class). This commit refactor the LESS following these rules: - No more division of non-layout and layout rules. Dividing LESS rules in x_layout.less and x.less was a mistake. Many rules can be considered to be layout and not layout at the same time, developers always have to switch from one file part to the other, many CSS selectors (and rules!) are duplicated for nothing, ... - Field style is extracted from x_view.less and put in the new fields.less file. As before, the fields_extra.less will contain the rules specific to community so that the enterprise repo can override those by replacing the whole file. - Many classes have been renamed so that o_form_x_y becomes o_x_y as many classes can now be applied outside of form view. These classes should not be used in templates anyway. The commit also changes the DOM of fields so that it is more minimalist (no useless parent div, etc). Input elements are not automatically styled anymore, they have to get the o_input class explicitely. This allows to fix lots of small style bugs of previous versions (required monetary field had not the proper style, readonly m2m tags appeared as editable, ...). This also improves the LESS code. The editable list view should also completely stop flickering on chrome and firefox. The commit also removes the orange outline on list view dirty cells. The commit also removes deprecated static xml, LESS and other code. Notice there are still styles to restore/fix and LESS to improve.
Diffstat (limited to 'addons/web/static/tests/fields')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js500
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js380
2 files changed, 439 insertions, 441 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 02f59278786..54907582685 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -322,7 +322,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldFloat');
- QUnit.test('float field when unset', function(assert) {
+ QUnit.test('float field when unset', function (assert) {
assert.expect(1);
var form = createView({
@@ -337,7 +337,7 @@ QUnit.module('basic_fields', {
res_id: 4,
});
- assert.ok(form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(form.$('.o_field_widget').hasClass('o_field_empty'),
'Non-set float field should be recognized as unset.');
form.destroy();
@@ -359,7 +359,7 @@ QUnit.module('basic_fields', {
'</form>',
res_id: 1,
});
- assert.strictEqual(form.$('span.o_form_field_number:contains(0.4)').length, 1,
+ assert.strictEqual(form.$('span.o_field_number:contains(0.4)').length, 1,
"should contain a number rounded to 1 decimal");
form.destroy();
});
@@ -379,22 +379,22 @@ QUnit.module('basic_fields', {
res_id: 2,
});
- assert.ok(!form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(!form.$('.o_field_widget').hasClass('o_field_empty'),
'Float field should be considered set for value 0.');
- assert.strictEqual(form.$('.o_form_field.o_form_field_number').first().text(), '0.000',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '0.000',
'The value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').val(), '0.000',
+ assert.strictEqual(form.$('input').val(), '0.000',
'The value should be rendered with correct precision.');
- form.$('input.o_form_input').val('108.2458938598598').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '108.2458938598598',
+ form.$('input').val('108.2458938598598').trigger('input');
+ assert.strictEqual(form.$('input').val(), '108.2458938598598',
'The value should not be formated yet.');
- form.$('input.o_form_input').val('18.8958938598598').trigger('input');
+ form.$('input').val('18.8958938598598').trigger('input');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.o_form_field_number').first().text(), '18.896',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '18.896',
'The new value should be rounded properly.');
form.destroy();
@@ -420,23 +420,23 @@ QUnit.module('basic_fields', {
var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector)').first();
$cell.click();
- assert.strictEqual(list.$('input.o_form_input').length, 1,
+ assert.strictEqual(list.$('input[name="qux"]').length, 1,
'The view should have 1 input for editable float.');
- list.$('input.o_form_input').val('108.2458938598598').trigger('input');
- assert.strictEqual(list.$('input.o_form_input').val(), '108.2458938598598',
+ list.$('input[name="qux"]').val('108.2458938598598').trigger('input');
+ assert.strictEqual(list.$('input[name="qux"]').val(), '108.2458938598598',
'The value should not be formated yet.');
- list.$('input.o_form_input').val('18.8958938598598').trigger('input');
+ list.$('input[name="qux"]').val('18.8958938598598').trigger('input');
list.$buttons.find('.o_list_button_save').click();
- assert.strictEqual(list.$('.o_form_field.o_form_field_number').first().text(), '18.896',
+ assert.strictEqual(list.$('.o_field_widget').first().text(), '18.896',
'The new value should be rounded properly.');
list.destroy();
});
- QUnit.module('EmailWidget');
+ QUnit.module('FieldEmail');
QUnit.test('email field in form view', function (assert) {
assert.expect(7);
@@ -455,7 +455,7 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- var $mailtoLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ var $mailtoLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($mailtoLink.length, 1,
"should have a anchor with correct classes");
assert.strictEqual($mailtoLink.text(), 'yop',
@@ -465,17 +465,17 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the email field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('new').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('new').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- $mailtoLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ $mailtoLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($mailtoLink.text(), 'new',
"new value should be displayed properly");
assert.strictEqual($mailtoLink.attr('href'), 'mailto:new',
@@ -567,22 +567,22 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field').text(), 'yop',
+ assert.strictEqual(form.$('.o_field_widget').text(), 'yop',
"the value should be displayed properly");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the char field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('limbo').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('limbo').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field').text(), 'limbo',
+ assert.strictEqual(form.$('.o_field_widget').text(), 'limbo',
'the new value should be displayed');
form.destroy();
});
@@ -639,30 +639,30 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').length, 1,
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').length, 1,
"should have a anchor with correct classes");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').attr('href'), 'yop',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').attr('href'), 'yop',
"should have proper href link");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').text(), 'yop',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').text(), 'yop',
"the value should be displayed properly");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the char field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('limbo').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('limbo').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').length, 1,
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').length, 1,
"should still have a anchor with correct classes");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').attr('href'), 'limbo',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').attr('href'), 'limbo',
"should have proper new href link");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').text(), 'limbo',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').text(), 'limbo',
'the new value should be displayed');
form.destroy();
@@ -727,12 +727,12 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.ok(form.$('div.o_form_textarea').length, "should have a text area");
- assert.strictEqual(form.$('div.o_form_textarea').text(), 'yop', 'should be "yop" in readonly');
+ assert.ok(form.$('div.o_field_text').length, "should have a text area");
+ assert.strictEqual(form.$('div.o_field_text').text(), 'yop', 'should be "yop" in readonly');
form.$buttons.find('.o_form_button_edit').click();
- var $textarea = form.$('.o_form_textarea textarea');
+ var $textarea = form.$('textarea.o_field_text');
assert.ok($textarea.length, "should have a text area");
assert.strictEqual($textarea.val(), 'yop', 'should still be "yop" in edit');
@@ -744,7 +744,7 @@ QUnit.module('basic_fields', {
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('div.o_form_textarea').text(), 'hello world',
+ assert.strictEqual(form.$('div.o_field_text').text(), 'hello world',
'should be "hello world" after save');
form.destroy();
});
@@ -764,7 +764,7 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- var $field = form.$('div.o_list_text');
+ var $field = form.$('div.o_field_text');
assert.strictEqual($field.outerHeight(), $field[0].scrollHeight,
"text field should not have a scroll bar");
@@ -805,27 +805,27 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('a.o_form_field[name="document"] > .fa-download').length, 1,
+ assert.strictEqual(form.$('a.o_field_widget[name="document"] > .fa-download').length, 1,
"the binary field should be rendered as a downloadable link in readonly");
- form.$('a.o_form_field[name="document"]').click();
+ form.$('a.o_field_widget[name="document"]').click();
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('a.o_form_field[name="document"] > .fa-download').length, 0,
+ assert.strictEqual(form.$('a.o_field_widget[name="document"] > .fa-download').length, 0,
"the binary field should not be rendered as a downloadable link in edit");
- assert.strictEqual(form.$('div.o_form_field_binary_file[name="document"]').length, 1,
+ assert.strictEqual(form.$('div.o_field_binary_file[name="document"]').length, 1,
"the binary field should be correctly rendered in edit");
- assert.strictEqual(form.$('.o_form_field_binary_file > input').attr('readonly'), 'readonly',
+ assert.strictEqual(form.$('.o_field_binary_file > input').attr('readonly'), 'readonly',
"the input should be readonly");
- assert.strictEqual(form.$('.o_form_field_binary_file > .o_clear_file_button').length, 1,
+ assert.strictEqual(form.$('.o_field_binary_file > .o_clear_file_button').length, 1,
"there shoud be a button to clear the file");
- form.$('.o_form_field_binary_file > .o_clear_file_button').click();
+ form.$('.o_field_binary_file > .o_clear_file_button').click();
- assert.ok(form.$('.o_form_field_binary_file > input').hasClass('o_hidden'),
+ assert.ok(form.$('.o_field_binary_file > input').hasClass('o_hidden'),
"the input should be hidden");
- assert.strictEqual(form.$('.o_form_field_binary_file > .o_select_file_button:not(.o_hidden)').length, 1,
+ assert.strictEqual(form.$('.o_field_binary_file > .o_select_file_button:not(.o_hidden)').length, 1,
"there shoud be a button to upload the file");
form.destroy();
@@ -1106,7 +1106,7 @@ QUnit.module('basic_fields', {
arch:'<form string="Partners"><field name="date"/></form>',
res_id: 4,
});
- var $span = form.$('span.o_form_field');
+ var $span = form.$('span.o_field_widget');
assert.strictEqual($span.length, 1, "should have one span in the form view");
assert.strictEqual($span.text(), "", "and it should be empty");
form.destroy();
@@ -1135,7 +1135,7 @@ QUnit.module('basic_fields', {
},
});
- assert.strictEqual(form.$('.o_form_field_date').text(), '02/03/2017',
+ assert.strictEqual(form.$('.o_field_date').text(), '02/03/2017',
'the date should be correctly displayed in readonly');
// switch to edit mode
@@ -1157,7 +1157,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), '02/22/2017',
+ assert.strictEqual(form.$('.o_field_date').text(), '02/22/2017',
'the selected date should be displayed after saving');
form.destroy();
});
@@ -1244,7 +1244,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), '',
+ assert.strictEqual(form.$('.o_field_date').text(), '',
'the selected date should be displayed after saving');
form.destroy();
});
@@ -1252,7 +1252,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldDatetime');
- QUnit.test('datetime field in form view', function(assert) {
+ QUnit.test('datetime field in form view', function (assert) {
assert.expect(6);
var form = createView({
@@ -1271,7 +1271,7 @@ QUnit.module('basic_fields', {
});
var expectedDateString = "02/08/2017 12:00:00"; // 10:00:00 without timezone
- assert.strictEqual(form.$('.o_form_field_date').text(), expectedDateString,
+ assert.strictEqual(form.$('.o_field_date').text(), expectedDateString,
'the datetime should be correctly displayed in readonly');
// switch to edit mode
@@ -1302,7 +1302,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), newExpectedDateString,
+ assert.strictEqual(form.$('.o_field_date').text(), newExpectedDateString,
'the selected date should be displayed after saving');
form.destroy();
@@ -1407,7 +1407,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), '',
+ assert.strictEqual(form.$('.o_field_date').text(), '',
'the selected date should be displayed after saving');
form.destroy();
});
@@ -1415,7 +1415,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldMonetary');
- QUnit.test('monetary field in form view', function(assert) {
+ QUnit.test('monetary field in form view', function (assert) {
assert.expect(5);
var form = createView({
@@ -1435,28 +1435,28 @@ QUnit.module('basic_fields', {
});
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '$\u00a09.10',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '$\u00a09.10',
'The value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').first().val(), '9.10',
+ assert.strictEqual(form.$('input').val(), '9.10',
'The input should be rendered without the currency symbol.');
- assert.strictEqual(form.$('input.o_form_input').parent().children().first().text(), '$',
+ assert.strictEqual(form.$('input').parent().children().first().text(), '$',
'The input should be preceded by a span containing the currency symbol.');
- form.$('input.o_form_input').first().val('108.2458938598598').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '108.2458938598598',
+ form.$('input').val('108.2458938598598').trigger('input');
+ assert.strictEqual(form.$('input').val(), '108.2458938598598',
'The value should not be formated yet.');
form.$buttons.find('.o_form_button_save').click();
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '$\u00a0108.25',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '$\u00a0108.25',
'The new value should be rounded properly.');
form.destroy();
});
- QUnit.test('monetary field with currency symbol after', function(assert) {
+ QUnit.test('monetary field with currency symbol after', function (assert) {
assert.expect(5);
var form = createView({
@@ -1476,22 +1476,22 @@ QUnit.module('basic_fields', {
});
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '0.00\u00a0€',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '0.00\u00a0€',
'The value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').first().val(), '0.00',
+ assert.strictEqual(form.$('input').first().val(), '0.00',
'The input should be rendered without the currency symbol.');
- assert.strictEqual(form.$('input.o_form_input').parent().children().eq(1).text(), '€',
+ assert.strictEqual(form.$('input').parent().children().eq(1).text(), '€',
'The input should be followed by a span containing the currency symbol.');
- form.$('input.o_form_input').first().val('108.2458938598598').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').first().val(), '108.2458938598598',
+ form.$('input').first().val('108.2458938598598').trigger('input');
+ assert.strictEqual(form.$('input').first().val(), '108.2458938598598',
'The value should not be formated yet.');
form.$buttons.find('.o_form_button_save').click();
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '108.25\u00a0€',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '108.25\u00a0€',
'The new value should be rounded properly.');
form.destroy();
@@ -1513,15 +1513,15 @@ QUnit.module('basic_fields', {
},
});
- var dollarValues = list.$('td').filter(function() {return _.str.include($(this).text(), '$')});
+ var dollarValues = list.$('td').filter(function () {return _.str.include($(this).text(), '$');});
assert.strictEqual(dollarValues.length, 1,
'Only one line has dollar as a currency.');
- var euroValues = list.$('td').filter(function() {return _.str.include($(this).text(), '€')});
+ var euroValues = list.$('td').filter(function () {return _.str.include($(this).text(), '€');});
assert.strictEqual(euroValues.length, 1,
'One one line has euro as a currency.');
- var zeroValues = list.$('td').filter(function() {return _.str.include($(this).text(), '0.00')});
+ var zeroValues = list.$('td').filter(function () {return _.str.include($(this).text(), '0.00');});
assert.strictEqual(zeroValues.length, 2,
'Unset float values should be rendered as zeros.');
@@ -1531,15 +1531,15 @@ QUnit.module('basic_fields', {
assert.strictEqual($cell.children().length, 1,
'The cell td should only contain the special div of monetary widget.');
- assert.strictEqual(list.$('input.o_form_input').length, 1,
+ assert.strictEqual(list.$('[name="qux"] input').length, 1,
'The view should have 1 input for editable monetary float.');
- assert.strictEqual(list.$('input.o_form_input').val(), '9.10',
+ assert.strictEqual(list.$('[name="qux"] input').val(), '9.10',
'The input should be rendered without the currency symbol.');
- assert.strictEqual(list.$('input.o_form_input').parent().children().first().text(), '$',
+ assert.strictEqual(list.$('[name="qux"] input').parent().children().first().text(), '$',
'The input should be preceded by a span containing the currency symbol.');
- list.$('input.o_form_input').val('108.2458938598598').trigger('input');
- assert.strictEqual(list.$('input.o_form_input').val(), '108.2458938598598',
+ list.$('[name="qux"] input').val('108.2458938598598').trigger('input');
+ assert.strictEqual(list.$('[name="qux"] input').val(), '108.2458938598598',
'The typed value should be correctly displayed.');
list.$buttons.find('.o_list_button_save').click();
@@ -1577,22 +1577,22 @@ QUnit.module('basic_fields', {
},
});
- assert.strictEqual(form.$('.o_form_field_monetary').html(), "$&nbsp;9.10",
+ assert.strictEqual(form.$('.o_field_monetary').html(), "$&nbsp;9.10",
"readonly value should contain the currency");
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_monetary > input').val(), "9.10",
+ assert.strictEqual(form.$('.o_field_monetary > input').val(), "9.10",
"input value in edition should only contain the value, without the currency");
form.$('input[type="checkbox"]').click(); // Change the field on which the monetary depends
- assert.strictEqual(form.$('.o_form_field_monetary > input').length, 1,
+ assert.strictEqual(form.$('.o_field_monetary > input').length, 1,
"After the onchange, the monetary <input/> should not have been duplicated");
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
- form.$('.o_form_field_many2one input').click();
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
+ form.$('.o_field_many2one input').click();
$dropdown.find('li:not(.o_m2o_dropdown_option):last').mouseenter().click();
- assert.strictEqual(form.$('.o_form_field_monetary > span').html(), "€",
+ assert.strictEqual(form.$('.o_field_monetary > span').html(), "€",
"After currency change, the monetary field currency should have been updated");
form.destroy();
@@ -1600,7 +1600,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldInteger');
- QUnit.test('integer field when unset', function(assert) {
+ QUnit.test('integer field when unset', function (assert) {
assert.expect(1);
var form = createView({
@@ -1611,13 +1611,13 @@ QUnit.module('basic_fields', {
res_id: 4,
});
- assert.ok(form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(form.$('.o_field_widget').hasClass('o_field_empty'),
'Non-set integer field should be recognized as unset.');
form.destroy();
});
- QUnit.test('integer field in form view', function(assert) {
+ QUnit.test('integer field in form view', function (assert) {
assert.expect(4);
var form = createView({
@@ -1628,25 +1628,25 @@ QUnit.module('basic_fields', {
res_id: 2,
});
- assert.ok(!form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(!form.$('.o_field_widget').hasClass('o_field_empty'),
'Integer field should be considered set for value 0.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').val(), '0',
- 'The value should be rendered correctly in edit mode.')
+ assert.strictEqual(form.$('input').val(), '0',
+ 'The value should be rendered correctly in edit mode.');
- form.$('input.o_form_input').val('-18').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '-18',
- 'The value should be correctly displayed in the input.')
+ form.$('input').val('-18').trigger('input');
+ assert.strictEqual(form.$('input').val(), '-18',
+ 'The value should be correctly displayed in the input.');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field').text(), '-18',
- 'The new value should be saved and displayed properly.')
+ assert.strictEqual(form.$('.o_field_widget').text(), '-18',
+ 'The new value should be saved and displayed properly.');
form.destroy();
});
- QUnit.test('integer field in form view with virtual id', function(assert) {
+ QUnit.test('integer field in form view with virtual id', function (assert) {
assert.expect(2);
var params = {
View: FormView,
@@ -1657,7 +1657,7 @@ QUnit.module('basic_fields', {
params.res_id = this.data.partner.records[1].id = "2-20170808020000";
var form = createView(params);
- assert.strictEqual(form.$('.o_form_field').text(), "2-20170808020000",
+ assert.strictEqual(form.$('.o_field_widget').text(), "2-20170808020000",
"Should display virtual id");
form.destroy();
@@ -1683,7 +1683,7 @@ QUnit.module('basic_fields', {
'</tree>',
});
- var zeroValues = list.$('td').filter(function() {return $(this).text() === '0'});
+ var zeroValues = list.$('td').filter(function () {return $(this).text() === '0';});
assert.strictEqual(zeroValues.length, 1,
'Unset integer values should not be rendered as zeros.');
@@ -1691,16 +1691,16 @@ QUnit.module('basic_fields', {
var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector)').first();
$cell.click();
- assert.strictEqual(list.$('input.o_form_input').length, 1,
- 'The view should have 1 input for editable integer.')
+ assert.strictEqual(list.$('input[name="int_field"]').length, 1,
+ 'The view should have 1 input for editable integer.');
- list.$('input.o_form_input').val('-28').trigger('input');
- assert.strictEqual(list.$('input.o_form_input').val(), '-28',
- 'The value should be displayed properly in the input.')
+ list.$('input[name="int_field"]').val('-28').trigger('input');
+ assert.strictEqual(list.$('input[name="int_field"]').val(), '-28',
+ 'The value should be displayed properly in the input.');
list.$buttons.find('.o_list_button_save').click();
assert.strictEqual(list.$('td:not(.o_list_record_selector)').first().text(), '-28',
- 'The new value should be saved and displayed properly.')
+ 'The new value should be saved and displayed properly.');
list.destroy();
});
@@ -1708,7 +1708,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldFloatTime');
- QUnit.test('float_time field in form view', function(assert) {
+ QUnit.test('float_time field in form view', function (assert) {
assert.expect(5);
var form = createView({
@@ -1731,20 +1731,20 @@ QUnit.module('basic_fields', {
});
// 9 + 0.1 * 60 = 9.06
- assert.strictEqual(form.$('.o_form_field').first().text(), '09:06',
- 'The formatted time value should be displayed properly.')
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '09:06',
+ 'The formatted time value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').val(), '09:06',
- 'The value should be rendered correctly in the input.')
+ assert.strictEqual(form.$('input').val(), '09:06',
+ 'The value should be rendered correctly in the input.');
- form.$('input.o_form_input').val('-11:48').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '-11:48',
- 'The new value should be displayed properly in the input.')
+ form.$('input').val('-11:48').trigger('input');
+ assert.strictEqual(form.$('input').val(), '-11:48',
+ 'The new value should be displayed properly in the input.');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field').first().text(), '-11:48',
- 'The new value should be saved and displayed properly.')
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '-11:48',
+ 'The new value should be saved and displayed properly.');
form.destroy();
});
@@ -1775,7 +1775,7 @@ QUnit.module('basic_fields', {
},
});
- var $phoneLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ var $phoneLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($phoneLink.length, 1,
"should have a anchor with correct classes");
assert.strictEqual($phoneLink.text(), 'y\u00ADop',
@@ -1785,17 +1785,17 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the phone field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('new').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('new').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- $phoneLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ $phoneLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($phoneLink.text(), 'n\u00ADew',
"new value should be displayed properly as text with the skype obfuscation");
assert.strictEqual($phoneLink.attr('href'), 'tel:new',
@@ -1804,7 +1804,7 @@ QUnit.module('basic_fields', {
form.destroy();
});
- QUnit.test('phone field in editable list view on extra small screens', function(assert) {
+ QUnit.test('phone field in editable list view on extra small screens', function (assert) {
assert.expect(10);
var list = createView({
@@ -1885,7 +1885,7 @@ QUnit.module('basic_fields', {
},
});
- var $phone = form.$('span.o_form_field.o_text_overflow:not(.o_form_uri)');
+ var $phone = form.$('span.o_field_widget.o_text_overflow:not(.o_form_uri)');
assert.strictEqual($phone.length, 1,
"should have a simple span rather than a link");
assert.strictEqual($phone.text(), 'yop',
@@ -1893,23 +1893,23 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the phone field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('new').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('new').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('span.o_form_field.o_text_overflow:not(.o_form_uri)').text(), 'new',
+ assert.strictEqual(form.$('span.o_field_widget.o_text_overflow:not(.o_form_uri)').text(), 'new',
"new value should be displayed properly as text without skype obfuscation");
form.destroy();
});
- QUnit.test('phone field in editable list view on normal screens', function(assert) {
+ QUnit.test('phone field in editable list view on normal screens', function (assert) {
// The behavior of this widget is completely altered by crm_voip so this
// test is irrelevant and fails if crm_voip is installed. The enterprise
// module is responsible for testing its own behavior in its own tests.
@@ -1981,13 +1981,13 @@ QUnit.module('basic_fields', {
res_id: 2,
});
- assert.strictEqual(form.$('.o_form_field.o_priority:not(.o_form_field_empty)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority:not(.o_field_empty)').length, 1,
"widget should be considered set, even though there is no value for this field");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 0,
"should have no full star since there is no value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 2,
"should have two empty stars since there is no value");
form.destroy();
@@ -2010,22 +2010,22 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field.o_priority:not(.o_form_field_empty)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority:not(.o_field_empty)').length, 1,
"widget should be considered set");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should have one empty star since the value is the second value");
// hover last star
- form.$('.o_form_field.o_priority a.o_priority_star.fa-star-o').last().trigger('mouseover');
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ form.$('.o_field_widget.o_priority a.o_priority_star.fa-star-o').last().trigger('mouseover');
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 2,
"should temporary have two full stars since we are hovering the third value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
"should temporary have no empty star since we are hovering the third value");
// Here we should test with mouseout, but currently the effect associated with it
@@ -2033,54 +2033,54 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should still have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should still have one empty star since the value is the second value");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should still have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should still have one empty star since the value is the second value");
// switch to edit mode to check that the new value was properly written
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should still have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should still have one empty star since the value is the second value");
// click on the second star in edit mode
- form.$('.o_form_field.o_priority a.o_priority_star.fa-star-o').last().click();
+ form.$('.o_field_widget.o_priority a.o_priority_star.fa-star-o').last().click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 2,
"should now have two full stars since the value is the third value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
"should now have no empty star since the value is the third value");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 2,
"should now have two full stars since the value is the third value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
"should now have no empty star since the value is the third value");
form.destroy();
});
- QUnit.test('priority widget in editable list view', function(assert) {
+ QUnit.test('priority widget in editable list view', function (assert) {
assert.expect(25);
var list = createView({
@@ -2090,7 +2090,7 @@ QUnit.module('basic_fields', {
arch: '<tree editable="bottom"><field name="selection" widget="priority"/></tree>',
});
- assert.strictEqual(list.$('.o_data_row').first().find('.o_priority:not(.o_form_field_empty)').length, 1,
+ assert.strictEqual(list.$('.o_data_row').first().find('.o_priority:not(.o_field_empty)').length, 1,
"widget should be considered set");
assert.strictEqual(list.$('.o_data_row').first().find('.o_priority a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
@@ -2141,7 +2141,7 @@ QUnit.module('basic_fields', {
"should now have two empty stars since the value is the first value");
// re-enter edit mode to force re-rendering the widget to check if the value was correctly saved
- var $cell = list.$('tbody td:not(.o_list_record_selector)').first();
+ $cell = list.$('tbody td:not(.o_list_record_selector)').first();
$cell.click();
assert.strictEqual(list.$('.o_data_row').first().find('.o_priority a.o_priority_star').length, 2,
@@ -2193,15 +2193,15 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 1,
"should have one red status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0,
"should not have one green status since selection is the second, blocked state");
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should not be a dropdown");
// Click on the status button to make the dropdown appear
- form.$('.o_form_field.o_selection .o_status').first().click();
+ form.$('.o_field_widget.o_selection .o_status').first().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1,
"there should be a dropdown");
assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2,
@@ -2211,26 +2211,26 @@ QUnit.module('basic_fields', {
form.$('ul.dropdown-menu.state:visible li').first().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should not be a dropdown anymore");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should not have one red status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0,
"should not have one green status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status').length, 1,
"should have one grey status since selection is the first, normal state");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should still not be a dropdown");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should still not have one red status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0,
"should still not have one green status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status').length, 1,
"should still have one grey status since selection is the first, normal state");
// Click on the status button to make the dropdown appear
- form.$('.o_form_field.o_selection .o_status').first().click();
+ form.$('.o_field_widget.o_selection .o_status').first().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1,
"there should be a dropdown");
assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2,
@@ -2240,18 +2240,18 @@ QUnit.module('basic_fields', {
form.$('ul.dropdown-menu.state:visible li').last().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should not be a dropdown anymore");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should not have one red status since selection is the third, done state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 1,
"should have one green status since selection is the third, done state");
// save
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should still not be a dropdown anymore");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should still not have one red status since selection is the third, done state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 1,
"should still have one green status since selection is the third, done state");
form.destroy();
@@ -2387,41 +2387,41 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field.label.label-warning').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1,
"should have a warning status label since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-default').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0,
"should not have a default status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-success').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0,
"should not have a success status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-warning').text(), 'Blocked',
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked',
"the label should say 'Blocked' since this is the label value for that state");
// // switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field.label.label-warning').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1,
"should have a warning status label since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-default').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0,
"should not have a default status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-success').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0,
"should not have a success status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-warning').text(), 'Blocked',
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked',
"the label should say 'Blocked' since this is the label value for that state");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.label.label-warning').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1,
"should have a warning status label since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-default').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0,
"should not have a default status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-success').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0,
"should not have a success status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-warning').text(), 'Blocked',
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked',
"the label should say 'Blocked' since this is the label value for that state");
form.destroy();
});
- QUnit.test('label_selection widget in editable list view', function(assert) {
+ QUnit.test('label_selection widget in editable list view', function (assert) {
assert.expect(21);
var list = createView({
@@ -2512,29 +2512,29 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'int_field', "should have 'int_field' as text");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should still have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should still have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'int_field', "should have 'int_field' as text");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'int_field', "should have 'int_field' as text");
form.destroy();
@@ -2564,29 +2564,29 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'yop', "should have 'yop' as text, since it is the value of field foo");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should still have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should still have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'yop', "should have 'yop' as text, since it is the value of field foo");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'yop', "should have 'yop' as text, since it is the value of field foo");
form.destroy();
@@ -2615,29 +2615,29 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'', "should not have any label");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should still have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should still have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'', "should not have any label");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'', "should not have any label");
form.destroy();
@@ -2663,35 +2663,35 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'10%', "should have 10% as pie value since int_field=10");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(180deg);'), "left mask should be covering the whole left side of the pie");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().attr('style'),
'transform: rotate(36deg);'), "right mask should be rotated from 360*(10/100) = 36 degrees");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'10%', "should have 10% as pie value since int_field=10");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(180deg);'), "left mask should be covering the whole left side of the pie");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().attr('style'),
'transform: rotate(36deg);'), "right mask should be rotated from 360*(10/100) = 36 degrees");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'10%', "should have 10% as pie value since int_field=10");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(180deg);'), "left mask should be covering the whole left side of the pie");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().attr('style'),
'transform: rotate(36deg);'), "right mask should be rotated from 360*(10/100) = 36 degrees");
form.destroy();
@@ -2714,35 +2714,35 @@ QUnit.module('basic_fields', {
res_id: 3,
});
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'80%', "should have 80% as pie value since int_field=80");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(288deg);'), "left mask should be rotated from 360*(80/100) = 288 degrees");
- assert.ok(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().hasClass('o_full'),
+ assert.ok(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().hasClass('o_full'),
"right mask should be hidden since the value > 50%");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'80%', "should have 80% as pie value since int_field=80");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(288deg);'), "left mask should be rotated from 360*(80/100) = 288 degrees");
- assert.ok(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().hasClass('o_full'),
+ assert.ok(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().hasClass('o_full'),
"right mask should be hidden since the value > 50%");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'80%', "should have 80% as pie value since int_field=80");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(288deg);'), "left mask should be rotated from 360*(80/100) = 288 degrees");
- assert.ok(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().hasClass('o_full'),
+ assert.ok(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().hasClass('o_full'),
"right mask should be hidden since the value > 50%");
form.destroy();
@@ -2767,31 +2767,31 @@ QUnit.module('basic_fields', {
// '</tree>',
// });
//
- // assert.strictEqual(list.$('.o_form_field_percent_pie .o_pie').length, 5,
+ // assert.strictEqual(list.$('.o_field_percent_pie .o_pie').length, 5,
// "should have five pie charts");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_pie_value').first().text(),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_pie_value').first().text(),
// '10%', "should have 10% as pie value since int_field=10");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
// 'transform: rotate(180deg);', "left mask should be covering the whole left side of the pie");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'transform: rotate(36deg);', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// // switch to edit mode and check the result
// list.$('tbody td:not(.o_list_record_selector)').first().click();
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_pie_value').first().text(),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_pie_value').first().text(),
// '10%', "should have 10% as pie value since int_field=10");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
// 'transform: rotate(180deg);', "left mask should be covering the whole right side of the pie");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'transform: rotate(36deg);', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// // save
// list.$buttons.find('.o_list_button_save').click();
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_pie_value').first().text(),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_pie_value').first().text(),
// '10%', "should have 10% as pie value since int_field=10");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
// 'transform: rotate(180deg);', "left mask should be covering the whole right side of the pie");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'transform: rotate(36deg);', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// list.destroy();
@@ -2823,7 +2823,7 @@ QUnit.module('basic_fields', {
// As the domain is empty, there should be a button to add the first
// domain part
- var $domain = form.$(".o_form_field_domain");
+ var $domain = form.$(".o_field_domain");
var $domainAddFirstNodeButton = $domain.find(".o_domain_add_first_node_button");
assert.equal($domainAddFirstNodeButton.length, 1,
"there should be a button to create first domain element");
@@ -2865,7 +2865,7 @@ QUnit.module('basic_fields', {
// Saving the form view should show a readonly domain containing the
// "color" field
form.$buttons.find('.o_form_button_save').click();
- $domain = form.$(".o_form_field_domain");
+ $domain = form.$(".o_field_domain");
assert.ok($domain.html().indexOf("Color index") >= 0,
"field selector readonly value should now contain 'Color index'");
form.destroy();
@@ -2897,7 +2897,7 @@ QUnit.module('basic_fields', {
// As the domain is equal to [["id", "=", 1]] there should be a field
// selector to change this
- var $domain = form.$(".o_form_field_domain");
+ var $domain = form.$(".o_field_domain");
var $fieldSelector = $domain.find(".o_field_selector");
assert.equal($fieldSelector.length, 1,
"there should be a field selector");
@@ -2924,7 +2924,7 @@ QUnit.module('basic_fields', {
"field selector popover should contain 'Product Name' field");
// Now change the value of the "bar" field to "partner_type"
- form.$(".o_field_widget.o_form_input").click().val("partner_type").trigger("input");
+ form.$("input.o_field_widget").click().val("partner_type").trigger("input");
// Refocusing the field selector input should open the popover again
$fieldSelector = form.$(".o_field_selector");
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index d6ea4a946be..db81e19731c 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -259,9 +259,9 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
assert.ok($dropdown.is(':visible'),
'clicking on the m2o input should open the dropdown if it is not open yet');
assert.strictEqual($dropdown.find('li:not(.o_m2o_dropdown_option)').length, 7,
@@ -269,19 +269,19 @@ QUnit.module('relational_fields', {
assert.strictEqual($dropdown.find('li.o_m2o_dropdown_option').length, 2,
'autocomplete should contain "Search More" and Create and Edit..."');
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
assert.ok(!$dropdown.is(':visible'),
'clicking on the m2o input should close the dropdown if it is open');
// change the value of the m2o with a suggestion of the dropdown
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
$dropdown.find('li:first()').click();
assert.ok(!$dropdown.is(':visible'), 'clicking on a value should close the dropdown');
- assert.strictEqual(form.$('.o_form_field_many2one input').val(), 'first record',
+ assert.strictEqual(form.$('.o_field_many2one input').val(), 'first record',
'value of the m2o should have been correctly updated');
// change the value of the m2o with a record in the 'Search More' modal
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
// click on 'Search More' (mouseenter required by ui-autocomplete)
$dropdown.find('.o_m2o_dropdown_option:contains(Search)').mouseenter().click();
assert.ok($('.modal .o_list_view').length, "should have opened a list view in a modal");
@@ -299,7 +299,7 @@ QUnit.module('relational_fields', {
$('.modal tbody tr:contains(Partner 20)').click(); // choose record 'Partner 20'
assert.ok(!$('.modal').length, "should have closed the modal");
assert.ok(!$dropdown.is(':visible'), 'should have closed the dropdown');
- assert.strictEqual(form.$('.o_form_field_many2one input').val(), 'Partner 20',
+ assert.strictEqual(form.$('.o_field_many2one input').val(), 'Partner 20',
'value of the m2o should have been correctly updated');
// save
@@ -479,8 +479,8 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('a').text(), '', 'the tag a should be empty');
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_many2one input').click();
- form.$('.o_form_field_many2one input').autocomplete('widget').find('a').first().click();
+ form.$('.o_field_many2one input').click();
+ form.$('.o_field_many2one input').autocomplete('widget').find('a').first().click();
assert.strictEqual(form.$('input').val(), "xphone", "should have selected xphone");
@@ -549,8 +549,8 @@ QUnit.module('relational_fields', {
},
});
- form.$('.o_form_field_many2one input').focus();
- form.$('.o_form_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
+ form.$('.o_field_many2one input').focus();
+ form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
$('.modal .modal-footer .btn-primary').first().click();
@@ -571,8 +571,8 @@ QUnit.module('relational_fields', {
'</form>',
});
- form.$('.o_form_field_many2one input').focus();
- form.$('.o_form_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
+ form.$('.o_field_many2one input').focus();
+ form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
assert.strictEqual($('.modal').length, 0, "should not display the create modal");
form.destroy();
@@ -607,17 +607,17 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('td.o_list_record_selector').length, 0,
"embedded one2many should not have a selector");
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
"embedded one2many should not be editable");
assert.ok(!form.$('td.o_list_record_delete').length,
"embedded one2many records should not have a trash icon");
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
"embedded one2many should now be editable");
- assert.strictEqual(form.$('.o_form_field_x2many_list_row_add').attr('colspan'), "2",
+ assert.strictEqual(form.$('.o_field_x2many_list_row_add').attr('colspan'), "2",
"should have colspan 2 (one for field foo, one for being below trash icon)");
assert.ok(form.$('td.o_list_record_delete').length,
@@ -934,12 +934,12 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.destroy();
});
@@ -1027,7 +1027,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_kanban_view .delete_icon').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_one2many .o-kanban-button-new').length,
+ assert.ok(!form.$('.o_field_one2many .o-kanban-button-new').length,
'"Create" button should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -1040,20 +1040,20 @@ QUnit.module('relational_fields', {
'color of subrecord should be the one in DB');
assert.ok(form.$('.o_kanban_view .delete_icon').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_one2many .o-kanban-button-new').length,
+ assert.ok(form.$('.o_field_one2many .o-kanban-button-new').length,
'"Create" button should be visible in edit');
// edit existing subrecord
form.$('.oe_kanban_global_click').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_kanban_record span:first').text(), 'new name',
'value of subrecord should have been updated');
// create a new subrecord
form.$('.o-kanban-button-new').click();
- $('.modal .o_form_view .o_form_input').val('new subrecord 1').trigger('input');
+ $('.modal .o_form_view input').val('new subrecord 1').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 2,
'should contain 2 records');
@@ -1062,9 +1062,9 @@ QUnit.module('relational_fields', {
// create two new subrecords
form.$('.o-kanban-button-new').click();
- $('.modal .o_form_view .o_form_input').val('new subrecord 2').trigger('input');
+ $('.modal .o_form_view input').val('new subrecord 2').trigger('input');
$('.modal .modal-footer .btn-primary:nth(1)').click(); // save and new
- $('.modal .o_form_view .o_form_input').val('new subrecord 3').trigger('input');
+ $('.modal .o_form_view input').val('new subrecord 3').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 4,
'should contain 4 records');
@@ -1153,7 +1153,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_list_record_delete').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -1164,13 +1164,13 @@ QUnit.module('relational_fields', {
'display_name of first subrecord should be the one in DB');
assert.ok(form.$('.o_list_record_delete').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not visible in edit');
// edit existing subrecord
form.$('.o_list_view tbody tr:first() td:eq(1)').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'new name',
'value of subrecord should have been updated');
@@ -1213,7 +1213,7 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.$('.o_list_view tbody td:first()').click();
@@ -1223,7 +1223,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should be available in edit');
// edit existing subrecord
@@ -1232,7 +1232,7 @@ QUnit.module('relational_fields', {
'in edit, clicking on a subrecord should not open a dialog');
assert.ok(form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
'first row should be in edition');
- form.$('.o_list_view .o_form_input:first()').val('new name').trigger('input');
+ form.$('.o_list_view input:first()').val('new name').trigger('input');
form.$('.o_list_view tbody tr:nth(1) td:first').click(); // click on second record to validate the first one
assert.ok(!form.$('.o_list_view tbody tr:first').hasClass('o_selected_row'),
@@ -1273,11 +1273,11 @@ QUnit.module('relational_fields', {
// edit mode, then click on Add an item and enter a value
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$('.o_selected_row > td input').val('kartoffel').trigger('input');
// click again on Add an item
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('td:contains(kartoffel)').length, 1,
"should have one td with the new value");
assert.strictEqual(form.$('.o_selected_row > td input').length, 1,
@@ -1319,8 +1319,8 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"should have 1 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('tr.o_data_row').length, 3,
"should have 3 data rows");
@@ -1365,14 +1365,14 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('textarea').val(), "",
"field turtle_description should be empty");
// add a value in the turtle_trululu field to trigger an onchange
- var $dropdown = form.$('.o_form_field_many2one[name=turtle_trululu] input')
+ var $dropdown = form.$('.o_field_many2one[name=turtle_trululu] input')
.autocomplete('widget');
- form.$('.o_form_field_many2one[name=turtle_trululu] input').click();
+ form.$('.o_field_many2one[name=turtle_trululu] input').click();
$dropdown.find('a:contains(first record)').mouseenter().click();
assert.strictEqual(form.$('textarea').val(), "Some Description",
"field turtle_description should be set to the result of the onchange");
@@ -1411,13 +1411,13 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$('label.o_form_label').first().click();
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should still have 0 data rows");
// click on Add an item again, then click on save
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should still have 0 data rows");
@@ -1453,7 +1453,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"should have 1 data rows");
@@ -1518,7 +1518,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
// input some text in required turtle_foo field
form.$('input[name="turtle_foo"]').val('aubergine').trigger('input');
@@ -1718,10 +1718,10 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_list_view tbody tr:eq(0) td:first').hasClass('o_readonly'),
+ assert.ok(form.$('.o_list_view tbody tr:eq(0) td:first').hasClass('o_readonly_modifier'),
"first record should have display_name in readonly mode");
- assert.notOk(form.$('.o_list_view tbody tr:eq(1) td:first').hasClass('o_readonly'),
+ assert.notOk(form.$('.o_list_view tbody tr:eq(1) td:first').hasClass('o_readonly_modifier'),
"second record should not have display_name in readonly mode");
form.destroy();
});
@@ -1752,8 +1752,8 @@ QUnit.module('relational_fields', {
'o2m pager should be hidden');
// click to create a subrecord
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
- $('.modal .o_form_input').val('new record').trigger('input');
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
+ $('.modal input').val('new record').trigger('input');
$('.modal .modal-footer button:eq(0)').click(); // save and close
assert.ok(!form.$('.o_x2m_control_panel .o_cp_pager div').is(':visible'),
@@ -1807,11 +1807,11 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
- $('.modal .o_form_field_many2one input').click();
+ $('.modal .o_field_many2one input').click();
- var $dropdown = $('.modal .o_form_field_many2one input').autocomplete('widget');
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(1) a').mouseenter();
$dropdown.find('li:eq(1) a').click();
@@ -1865,11 +1865,11 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
// write in the many2one field, value = 37 (xphone)
- $('.modal .o_form_field_many2one input').click();
- var $dropdown = $('.modal .o_form_field_many2one input').autocomplete('widget');
+ $('.modal .o_field_many2one input').click();
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(0) a').mouseenter();
$dropdown.find('li:eq(0) a').click();
@@ -1900,8 +1900,8 @@ QUnit.module('relational_fields', {
"should display 123 (previous change has been discarded)");
// write in the many2one field, value = 41 (xpad)
- $('.modal .o_form_field_many2one input').click();
- $dropdown = $('.modal .o_form_field_many2one input').autocomplete('widget');
+ $('.modal .o_field_many2one input').click();
+ $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(1) a').mouseenter();
$dropdown.find('li:eq(1) a').click();
@@ -1956,7 +1956,7 @@ QUnit.module('relational_fields', {
form.$('tr.o_data_row:eq(0) td:contains(xphone)').click();
// write in the many2one field
- $('.modal .o_form_field_many2one input').click();
+ $('.modal .o_field_many2one input').click();
form.destroy();
});
@@ -1994,7 +1994,7 @@ QUnit.module('relational_fields', {
form.$('tr.o_data_row:eq(0) td:contains(xphone)').click();
// trigger a name search
- form.$('table td input.o_form_input').click();
+ form.$('table td input').click();
form.destroy();
});
@@ -2030,7 +2030,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2055,17 +2055,17 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
- assert.strictEqual(form.$('td input.o_field_widget.o_form_input').length, 1,
+ assert.strictEqual(form.$('td input.o_field_widget').length, 1,
"should have created a row in edit mode");
- form.$('td input.o_field_widget.o_form_input').val('a').trigger('input');
+ form.$('td input.o_field_widget').val('a').trigger('input');
- assert.strictEqual(form.$('td input.o_field_widget.o_form_input').length, 1,
+ assert.strictEqual(form.$('td input.o_field_widget').length, 1,
"should not have unselected the row after edition");
- form.$('td input.o_field_widget.o_form_input').val('abc').trigger('input');
+ form.$('td input.o_field_widget').val('abc').trigger('input');
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('td:contains(abc)').length, 1,
@@ -2100,7 +2100,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2148,7 +2148,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual($('.modal .o_data_row').length, 2,
"sould have 2 records in the select view (the last one is not displayed because it is already selected)");
@@ -2157,14 +2157,14 @@ QUnit.module('relational_fields', {
$('.modal .o_select_button').click();
$('.o_form_button_save').click();
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual($('.modal .o_data_row').length, 1,
"sould have 1 record in the select view");
$('.modal-footer button:eq(1)').click();
- $('.modal input.o_form_field[name="turtle_foo"]').val('tototo').trigger('input');
- $('.modal input.o_form_field[name="turtle_int"]').val(50).trigger('input');
+ $('.modal input.o_field_widget[name="turtle_foo"]').val('tototo').trigger('input');
+ $('.modal input.o_field_widget[name="turtle_int"]').val(50).trigger('input');
var $many2one = $('.modal [name="product_id"] input').click();
var $dropdown = $many2one.autocomplete('widget');
$dropdown.find('li:first a').mouseenter();
@@ -2245,7 +2245,7 @@ QUnit.module('relational_fields', {
// add a one2many record
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
$('.modal .o_data_row:first .o_list_record_selector input').click();
$('.modal .o_select_button').click();
@@ -2294,7 +2294,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2326,7 +2326,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2357,7 +2357,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2384,11 +2384,11 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
$('.modal-footer button.btn-primary').first().click();
assert.strictEqual($('.modal').length, 1, "should still have an open modal");
- assert.strictEqual($('.modal tbody label.o_form_invalid').length, 1,
+ assert.strictEqual($('.modal tbody label.o_field_invalid').length, 1,
"should have displayed invalid fields");
form.destroy();
});
@@ -2539,7 +2539,7 @@ QUnit.module('relational_fields', {
}
});
- assert.strictEqual(form.$('.o_form_field[name="turtles"] .o_list_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget[name="turtles"] .o_list_view').length, 1,
'should display one2many list view in the modal');
assert.strictEqual(form.$('.o_data_row').length, 2,
@@ -2603,7 +2603,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field').text(), "xphone",
+ assert.strictEqual($('.modal .o_field_widget').text(), "xphone",
'should display the form view dialog with the many2one value');
$('.modal-footer button').click(); // close the modal
@@ -2612,21 +2612,21 @@ QUnit.module('relational_fields', {
// edit the m2m of first row
form.$('.o_list_view tbody td:first()').click();
// remove a tag
- form.$('.o_form_field_many2manytags .badge:contains(aaa) .o_delete').click();
- assert.strictEqual(form.$('.o_selected_row .o_form_field_many2manytags .o_badge_text:contains(aaa)').length, 0,
+ form.$('.o_field_many2manytags .badge:contains(aaa) .o_delete').click();
+ assert.strictEqual(form.$('.o_selected_row .o_field_many2manytags .o_badge_text:contains(aaa)').length, 0,
"tag should have been correctly removed");
// add a tag
- var $m2mInput = form.$('.o_selected_row .o_form_field_many2manytags input');
+ var $m2mInput = form.$('.o_selected_row .o_field_many2manytags input');
$m2mInput.click();
$m2mInput.autocomplete('widget').find('li:first()').click();
- assert.strictEqual(form.$('.o_selected_row .o_form_field_many2manytags .o_badge_text:contains(first record)').length, 1,
+ assert.strictEqual(form.$('.o_selected_row .o_field_many2manytags .o_badge_text:contains(first record)').length, 1,
"tag should have been correctly added");
// edit the m2o of first row
- var $m2oInput = form.$('.o_selected_row .o_form_field_many2one:first input');
+ var $m2oInput = form.$('.o_selected_row .o_field_many2one:first input');
$m2oInput.click();
$m2oInput.autocomplete('widget').find('li:contains(xpad)').mouseover().click();
- assert.strictEqual(form.$('.o_selected_row .o_form_field_many2one:first input').val(), 'xpad',
+ assert.strictEqual(form.$('.o_selected_row .o_field_many2one:first input').val(), 'xpad',
"m2o value should have been updated");
// save (should correctly generate the commands)
@@ -2673,7 +2673,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field[name="partner_ids"] .o_list_view').length, 1,
+ assert.strictEqual($('.modal .o_field_widget[name="partner_ids"] .o_list_view').length, 1,
'should display many2many list view in the modal');
form.destroy();
@@ -2705,7 +2705,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field[name="turtle_foo"]').text(), 'blip',
+ assert.strictEqual($('.modal .o_field_widget[name="turtle_foo"]').text(), 'blip',
'should open the modal and display the form field');
form.destroy();
@@ -2737,7 +2737,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field[name="turtle_foo"]').text(), 'blip',
+ assert.strictEqual($('.modal .o_field_widget[name="turtle_foo"]').text(), 'blip',
'should open the modal and display the form field');
form.destroy();
@@ -2784,38 +2784,38 @@ QUnit.module('relational_fields', {
res_id: 4,
});
- assert.strictEqual(form.$('.o_form_field .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view').length, 1,
"should have one inner kanban view for the one2many field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 0,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 0,
"should not have kanban records yet");
// // switch to edit mode and create a new kanban record
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field .o-kanban-button-new').click();
+ form.$('.o_field_widget .o-kanban-button-new').click();
// save & close the modal
- assert.strictEqual($('.modal-content input.o_form_field').val(), 'My little Foo Value',
+ assert.strictEqual($('.modal-content input.o_field_widget').val(), 'My little Foo Value',
"should already have the default value for field foo");
$('.modal-content .btn-primary').first().click();
- assert.strictEqual(form.$('.o_form_field .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view').length, 1,
"should have one inner kanban view for the one2many field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
"should now have one kanban record");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
'', "should not have a value for the id field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
'My little Foo Value', "should have a value for the foo field");
// save the view to force a create of the new record in the one2many
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view').length, 1,
"should have one inner kanban view for the one2many field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
"should now have one kanban record");
- assert.notEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
+ assert.notEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
'', "should now have a value for the id field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
'My little Foo Value', "should still have a value for the foo field");
form.destroy();
@@ -2844,11 +2844,11 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_data_row:first td:first').click();
- assert.strictEqual(form.$('.o_form_input[name="turtle_foo"]')[0], document.activeElement,
+ assert.strictEqual(form.$('input[name="turtle_foo"]')[0], document.activeElement,
"turtle foo field should have focus");
- form.$('.o_form_input[name="turtle_foo"]').trigger({type: 'keydown', which: $.ui.keyCode.TAB});
- assert.strictEqual(form.$('.o_form_input[name="turtle_int"]')[0], document.activeElement,
+ form.$('input[name="turtle_foo"]').trigger({type: 'keydown', which: $.ui.keyCode.TAB});
+ assert.strictEqual(form.$('input[name="turtle_int"]')[0], document.activeElement,
"turtle int field should have focus");
form.destroy();
});
@@ -2887,7 +2887,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row').length, 1,
"should start with one data row");
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('.o_data_row').length, 2,
"should have 2 data rows");
@@ -2934,7 +2934,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row').length, 1,
"should start with one data row");
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('.o_data_row').length, 2,
"should have 2 data rows");
@@ -2975,7 +2975,7 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field_one2many .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_one2many .o_kanban_view').length, 1,
"should have rendered a kanban view");
form.destroy();
@@ -3014,16 +3014,16 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should start with value 0");
- form.$('.o_form_field_x2many_list_row_add a').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ form.$('.o_field_x2many_list_row_add a').click();
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should still be 0 (no onchange should have been done yet");
assert.verifySteps(['read', 'default_get'], "no onchange should have been applied");
form.$('.o_field_widget[name="turtle_foo"]').val("some text").trigger('input');
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "1",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "1",
"int_field should now be 1 (the onchange should have been done");
form.destroy();
@@ -3066,16 +3066,16 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should start with value 0");
- form.$('.o_form_field_x2many_list_row_add a').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ form.$('.o_field_x2many_list_row_add a').click();
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should still be 0 (no onchange should have been done yet");
assert.verifySteps(['read', 'default_get'], "no onchange should have been applied");
form.$('.o_field_widget[name="turtle_foo"]').val("some text").trigger('input');
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "1",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "1",
"int_field should now be 1 (the onchange should have been done");
form.destroy();
@@ -3152,7 +3152,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_kanban_view .delete_icon').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_many2many .o-kanban-button-new').length,
+ assert.ok(!form.$('.o_field_many2many .o-kanban-button-new').length,
'"Add" button should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -3163,20 +3163,20 @@ QUnit.module('relational_fields', {
'display_name of subrecord should be the one in DB');
assert.ok(form.$('.o_kanban_view .delete_icon').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_many2many .o-kanban-button-new').length,
+ assert.ok(form.$('.o_field_many2many .o-kanban-button-new').length,
'"Add" button should be visible in edit');
// edit existing subrecord
form.$('.oe_kanban_global_click:first()').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_kanban_record:first() span').text(), 'new name',
'value of subrecord should have been updated');
// add subrecords
// -> single select
- form.$('.o_form_field_many2many .o-kanban-button-new').click();
+ form.$('.o_field_many2many .o-kanban-button-new').click();
assert.ok($('.modal .o_list_view').length, "should have opened a list view in a modal");
assert.strictEqual($('.modal .o_list_view tbody .o_list_record_selector').length, 3,
"list view should contain 3 records");
@@ -3188,7 +3188,7 @@ QUnit.module('relational_fields', {
'record "red" should be in the kanban');
// -> multiple select
- form.$('.o_form_field_many2many .o-kanban-button-new').click();
+ form.$('.o_field_many2many .o-kanban-button-new').click();
assert.ok($('.modal .o_select_button').prop('disabled'), "select button should be disabled");
assert.strictEqual($('.modal .o_list_view tbody .o_list_record_selector').length, 2,
"list view should contain 2 records");
@@ -3199,7 +3199,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 5,
'kanban should now contain 5 records');
// -> created record
- form.$('.o_form_field_many2many .o-kanban-button-new').click();
+ form.$('.o_field_many2many .o-kanban-button-new').click();
$('.modal .modal-footer .btn-primary:nth(1)').click(); // click on 'Create'
assert.ok($('.modal .o_form_view.o_form_editable').length,
"should have opened a form view in edit mode, in a modal");
@@ -3297,7 +3297,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_list_record_delete').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -3308,13 +3308,13 @@ QUnit.module('relational_fields', {
'display_name of first subrecord should be the one in DB');
assert.ok(form.$('.o_list_record_delete').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should be visible in edit');
// edit existing subrecord
form.$('.o_list_view tbody tr:first()').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'new name',
'value of subrecord should have been updated');
@@ -3355,7 +3355,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_list_record_delete').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -3366,7 +3366,7 @@ QUnit.module('relational_fields', {
'display_name of first subrecord should be the one in DB');
assert.ok(form.$('.o_list_record_delete').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not visible in edit');
// edit existing subrecord
@@ -3375,7 +3375,7 @@ QUnit.module('relational_fields', {
'in edit, clicking on a subrecord should not open a dialog');
assert.ok(form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
'first row should be in edition');
- form.$('.o_list_view .o_form_input:first()').val('new name').trigger('input');
+ form.$('.o_list_view input:first()').val('new name').trigger('input');
// FIXME: this doesn"t work for now as the x2many fields are reset on field changed
// form.$('.o_list_view tbody td:nth(1)').click(); // click on second record to validate the first one
// assert.ok(!form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
@@ -3416,7 +3416,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_x2many_list_row_add').length, 1, "should have the 'Add an item' link");
+ assert.strictEqual(form.$('.o_field_x2many_list_row_add').length, 1, "should have the 'Add an item' link");
assert.strictEqual(form.$('.o_list_record_delete').length, 2, "should have the 'Add an item' link");
form.destroy();
@@ -3437,7 +3437,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_x2many_list_row_add').length, 0, "should not have the 'Add an item' link");
+ assert.strictEqual(form.$('.o_field_x2many_list_row_add').length, 0, "should not have the 'Add an item' link");
assert.strictEqual(form.$('.o_list_record_delete').length, 0, "should not have the 'Add an item' link");
form.destroy();
@@ -3459,12 +3459,12 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in edit either');
form.destroy();
@@ -3508,7 +3508,7 @@ QUnit.module('relational_fields', {
},
});
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
$('.modal .o_data_row:first').click(); // add a first record to the relation
assert.strictEqual(form.$('.o_data_row').length, 1,
@@ -3516,7 +3516,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row:first .o_badge_text').text(), 'leonardodonatello',
"inner m2m should have been fetched and correctly displayed");
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
$('.modal .o_data_row:first').click(); // add a second record to the relation
assert.strictEqual(form.$('.o_data_row').length, 2,
@@ -3658,8 +3658,8 @@ QUnit.module('relational_fields', {
},
});
- assert.ok(form.$('.o_statusbar_status').hasClass('o_form_field_empty'),
- 'statusbar widget should have class o_form_field_empty');
+ assert.ok(form.$('.o_statusbar_status').hasClass('o_field_empty'),
+ 'statusbar widget should have class o_field_empty');
assert.strictEqual(form.$('.o_statusbar_status').children().length, 0,
'statusbar widget should be empty');
form.destroy();
@@ -3896,7 +3896,7 @@ QUnit.module('relational_fields', {
return this._super.apply(this, arguments);
},
});
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should contain 2 tags");
assert.ok(form.$('span:contains(gold)').length,
'should have fetched and rendered gold partner tag');
@@ -3907,33 +3907,33 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should still contain 2 tags in edit mode");
assert.ok(form.$('.o_tag_color_2 .o_badge_text:contains(gold)').length,
'first tag should still contain "gold" and be color 2 in edit mode');
- assert.strictEqual(form.$('.o_form_field_many2manytags .o_delete').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags .o_delete').length, 2,
"tags should contain a delete button");
// add an other existing tag
- var $input = form.$('.o_form_field_many2manytags input');
+ var $input = form.$('.o_field_many2manytags input');
$input.click(); // opens the dropdown
assert.strictEqual($input.autocomplete('widget').find('li').length, 1,
"autocomplete dropdown should have 1 entry");
assert.strictEqual($input.autocomplete('widget').find('li a:contains("red")').length, 1,
"autocomplete dropdown should contain 'red'");
$input.autocomplete('widget').find('li').click(); // add 'red'
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 3,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 3,
"should contain 3 tags");
- assert.ok(form.$('.o_form_field_many2manytags > span:contains("red")').length,
+ assert.ok(form.$('.o_field_many2manytags > span:contains("red")').length,
"should contain newly added tag 'red'");
- assert.ok(form.$('.o_form_field_many2manytags > span[data-color=8]:contains("red")').length,
+ assert.ok(form.$('.o_field_many2manytags > span[data-color=8]:contains("red")').length,
"should have fetched the color of added tag");
// remove tag with id 14
- form.$('.o_form_field_many2manytags span[data-id=14] .o_delete').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ form.$('.o_field_many2manytags span[data-id=14] .o_delete').click();
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should contain 2 tags");
- assert.ok(!form.$('.o_form_field_many2manytags > span:contains("silver")').length,
+ assert.ok(!form.$('.o_field_many2manytags > span:contains("silver")').length,
"should not contain tag 'silver' anymore");
// save the record (should do the write RPC with the correct commands)
@@ -3969,7 +3969,7 @@ QUnit.module('relational_fields', {
return this._super.apply(this, arguments);
}
});
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain 1 tag");
assert.ok(form.$('span:contains(gold)').length,
'should have fetched and rendered gold partner tag');
@@ -3977,16 +3977,16 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
// add an other existing tag
- var $input = form.$('.o_form_field_many2manytags input');
+ var $input = form.$('.o_field_many2manytags input');
$input.click(); // opens the dropdown
assert.strictEqual($input.autocomplete('widget').find('li').length, 1,
"autocomplete dropdown should have 1 entry");
assert.strictEqual($input.autocomplete('widget').find('li a:contains("silver")').length, 1,
"autocomplete dropdown should contain 'silver'");
$input.autocomplete('widget').find('li').click(); // add 'silver'
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should contain 2 tags");
- assert.ok(form.$('.o_form_field_many2manytags > span:contains("silver")').length,
+ assert.ok(form.$('.o_field_many2manytags > span:contains("silver")').length,
"should contain newly added tag 'silver'");
form.destroy();
@@ -4014,14 +4014,14 @@ QUnit.module('relational_fields', {
});
assert.ok(form.$('.o_form_view').hasClass('o_form_editable'), "form should be in edit mode");
- var $input = form.$('.o_form_field_many2manytags input');
+ var $input = form.$('.o_field_many2manytags input');
$input.click(); // opens the dropdown
assert.strictEqual($input.autocomplete('widget').find('li').length, 3,
"autocomplete dropdown should have 3 entries (2 values + 'Search and Edit...')");
$input.autocomplete('widget').find('li:first()').click(); // adds a tag
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain 1 tag");
- assert.ok(form.$('.o_form_field_many2manytags > span:contains("gold")').length,
+ assert.ok(form.$('.o_field_many2manytags > span:contains("gold")').length,
"should contain newly added tag 'gold'");
// save the record (should do the write RPC with the correct commands)
@@ -4059,7 +4059,7 @@ QUnit.module('relational_fields', {
});
QUnit.test('fieldmany2many tags in editable list', function (assert) {
- assert.expect(5);
+ assert.expect(4);
this.data.partner.records[0].timmy = [12];
@@ -4073,13 +4073,13 @@ QUnit.module('relational_fields', {
'</tree>',
});
- assert.strictEqual(list.$('.o_data_row:first .o_form_field_many2manytags .badge').length, 1,
+ assert.strictEqual(list.$('.o_data_row:first .o_field_many2manytags .badge').length, 1,
"m2m field should contain one tag");
// edit first row
list.$('.o_data_row:first td:nth(2)').click();
- var $m2o = list.$('.o_data_row:first .o_form_field_many2manytags .o_form_field_many2one');
+ var $m2o = list.$('.o_data_row:first .o_field_many2manytags .o_field_many2one');
assert.strictEqual($m2o.length, 1, "a many2one widget should have been instantiated");
// add a tag
@@ -4087,15 +4087,13 @@ QUnit.module('relational_fields', {
$input.click();
$input.autocomplete('widget').find('li:first()').click(); // adds a tag
- assert.strictEqual(list.$('.o_data_row:first .o_form_field_many2manytags .badge').length, 2,
+ assert.strictEqual(list.$('.o_data_row:first .o_field_many2manytags .badge').length, 2,
"m2m field should contain 2 tags");
- assert.ok(list.$('.o_data_row:first .o_many2many_tags_cell').hasClass('o_field_dirty'),
- "edited cell should have class o_field_dirty");
// leave edition
list.$('.o_data_row:nth(1) td:nth(2)').click();
- assert.strictEqual(list.$('.o_data_row:first .o_form_field_many2manytags .badge').length, 2,
+ assert.strictEqual(list.$('.o_data_row:first .o_field_many2manytags .badge').length, 2,
"m2m field should contain 2 tags");
list.destroy();
@@ -4121,31 +4119,31 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain one tag");
// update foo, which will trigger an onchange and update timmy
// -> m2mtags input should not have taken the focus
- form.$('.o_form_input:first').focus();
- form.$('.o_form_input:first').val('trigger onchange').trigger('input');
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 0,
+ form.$('input:first').focus();
+ form.$('input:first').val('trigger onchange').trigger('input');
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 0,
"should contain no tags");
- assert.strictEqual(form.$('.o_form_input:first').get(0), document.activeElement,
+ assert.strictEqual(form.$('input:first').get(0), document.activeElement,
"foo input should have kept the focus");
// add a tag -> m2mtags input should still have the focus
- form.$('.o_form_field_many2manytags input').click(); // opens the dropdown
- form.$('.o_form_field_many2manytags input').autocomplete('widget').find('li:first').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ form.$('.o_field_many2manytags input').click(); // opens the dropdown
+ form.$('.o_field_many2manytags input').autocomplete('widget').find('li:first').click();
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain a tag");
- assert.strictEqual(form.$('.o_form_field_many2manytags input').get(0), document.activeElement,
+ assert.strictEqual(form.$('.o_field_many2manytags input').get(0), document.activeElement,
"m2m tags input should have kept the focus");
// remove a tag -> m2mtags input should still have the focus
- form.$('.o_form_field_many2manytags .o_delete').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 0,
+ form.$('.o_field_many2manytags .o_delete').click();
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 0,
"should contain no tags");
- assert.strictEqual(form.$('.o_form_field_many2manytags input').get(0), document.activeElement,
+ assert.strictEqual(form.$('.o_field_many2manytags input').get(0), document.activeElement,
"m2m tags input should have kept the focus");
form.destroy();
@@ -4166,11 +4164,11 @@ QUnit.module('relational_fields', {
});
assert.ok(form.$('div.o_radio_item').length, "should have rendered outer div");
- assert.strictEqual(form.$('input.o_form_radio').length, 2, "should have 2 possible choices");
+ assert.strictEqual(form.$('input.o_radio_input').length, 2, "should have 2 possible choices");
assert.ok(form.$('label.o_form_label:contains(xphone)').length, "one of them should be xphone");
assert.strictEqual(form.$('input:checked').length, 0, "none of the input should be checked");
- form.$("input.o_form_radio:first").click();
+ form.$("input.o_radio_input:first").click();
assert.strictEqual(form.$('input:checked').length, 1, "one of the input should be checked");
@@ -4201,11 +4199,11 @@ QUnit.module('relational_fields', {
});
form.$("input[type='checkbox']").click();
- assert.strictEqual(form.$('input.o_form_radio[data-value="37"]:checked').length, 1, "one of the input should be checked");
- assert.strictEqual(form.$('input.o_form_radio[data-value="black"]:checked').length, 1, "the other of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="37"]:checked').length, 1, "one of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="black"]:checked').length, 1, "the other of the input should be checked");
form.$("input[type='checkbox']").click();
- assert.strictEqual(form.$('input.o_form_radio[data-value="41"]:checked').length, 1, "the other of the input should be checked");
- assert.strictEqual(form.$('input.o_form_radio[data-value="red"]:checked').length, 1, "one of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="41"]:checked').length, 1, "the other of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="red"]:checked').length, 1, "one of the input should be checked");
form.destroy();
});
@@ -4225,11 +4223,11 @@ QUnit.module('relational_fields', {
assert.ok(form.$('div.o_radio_item').length, "should have rendered outer div");
- assert.strictEqual(form.$('input.o_form_radio').length, 2, "should have 2 possible choices");
+ assert.strictEqual(form.$('input.o_radio_input').length, 2, "should have 2 possible choices");
assert.ok(form.$('label.o_form_label:contains(Red)').length, "one of them should be Red");
// click on 2nd option
- form.$("input.o_form_radio").eq(1).click();
+ form.$("input.o_radio_input").eq(1).click();
form.$buttons.find('.o_form_button_save').click();
@@ -4254,24 +4252,24 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('div.o_form_field div.o_checkbox').length, 2,
+ assert.strictEqual(form.$('div.o_field_widget div.o_checkbox').length, 2,
"should have fetched and displayed the 2 values of the many2many");
- assert.ok(form.$('div.o_form_field div.o_checkbox input').eq(0).prop('checked'),
+ assert.ok(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'),
"first checkbox should be checked");
- assert.notOk(form.$('div.o_form_field div.o_checkbox input').eq(1).prop('checked'),
+ assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'),
"second checkbox should not be checked");
- assert.ok(form.$('div.o_form_field div.o_checkbox input').prop('disabled'),
+ assert.ok(form.$('div.o_field_widget div.o_checkbox input').prop('disabled'),
"the checkboxes should be disabled");
form.$buttons.find('.o_form_button_edit').click();
- assert.notOk(form.$('div.o_form_field div.o_checkbox input').prop('disabled'),
+ assert.notOk(form.$('div.o_field_widget div.o_checkbox input').prop('disabled'),
"the checkboxes should not be disabled");
// add a m2m value
- form.$('div.o_form_field div.o_checkbox input').eq(1).click();
+ form.$('div.o_field_widget div.o_checkbox input').eq(1).click();
form.$buttons.find('.o_form_button_save').click();
assert.deepEqual(this.data.partner.records[0].timmy, [12, 14],
"should have added the second element to the many2many");
@@ -4280,13 +4278,13 @@ QUnit.module('relational_fields', {
// remove a m2m value
form.$buttons.find('.o_form_button_edit').click();
- form.$('div.o_form_field div.o_checkbox input').eq(0).click();
+ form.$('div.o_field_widget div.o_checkbox input').eq(0).click();
form.$buttons.find('.o_form_button_save').click();
assert.deepEqual(this.data.partner.records[0].timmy, [14],
"should have removed the first element to the many2many");
- assert.notOk(form.$('div.o_form_field div.o_checkbox input').eq(0).prop('checked'),
+ assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'),
"first checkbox should be checked");
- assert.ok(form.$('div.o_form_field div.o_checkbox input').eq(1).prop('checked'),
+ assert.ok(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'),
"second checkbox should not be checked");
form.destroy();
@@ -4334,29 +4332,29 @@ QUnit.module('relational_fields', {
},
});
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload').length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload').length, 1,
"there should be the attachment widget");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .oe_attachments').children().length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .oe_attachments').children().length, 1,
"there should be no attachment");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_attach').length, 0,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_attach').length, 0,
"there should not be an Add button (readonly)");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .oe_attachment .oe_delete').length, 0,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .oe_attachment .oe_delete').length, 0,
"there should not be a Delete button (readonly)");
// to edit mode
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_attach').length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_attach').length, 1,
"there should be an Add button");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_attach').text().trim(), "Pictures",
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_attach').text().trim(), "Pictures",
"the button should be correctly named");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_hidden_input_file form').length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_hidden_input_file form').length, 1,
"there should be a hidden form to upload attachments");
// TODO: add an attachment
// no idea how to test this
// delete the attachment
- form.$('div.o_form_field.oe_fileupload .oe_attachment .oe_delete').click();
+ form.$('div.o_field_widget.oe_fileupload .oe_attachment .oe_delete').click();
assert.verifySteps([
@@ -4366,7 +4364,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .oe_attachments').children().length, 0,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .oe_attachments').children().length, 0,
"there should be no attachment");
form.destroy();