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

I have added a many2one field for incoterm to the delivery order, however I want to pull the value from the sales order if it is set when the delivery order is created.


I tried using a default value calculated by pulling from sale_id.incoterm However this field is not populated at time of stock.picking creation, so it comes up blank. 


I thought about using an onchange, however, onchanges are not called when a recorded is created by the server, so it only works if sale_id is manually changed. 


Is there a better way to set data on a record from another record during creation?

Аватар
Отменить
Лучший ответ

You can use related field of the sale_id and add incoterm in DO.

incoterm_id = fields.Many2one(related="sale_id.incoterm_id", string="Incoterem", store=True, readonly=False)


Аватар
Отменить
Автор

That did the trick. thanks!

Related Posts Ответы Просмотры Активность
1
нояб. 24
19001
1
окт. 23
2114
2
окт. 23
2362
2
авг. 23
4405
4
авг. 23
20755