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"> <form model="clinic.hd.case.popup.dlz">
<field name="hd_case_id" invisible="1"/> <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> <foot>
<button string="Validate" type="success" method="new_dlz"/> <button string="Validate" type="success" method="new_dlz"/>
</foot> </foot>

View File

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

View File

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

View File

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

View File

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

View File

@ -866,11 +866,32 @@ class HDCase(Model):
def new_dialyzer(self,ids,context={}): def new_dialyzer(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
dlz_vals=get_model("clinic.dialyzer").default_get() is_wiz=context.get("is_wiz")
dlz_vals['patient_id']=obj.patient_id.id dlz_vals={}
dlz_vals['company_id']=dlz_vals['company_id'][0] if is_wiz:
product_name=dlz_vals['product_id'][1] pop_id=context.get('pop_id')
dlz_vals['product_id']=dlz_vals['product_id'][0] 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) dlz_id=get_model('clinic.dialyzer').create(dlz_vals)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id) dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
dialyzer.confirm() dialyzer.confirm()

View File

@ -22,6 +22,16 @@ class HDCasePopupDlz(Model):
_defaults={ _defaults={
'hd_case_id': _get_hd_case_id, '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() HDCasePopupDlz.register()

View File

@ -8,6 +8,7 @@ class PatientCycle(Model):
_fields={ _fields={
"patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True), "patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True),
"cycle_id": fields.Many2One('clinic.cycle',"Cycle",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), '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 patient=obj.patient_id
dialyzers=get_model("clinic.dialyzer").search_browse([['patient_id','=',patient.id],['state','=','active']]) dialyzers=get_model("clinic.dialyzer").search_browse([['patient_id','=',patient.id],['state','=','active']])
if not dialyzers: if not dialyzers:
return {} ### for to new dlz from hd case
dlz_id=self.new_dlz(patient.id, obj.department_id.id) dlz_id=self.new_dlz(patient.id, obj.department_id.id)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id) dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
else: else:
@ -176,7 +177,8 @@ class Visit(Model):
st=get_model("clinic.setting").browse(1) st=get_model("clinic.setting").browse(1)
if st.find_dlz: if st.find_dlz:
dialyzer=self.get_dlz(obj.id) dialyzer=self.get_dlz(obj.id)
vals['dialyzers'].append(('create',dialyzer)) if dialyzer:
vals['dialyzers'].append(('create',dialyzer))
vals['staffs'].append(('create',{ vals['staffs'].append(('create',{
'staff_id': obj.doctor_id.id, 'staff_id': obj.doctor_id.id,