Shravy
Shravy

Reputation: 666

How to implement the following scenario in odoo?

I am trying to get the list of attendees from calendar event to be autopopulated in my custom module

def get_meet_dets(self, cr, uid, ids, meet_ref, context=None):
    val = {}
    res = []
    if meet_ref:
        for det in self.pool.get('calendar.event').browse(cr,uid,meet_ref,context=context):
            for asst in det.attendee_ids:
                val = {
                    'emp_i' : asst.partner_id.name,
                    }
                res.append(val)
        val.update({'matp':res})
    return {'value': val}

The above code gets the name from res.partner table and fills the details from user. How can I get the the user's details from hr.employee.

Kindly anyone help me on this. Thanks a lot

Upvotes: 1

Views: 376

Answers (1)

JordyRitzen
JordyRitzen

Reputation: 702

Search with the partner_id on the employee model

employee_model = self.pool.get('hr.employee')
employee_ids = employee_model.search(cr, uid, [('partner_id', '=', asst.partner_id.id)], context=context)

then you could browse on the ids you've been given. KEEP IN MIND that ONE partner could be linked to MULTIPLE employees

Upvotes: 0

Related Questions