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="categ_id" position="after">
<field name="patient_types"/> <field name="patient_types"/>
</field> </field>
<field name="create_time" position="after">
<field name="report_visible"/>
</field>
</inherit> </inherit>

View File

@ -2,15 +2,19 @@
<head> <head>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="Run Script" type="default" method="run_script" perm="clinic_setting_test"/> <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?"/> <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> </button>
</head> </head>
<separator string="Visit"/> <separator string="Visit"/>
<group form_layout="stacked"> <group form_layout="stacked">
<field name="find_dlz"/> <field name="find_dlz"/>
<!--
<newline/> <newline/>
<field name="auto_gen_visit" string="Next Gen"/> <field name="auto_gen_visit" string="Next Gen"/>
<field name="next_date" span="3"/> <field name="next_date" span="3"/>
-->
</group> </group>
<separator string="HD Case"/> <separator string="HD Case"/>
<group form_layout="stacked"> <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"), _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=''): def check_idcard(self,card_type,idcard=''):
res=True res=True

View File

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

View File

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

View File

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

View File

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