improve report medical summary

conv_bal
watcha.h@almacom.co.th 2015-05-08 08:09:12 +07:00
parent 2cafedd193
commit 96a6d721f9
7 changed files with 20 additions and 8 deletions

View File

@ -2,4 +2,7 @@
<field name="categ_id" position="after">
<field name="patient_types"/>
</field>
<field name="create_time" position="after">
<field name="report_visible"/>
</field>
</inherit>

View File

@ -2,15 +2,19 @@
<head>
<button string="Options" dropdown="1">
<item string="Run Script" type="default" method="run_script" perm="clinic_setting_test"/>
<!--
<item string="Manual Generate Visit" perm="clinic_gen_visit" method="manual_generate_visit" confirm="This action will remove all pending visit of this month and generate new one. Are you sure?"/>
-->
</button>
</head>
<separator string="Visit"/>
<group form_layout="stacked">
<field name="find_dlz"/>
<!--
<newline/>
<field name="auto_gen_visit" string="Next Gen"/>
<field name="next_date" span="3"/>
-->
</group>
<separator string="HD Case"/>
<group form_layout="stacked">

View File

@ -275,7 +275,7 @@ class Patient(Model):
}
_sql_constraints=("clinic_patient_key_uniq","unique(name_check)","name should be unique"),
_order="reg_date desc"
#_order="reg_date desc"
def check_idcard(self,card_type,idcard=''):
res=True

View File

@ -5,6 +5,7 @@ class Product(Model):
_fields={
'patient_types': fields.Many2Many("clinic.patient.type","Patient Types"),
'departments': fields.One2Many('clinic.department.product','product_id','Departments'),
'report_visible': fields.Boolean("Report Visible"),
}
Product.register()

View File

@ -85,6 +85,7 @@ class ReportMedicalSummary(Model):
dom=[]
dom.append(['type','=','stock'])
dom.append(['report_visible','=',True])
if prod_categ_id:
dom.append(['categ_id.id','child_of',prod_categ_id])
categ_ids=set()
@ -202,9 +203,6 @@ class ReportMedicalSummary(Model):
elif branch_id:
branch=get_model("clinic.branch").browse(branch_id)
sub_name="(%s)" % branch.name or ""
from pprint import pprint
for line in lines:
pprint(line)
data={
'company_name': '%s %s' % (company.name or "", sub_name),
'parent_company_name': company.parent_id.name or "",

View File

@ -161,10 +161,10 @@ class ClinicSetting(Model):
if user_id !=1:
print("Only admin!!")
return
for pv in get_model("province").search_browse([]):
name=(pv.name or "")[0:1]
pv.write({
'sort_name': name,
categ_ids=get_model('product.categ').search([['parent_id.code','=','MDC']])
for prod in get_model("product").search_browse([['categ_id','in',categ_ids]]):
prod.write({
'report_visible': True,
})
#for dt in get_model("district").search_browse([]):
#name=(dt.name or "")[0:1]

View File

@ -95,6 +95,8 @@ class VisitBoard(Model):
department_id=obj.department_id.id
branch_id=obj.branch_id.id
def auto_gen_visit(dom=[]):
dom.append(['dispose','=',False])
dom.append(['walkin','=','no'])
def daterange(start_date, end_date):
for n in range(int ((end_date - start_date).days)):
yield start_date + timedelta(n)
@ -110,6 +112,10 @@ class VisitBoard(Model):
for date in daterange(convert_date(date_from),convert_date(date_to)+timedelta(days=1)):
weekday=date.weekday()
date_txt=date.strftime("%Y-%m-%d")
datenow=time.strftime("%Y-%m-%d")
if date_txt < datenow:
print("continue ", date_txt, datenow)
continue
for pt in get_model("clinic.patient").search_browse(dom):
for pc in pt.cycles:
w=DAYS.get(pc.day,0) #default monday