conv_bal
watcha.h 2014-11-24 17:22:21 +07:00
parent a13cc8797f
commit 6f6d86792f
2 changed files with 7 additions and 3 deletions

View File

@ -3,4 +3,5 @@
<field name="date_from" span="3"/> <field name="date_from" span="3"/>
<field name="date_to" span="3"/> <field name="date_to" span="3"/>
<field name="personal_id" span="3"/> <field name="personal_id" span="3"/>
<field name="type" span="3"/>
</form> </form>

View File

@ -16,6 +16,7 @@ class ReportNurseFeeDetail(Model):
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
'personal_id': fields.Many2One("clinic.personal","Personal"), 'personal_id': fields.Many2One("clinic.personal","Personal"),
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["personal","Personal"]],"Type"),
} }
def _get_date_from(self,context={}): def _get_date_from(self,context={}):
@ -47,12 +48,14 @@ class ReportNurseFeeDetail(Model):
time_start='%s-%s-01'%(year,str(month).zfill(2)) time_start='%s-%s-01'%(year,str(month).zfill(2))
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
personal_id=None personal_id=None
personal_type=None
if ids: if ids:
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
month=obj.date_from.split("-")[1] month=obj.date_from.split("-")[1]
time_start=obj.date_from time_start=obj.date_from
time_stop=obj.date_to time_stop=obj.date_to
personal_id=obj.personal_id.id personal_id=obj.personal_id.id
personal_type=obj.type
# new patient of this month # new patient of this month
dom=[] dom=[]
dom.append(['date','>=',time_start]) dom.append(['date','>=',time_start])
@ -66,11 +69,11 @@ class ReportNurseFeeDetail(Model):
# group by date # group by date
all_vals={} all_vals={}
for record in records: for record in records:
#date=''
#if record.date:
#date=record.date[8:10]
date=record.date date=record.date
personal=record.personal_id personal=record.personal_id
if personal_type:
if personal_type!=personal.type:
continue
key=(date,personal.id) key=(date,personal.id)
if key not in all_vals.keys(): if key not in all_vals.keys():
all_vals[key]={ all_vals[key]={