Search code examples
odoo-11

How to call method of the installed module into another installed module in Odoo 11?


I am using Odoo 11 and I want to use a method of Sale module > models > sale > SaleOrder > action_confirm method into Mail module > models > mail_mail > MailMail > send method

How to use the method of a module to another module method?


Solution

  • The method of a module that you are describing is just a method will be part of an Odoo model, sale.order in this case so if you wanna call it you just need a sale.order record to call the method. For example:

    order_id = 3
    order = self.env['sale.order'].browse(order_id)
    order.action_confirm()
    

    You could use that code anywhere you wanna use it. Normally in an Odoo method that provides the self.env access to the Odoo models.