Good day everyone.
Is there a way to execute custom code after a sale order is created succesfully? I was thinking inherit sale order and override or extend the create method not sure if thats the proper/right way.
Thanks in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Good day everyone.
Is there a way to execute custom code after a sale order is created succesfully? I was thinking inherit sale order and override or extend the create method not sure if thats the proper/right way.
Thanks in advance
Take a look at how we do this in the sale_purchase module:
https://github.com/odoo/odoo/blob/15.0/addons/sale_purchase/models/sale_order.py#L24
There is an internal function that we override.
(you would do the same in your own module: call super and then your code)
def _action_confirm(self):
result = super(SaleOrder, self)._action_confirm()
for order in self:
order.order_line.sudo()._purchase_service_generation()
return result
More documentation at https://www.odoo.com/documentation/15.0/developer/howtos/rdtraining/13_inheritance.html
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-se
when you need to execute your function, on creation of the sale order or on confirming the sale order ?
Yes you have to override create or write method..
Thanks Ray, that worked just fine.