Skip to Content
Menu
This question has been flagged
1 Reply
2786 Views

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

Avatar
Discard
Best Answer

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... 

Avatar
Discard