How can you do this:
_defaults = { 'sale_order_id': lambda self, cr, uid, context: context.get('sale_order_id', False), }
In the new API?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How can you do this:
_defaults = { 'sale_order_id': lambda self, cr, uid, context: context.get('sale_order_id', False), }
In the new API?
You can use it while defining new field:
user_id = fields.Many2one('res.users', string='Salesperson', track_visibility='onchange',
readonly=True, states={'draft': [('readonly', False)]},
default=lambda self: self.env.user)
In new API, you can define default at field level.
Try this:
sale_order_id = fields.Many2one('sale.order', default=lambda self: self.env.context.get('sale_order_id', False))
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 2 22
|
5538 | ||
api.onchange v8 doesnt work
Đã xử lý
|
|
2
thg 9 15
|
4612 | |
|
3
thg 8 15
|
8062 | ||
|
0
thg 5 15
|
3108 | ||
|
2
thg 11 23
|
18645 |