helo i have a problem
i have file.py like this :
medical_record = fields.Char(string='Nomor Medical Record')
check_medical_record = fields.Char(string='Masukan Medical Record')
check = fields.Boolean(string='Check')
@api.onchange('medical_record', 'check_medical_record')
def _checked(self):
if medical_record == check_medical_record:
self.check = False
else:
self.check = True
and my file xml like this :
<field name="medical_record"/>
<field name="check_medical_record"/>
<field name="check"/>
<button string="Generate name" type="object" name="generate_record_name" class="oe_highlight" attrs="{'invisible':[('check', '=', True)]}"/>
i want the button to show up when the value medical_record = check_medical_record
but i got an error like this, pls help me thanks
Odoo Server Error
Traceback (most recent call last):
File "D:\Dev\Workspaces\odoo10\odoo\http.py", line 642, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\Dev\Workspaces\odoo10\odoo\http.py", line 684, in dispatch
result = self._call_function(**self.params)
File "D:\Dev\Workspaces\odoo10\odoo\http.py", line 334, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\Dev\Workspaces\odoo10\odoo\service\model.py", line 101, in wrapper
return f(dbname, *args, **kwargs)
File "D:\Dev\Workspaces\odoo10\odoo\http.py", line 327, in checked_call
result = self.endpoint(*a, **kw)
File "D:\Dev\Workspaces\odoo10\odoo\http.py", line 942, in __call__
return self.method(*args, **kw)
File "D:\Dev\Workspaces\odoo10\odoo\http.py", line 507, in response_wrap
response = f(*args, **kw)
File "D:\Dev\Workspaces\odoo10\odoo\addons\web\controllers\main.py", line 895, in call_kw
return self._call_kw(model, method, args, kwargs)
File "D:\Dev\Workspaces\odoo10\odoo\addons\web\controllers\main.py", line 887, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "D:\Dev\Workspaces\odoo10\odoo\api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "D:\Dev\Workspaces\odoo10\odoo\api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "D:\Dev\Workspaces\odoo10\odoo\models.py", line 5522, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "D:\Dev\Workspaces\odoo10\odoo\models.py", line 5420, in _onchange_eval
method_res = method(self)
File "D:\Dev\Workspaces\odoo10\addons-gabungan-asli\antrian\antrian.py", line 37, in _checked
if medical_record == check_medical_record:
NameError: global name 'medical_record' is not defined