Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty

Hi everyone! I created a JS button located in the sale order line that call a python method and opens an action as a popup. 

The goal here is that the user can access to that button and do something, the very next moment it clicks on "Add a Line" on a Sale Order.

The issue I'm having is that inside the python method, the sale order line is not created yet and therefore anything I do afterwards is useless.

How can I make sure that when I click the JS button, my Sale Order Line get created before?


This is the event and the call of the js function:

events:_.extend({}, Widget.prototype.events,{'click':'_openBudgetSplit',}),
/**
* @private
* @param{MouseEvent}event
* @returns{Promise} action loaded
*/
async_openBudgetSplit(ev) {
    ev.stopPropagation();
    this.$el.find('.fa-percent').prop('special_click', true);
    var action = awaitthis._rpc({
        model:'sale.order.line',
        method:'action_show_budget_split',
        args: [[this.model.data.id], this.product_id, [this.product]]            });
    return this.do_action(action);


Thanks a lot in advance :)

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
toukok. 22
13777
2
huhtik. 22
3994
1
huhtik. 22
3067
10
jouluk. 24
30843
1
heinäk. 24
6168