[MERGE] forward port branch saas-11.1 up to 7e469eb77a

This commit is contained in:
Christophe Simonis
2018-02-01 18:20:28 +01:00
112 changed files with 1165 additions and 671 deletions
@@ -1082,6 +1082,7 @@ var UrlWidget = InputField.extend({
_renderReadonly: function () {
this.$el.text(this.attrs.text || this.value)
.addClass('o_form_uri o_text_overflow')
.attr('target', '_blank')
.attr('href', this.value);
}
});
@@ -1105,6 +1105,7 @@ var FieldX2Many = AbstractField.extend({
* @param {OdooEvent} event
*/
_onResequence: function (event) {
event.stopPropagation();
var self = this;
this.trigger_up('freeze_order', {id: this.value.id});
var rowIDs = event.data.rowIDs.slice();
@@ -20,7 +20,8 @@ var FieldTimezoneMismatch = FieldSelection.extend({
* @override
*/
start: function () {
this._datetime = setInterval(this._renderDateTimeTimezone.bind(this), 1000);
var interval = navigator.platform.toUpperCase().indexOf('MAC') >= 0 ? 60000 : 1000;
this._datetime = setInterval(this._renderDateTimeTimezone.bind(this), interval);
return this._super.apply(this, arguments);
},
/**
@@ -102,7 +102,7 @@ var KanbanColumn = Widget.extend({
// should find a way to use the touch events to make sortable work.
this.$el.sortable({
connectWith: '.o_kanban_group',
containment: this.draggable ? '.o_kanban_view' : 'parent',
containment: this.draggable ? false : 'parent',
revert: 0,
delay: 0,
items: '> .o_kanban_record:not(.o_updating)',
+24 -26
View File
@@ -80,39 +80,37 @@ div.o_boolean_toggle {
width: 32px !important;
height: 18px;
& > label {
& > input {
> input {
display: none;
}
& > .slider {
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #a0a0a0;
border-radius: 24px;
&:before {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #a0a0a0;
border-radius: 24px;
&:before {
position: absolute;
content: "";
height: 12px;
width: 12px;
left: 3px;
bottom: 3px;
background-color: white;
border-radius: 50%;
}
content: "";
height: 12px;
width: 12px;
left: 3px;
bottom: 3px;
background-color: white;
border-radius: 50%;
}
}
& > input:checked + .slider {
background-color: @odoo-brand-optional;
> input:checked + .slider {
background-color: @odoo-brand-optional;
&:before {
.translate(14px; 0px);
}
&:before {
.translate(14px; 0px);
}
}
}
@@ -1111,7 +1111,7 @@ QUnit.module('basic_fields', {
QUnit.module('UrlWidget');
QUnit.test('url widget in form view', function (assert) {
assert.expect(8);
assert.expect(9);
var form = createView({
View: FormView,
@@ -1131,6 +1131,8 @@ QUnit.module('basic_fields', {
"should have a anchor with correct classes");
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_field_widget.o_text_overflow').attr('target'), '_blank',
"should have target attribute set to _blank");
assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').text(), 'yop',
"the value should be displayed properly");
@@ -1321,6 +1321,93 @@ QUnit.module('relational_fields', {
form.destroy();
});
QUnit.test('X2Many sequence list in modal', function (assert) {
assert.expect(5);
this.data.partner.fields.sequence = {string: 'Sequence', type: 'integer'};
this.data.partner.records[0].sequence = 1;
this.data.partner.records[1].sequence = 2;
this.data.partner.onchanges = {
sequence: function (obj) {
if (obj.id === 2) {
obj.sequence = 1;
assert.step('onchange sequence');
}
},
};
this.data.product.fields.turtle_ids = {string: 'Turtles', type: 'one2many', relation: 'turtle'};
this.data.product.records[0].turtle_ids = [1];
this.data.turtle.fields.partner_types_ids = {string: "Partner", type: "one2many", relation: 'partner'};
this.data.turtle.fields.type_id = {string: "Partner Type", type: "many2one", relation: 'partner_type'};
this.data.partner_type.fields.partner_ids = {string: "Partner", type: "one2many", relation: 'partner'};
this.data.partner_type.records[0].partner_ids = [1,2];
testUtils.createAsyncView({
View: FormView,
model: 'product',
data: this.data,
arch: '<form>' +
'<field name="name"/>' +
'<field name="turtle_ids" widget="one2many_list">' +
'<tree string="Turtles" editable="bottom">' +
'<field name="type_id"/>' +
'</tree>' +
'</field>' +
'</form>',
archs: {
'partner_type,false,form': '<form><field name="partner_ids"/></form>',
'partner,false,list': '<tree string="Vendors">' +
'<field name="display_name"/>' +
'<field name="sequence" widget="handle"/>' +
'</tree>',
},
res_id: 37,
mockRPC: function (route, args) {
if (route === '/web/dataset/call_kw/product/read') {
return $.when([{id: 37, name: 'xphone', display_name: 'leonardo', turtle_ids: [1]}]);
}
if (route === '/web/dataset/call_kw/turtle/read') {
return $.when([{id: 1, type_id: [12, 'gold']}]);
}
if (route === '/web/dataset/call_kw/partner_type/get_formview_id') {
return $.when(false)
}
if (route === '/web/dataset/call_kw/partner_type/read') {
return $.when([{id: 12, partner_ids: [1,2], display_name: 'gold'}])
}
if (route === '/web/dataset/call_kw/partner_type/write') {
assert.step('partner_type write');
}
return this._super.apply(this, arguments);
},
}).then(function(form) {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_data_cell').click();
form.$('.o_external_button').click();
var $modal = $('.modal-dialog');
assert.equal($modal.length, 1,
'There should be 1 modal opened');
var $handles = $modal.find('.ui-sortable-handle');
assert.equal($handles.length, 2,
'There should be 2 sequence handlers');
testUtils.dragAndDrop($handles.eq(1), $modal.find('tbody tr').first());
// Saving the modal and then the original model
$modal.find('.modal-footer .btn-primary').click();
form.$buttons.find('.o_form_button_save').click();
assert.verifySteps(['onchange sequence', 'partner_type write']);
form.destroy();
});
});
QUnit.test('autocompletion in a many2one, in form view with a domain', function (assert) {
assert.expect(1);