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))
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|  | 2 ก.พ. 22  | 6188 | ||
| 
            
                api.onchange v8 doesnt work
            
            
                    แก้ไขแล้ว
            
         |  | 2 ก.ย. 15  | 5332 | |
|  | 3 ส.ค. 15  | 8602 | ||
|  | 0 พ.ค. 15  | 3681 | ||
|  | 2 พ.ย. 23  | 19511 |