[FIX] web: revert ignore default_* on group creation
This reverts commit 4cb585ab4f.
When creating from the kanban view:
- crm.stage
- hr.recruitment.stage
- project.task.type
- helpdesk.type
- mrp.eco.stage
We go from a dashboard of eg. "GroupRecord" named "group_id" in the
record. And when a stage is created, "default_group_id" is used. With
the change the stage was not linked to the current "grouping".
We could probably use "search_default_group_id" instead but the behavior
may be present in existing customization.
opw-1884217
closes #26943
This commit is contained in:
@@ -60,15 +60,11 @@ var KanbanModel = BasicModel.extend({
|
||||
if (!groupByField || groupByField.type !== 'many2one') {
|
||||
return $.Deferred().reject(); // only supported when grouped on m2o
|
||||
}
|
||||
// ignore action default which may be for another model
|
||||
var context = _.pick(parent.context, function (value, key) {
|
||||
return key.slice(0,8) !== 'default_';
|
||||
});
|
||||
return this._rpc({
|
||||
model: groupByField.relation,
|
||||
method: 'name_create',
|
||||
args: [name],
|
||||
context: context, // todo: combine with view context
|
||||
context: parent.context, // todo: combine with view context
|
||||
})
|
||||
.then(function (result) {
|
||||
var newGroup = self._makeDataPoint({
|
||||
|
||||
@@ -665,43 +665,6 @@ QUnit.module('Views', {
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('m2o group record created does not use action defaults', function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var kanban = createView({
|
||||
View: KanbanView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch: '<kanban class="o_kanban_test" on_create="quick_create">' +
|
||||
'<templates><t t-name="kanban-box">' +
|
||||
'<div>' +
|
||||
'<field name="foo"/>' +
|
||||
'</div>' +
|
||||
'</t></templates>' +
|
||||
'</kanban>',
|
||||
groupBy: ['product_id'],
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method === 'name_create') {
|
||||
assert.notOk(_.has(args.kwargs.context, 'default_name'),
|
||||
"default_* should be removed from context");
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
viewOptions: {
|
||||
context: {
|
||||
default_name: 'default name partner',
|
||||
},
|
||||
},
|
||||
});
|
||||
kanban.renderButtons();
|
||||
|
||||
kanban.$('.o_column_quick_create input').val('new product');
|
||||
kanban.$('.o_column_quick_create button.o_kanban_add').click();
|
||||
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
|
||||
QUnit.test('quick create fail in grouped', function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user