multi confirm
parent
f61aa16d5b
commit
642f5c8c10
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="string">Confirm Visit</field>
|
||||
<field name="view_cls">form_popup</field>
|
||||
<field name="model">clinic.popup.visit.confirm</field>
|
||||
<field name="target">_popup</field>
|
||||
</action>
|
|
@ -2,7 +2,6 @@
|
|||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<!--<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>
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
<field name="doctor_id" span="2"/>
|
||||
<field name="department_id" span="2"/>
|
||||
<field name="branch_id" span="2"/>
|
||||
<button string='Confirm Visits' method="confirm" type="success" icon="arrow-right"/>
|
||||
</form>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<form model="clinic.popup.visit.confirm" title="Waiting Confirm">
|
||||
<field name="visitboard_id" invisible="1"/>
|
||||
<field name="lines" nolabel="1">
|
||||
<list noadd="1">
|
||||
<field name="cycle_id"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="visit_id" invisible="1"/>
|
||||
</list>
|
||||
</field>
|
||||
<foot>
|
||||
<button string="Confirm" type="success" method="confirm"/>
|
||||
</foot>
|
||||
</form>
|
|
@ -23,6 +23,8 @@ from . import patient_morbidity
|
|||
from . import race
|
||||
from . import visit
|
||||
from . import visit_board
|
||||
from . import visit_popup_confirm
|
||||
from . import visit_popup_confirm_line
|
||||
from . import hd_case
|
||||
from . import hd_case_line
|
||||
from . import hd_case_expense
|
||||
|
|
|
@ -97,7 +97,7 @@ class Patient(Model):
|
|||
"documents": fields.One2Many("document","related_id","Documents"),
|
||||
'resign_date': fields.Date("Resign Date"),
|
||||
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch",search=True),
|
||||
'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"),
|
||||
|
|
|
@ -24,7 +24,7 @@ class VisitBoard(Model):
|
|||
_name="clinic.visit.board"
|
||||
_string="Visit Board"
|
||||
_transient=True
|
||||
|
||||
_name_field="date"
|
||||
_fields={
|
||||
"date": fields.Date("Month", required=False),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
|
@ -45,7 +45,6 @@ class VisitBoard(Model):
|
|||
def get_report_data(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model("company").browse(company_id)
|
||||
|
||||
date_from=datetime.now().strftime("%Y-%m-%d")
|
||||
date_to=(datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d")
|
||||
patient_id=None
|
||||
|
@ -294,5 +293,14 @@ class VisitBoard(Model):
|
|||
data['date_from']="%s-%s-01"%(year,month)
|
||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||
return data
|
||||
|
||||
def confirm(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
return {
|
||||
'next': {
|
||||
'refer_id': obj.id,
|
||||
'name': 'clinic_popup_visit_confirm',
|
||||
}
|
||||
}
|
||||
|
||||
VisitBoard.register()
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_user
|
||||
|
||||
DRT=0
|
||||
|
||||
class VisitPopupConfirm(Model):
|
||||
_name="clinic.popup.visit.confirm"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"visitboard_id": fields.Many2One("clinic.visit.board","Visit Board",required=True,on_delete="cascade"),
|
||||
'user_id': fields.Many2One("base.user","User"),
|
||||
"note": fields.Text("Note"),
|
||||
'lines': fields.One2Many("clinic.popup.visit.confirm.line","popup_visit_id",'Lines'),
|
||||
}
|
||||
|
||||
def _get_visitboard_id(self,context={}):
|
||||
visitboard_id=context.get("refer_id")
|
||||
if not visitboard_id:
|
||||
return None
|
||||
return int(visitboard_id)
|
||||
|
||||
def _get_default_lines(self,context={}):
|
||||
visitboard_id=context.get("refer_id")
|
||||
if not visitboard_id:
|
||||
return []
|
||||
return self._get_lines(int(visitboard_id))
|
||||
|
||||
def _get_lines(self,visitboard_id=None):
|
||||
lines=[]
|
||||
if not visitboard_id:
|
||||
return lines
|
||||
board=get_model("clinic.visit.board").browse(visitboard_id)
|
||||
date_from=datetime.now().strftime("%Y-%m-%d")
|
||||
date_to=(datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d")
|
||||
date_from=board.date_from
|
||||
date_to=board.date_to
|
||||
patient_id=board.patient_id.id
|
||||
cycle_id=board.cycle_id.id
|
||||
doctor_id=board.doctor_id.id
|
||||
department_id=board.department_id.id
|
||||
branch_id=board.branch_id.id
|
||||
|
||||
time_start='%s 00:00:00'%(date_from)
|
||||
time_stop='%s 23:59:59'%(date_to)
|
||||
dom=[]
|
||||
dom.append(['time_start','>=','%s'%time_start])
|
||||
dom.append(['time_stop','<=','%s'%time_stop])
|
||||
dom.append(['state','in',['pending']])
|
||||
if patient_id:
|
||||
dom.append(['patient_id','=',patient_id])
|
||||
if cycle_id:
|
||||
dom.append(['cycle_id','=',cycle_id])
|
||||
if doctor_id:
|
||||
dom.append(['doctor_id','=',doctor_id])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
|
||||
for visit in get_model("clinic.visit").search_browse(dom):
|
||||
cycle=visit.cycle_id
|
||||
patient=visit.patient_id
|
||||
department=visit.department_id
|
||||
lines.append({
|
||||
'patient_id': patient.id,
|
||||
'cycle_id': cycle.id,
|
||||
'department_id': department.id,
|
||||
'visit_id': visit.id,
|
||||
})
|
||||
return lines
|
||||
|
||||
_defaults={
|
||||
'visitboard_id': _get_visitboard_id,
|
||||
'user_id': lambda *a: get_active_user(),
|
||||
'lines': _get_default_lines,
|
||||
}
|
||||
|
||||
def confirm(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
board=obj.visitboard_id
|
||||
count=0
|
||||
for line in obj.lines:
|
||||
vs=line.visit_id
|
||||
vs.confirm()
|
||||
count+=1
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_visit_board',
|
||||
'mode': 'form',
|
||||
'active_id': board.id,
|
||||
},
|
||||
'flash': 'Total confirmed is %s'%count,
|
||||
}
|
||||
|
||||
VisitPopupConfirm.register()
|
|
@ -0,0 +1,19 @@
|
|||
from netforce.model import Model, fields
|
||||
|
||||
class VisitPopupConfirmLine(Model):
|
||||
_name="clinic.popup.visit.confirm.line"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"popup_visit_id": fields.Many2One("clinic.popup.visit.confirm","Popup Board",required=True,on_delete="cascade"),
|
||||
'patient_id': fields.Many2One("clinic.patient","Patient"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
|
||||
'visit_id': fields.Many2One("clinic.visit","Visit"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'is_confirm': False,
|
||||
}
|
||||
|
||||
VisitPopupConfirmLine.register()
|
|
@ -2,9 +2,11 @@ todo:
|
|||
- report
|
||||
- doctor labort cost detail ***
|
||||
- matching payment ***
|
||||
- popup messagging
|
||||
- modify message of log
|
||||
- popup messagging -> Ask DJ
|
||||
- modify message of log -> Ask DJ
|
||||
- show image of staff
|
||||
- copy old nurse from previous cycle item
|
||||
- multi confirm ****
|
||||
=======
|
||||
generate visit ใหม่ -> ok
|
||||
popup select dyalyzer -> ok
|
||||
|
|
Loading…
Reference in New Issue