that is really tricky thing to do, "Monkey Patch" is not a very good way to go, you should try to inheriting BaseModel as Leonardo says, also, if you want to keep track of the prints in the log file you wont be able to audit them, try logger instead.
On Tue, Oct 14, 2014 at 8:38 AM, Francesco Apruzzese <[email protected]> wrote: > Il 14/10/2014 12:24, [email protected] ha scritto: > > Thank you! This is what i'm searching! > > Hi, >> >> 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. >> >> > > _______________________________________________ > Mailing list: https://launchpad.net/~openerp-community > Post to : [email protected] > Unsubscribe : https://launchpad.net/~openerp-community > More help : https://help.launchpad.net/ListHelp > -- Ing. Oscar Alcalá Rivera *312-107-1704* · [email protected] <[email protected]> Vauxoo SA Tlf: *3123111122* *Open Source Enthusiast* *LinuxCounter:**566085* [image: twitter] <http://twitter.com/oscarolar> [image: linkedIn] <http://www.linkedin.com/pub/oscar-alcal%C3%A1/3b/a79/922> [image: Google+] <http://plus.google.com/107659954580035981067/posts> [image: eco] No me imprimas si no es necesario. Protejamos el medio ambiente
_______________________________________________ Mailing list: https://launchpad.net/~openerp-community Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-community More help : https://help.launchpad.net/ListHelp

