[FIX] kanban: adding context when editing column
Before this commit, when editing a column in a kanban view, in project for instance, the translations weren't loaded. Now, the translations are correctly loaded. opw-2340125 closes odoo/odoo#58984 X-original-commit: e95ed1253817beccb76d1fbd55b1318b3d65cfe5 Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
@@ -3,6 +3,7 @@ odoo.define('web.KanbanColumn', function (require) {
|
||||
|
||||
var config = require('web.config');
|
||||
var core = require('web.core');
|
||||
var session = require('web.session');
|
||||
var Dialog = require('web.Dialog');
|
||||
var KanbanRecord = require('web.KanbanRecord');
|
||||
var RecordQuickCreate = require('web.kanban_record_quick_create');
|
||||
@@ -337,6 +338,7 @@ var KanbanColumn = Widget.extend({
|
||||
new view_dialogs.FormViewDialog(this, {
|
||||
res_model: this.relation,
|
||||
res_id: this.id,
|
||||
context: session.user_context,
|
||||
title: _t("Edit Column"),
|
||||
on_saved: this.trigger_up.bind(this, 'reload'),
|
||||
}).open();
|
||||
|
||||
@@ -3565,6 +3565,44 @@ QUnit.module('Views', {
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('edit a column propagates right context', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const kanban = await createView({
|
||||
View: KanbanView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch: '<kanban class="o_kanban_test" on_create="quick_create">' +
|
||||
'<field name="product_id"/>' +
|
||||
'<templates><t t-name="kanban-box">' +
|
||||
'<div><field name="foo"/></div>' +
|
||||
'</t></templates>' +
|
||||
'</kanban>',
|
||||
groupBy: ['product_id'],
|
||||
archs: {
|
||||
'product,false,form': '<form string="Product"><field name="display_name"/></form>',
|
||||
},
|
||||
session: {user_context: {lang: 'brol'}},
|
||||
mockRPC: function (route, args) {
|
||||
let context;
|
||||
if (route === '/web/dataset/search_read' && args.model === 'partner') {
|
||||
context = args.context;
|
||||
assert.strictEqual(context.lang, 'brol',
|
||||
'lang is present in context for partner operations');
|
||||
}
|
||||
if (args.model === 'product') {
|
||||
context = args.kwargs.context;
|
||||
assert.strictEqual(context.lang, 'brol',
|
||||
'lang is present in context for product operations');
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
testUtils.kanban.toggleGroupSettings(kanban.$('.o_kanban_group[data-id=5]'));
|
||||
await testUtils.dom.click(kanban.$('.o_kanban_group[data-id=5] .o_column_edit'));
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('quick create column should be opened if there is no column', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user