multi department

conv_bal
watcha.h 2015-03-13 14:43:57 +07:00
parent f472cea02d
commit 60c55cd6f1
9 changed files with 42 additions and 13 deletions

View File

@ -4,6 +4,8 @@
<field name="model">clinic.staff.rotation</field> <field name="model">clinic.staff.rotation</field>
<field name="tabs">[ <field name="tabs">[
["All",[]], ["All",[]],
["Nurse",[["type","=","nurse"]]],
["Doctor",[["type","=","doctor"]]],
["Draft",[["state","=","draft"]]], ["Draft",[["state","=","draft"]]],
["Approved",[["state","=","approved"]]] ["Approved",[["state","=","approved"]]]
]</field> ]</field>

View File

@ -1,4 +1,5 @@
<list model="clinic.staff.rotation"> <list model="clinic.staff.rotation">
<field name="hire_date"/>
<field name="staff_id"/> <field name="staff_id"/>
<field name="type"/> <field name="type"/>
<field name="level_id"/> <field name="level_id"/>

View File

@ -995,6 +995,14 @@ class HDCase(Model):
pay_type=payment.pay_type or '' pay_type=payment.pay_type or ''
user_id=get_active_user() user_id=get_active_user()
user=get_model("base.user").browse(user_id) 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={ data={
'comp_name': comp.name or '', 'comp_name': comp.name or '',
'comp_addr': comp_addr or '', 'comp_addr': comp_addr or '',
@ -1002,8 +1010,8 @@ class HDCase(Model):
'number': payment.number or '', 'number': payment.number or '',
'ref': payment.ref, 'ref': payment.ref,
'date': payment.date, 'date': payment.date,
'datenow': time.strftime("%d/%m/%Y"), 'datenow': payment.date or time.strftime("%d/%m/%Y"),
'dateprint': time.strftime("%d/%m/%Y %H:%M:%S"), 'dateprint': payment.date or time.strftime("%d/%m/%Y %H:%M:%S"),
'cust_name': cust_name, 'cust_name': cust_name,
'cust_addr': cust_addr, 'cust_addr': cust_addr,
'user_name': user.name or "", 'user_name': user.name or "",
@ -1015,6 +1023,7 @@ class HDCase(Model):
'is_cheque': is_cheque, 'is_cheque': is_cheque,
'is_draft': is_draft, 'is_draft': is_draft,
'pay_type': pay_type, 'pay_type': pay_type,
'state': payment.state or "",
} }
if pay_type=='direct': if pay_type=='direct':
data['pay_type']='Cash' data['pay_type']='Cash'
@ -1035,8 +1044,9 @@ class HDCase(Model):
for payment in obj.payments: for payment in obj.payments:
context['payment_id']=payment.id context['payment_id']=payment.id
data=self.get_report_payment_data(context=context) data=self.get_report_payment_data(context=context)
#XXX
limit_item=15 limit_item=15
if data['state']=='draft':
limit_item=10
for i in range(len(data['lines']),limit_item): for i in range(len(data['lines']),limit_item):
data['lines'].append({ data['lines'].append({
'no': '', 'no': '',

View File

@ -184,9 +184,6 @@ class Patient(Model):
if b_ids: if b_ids:
return b_ids[0] return b_ids[0]
def _get_dpts(self,context={}):
return get_model("clinic.department").search([])
_defaults={ _defaults={
#"number": _get_number, #"number": _get_number,
"number": "", "number": "",
@ -198,11 +195,10 @@ class Patient(Model):
"active" : True, "active" : True,
'state': 'admit', 'state': 'admit',
'walkin': 'no', 'walkin': 'no',
'departments': _get_dpts,
} }
_sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), _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=''): def check_idcard(self,idcard=''):
res=True res=True
@ -360,6 +356,8 @@ class Patient(Model):
'related_id': "clinic.patient,%s"%obj.id, 'related_id': "clinic.patient,%s"%obj.id,
}) })
del vals['addresses'] del vals['addresses']
else:
obj.simple_address()
if obj.rm_remain_visit or vals.get('rm_remain_visit'): 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')]]) visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','in',('draft','pending')]])
get_model('clinic.visit').delete(visit_ids) get_model('clinic.visit').delete(visit_ids)

View File

@ -529,6 +529,14 @@ class Shop(Model):
pay_type=shop.pay_type or '' pay_type=shop.pay_type or ''
user_id=get_active_user() user_id=get_active_user()
user=get_model("base.user").browse(user_id) 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={ data={
'comp_name': comp.name or '', 'comp_name': comp.name or '',
'comp_addr': comp_addr or '', 'comp_addr': comp_addr or '',
@ -536,8 +544,8 @@ class Shop(Model):
'number': shop.number or '', 'number': shop.number or '',
'ref': shop.ref, 'ref': shop.ref,
'date': shop.date, 'date': shop.date,
'datenow': time.strftime("%d/%m/%Y"), 'datenow': shop.date or time.strftime("%d/%m/%Y"),
'dateprint': time.strftime("%d/%m/%Y %H:%M:%S"), 'dateprint': shop.date or time.strftime("%d/%m/%Y %H:%M:%S"),
'cust_name': cust_name, 'cust_name': cust_name,
'cust_addr': cust_addr, 'cust_addr': cust_addr,
'note': shop.note or '', 'note': shop.note or '',
@ -548,6 +556,7 @@ class Shop(Model):
'is_cheque': is_cheque, 'is_cheque': is_cheque,
'is_draft': is_draft, 'is_draft': is_draft,
'user_name': user.name or "", 'user_name': user.name or "",
'state': shop.state or "",
} }
blank_dot='' blank_dot=''
if pay_type=='cash': if pay_type=='cash':
@ -572,8 +581,9 @@ class Shop(Model):
for obj in get_model('clinic.shop').browse(ids): for obj in get_model('clinic.shop').browse(ids):
context['refer_id']=obj.id context['refer_id']=obj.id
data=get_model('clinic.shop').get_page(context=context) data=get_model('clinic.shop').get_page(context=context)
#XXX fix 15 per page
limit_item=15 limit_item=15
if data['state']=='draft':
limit_item=10
for i in range(len(data['lines']),limit_item): for i in range(len(data['lines']),limit_item):
data['lines'].append({ data['lines'].append({
'no': '', 'no': '',

View File

@ -1,5 +1,5 @@
from netforce.model import Model, fields, get_model 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): class SickBed(Model):
_name="clinic.sickbed" _name="clinic.sickbed"
@ -13,6 +13,7 @@ class SickBed(Model):
patient_id=None patient_id=None
image=None image=None
date='' 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): for hd_case in sorted(obj.hd_cases, key=lambda a: a.id):
patient=hd_case.patient_id patient=hd_case.patient_id
patient_id=patient.id patient_id=patient.id
@ -23,6 +24,7 @@ class SickBed(Model):
'image': image, 'image': image,
'date': date, 'date': date,
} }
set_active_user(get_active_user())
return res return res
_fields={ _fields={

View File

@ -22,7 +22,7 @@ class StaffRotation(Model):
"staff_id": fields.Many2One("clinic.staff","Staff", search=True), "staff_id": fields.Many2One("clinic.staff","Staff", search=True),
'categ_id': fields.Many2One("clinic.staff.categ","Category",search=True), 'categ_id': fields.Many2One("clinic.staff.categ","Category",search=True),
"level_id": fields.Many2One("clinic.staff.level","Level", 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), "resign_date": fields.Date("Resign Date", search=True),
"wage": fields.Float("Wage"), "wage": fields.Float("Wage"),
"max_cycle": fields.Integer("Max Cycle"), "max_cycle": fields.Integer("Max Cycle"),
@ -40,6 +40,8 @@ class StaffRotation(Model):
'type': 'nurse', 'type': 'nurse',
} }
_order="hire_date desc"
def to_draft(self,ids,context={}): def to_draft(self,ids,context={}):
for obj in self.browse(ids): for obj in self.browse(ids):
obj.write({ obj.write({

View File

@ -6,3 +6,7 @@
report cycle item : report cycle item :
- sunanna can not see - sunanna can not see
report:
- reciept:
- remove border line