Skip to Content
Menu
This question has been flagged
2 Replies
5460 Views

i have a customers in my odoo 8.0 software and all of them have a tags.i would like when i create a contact(child_ids) have automatically the same tags(category_id) of his customer.
i use this code but it doesn't work:

def _get_default_tags(self):
        return self.pool.get('res.partner.category').search(crself.env.cr, self.env.uid,  [])
       

Avatar
Discard
Best Answer

If you are following new api then try this code:

def _get_default_tags(self):
        # return self.category_id #if you are using this function in res.partner

# return self.env['res.partner.category'].search([('partner_ids', 'in', self.id)]) #change domain as per odoo8 fields this is just an example
 



Avatar
Discard
Author Best Answer

thanks  Hilar for reply,  i'm used this code but it doesn't work

Avatar
Discard

this is the proven code and will get exact results, you must check you function call and new api guidelines. Thanks