conv_bal
watcha.h 2014-11-26 23:04:58 +07:00
parent 3633b10d77
commit ba6adec611
6 changed files with 33 additions and 15 deletions

View File

@ -5,6 +5,7 @@
<item string="Load Nurses" method="load_nurse_from_schedule" states='draft'/> <item string="Load Nurses" method="load_nurse_from_schedule" states='draft'/>
<item string="Compute Labor Cost" method="compute" states='draft'/> <item string="Compute Labor Cost" method="compute" states='draft'/>
<item string="View Schedule" method="view_schedule"/> <item string="View Schedule" method="view_schedule"/>
<item string="View Cycle Dialy" method="view_cycle_dialy"/>
</button> </button>
</head> </head>
@ -30,7 +31,7 @@
<field name="level_id"/> <field name="level_id"/>
<field name="qty"/> <field name="qty"/>
<field name="formular_org" readonly="1"/> <field name="formular_org" readonly="1"/>
<field name="formular"/> <field name="formular" readonly="1"/>
<field name="amount"/> <field name="amount"/>
</list> </list>
</field> </field>

View File

@ -18,8 +18,8 @@
<item string="Patients" action="clinic_patient"/> <item string="Patients" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/> <item string="Dialyzers" action="clinic_dialyzer"/>
<divider/> <divider/>
<header string="PATIENT SETTINGS"/> <header string="SETTINGS"/>
<item string="Patient Categories" action="clinic_patient_categ"/> <item string="Categories" action="clinic_patient_categ"/>
<item string="Cause Chronics" action="clinic_cause_chronic"/> <item string="Cause Chronics" action="clinic_cause_chronic"/>
<item string="Comorbidities" action="clinic_comorbidity"/> <item string="Comorbidities" action="clinic_comorbidity"/>
<item string="Graduations" action="clinic_grade"/> <item string="Graduations" action="clinic_grade"/>

View File

@ -231,7 +231,7 @@ class CycleItem(Model):
'mode': 'form', 'mode': 'form',
'active_id': cycle_dialy.id, 'active_id': cycle_dialy.id,
}, },
'flash': 'Cycle Item has been confirmed, please see detail of cost below.', 'flash': 'Cycle Item has been validated, please see the detail of cost below.',
} }
def to_draft(self,ids,context={}): def to_draft(self,ids,context={}):
@ -254,8 +254,11 @@ class CycleItem(Model):
} }
} }
levels.update(vals) levels.update(vals)
for nurse in obj.nurses:
level=nurse.level_id for ns in obj.nurses:
level=ns.level_id
if not level:
raise Exception("Please specify level for %s"%ns.nurse_id.name)
levels[level.id]['total']+=1 levels[level.id]['total']+=1
st_levels={} st_levels={}
@ -404,6 +407,18 @@ class CycleItem(Model):
} }
} }
def view_cycle_dialy(self,ids,context={}):
obj=self.browse(ids)[0]
if not obj.cycle_dialy_id:
raise Exception("Please validate cycle item")
return {
'next': {
'name': 'clinic_cycle_dialy',
'mode': 'form',
'active_id': obj.cycle_dialy_id.id,
}
}
def load_nurse_from_schedule(self,ids,context={}): def load_nurse_from_schedule(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
#TODO check cycle number & date from schedule #TODO check cycle number & date from schedule

View File

@ -107,17 +107,19 @@ class Schedule(Model):
for line in obj.lines: for line in obj.lines:
nurse=line.nurse_id nurse=line.nurse_id
cycle=line.cycle_id cycle=line.cycle_id
item_ids=get_model("clinic.cycle.item").search([['date','=',date],['cycle_id','=',cycle.id],['state','=','draft']]) item_objs=get_model("clinic.cycle.item").search_browse([['date','=',date],['cycle_id','=',cycle.id]])
if item_ids: if item_objs:
item_id=item_ids[0] item=item_objs[0]
if not items.get(item_id): if item.state!='draft':
items[item_id]=[] continue
items[item_id].append(('create',{ if not items.get(item.id):
items[item.id]=[]
items[item.id].append(('create',{
'nurse_id': nurse.id, 'nurse_id': nurse.id,
'level_id': nurse.level_id.id, 'level_id': nurse.level_id.id,
})) }))
line.write({ line.write({
'cycle_item_id': item_id, 'cycle_item_id': item.id,
}) })
cycles.update({cycle.name}) cycles.update({cycle.name})
else: else:

View File

@ -14,7 +14,7 @@ class SettingLevel(Model):
"setting_id": fields.Many2One("clinic.setting","Setting"), "setting_id": fields.Many2One("clinic.setting","Setting"),
"level_id": fields.Many2One("clinic.staff.level","Level",domain=[['type','=','nurse']]), "level_id": fields.Many2One("clinic.staff.level","Level",domain=[['type','=','nurse']]),
'var_a': fields.Char("Ax"), 'var_a': fields.Char("Ax"),
"op": fields.Selection([["+","+"],["-","-"],["*","*"],["/","/"]],"Operation"), "op": fields.Selection([["+","+"],["-","-"]],"Operation"),
'var_b': fields.Char("B"), 'var_b': fields.Char("B"),
'formular': fields.Text("Formular (Ax op B)",function="_get_formular"), 'formular': fields.Text("Formular (Ax op B)",function="_get_formular"),
} }

View File

@ -6,7 +6,7 @@ class SettingProduct(Model):
_fields={ _fields={
"setting_id": fields.Many2One("clinic.setting","Setting"), "setting_id": fields.Many2One("clinic.setting","Setting"),
"type": fields.Selection([("fee","FEE"),("others","Others")],"Type",required=True), "type": fields.Selection([("fee","Fee"),("others","Others")],"Type",required=True),
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Patient Type",required=True), "patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Patient Type",required=True),
'uom_id': fields.Many2One("uom","UOM", required=True), 'uom_id': fields.Many2One("uom","UOM", required=True),
"product_id": fields.Many2One("product","Product"), "product_id": fields.Many2One("product","Product"),