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