Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Add current user to a session

By
Juan
on 2/9/16, 8:02 AM 227 views

We're trying to modify the behaviour of the example given in odoo website( https://www.odoo.com/documentation/8.0/howtos/backend.html#wizards ), and we want to add a button in the session view that when pressed, adds the current user in the session as an attendee

@api.multi
def add_user(self):
    self.attendee_ids |= self._uid

That doesn't work because _uid is just the id, while session.attendee_ids returns res.partners (3, 45, 32 ... ), so we want to add the id (which is just the integer) into res.partners (3, 45, 32 ..., 1)


2
Jo
On 2/10/16, 5:34 AM

Hi Juan,

This code will help you.

self.env['res.users'].browse(self._uid).partner_id
1
Carlos DuAl
On 2/10/16, 6:00 AM

Just a small addition to what Jothimani said,  for me it worked with browse(self._uid) instead of browse(uid)
self.env['res.users'].browse(self._uid).partner_id

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/9/16, 8:02 AM
Seen: 227 times
Last updated: 2/10/16, 6:00 AM