conv_bal
watcha.h@almacom.co.th 2015-01-15 15:45:11 +07:00
parent 326999bb47
commit 206554cb60
9 changed files with 51 additions and 12 deletions

View File

@ -1,6 +1,10 @@
<form model="clinic.hd.case.popup.dlz">
<field name="hd_case_id" invisible="1"/>
<field name="product_id"/>
<field name="product_id" domain="[['categ_id.name','=','Dialyzer']]" span="6"/>
<field name="dialyzer_type" span="6"/>
<field name="max_use_time" span="6" required="1"/>
<field name="exp_date" span="6"/>
<field name="note" span="6"/>
<foot>
<button string="Validate" type="success" method="new_dlz"/>
</foot>

View File

@ -2,8 +2,8 @@
<head>
<field name="state"/>
<button string="Options" dropdown="1">
<item string="New Dialyzer" method="new_dialyzer" states="draft,waiting_treatment"/>
<item string="New Dialyzer(Testing)" action="clinic_hd_case_dlz" states="draft,waiting_treatment" perm="clinic_new_dlz"/>
<!--<item string="New Dialyzer" method="new_dialyzer" states="draft,waiting_treatment"/>-->
<item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,waiting_treatment"/>
<item string="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/>
</button>
</head>
@ -45,7 +45,7 @@
<list>
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
<field name="dialyzer_type" span="2"/>
<field name="use_time" readonly="1"/>
<field name="use_time"/>
<field name="max_use_time" readonly="1"/>
<field name="description"/>
</list>

View File

@ -1,5 +1,6 @@
<form model="clinic.patient.cycle">
<field name="patient_id"/>
<field name="department_id" required="1"/>
<field name="cycle_id"/>
<field name="day"/>
</form>

View File

@ -1,5 +1,6 @@
<list model="clinic.patient.cycle">
<field name="patient_id"/>
<field name="department_id"/>
<field name="cycle_id"/>
<field name="day"/>
</list>

View File

@ -26,8 +26,7 @@
</group>
</tab>
<tab string="Testing">
<button string="Dummy" type="default" method="run_script"/>
<!--<button string="Reset Import" icon="repeat" type="default" method="reset_last_import"/>-->
<button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/>
</tab>
</tabs>
<foot>

View File

@ -866,11 +866,32 @@ class HDCase(Model):
def new_dialyzer(self,ids,context={}):
obj=self.browse(ids)[0]
dlz_vals=get_model("clinic.dialyzer").default_get()
dlz_vals['patient_id']=obj.patient_id.id
dlz_vals['company_id']=dlz_vals['company_id'][0]
product_name=dlz_vals['product_id'][1]
dlz_vals['product_id']=dlz_vals['product_id'][0]
is_wiz=context.get("is_wiz")
dlz_vals={}
if is_wiz:
pop_id=context.get('pop_id')
if pop_id:
pop=get_model("clinic.hd.case.popup.dlz").browse(pop_id)
prod=pop.product_id
dlz_vals={
'product_id': prod.id,
'name': prod.name or "",
'note': pop.note or '',
'use_time': 0,
'max_use_time': pop.max_use_time,
'dialyzer_type': pop.dialyzer_type,
'exp_date': pop.exp_date,
'department_id': obj.department_id.id,
'patient_id': obj.patient_id.id,
'visit_id': obj.visit_id.id,
}
else:
dlz_vals=get_model("clinic.dialyzer").default_get()
dlz_vals['patient_id']=obj.patient_id.id
dlz_vals['company_id']=dlz_vals['company_id'][0]
product_name=dlz_vals['product_id'][1]
dlz_vals['product_id']=dlz_vals['product_id'][0]
dlz_id=get_model('clinic.dialyzer').create(dlz_vals)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
dialyzer.confirm()

View File

@ -22,6 +22,16 @@ class HDCasePopupDlz(Model):
_defaults={
'hd_case_id': _get_hd_case_id,
'dialyzer_type': 'low',
'max_use_time': 10,
}
def new_dlz(self,ids,context={}):
obj=self.browse(ids)[0]
hd_case=obj.hd_case_id
if hd_case:
context['is_wiz']=True
context['pop_id']=obj.id
return hd_case.new_dialyzer(context=context)
HDCasePopupDlz.register()

View File

@ -8,6 +8,7 @@ class PatientCycle(Model):
_fields={
"patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True),
"cycle_id": fields.Many2One('clinic.cycle',"Cycle",search=True),
"department_id": fields.Many2One('clinic.department',"Department",search=True),
'day': fields.Selection([('mon', 'Monday'), ('tue','Tuesday'), ('wed','Wedsday'),('thu','Thursday'),('fri','Friday'),('sat','Satherday'),('sun','Sunday')], 'Days',search=True),
}

View File

@ -120,6 +120,7 @@ class Visit(Model):
patient=obj.patient_id
dialyzers=get_model("clinic.dialyzer").search_browse([['patient_id','=',patient.id],['state','=','active']])
if not dialyzers:
return {} ### for to new dlz from hd case
dlz_id=self.new_dlz(patient.id, obj.department_id.id)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
else:
@ -176,7 +177,8 @@ class Visit(Model):
st=get_model("clinic.setting").browse(1)
if st.find_dlz:
dialyzer=self.get_dlz(obj.id)
vals['dialyzers'].append(('create',dialyzer))
if dialyzer:
vals['dialyzers'].append(('create',dialyzer))
vals['staffs'].append(('create',{
'staff_id': obj.doctor_id.id,