Anyone know if it is possible to default the Salesperson when adding a new contact using domain?
We are on v15 and typically use studio for edits.
Thanks.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Anyone know if it is possible to default the Salesperson when adding a new contact using domain?
We are on v15 and typically use studio for edits.
Thanks.
Hi,
If you like to set a default value in XML, for a particular page or view, then you can consider the following option: In the "action" record that opens your Form View, you can add an entry in a "context" dictionary, like this:
<field name="context">{'default_user_id': uid}</field>
OR
use default=lambda self: self.env.user in the field
OR
In defaults, you can only set a default value for the field and not the domain. Instead, u can do the other way, add another field which will fetch the domain value and that field tries to use it as a domain to your fields.
current_user_id = fields.Many2one('res.users', default=lambda self: self.env.user)
user_id = fields.Many2one('res.users', domain="[('user_id', '=', current_user_id)]")
Regards
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ý
hello
are you found the solution for this ?