Skip to content
Permalink
Browse files

[FIX] web: backport of 70c6d3b to 12.0

make sidebar filter generic

Adding `res_model` and `res_fields` attributes on a field of
a calendar view adds a filter in the sidebar.
It saves the result as the defined model and should save it
in the defined field.
However `partner_id` has been hardcoded in the rpc call that creates
the record. This breaks genericity, it cannot be used with another
field than `partner_id`.

This commit makes this generic by correctly setting the field name
in the rpc call.

closes #31858

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>


Co-authored-by: Ildar Nasyrov <iledarn@gmail.com>
  • Loading branch information...
2 people authored and mart-e committed Jan 9, 2019
1 parent 7a7dbf9 commit 4b8e0d82bb2463e9d5e3492f7014c89cdc41b5e7
Showing with 3 additions and 1 deletion.
  1. +3 −1 addons/web/static/src/js/views/calendar/calendar_renderer.js
@@ -112,11 +112,13 @@ var SidebarFilter = Widget.extend(FieldManagerMixin, {
_onFieldChanged: function (event) {
var self = this;
event.stopPropagation();
var createValues = {'user_id': session.uid};
var value = event.data.changes[this.write_field].id;
createValues[this.write_field] = value;
this._rpc({
model: this.write_model,
method: 'create',
args: [{'user_id': session.uid,'partner_id': value,}],
args: [createValues],
})
.then(function () {
self.trigger_up('changeFilter', {

0 comments on commit 4b8e0d8

Please sign in to comment.
You can’t perform that action at this time.