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

This commit is contained in:
Christophe Simonis
2017-09-19 11:06:46 +02:00
14 changed files with 124 additions and 16 deletions
@@ -1073,7 +1073,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 -1
View File
@@ -673,7 +673,9 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
});
},
destroy: function() {
this.$buttons.off().destroy();
if (this.$buttons) {
this.$buttons.off().destroy();
}
this._super.apply(this, arguments);
},
-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 -3
View File
@@ -49,7 +49,8 @@ class AcquirerSips(models.Model):
'prod': 'https://payment-webinit.sips-atos.com/paymentInit',
'test': 'https://payment-webinit.simu.sips-atos.com/paymentInit', }
return {'sips_form_url': url.get(environment, url['test']), }
icp_value = self.env['ir.config_parameter'].sudo().get_param('acquirer_sips_url_%s' % environment)
return {'sips_form_url': icp_value or url.get(environment, url['test']), }
def _sips_generate_shasign(self, values):
""" Generate the shasign for incoming or outgoing communications.
@@ -172,8 +173,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
@@ -2070,6 +2070,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
@@ -1418,7 +1418,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));
},
switch_view: function(event) {
if ('res_id' in event.data) {
@@ -2040,8 +2040,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
@@ -2222,6 +2223,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();
},
});
/**
@@ -257,7 +257,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);
@@ -115,6 +115,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
@@ -3813,6 +3813,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();
});
});
});
});
@@ -910,8 +910,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
@@ -211,7 +211,7 @@ QUnit.module('Views', {
});
QUnit.test('invisible fields are properly hidden', function (assert) {
assert.expect(3);
assert.expect(4);
var form = createView({
View: FormView,
@@ -224,6 +224,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,
@@ -235,6 +239,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();
});
@@ -5843,6 +5849,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);