[MERGE] forward port branch saas-17 up to 2a343d7c9c

This commit is contained in:
Christophe Simonis
2017-09-19 11:58:01 +02:00
18 changed files with 134 additions and 21 deletions
@@ -1075,7 +1075,7 @@ var ManualModel = StatementModel.extend({
return self._rpc({
model: 'account.move.line',
method: 'get_data_for_manual_reconciliation',
args: ['account', model.account_ids || self.account_ids],
args: ['account', context.account_ids || self.account_ids],
context: context,
})
.then(function (result) {
-3
View File
@@ -175,7 +175,4 @@ class OgonePayment(PaymentAcquirerCommon):
'number': '4000000000000002',
'brand': 'VISA'})
# check an alias is set, containing at least OPENERP
self.assertIn('OPENERP', tx.partner_reference, 'ogone: wrong partner reference after creating an alias')
res = tx.ogone_s2s_execute({})
-2
View File
@@ -167,8 +167,6 @@ class TxSips(models.Model):
# check what is bought
if float_compare(float(data.get('amount', '0.0')) / 100, self.amount, 2) != 0:
invalid_parameters.append(('amount', data.get('amount'), '%.2f' % self.amount))
if self.partner_reference and data.get('customerId') != self.partner_reference:
invalid_parameters.append(('customerId', data.get('customerId'), self.partner_reference))
return invalid_parameters
@@ -2207,6 +2207,8 @@ exports.Order = Backbone.Model.extend({
initialize_validation_date: function () {
this.validation_date = new Date();
this.formatted_validation_date = field_utils.format.datetime(
moment(this.validation_date), {}, {timezone: false});
},
set_tip: function(tip) {
+1 -1
View File
@@ -1444,7 +1444,7 @@
<t t-name="PosTicket">
<div class="pos-sale-ticket">
<div class="pos-center-align"><t t-esc="moment().format('L LT')"/> <t t-esc="order.name"/></div>
<div class="pos-center-align"><t t-esc="order.formatted_validation_date"/> <t t-esc="order.name"/></div>
<br />
<t t-esc="widget.pos.company.name"/><br />
<div class="receipt-phone">
@@ -26,7 +26,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
search: function(event) {
var d = event.data;
_.extend(this.env, this._process_search_data(d.domains, d.contexts, d.groupbys));
this.active_view.controller.reload(_.extend({}, this.env));
this.active_view.controller.reload(_.extend({offset: 0}, this.env));
},
add_filter: '_onAddFilter',
switch_view: function(event) {
@@ -2098,8 +2098,9 @@ var FieldDomain = AbstractField.extend({
"click .o_field_domain_dialog_button": "_onDialogEditButtonClick",
}),
custom_events: _.extend({}, AbstractField.prototype.custom_events, {
"domain_changed": "_onDomainSelectorValueChange",
"domain_selected": "_onDomainSelectorDialogValueChange",
domain_changed: "_onDomainSelectorValueChange",
domain_selected: "_onDomainSelectorDialogValueChange",
open_record: "_onOpenRecord",
}),
/**
* @constructor
@@ -2280,6 +2281,15 @@ var FieldDomain = AbstractField.extend({
_onDomainSelectorDialogValueChange: function (e) {
this._setValue(Domain.prototype.arrayToString(e.data.domain));
},
/**
* Stops the propagation of the 'open_record' event, as we don't want the
* user to be able to open records from the list opened in a dialog.
*
* @param {OdooEvent} event
*/
_onOpenRecord: function (event) {
event.stopPropagation();
},
});
/**
@@ -228,7 +228,7 @@ var AbstractView = Class.extend({
attrs.limit = attrs.mode === "tree" ? 80 : 40;
if (attrs.Widget.prototype.useSubview && !(attrs.invisible && JSON.parse(attrs.invisible)) && !attrs.views[attrs.mode]) {
if (attrs.Widget.prototype.useSubview && !attrs.__no_fetch && !attrs.views[attrs.mode]) {
var context = {};
var regex = /'([a-z]*_view_ref)' *: *'(.*?)'/g;
var matches;
@@ -510,6 +510,7 @@ var FormController = BasicController.extend({
* @param {OdooEvent} event
*/
_onToggleColumnOrder: function (event) {
event.stopPropagation();
this.model.setSort(event.data.id, event.data.name);
var field = event.data.field;
var state = this.model.get(this.handle);
@@ -97,6 +97,18 @@
vertical-align: middle;
}
}
&.o_full {
position: relative;
.o_button_more {
padding: 0 10px;
}
.o_dropdown_more {
.o-position-absolute(@top: 100%, @right: 0);
min-width: 0;
padding: 0px;
}
}
}
// Avatar
@@ -3955,6 +3955,46 @@ QUnit.module('basic_fields', {
form.destroy();
});
QUnit.test('basic domain field: show the selection', function (assert) {
assert.expect(2);
this.data.partner.records[0].foo = "[]";
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch:
'<form>' +
'<sheet>' +
'<group>' +
'<field name="foo" widget="domain" options="{\'model\': \'partner_type\'}"/>' +
'</group>' +
'</sheet>' +
'</form>',
archs: {
'partner_type,false,list': '<tree><field name="display_name"/></tree>',
'partner_type,false,search': '<search><field name="name" string="Name"/></search>',
},
res_id: 1,
});
assert.equal(form.$(".o_domain_show_selection_button").text().trim().substr(0, 2), "2 ",
"selection should contain 2 records");
// open the selection
form.$(".o_domain_show_selection_button").click();
assert.strictEqual($('.modal .o_list_view .o_data_row').length, 2,
"should have open a list view with 2 records in a dialog");
// click on a record -> should not open the record
// we don't actually check that it doesn't open the record because even
// if it tries to, it will crash as we don't define an arch in this test
$('.modal .o_list_view .o_data_row:first .o_data_cell').click();
form.destroy();
});
});
});
});
@@ -947,8 +947,7 @@ var MockServer = Class.extend({
return $.when(this.data[args.model][args.method](args.args, args.kwargs));
}
console.error("Unimplemented route", route, args);
return $.when();
throw new Error("Unimplemented route: " + route);
},
/**
* helper function: traverse a tree and apply the function f to each of its
+47 -1
View File
@@ -213,7 +213,7 @@ QUnit.module('Views', {
});
QUnit.test('invisible fields are properly hidden', function (assert) {
assert.expect(3);
assert.expect(4);
var form = createView({
View: FormView,
@@ -226,6 +226,10 @@ QUnit.module('Views', {
'<field name="bar"/>' +
'</group>' +
'<field name="qux" invisible="1"/>' +
// x2many field without inline view: as it is always invisible, the view
// should not be fetched. we don't specify any view in this test, so if it
// ever tries to fetch it, it will crash, indicating that this is wrong.
'<field name="p" invisible="True"/>' +
'</sheet>' +
'</form>',
res_id: 1,
@@ -237,6 +241,8 @@ QUnit.module('Views', {
"should not contain span with field value");
assert.strictEqual(form.$('.o_field_widget.o_invisible_modifier:contains(0.4)').length, 1,
"field qux should be invisible");
assert.ok(form.$('.o_field_widget[name=p]').hasClass('o_invisible_modifier'),
"field p should be invisible");
form.destroy();
});
@@ -5845,6 +5851,46 @@ QUnit.module('Views', {
form.destroy();
});
QUnit.test('can toggle column in x2many in sub form view', function (assert) {
assert.expect(2);
this.data.partner.records[2].p = [1,2];
this.data.partner.fields.foo.sortable = true;
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: '<form string="Partners">' +
'<field name="trululu"/>' +
'</form>',
res_id: 1,
mockRPC: function (route, args) {
if (route === '/web/dataset/call_kw/partner/get_formview_id') {
return $.when(false);
}
return this._super.apply(this, arguments);
},
archs: {
'partner,false,form': '<form string="Partners">' +
'<field name="p">' +
'<tree>' +
'<field name="foo"/>' +
'</tree>' +
'</field>' +
'</form>',
},
viewOptions: {mode: 'edit'},
});
form.$('.o_external_button').click();
assert.strictEqual($('.modal-body .o_form_view .o_list_view .o_data_cell').text(), "yopblip",
"table has some initial order");
$('.modal-body .o_form_view .o_list_view th').click();
assert.strictEqual($('.modal-body .o_form_view .o_list_view .o_data_cell').text(), "blipyop",
"table is now sorted");
form.destroy();
});
QUnit.test('rainbowman attributes correctly passed on button click', function (assert) {
assert.expect(1);
@@ -6,9 +6,11 @@
/// Un-grouped Layout (default)
&.o_kanban_ungrouped {
.o-justify-content(space-between);
margin: 0 0 0 (@o-kanban-record-margin - 2 * @grid-gutter-width);
@media (min-width: @screen-md-min) {
margin: 0 -@grid-gutter-width;
@media (max-width: @screen-xs-max) {
padding-left: @odoo-horizontal-padding - @o-kanban-record-margin;
padding-right: @odoo-horizontal-padding;
}
.o_kanban_record {
@@ -17,8 +19,7 @@
}
.o_kanban_record {
margin-left: @grid-gutter-width;
margin-right: @grid-gutter-width;
margin-left: @grid-gutter-width * 2;
padding: 0;
box-shadow: none;
background: none;
-1
View File
@@ -2,7 +2,6 @@
# set server timezone in UTC before time module imported
__import__('os').environ['TZ'] = 'UTC'
__import__('pkg_resources').declare_namespace('odoo.addons')
import odoo
if __name__ == "__main__":
+6
View File
@@ -3,6 +3,12 @@
""" OpenERP core library."""
#----------------------------------------------------------
# odoo must be a namespace package for odoo.addons to become one too
# https://packaging.python.org/guides/packaging-namespace-packages/
#----------------------------------------------------------
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
#----------------------------------------------------------
# Running mode flags (gevent, prefork)
#----------------------------------------------------------
+4 -1
View File
@@ -14,4 +14,7 @@ This module also conveniently reexports some symbols from odoo.modules.
Importing them from here is deprecated.
"""
__import__('pkg_resources').declare_namespace(__name__)
# make odoo.addons a namespace package, while keeping this __init__.py
# present, for python 2 compatibility
# https://packaging.python.org/guides/packaging-namespace-packages/
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
-1
View File
@@ -2,7 +2,6 @@
# set server timezone in UTC before time module imported
__import__('os').environ['TZ'] = 'UTC'
__import__('pkg_resources').declare_namespace('odoo.addons')
import odoo
if __name__ == "__main__":