How can I set in the customers, default tags?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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')]))
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.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 3 15
|
4587 | ||
|
1
thg 6 22
|
2366 | ||
|
8
thg 11 20
|
17631 | ||
|
0
thg 4 16
|
3218 | ||
|
3
thg 3 16
|
17546 |