Obrigado Paulino!!! But, how can I be sure that the different output will only ocurr inside my module? I gather that has something to do with context so I tried the following:
<field name="context">{'contact_display': 'sort_form'}</field> (in my view) def name_get(self, cr, user, ids, context={}): if not len(ids): return [] res = [] for r in self.read(cr, user, ids, ['designacao','name','zip','city','partner_id', 'street']): if context.get('contact_display', 'contact')=='partner': res.append((r['id'], r['partner_id'][1])) else: if context.get('contact_display', 'contact')=='sort_form': addr = r['designacao'] or r['name'] or '' else: addr = r['name'] or '' if r['name'] and (r['zip'] or r['city']): addr += ', ' addr += (r['street'] or '') + ' ' + (r['zip'] or '') + ' ' + (r['city'] or '') res.append((r['id'], addr.strip() or '/')) return res (in my module's .py) So, what I'm trying to do is to run a line of code only when my module calls the method. However, it doesn't work. Truth is I didn't find any documentation explaining the "context" thing, so, I'm doing this using common sense... -------------------- m2f -------------------- -- http://www.openobject.com/forum/viewtopic.php?p=36402#36402 -------------------- m2f -------------------- _______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman/listinfo/tinyerp-users
