I have created few models and in one of them I am unable to trigger Onchange api on any field. Depends is working fine but onchange is not triggering.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilitat
- Inventari
- PoS
- Project
- MRP
This question has been flagged
Hi,
This on-change decorator is used with the onchange method for the given fields.
This decorator will trigger the call to the decorated function if any of the
fields specified in the decorator is changed in the form.
The onchange decorator supports simple field names only, and it does not support the
dotted names(fields of relational fields like product_id.name).
It is not possible to modify one2many and many2many fields.
@api.onchange('invoice_id')
def _onchange_invoice(self):
product = self.invoice_id.invoice_line_ids
storable_product = [rec.product_id.id for rec in product
if rec.product_id.detailed_type == 'product']
sale = self.env['sale.order'].search([])
print(sale)
return {'domain': {'product_id': [('id', 'in', storable_product)]}}
Hope it helps,
This should be comment answer. Not solution answer. In my browser, I cannot post comment
We need more context here. is this inside a wizard, report, form, or tree view? how can we reproduce the error on our side? provide enough code to reproduce the issue and don't just copy paste all your code
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-seRelated Posts | Respostes | Vistes | Activitat | |
---|---|---|---|---|
|
3
de juny 19
|
6781 | ||
|
0
d’abr. 24
|
903 | ||
|
1
de juny 15
|
4138 | ||
|
2
d’abr. 25
|
2122 | ||
|
2
d’ag. 24
|
919 |