show epo on list of hd case

conv_bal
watcha.h 2015-02-23 07:50:19 +07:00
parent d68842e5a5
commit f9546abf6b
5 changed files with 41 additions and 6 deletions

View File

@ -4,6 +4,7 @@
<field name="cycle_id"/> <field name="cycle_id"/>
<field name="patient_id"/> <field name="patient_id"/>
<field name="patient_type_id"/> <field name="patient_type_id"/>
<field name="epo"/>
<field name="department_id"/> <field name="department_id"/>
<field name="doctor_id"/> <field name="doctor_id"/>
<field name="state"/> <field name="state"/>

View File

@ -12,10 +12,10 @@
<field name="type_id"/> <field name="type_id"/>
<field name="name"/> <field name="name"/>
<field name="reg_date"/> <field name="reg_date"/>
<field name="categ_id"/>
<field name="doctor_id"/> <field name="doctor_id"/>
<field name="department_id"/>
<field name="branch_id"/> <field name="branch_id"/>
<field name="categ_id"/>
<field name="department_id" domain='[["branch_id","=",branch_id]]'/>
<tabs> <tabs>
<tab string="General Information"> <tab string="General Information">
<group span="6" columns="1"> <group span="6" columns="1">

View File

@ -71,8 +71,26 @@ class HDCase(Model):
} }
return res return res
def _get_epo(self,ids,context={}):
res={}
for obj in self.browse(ids):
names=[]
for line in obj.lines:
prod=line.product_id
categ=line.product_categ_id
if categ and prod:
if categ.code=='EPO':
name=prod.name or ""
name=name.split("-") #XXX
if name:
name=name[0].title()
names.append(name)
res[obj.id]=','.join([n for n in names])
return res
_fields={ _fields={
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),
"epo": fields.Char("EPO",function="_get_epo"),
'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'), 'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'),
"ref": fields.Char("Ref",search=True), "ref": fields.Char("Ref",search=True),
"time_start": fields.DateTime("Start Time",required=True), "time_start": fields.DateTime("Start Time",required=True),

View File

@ -214,8 +214,24 @@ class Patient(Model):
if not vals['active']: if not vals['active']:
vals['resign_date']=time.strftime("%Y-%m-%d") vals['resign_date']=time.strftime("%Y-%m-%d")
vals['rm_remain_visit']=True vals['rm_remain_visit']=True
else:
vals['rm_remain_visit']=False
for obj in self.browse(ids): for obj in self.browse(ids):
if 'department_id' in vals.keys():
vids=get_model("clinic.visit").search([['patient_id','=',obj.id],['state','in',['draft','pending']]])
for visit in get_model('clinic.visit').browse(vids):
visit.write({
'department_id': vals['department_id']
})
print("update visit set department = %s"%(visit.department_id.name))
if 'branch_id' in vals.keys():
vids=get_model("clinic.visit").search([['patient_id','=',obj.id],['state','in',['draft','pending']]])
for visit in get_model('clinic.visit').browse(vids):
visit.write({
'branch_id': vals['branch_id']
})
print("update visit set branch_id = %s"%(visit.department_id.name))
if 'doctor_id' in vals.keys(): if 'doctor_id' in vals.keys():
for vs in get_model("clinic.visit").search_browse([['state','in',['draft','pending']],['patient_id','=',obj.id]]): for vs in get_model("clinic.visit").search_browse([['state','in',['draft','pending']],['patient_id','=',obj.id]]):
vs.write({ vs.write({

View File

@ -1,5 +1,5 @@
todo: todo:
matching payment show epo in list of hd case
create contact from staff matching payment > ok
- xxxx create contact from staff -> ok
script to clear invoice script to clear invoice -