CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to send a message to the salesperson assigned to an Account when that account is edited by another user. How to I tie into the ORM to trigger my function on object save? The closest I have gotten is the on_change method on specific fields; I don't want to add this per field.
You can override the write() method of the desired object (e.g.
def write(self, cr, uid, ids, vals, context=None): my_custom_send_mail_function() res = super(my_class, self).write(cr, uid, ids, vals, context=context) return res
But this is a very deep intrusion into the system and may have side effects.
Mabye you can also use
Automated Actions for this purpose. See menu "Settings / Technical / Automated Actions".
The solution I found is overwriting the object in questions write() function. I was hoping there was a flag or setting instead, but this does the trick too.
def write(self, cr, uid, ids, vals, context=None): # Function calls and such here return super(sale_order, self).write(cr, uid, ids, vals, context=context)
About This Community
Odoo Training Center
|Asked: 3/12/13, 12:36 PM|
|Seen: 7880 times|
|Last updated: 3/16/15, 8:10 AM|