diff --git a/netforce_clinic/actions/clinic_staff_rotate.xml b/netforce_clinic/actions/clinic_staff_rotate.xml index b8bf808..cbf6785 100644 --- a/netforce_clinic/actions/clinic_staff_rotate.xml +++ b/netforce_clinic/actions/clinic_staff_rotate.xml @@ -4,6 +4,8 @@ clinic.staff.rotation [ ["All",[]], + ["Nurse",[["type","=","nurse"]]], + ["Doctor",[["type","=","doctor"]]], ["Draft",[["state","=","draft"]]], ["Approved",[["state","=","approved"]]] ] diff --git a/netforce_clinic/layouts/clinic_staff_rotate_list.xml b/netforce_clinic/layouts/clinic_staff_rotate_list.xml index 4affbf0..da8dfdb 100644 --- a/netforce_clinic/layouts/clinic_staff_rotate_list.xml +++ b/netforce_clinic/layouts/clinic_staff_rotate_list.xml @@ -1,4 +1,5 @@ + diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 4650534..c941c25 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -995,6 +995,14 @@ class HDCase(Model): pay_type=payment.pay_type or '' user_id=get_active_user() user=get_model("base.user").browse(user_id) + #XXX remove , + index=0 + for ca in comp_addr: + ca=ca.replace(" ","") + if ca==',': + break + index+=1 + comp_addr=comp_addr[index+1:] data={ 'comp_name': comp.name or '', 'comp_addr': comp_addr or '', @@ -1002,8 +1010,8 @@ class HDCase(Model): 'number': payment.number or '', 'ref': payment.ref, 'date': payment.date, - 'datenow': time.strftime("%d/%m/%Y"), - 'dateprint': time.strftime("%d/%m/%Y %H:%M:%S"), + 'datenow': payment.date or time.strftime("%d/%m/%Y"), + 'dateprint': payment.date or time.strftime("%d/%m/%Y %H:%M:%S"), 'cust_name': cust_name, 'cust_addr': cust_addr, 'user_name': user.name or "", @@ -1015,6 +1023,7 @@ class HDCase(Model): 'is_cheque': is_cheque, 'is_draft': is_draft, 'pay_type': pay_type, + 'state': payment.state or "", } if pay_type=='direct': data['pay_type']='Cash' @@ -1035,8 +1044,9 @@ class HDCase(Model): for payment in obj.payments: context['payment_id']=payment.id data=self.get_report_payment_data(context=context) - #XXX limit_item=15 + if data['state']=='draft': + limit_item=10 for i in range(len(data['lines']),limit_item): data['lines'].append({ 'no': '', diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index d7bebbe..710c9c6 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -184,9 +184,6 @@ class Patient(Model): if b_ids: return b_ids[0] - def _get_dpts(self,context={}): - return get_model("clinic.department").search([]) - _defaults={ #"number": _get_number, "number": "", @@ -198,11 +195,10 @@ class Patient(Model): "active" : True, 'state': 'admit', 'walkin': 'no', - 'departments': _get_dpts, } _sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), - _order="number desc" + _order="reg_date desc" def check_idcard(self,idcard=''): res=True @@ -360,6 +356,8 @@ class Patient(Model): 'related_id': "clinic.patient,%s"%obj.id, }) del vals['addresses'] + else: + obj.simple_address() if obj.rm_remain_visit or vals.get('rm_remain_visit'): visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','in',('draft','pending')]]) get_model('clinic.visit').delete(visit_ids) diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 925c6ab..6db7420 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -529,6 +529,14 @@ class Shop(Model): pay_type=shop.pay_type or '' user_id=get_active_user() user=get_model("base.user").browse(user_id) + #XXX remove , + index=0 + for ca in comp_addr: + ca=ca.replace(" ","") + if ca==',': + break + index+=1 + comp_addr=comp_addr[index+1:] data={ 'comp_name': comp.name or '', 'comp_addr': comp_addr or '', @@ -536,8 +544,8 @@ class Shop(Model): 'number': shop.number or '', 'ref': shop.ref, 'date': shop.date, - 'datenow': time.strftime("%d/%m/%Y"), - 'dateprint': time.strftime("%d/%m/%Y %H:%M:%S"), + 'datenow': shop.date or time.strftime("%d/%m/%Y"), + 'dateprint': shop.date or time.strftime("%d/%m/%Y %H:%M:%S"), 'cust_name': cust_name, 'cust_addr': cust_addr, 'note': shop.note or '', @@ -548,6 +556,7 @@ class Shop(Model): 'is_cheque': is_cheque, 'is_draft': is_draft, 'user_name': user.name or "", + 'state': shop.state or "", } blank_dot='' if pay_type=='cash': @@ -572,8 +581,9 @@ class Shop(Model): for obj in get_model('clinic.shop').browse(ids): context['refer_id']=obj.id data=get_model('clinic.shop').get_page(context=context) - #XXX fix 15 per page limit_item=15 + if data['state']=='draft': + limit_item=10 for i in range(len(data['lines']),limit_item): data['lines'].append({ 'no': '', diff --git a/netforce_clinic/models/sickbed.py b/netforce_clinic/models/sickbed.py index 02fe9fe..64f80c6 100644 --- a/netforce_clinic/models/sickbed.py +++ b/netforce_clinic/models/sickbed.py @@ -1,5 +1,5 @@ from netforce.model import Model, fields, get_model -from netforce.access import get_active_company, get_active_user +from netforce.access import get_active_company, get_active_user, set_active_user class SickBed(Model): _name="clinic.sickbed" @@ -13,6 +13,7 @@ class SickBed(Model): patient_id=None image=None date='' + set_active_user(1) #FIXME permission denined because of department of patient for hd_case in sorted(obj.hd_cases, key=lambda a: a.id): patient=hd_case.patient_id patient_id=patient.id @@ -23,6 +24,7 @@ class SickBed(Model): 'image': image, 'date': date, } + set_active_user(get_active_user()) return res _fields={ diff --git a/netforce_clinic/models/staff_rotation.py b/netforce_clinic/models/staff_rotation.py index 5e2455f..cc79189 100644 --- a/netforce_clinic/models/staff_rotation.py +++ b/netforce_clinic/models/staff_rotation.py @@ -22,7 +22,7 @@ class StaffRotation(Model): "staff_id": fields.Many2One("clinic.staff","Staff", search=True), 'categ_id': fields.Many2One("clinic.staff.categ","Category",search=True), "level_id": fields.Many2One("clinic.staff.level","Level", search=True), - "hire_date": fields.Date("Hire Date", search=True), + "hire_date": fields.Date("Date", search=True), "resign_date": fields.Date("Resign Date", search=True), "wage": fields.Float("Wage"), "max_cycle": fields.Integer("Max Cycle"), @@ -40,6 +40,8 @@ class StaffRotation(Model): 'type': 'nurse', } + _order="hire_date desc" + def to_draft(self,ids,context={}): for obj in self.browse(ids): obj.write({ diff --git a/netforce_clinic/reports/cust_payment.odt b/netforce_clinic/reports/cust_payment.odt index 02c2a99..312642e 100644 Binary files a/netforce_clinic/reports/cust_payment.odt and b/netforce_clinic/reports/cust_payment.odt differ diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 0f709e2..e20a4b2 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -6,3 +6,7 @@ report cycle item : - sunanna can not see + +report: + - reciept: + - remove border line