I have defined my 2 new fields first_name and last_name for a person-partner. Also when I say that the partner is a company then only name field is mandatory and other two are not.The problem comes when I set all 3 fields to mandatory by setting required=True which is not possible.So the solution is I need to check these at the create and write. How to go about it?
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ờ
1
Trả lời
8917
Lượt xem
Hi,
you must define the method create in your custom module and make tests in this function.
def create(self, cr, uid, vals, context=None):
if context is None:
context={}
if not vals.get('is_company') :
if not vals.get('first_name') :
raise osv.except_osv(('Error first_name'),
(' first_name required ') )
if not vals.get('last_name') :
raise osv.except_osv(('Error last_name'),
(' last_name required ') )
return super(res_partner,self).create(cr, uid, vals, context=context)
and same in methods write and copy.
Thanks.
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 | |
---|---|---|---|---|
|
2
thg 3 16
|
3457 | ||
|
0
thg 9 24
|
1131 | ||
How to access Partner Create Date ?
Đã xử lý
|
|
2
thg 2 21
|
7519 | |
|
0
thg 2 20
|
2986 | ||
|
2
thg 2 20
|
4025 |