← Back to team overview

openerp-community team mailing list archive

Re: Print a string for EVERY write


Il 14/10/2014 12:24, atchuthantu@xxxxxxxxx ha scritto:

Thank you! This is what i'm searching!


You can use the functionality used at Connector module available at OCA(https://github.com/OCA/connector/blob/7.0/connector/producer.py)

from openerp.osv import orm
write_original = orm.BaseModel.write
def write(self, cr, uid, ids, vals, context=None):
    print "Your custom statement"
    # Create a logger entry here
    result = write_original(self, cr, uid, ids, vals, context=context)
    return result
orm.BaseModel.write = write

Add this python code in your module, then for every WRITE function, your custom string will be printed to your console.

Follow ups