order create line of cycle dialy by seq of cycle

conv_bal
watcha.h 2014-11-24 08:28:46 +07:00
parent a0c5616f5e
commit 1a542dd360
5 changed files with 27 additions and 7 deletions

View File

@ -3,6 +3,7 @@
<field name="state"/> <field name="state"/>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="To Draft" method="to_draft" states="confirmed"/> <item string="To Draft" method="to_draft" states="confirmed"/>
<item string="Recheck Item" method="recheck_item" states="draft"/>
</button> </button>
</head> </head>
<tabs> <tabs>

View File

@ -14,6 +14,7 @@
</item> </item>
<item string="Patients"> <item string="Patients">
<item string="New Patient" action="clinic_patient" action_options="mode=form"/> <item string="New Patient" action="clinic_patient" action_options="mode=form"/>
<divider/>
<item string="Patients" action="clinic_patient"/> <item string="Patients" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/> <item string="Dialyzers" action="clinic_dialyzer"/>
<divider/> <divider/>
@ -29,8 +30,6 @@
<item string="Cycles" action="clinic_cycle"/> <item string="Cycles" action="clinic_cycle"/>
<item string="Cycle Items" action="clinic_cycle_item"/> <item string="Cycle Items" action="clinic_cycle_item"/>
<item string="Cycle Dialy" action="clinic_cycle_dialy"/> <item string="Cycle Dialy" action="clinic_cycle_dialy"/>
<divider/>
<header string="REPORTS" action="clinic_schedule"/>
</item> </item>
<item string="Schedules" action="clinic_schedule"/> <item string="Schedules" action="clinic_schedule"/>
<item string="Visits"> <item string="Visits">
@ -43,10 +42,16 @@
<item string="HD Case Dialy" action="clinic_hd_case_dialy"/> <item string="HD Case Dialy" action="clinic_hd_case_dialy"/>
</item> </item>
<item string="Reports"> <item string="Reports">
<header string="HD CASE"/>
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/> <item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
<item string="Medical Summary" action="clinic_report_medical_summary"/> <item string="Medical Summary" action="clinic_report_medical_summary"/>
<item string="Recent Patient" action="clinic_report_recent_patient"/> <item string="Recent Patient" action="clinic_report_recent_patient"/>
<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/> <item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>
<divider/>
<header string="LABOR COST"/>
<item string="Nurse Fee Summary" action="clinic_report_nurse_free_sum"/>
<item string="Nurse Fee Detail" action="clinic_report_nurse_free_detail"/>
<item string="Special Nurse" action="clinic_report_nurse_free_detail"/>
</item> </item>
<item string="Settings"> <item string="Settings">
<item string="Departments" action="clinic_department"/> <item string="Departments" action="clinic_department"/>

View File

@ -57,19 +57,26 @@ class CycleDialy(Model):
'flash':'Confirmed', 'flash':'Confirmed',
} }
def post(self,ids,context={}): def recheck_item(self,ids,context={}):
# create journal entry # copy cost of nurse and doctor from cycle item
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
lines=[]
ctx=context.copy()
context['called']=True
# sorted by sequence of cycle
for cycle_item in sorted(obj.cycle_items, key=lambda x: x.cycle_id.sequence):
lines+=cycle_item.validate(context=context)
obj.write({ obj.write({
'state': 'done', 'lines': lines,
}) })
context=ctx
return { return {
'next': { 'next': {
'name': 'clinic_cycle_dialy', 'name': 'clinic_cycle_dialy',
'mode': 'form', 'mode': 'form',
'active_id': obj.id, 'active_id': obj.id,
}, },
'flash':'Done!', 'flash':'Recheck successfully',
} }
def to_draft(self,ids,context={}): def to_draft(self,ids,context={}):

View File

@ -143,6 +143,8 @@ class CycleItem(Model):
personals=hd_case.personals personals=hd_case.personals
for ps in personals: for ps in personals:
personal=ps.personal_id personal=ps.personal_id
if not personal:
continue
base=personal.base base=personal.base
if not base: if not base:
base=cost_per_case base=cost_per_case
@ -209,7 +211,11 @@ class CycleItem(Model):
} }
line.update(vals) line.update(vals)
lines.append(('create',line)) lines.append(('create',line))
# call from outside
if context.get('called'):
return lines
cycle_dialy.write({ cycle_dialy.write({
'lines': lines, 'lines': lines,
}) })

View File

@ -1,4 +1,5 @@
======= =======
- add picture of patient to visit/hd case dialy
- cycle dialy - cycle dialy
- lines - lines
- order by cycle - order by cycle