Are there any way to create some new model after onchange triggered?
For example, I want to create my custom report object after the state of quotation is changed to sale order.
Are there any way to create some new model after onchange triggered?
For example, I want to create my custom report object after the state of quotation is changed to sale order.
IstaLibera
On
You can create a new instance of a model with the following code inside :sales.order inside a method with the decorator @api.onchange('state')
report_model = self.env['my.custom.report.object']
new_report_object = report_model.create({
'report_message': 'Quotation changed state to Sales Order'
})
Copyright © 2021 Jogjafile Inc.
I solved that by trying to override action_confirm method of sale.order and it's worked!