[FIX] mail: activity model js: pass context to get activity data

Go on the crm activity view
Have your user operate in another language than en_US

Bafore this commit, the activity types were not translated
This was because the context was not passed to the function

After this commit, the terms are translated

OPW 1924232

closes odoo/odoo#30837
This commit is contained in:
Lucas Perais (lpe)
2019-02-05 13:37:08 +00:00
parent 9d0b441013
commit 703263ad45
2 changed files with 8 additions and 1 deletions
@@ -2,6 +2,7 @@ odoo.define('mail.ActivityModel', function (require) {
'use strict';
var AbstractModel = require('web.AbstractModel');
var session = require('web.session');
var ActivityModel = AbstractModel.extend({
//--------------------------------------------------------------------------
@@ -57,6 +58,7 @@ var ActivityModel = AbstractModel.extend({
kwargs: {
res_model: this.modelName,
domain: this.domain,
context: session.user_context,
}
}).then(function (result) {
self.data.data = result;
+6 -1
View File
@@ -338,7 +338,7 @@ QUnit.test('activity view: activity widget', function (assert) {
activity.destroy();
});
QUnit.test('activity view: no group by', function (assert) {
assert.expect(4);
assert.expect(5);
var actionManager = createActionManager({
actions: [{
@@ -353,8 +353,13 @@ QUnit.test('activity view: no group by', function (assert) {
'task,false,search': '<search></search>',
},
data: this.data,
session: {
user_context: {lang: 'zz_ZZ'},
},
mockRPC: function(route, args) {
if (args.method === 'get_activity_data') {
assert.deepEqual(args.kwargs.context, {lang: 'zz_ZZ'},
'The context should have been passed');
return $.when(ACTIVITY_DATA);
}
return this._super(route, args);