Hi all, I'm extending the partner model. Just something dummy for test openERP concept before going into real developments. I create my class like thise from osv import osv, fields import netsvc
class pocscs(osv.osv): _name = 'res.partner' _inherit = 'res.partner' _columns = { 'age': fields.integer('Age'), 'typeage': fields.char('Type age', size=128), } _defaults = { } def age_change(self, cr, uid, ids, age, id): logger.notifyChannel('pocscs', netsvc.LOG_ERROR, "Setting typeage!!!!!!") if age < 20: self.write(cr, uid, ids, {'typeage':'Personne jeune'}) logger.notifyChannel('pocscs', netsvc.LOG_ERROR, "Age is : '%s' and Type age is '%s'!" % (age, res.partner[id].typeage)) elif 20 < age < 50: self.write(cr, uid, ids, {'typeage':'Personne mature'}) logger.notifyChannel('pocscs', netsvc.LOG_ERROR, "Age is : '%s' and Type age is '%s'!" % (age, res.partner[id].typeage)) else: self.write(cr, uid, ids, {'typeage':'Personne du troisieme age'}) logger.notifyChannel('pocscs', netsvc.LOG_ERROR, "Age is : '%s' and Type age is '%s'!" % (age, res.partner[id].typeage)) return res pocscs() and here the view I do some stuffs with in : name="age" on_change="age_change(age, id) Everything work fine, I install my module, and in the web client I can see Partner form with my two fields but when I change the "age" value I get a alert with > 'res.partner' object has no attribute 'age_change' And for sure as we can see I've defined a age_change method. Have I to define this method in res.partner (which will not be a best practice). I'm I doing somethin wrong? Thanks, Mouhamed -------------------- m2f -------------------- -- http://www.openerp.com/forum/viewtopic.php?p=27628#27628 -------------------- m2f -------------------- _______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman/listinfo/tinyerp-users
