Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2523 Представления

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 :)

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
мая 22
13805
2
апр. 22
4006
1
апр. 22
3072
10
дек. 24
30897
1
июл. 24
6190