i have module which has three field.name,firstname and lastname,when user save it firstname and lastname
concatenate in name field,here name field must be readonly mod.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
i have module which has three field.name,firstname and lastname,when user save it firstname and lastname
concatenate in name field,here name field must be readonly mod.
Hello Vijay,
This will help you.
name = fields.Char(compute='_compute_name', store="True")
firstname = fields.Char()
lastname = fields.Char()
@api.depends('firstname', 'lastname')
def _compute_name(self):
for record in self:
record.name = record.firstname + record.lastname
Hello, I think you've three options.
- Overriding the create and write functions.
-Use onchange method in the firstname and lastname: but if you used onchange method to modify a readonly field this will not update the field in DB, so you need to make an invisible field, as workaround.
-Make the name field as a functional field.
how to make name as functional field any demo function?
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 10 24
|
4181 | ||
Make field readonly based on group
Đã xử lý
|
|
9
thg 7 21
|
63228 | |
|
8
thg 11 19
|
7911 | ||
How to concatenate fields in a view?
Đã xử lý
|
|
8
thg 4 25
|
29093 | |
|
3
thg 8 24
|
16064 |