Antonio
Antonio

Reputation: 13

Odoo functions from parent

I have made a qweb report for res.partner that should list all the projects for that customer. But i don't know how to take the id for the current res.partner so i can search the database. I want to do something like the following code(where self.id is the id for the current partner):

data = self.env['project.project'].search([('partner_id', '=', self.id)])

I want to return the current open contact. For example if i call the function from the contact menu of Delta PC, i want the id of the contact Delta PC. I have tried someting like this:

partner = self.env['res.users'].browse(self.env.uid).partner_id

but it returns the current logged user from the contacts table.

Upvotes: 0

Views: 69

Answers (1)

Bhoomi Vaishnani
Bhoomi Vaishnani

Reputation: 718

Try this code:

<span t-esc="env.user.partner_id.name"/>

Following code will print current partner logged in.

Upvotes: 0

Related Questions