Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3127 มุมมอง

how to retrieve the values of the fields in order to insert them into other fields of another model in an automated action?

example:

I have a model: customer (id, name, address ...)

and a model: invoice (id, customer ...)

and a sale model:

at a sale I create an action to fill the invoice automatically and I want the 'invoice.client' field to contain the value of 'customer.name'

how can I do? 

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, 
In sale.order, you specify the client (partner_id) and you have a button Create Invoice that creates an invoice related to your order with client field filled. Check _prepare_invoice function
 In your action, you just need to call the Create invoice's native function and the job well be done automatically... 

อวตาร
ละทิ้ง