print visit

conv_bal
watcha.h 2014-10-04 23:11:34 +07:00
parent ffda3a2549
commit a27ef19307
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="type">report_odt</field>
<field name="model">clinic.visit</field>
<field name="method">get_data</field>
<field name="template">visit</field>
</action>

View File

@ -230,5 +230,24 @@ class Visit(Model):
if obj.state!='draft':
raise Exception("Can not delete visit %s because state is not draft!"%obj.number)
super().delete(ids,context=context)
def get_data(self,context={}):
ref_id=context.get("refer_id")
if not ref_id:
return {}
ref_id=int(ref_id)
obj=self.browse(ref_id)
cycle_list={'1': 'One','2': 'Two','3': 'Tree','4': 'Four'}
data={
'number': obj.number,
'visit_date': obj.visit_date,
'department_name': obj.department_id.name or "",
'patient_name': obj.patient_id.name or "",
'doctor_name': obj.doctor_id.name or "",
'nurse_name': obj.nurse_id.name or "",
'cycle': cycle_list.get(obj.cycle,""),
'print_date': time.strftime("%d/%m/%Y"),
}
return data
Visit.register()

Binary file not shown.