When loading a register with a computed field (example, a new sale margin field computed out of price and cost), I see that it is not populated with the value. Why? and how can I make the value being displayed?
It is properly stored in database.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
When loading a register with a computed field (example, a new sale margin field computed out of price and cost), I see that it is not populated with the value. Why? and how can I make the value being displayed?
It is properly stored in database.
Hello E.M.
To write a on_change method in .py file like this,
def on_change_emp_dept(self, cr, uid, ids, employee_id, context=None):
dept_id = False
if employee_id:
emp_pool = self.pool.get("hr.employee")
emp_obj = emp_pool.browse(cr, uid, employee_id, context=context)
dept_id = emp_obj and emp_obj[0].department_id.id or False
return {'value':{'department_id':dept_id}}
<field name="employee_id" on_change="on_change_emp_dept(employee_id)" />
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
4
May 23
|
8703 | ||
|
1
Jan 19
|
8057 | ||
|
0
Oct 17
|
2590 | ||
|
0
Nov 16
|
1908 | ||
|
0
Oct 16
|
4179 |
you can use the onchange to trigger the computation for client side (form view)