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

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

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