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

Hi all,

The end goal of this action is to programmatically add an order line to a sales order

I have a custom button defined in a sales order view like this:


<button name="401" type="action" class="btn-primary" string="help me"></button>


action id 401 is a server action that I've defined using the "sales.order" base model and the action to do is "execute python code"

The code so far is just this:


values = {
            'order_id': sale.order.id,
           'product_id':some_product
}
env['sale.order.line'].create(values)

 
I want to pass the current order id (sale.order.id) to the action's code. That way the create() function adds a new line to the current order automatically.

I think it has something to do with contexts, but the documentation is confusing to me. I've been googling all day.

Thanks!

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
mrt. 15
3143
1
feb. 19
10983
3
dec. 23
20311
0
mrt. 15
5420
1
jan. 25
1283