how to use hook or trigger in openerp odoo

1.7k views Asked by At

I am new in openerp odoo. i am trying to use odoo 8.

I am trying to develop a module where I want to store some specific information of another server.

My goal is to make relation with point of sale module of Odoo. I want to propagate sales order information to another server. So whenever a sales is made from point of sale module of Odoo I want that point of sale module will automatically trigger a method of my module that will send the order information to another server according to the saved server information in my module.

I don't want to modify point of sale module. but i want a mechanism that can be implemented in my custom module which will tell to point of sale module that whenever a sales is made it should trigger/acknowledge a method of my custom module and my module will send order information to another server.

Actually I don't know what is the technical name of such mechanism in Odoo.

Can anyone please tell me how to achieve this goal in a custom module.

1

There are 1 answers

1
Emipro Technologies Pvt. Ltd. On

You need inherit that model into your custom module., then you need to override create method of that model. You can override any methods that would be allowed as per inehritance rules.

You can catch the trigger point from there, like create / write(update) / delete etc.

class pos_order(osv.osv):
    _inherit = "pos.order"

    def create(self, cr, uid, vals, context=None):
        ### put your code here
        ### then call super method and return result

        return super(pos_order, self).create(cr, uid, vals, context=context)