Skip to Content
Menu
This question has been flagged

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
Discard
Related Posts Replies Views Activity
2
May 22
11943
2
Apr 22
2796
1
Apr 22
2019
1
Jul 24
4721
9
Jun 24
26819