I have field selection ,I want to get Id of the selection,Then I save id on field.char .What should I do
Can you help me ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have field selection ,I want to get Id of the selection,Then I save id on field.char .What should I do
Can you help me ?
See the below example
In Python:
_columns = {
'name': fields.many2one('hr.employee', "Employee", required=True),
'id_no': fields.char('Wage', size=64),
}
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
v = {}
if employee_id:
emp_sr = self.pool.get('hr.employee').search(cr, uid, [('id','=',employee_id)], context=context)
if emp_sr:
empt_br = self.pool.get('hr.employee').browse(cr, uid, emp_sr, context=context)[0]
v['id_no'] = str(emp_br.id)
return {'value': v}
In XML:
<field name="name" on_change="onchange_employee_id(name)"/>
<field name="id_no"/>
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-se| Related Posts | Respostes | Vistes | Activitat | |
|---|---|---|---|---|
|
0
de març 15
|
4281 | |||
|
1
de des. 23
|
27885 | |||
|
1
de març 15
|
4889 | |||
|
1
de març 15
|
8780 | |||
|
1
de març 15
|
4674 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
selection field or one2many field?
i'm sorry . selection is one2many field