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.

0

How to set default values to the tags in customer

By
wizardz
on 7/18/16, 4:50 AM 302 views

How can I set in the customers, default tags?

1
kirubanidhi
On 7/18/16, 6:39 AM

In this code is helful for you, change it right now.

partner_id=fields.Many2one('res.partner', 'Partner',change_default=True)

category_id= fields.Many2many('res.partner.category', id1='partner_id', id2='category_id', string='Tags',default=lambda self: self.env['res.partner.category'].search([('name','=','Employee')]))

0
Nikunj Antala
On 7/18/16, 6:57 AM

Hello wizardz,

For set-up default value  of tags for customer you need to inherit res.partner and set default value.

Example :


class res_partner(osv.osv):

    _inherit = 'res.partner'

     def get_category(self,cr,uid,context=None):

         res=self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'res_partner_category_17')

         return [(6,0,[res[1]])]

     _defaults={

         'category_id':get_category,

     }


Hope this helps.

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: 7/18/16, 4:50 AM
Seen: 302 times
Last updated: 7/18/16, 6:57 AM