[MERGE] forward port branch saas-16 up to b8540eefe3

This commit is contained in:
Christophe Simonis
2017-12-06 11:59:38 +01:00
34 changed files with 228 additions and 55 deletions
@@ -1389,6 +1389,51 @@ QUnit.module('basic_fields', {
session.get_file = oldGetFile;
});
QUnit.test('binary fields that are readonly in create mode do not download', function (assert) {
assert.expect(2);
// save the session function
var oldGetFile = session.get_file;
session.get_file = function (option) {
assert.step('We shouldn\'t be getting the file.');
return oldGetFile.bind(session)(option);
};
this.data.partner.onchanges = {
product_id: function (obj) {
obj.document = "onchange==\n";
},
};
this.data.partner.fields.document.readonly = true;
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: '<form string="Partners">' +
'<field name="product_id"/>' +
'<field name="document" filename="\'yooo\'"/>' +
'</form>',
res_id: 1,
});
form.$buttons.find('.o_form_button_create').click();
var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
form.$('.o_field_many2one input').click();
$dropdown.find('li:not(.o_m2o_dropdown_option):contains(xphone)').click();
assert.strictEqual(form.$('a.o_field_widget[name="document"] > .fa-download').length, 1,
'The link to download the binary should be present');
form.$('a.o_field_widget[name="document"]').click();
assert.verifySteps([]); // We shoudln't have passed through steps
form.destroy();
session.get_file = oldGetFile;
});
QUnit.test('text field rendering in list view', function (assert) {
assert.expect(1);