check card type
parent
66a9cf0cea
commit
bed92ace1a
|
@ -35,7 +35,7 @@
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="job"/>
|
<field name="job"/>
|
||||||
<field name="salary"/>
|
<field name="salary"/>
|
||||||
<field name="nation_id"/>
|
<field name="nation_id" onchange="onchange_nation"/>
|
||||||
<field name="race_id"/>
|
<field name="race_id"/>
|
||||||
<field name="grad_id"/>
|
<field name="grad_id"/>
|
||||||
<field name="phone"/>
|
<field name="phone"/>
|
||||||
|
|
|
@ -6,8 +6,8 @@ class Nation(Model):
|
||||||
_key=['code']
|
_key=['code']
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"code": fields.Char("Name",required=True,search=True),
|
"name": fields.Char("Name",required=True,search=True),
|
||||||
"name": fields.Char("Code",search=True),
|
"code": fields.Char("Code",search=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
Nation.register()
|
Nation.register()
|
||||||
|
|
|
@ -248,6 +248,7 @@ class Patient(Model):
|
||||||
|
|
||||||
def check_idcard(self,card_type,idcard=''):
|
def check_idcard(self,card_type,idcard=''):
|
||||||
res=True
|
res=True
|
||||||
|
print(card_type , idcard)
|
||||||
if card_type!='identification':
|
if card_type!='identification':
|
||||||
return False
|
return False
|
||||||
if idcard=='/':
|
if idcard=='/':
|
||||||
|
@ -326,8 +327,6 @@ class Patient(Model):
|
||||||
else:
|
else:
|
||||||
vals['state']='admit'
|
vals['state']='admit'
|
||||||
vals['rm_remain_visit']=False
|
vals['rm_remain_visit']=False
|
||||||
if 'card_no' in vals.keys():
|
|
||||||
self.check_idcard(vals.get("card_type",""),vals['card_no'])
|
|
||||||
ctx={}
|
ctx={}
|
||||||
if 'active' in vals.keys():
|
if 'active' in vals.keys():
|
||||||
if not vals['active']:
|
if not vals['active']:
|
||||||
|
@ -414,7 +413,8 @@ class Patient(Model):
|
||||||
self.function_store(ids,context=ctx)
|
self.function_store(ids,context=ctx)
|
||||||
# update name of partner
|
# update name of partner
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
print(obj.name or "")
|
if obj.card_type=='identification':
|
||||||
|
self.check_idcard(obj.card_type, obj.card_no)
|
||||||
obj.partner_id.write({
|
obj.partner_id.write({
|
||||||
'type': 'person',
|
'type': 'person',
|
||||||
'first_name': obj.first_name or "",
|
'first_name': obj.first_name or "",
|
||||||
|
@ -494,4 +494,19 @@ class Patient(Model):
|
||||||
def onchange_state(self,ids,context={}):
|
def onchange_state(self,ids,context={}):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def onchange_nation(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
nation_id=data['nation_id']
|
||||||
|
if nation_id:
|
||||||
|
nation=get_model("clinic.nation").browse(nation_id)
|
||||||
|
if nation.code:
|
||||||
|
if nation.code=='TH':
|
||||||
|
data['card_type']='identification'
|
||||||
|
else:
|
||||||
|
data['card_type']=''
|
||||||
|
else:
|
||||||
|
data['card_type']=''
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
Patient.register()
|
Patient.register()
|
||||||
|
|
Loading…
Reference in New Issue