Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
953 Weergaven

Hi all,


I am really struggling with showing a popover on Many2One Field in javascript in Odoo13.

Maybe I´m just having the wrong approach in attacking my problem. 


I want to show a popover via javascript on mail.activity user_id field which is Many2One

I included FormController and added mouseover and change event on extending the events. Basically it´s working fine so far with my mouseover event.

The Problem is: The "change event" just recognizes the change on many2one if I delete the user_id and put it back in. 

Just switching value by clicking another user or searching for it, doesn´t work obviously, cause basically the change doesn´t happen in any document object.


How can I listen on the value / model change?

there is an approach for Odoo 15 with patching the autocomplete, but I can´t really believe we need to patch sth in odoo for just listening on a change in a Many2One in JS

odoo-forum.../set-event-listener-change-at-many2one-field-218916

odoo.define('mail_activity.WidgetUserIDPopover', function (require) {    'use strict';    
var FormController = require('web.FormController');        ​FormController.include({           
​init: function(){               
​this._super.apply(this, arguments); ​​this.events = _.extend(this.events || {},{                   
​​ ​"change [name='user_id']":function(){                     
​Code XY;                      
​​​});
​​},               
​}); ​});
});

​ 



Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
sep. 22
2033
0
jun. 22
2582