Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
1733 Visualizzazioni

I am trying to upgrade an Odoo module from v14 to v17 and I am getting the error "trigger_up is not a function".

// the code below is inside: 
// export class OpenStreetMap extends Component {

marker.on("dragend", function (e) {
            var latlng = e.target._latlng;
            self.trigger_up("field_changed", {
              dataPointID: self.dataPointID,
              changes: {
                lat: latlng.lat,
                lng: latlng.lng,
              },
              viewType: self.viewType,
            });

I looked into the built-in odoo addons and the trigger_up function does exist. I am guessing that the "field_changed" is the one causing the issue here.

the 'latlng' variable also seems to be working correctly, printing both coordinates in the console when I move the marker.

Avatar
Abbandona
Autore Risposta migliore

@Cybrosys 
I have already declared the 
var self = this;

What I am asking is that what is the equivalent of 
self.trigger_up("field_change" ... in Odoo17.

Edit: The issue was solved with

self.props.record.update({lat: latlng.lat, lng: latlng.lng});


Avatar
Abbandona
Risposta migliore

Hi,

In Js mostly "this" is used instead of "self". So if you are calling self, then ensure that this is declared in the variable self inside the function.

eg: var self = this;


Hope it helps

Avatar
Abbandona