I have this model and method in odoo
class stock_transfer_details_items(models.TransientModel):
_inherit = 'stock.transfer_details_items'
lot_id = fields.Many2one('stock.production.lot', Lot/Serial Number')
q_auth = fields.Boolean(related='lot_id.q_auth', string="Quality Auth.")
needs_auth = fields.Boolean(related='product_id.needs_quality_auth')
@api.onchange("needs_auth")
def _onchange_NQA_domain(self):
domain = {'domain': {'lot_id': [('product_id', '=', rec.product_id.id)]}}
if rec.needs_auth:
domain = {'domain': {'lot_id': [('q_auth', '!=', False), ('product_id', '=', rec.product_id.id)]}}
return domain
All this code is working ok. My problem is that I need to apply this domain when the wizard opens. `@api.depends` means that the value changes depending on the value of needs_auth but it actually don't work if I don't interact with the checkbox of needs_auth. I want to apply the domain when the view is open and not interact with the needs_auth field, because the user will not be allow to interact.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
1289
查看
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
3
5月 25
|
2880 | ||
|
0
5月 25
|
292 | ||
|
2
3月 24
|
1429 | ||
|
1
11月 22
|
2617 | ||
|
0
8月 22
|
1504 |