I have this code and works fine, but i need get default value to wpartner_id when the form is open to create a new record.
'wpartner_id': fields.related('incidencia_id', 'partner_id', type="many2one", relation="res.partner", string="Cliente Incidencia", store=True),
How can i do it ?
_get_default_wpartner is a function that returns default wpartner.
def _get_default_wpartner(self, cr, uid, context=None): your code your condition #Something like Following domain =  # condition res = self.pool.get('res.partner').search(cr, uid, domain, limit=1) return res and res or False
Hope it work for you.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/25/13, 6:20 AM|
|Seen: 3602 times|
|Last updated: 3/16/15, 8:10 AM|