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"/>
<button string="Options" dropdown="1">
<item string="To Draft" method="to_draft" states="confirmed"/>
<item string="Recheck Item" method="recheck_item" states="draft"/>
</button>
</head>
<tabs>

View File

@ -14,6 +14,7 @@
</item>
<item string="Patients">
<item string="New Patient" action="clinic_patient" action_options="mode=form"/>
<divider/>
<item string="Patients" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/>
<divider/>
@ -29,8 +30,6 @@
<item string="Cycles" action="clinic_cycle"/>
<item string="Cycle Items" action="clinic_cycle_item"/>
<item string="Cycle Dialy" action="clinic_cycle_dialy"/>
<divider/>
<header string="REPORTS" action="clinic_schedule"/>
</item>
<item string="Schedules" action="clinic_schedule"/>
<item string="Visits">
@ -43,10 +42,16 @@
<item string="HD Case Dialy" action="clinic_hd_case_dialy"/>
</item>
<item string="Reports">
<header string="HD CASE"/>
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
<item string="Medical Summary" action="clinic_report_medical_summary"/>
<item string="Recent Patient" action="clinic_report_recent_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 string="Settings">
<item string="Departments" action="clinic_department"/>

View File

@ -57,19 +57,26 @@ class CycleDialy(Model):
'flash':'Confirmed',
}
def post(self,ids,context={}):
# create journal entry
def recheck_item(self,ids,context={}):
# copy cost of nurse and doctor from cycle item
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({
'state': 'done',
'lines': lines,
})
context=ctx
return {
'next': {
'name': 'clinic_cycle_dialy',
'mode': 'form',
'active_id': obj.id,
},
'flash':'Done!',
'flash':'Recheck successfully',
}
def to_draft(self,ids,context={}):

View File

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

View File

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