cycle item

conv_bal
watcha.h 2014-12-09 14:48:33 +07:00
parent 35c1f4d516
commit ea0896a5ad
4 changed files with 24 additions and 2 deletions

View File

@ -4,7 +4,6 @@
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="Load Nurses" method="load_nurse_from_schedule" states='draft'/> <item string="Load Nurses" method="load_nurse_from_schedule" states='draft'/>
<item string="View Schedule" method="view_schedule"/> <item string="View Schedule" method="view_schedule"/>
<item string="View Cycle Daily" method="view_cycle_daily"/>
<item string="To Draft" method="to_draft" states="validated" /> <item string="To Draft" method="to_draft" states="validated" />
</button> </button>
</head> </head>

View File

@ -11,12 +11,14 @@
<field name="lines" nolabel="1"> <field name="lines" nolabel="1">
<list> <list>
<field name="staff_id"/> <field name="staff_id"/>
<field name="type"/>
<field name="qty" onchange="onchange_line"/> <field name="qty" onchange="onchange_line"/>
<field name="rate" onchange="onchange_line"/> <field name="rate" onchange="onchange_line"/>
<field name="amount"/> <field name="amount"/>
</list> </list>
<form> <form>
<field name="staff_id"/> <field name="staff_id"/>
<field name="type"/>
<field name="qty"/> <field name="qty"/>
<field name="rate"/> <field name="rate"/>
<field name="amount"/> <field name="amount"/>

View File

@ -138,10 +138,22 @@ class CycleItem(Model):
if schd_ids: if schd_ids:
schedule_id=schd_ids[0] schedule_id=schd_ids[0]
if not schedule_id: if not schedule_id:
lines=[]
for lnurse in obj.nurses:
nurse=lnurse.nurse_id
level=nurse.level_id
lines.append(('create',{
'cycle_id': obj.cycle_id.id,
'cycle_item_id': obj.id,
'nurse_id': nurse.id,
'level_id': level.id ,
'note': '',
}))
schedule_id=get_model('clinic.schedule').create({ schedule_id=get_model('clinic.schedule').create({
'date': date, 'date': date,
'time_start': '%s 08:00:00'%date, #XXX 'time_start': '%s 08:00:00'%date, #XXX
'time_stop': '%s 21:00:00'%date, #XXX 'time_stop': '%s 21:00:00'%date, #XXX
'lines': lines,
}) })
return { return {
'next': { 'next': {

View File

@ -11,17 +11,26 @@ class LaborCostEntryLine(Model):
_fields={ _fields={
'entry_id': fields.Many2One("clinic.labor.cost.entry","Entry",required=True), 'entry_id': fields.Many2One("clinic.labor.cost.entry","Entry",required=True),
'staff_id': fields.Many2One("clinic.staff","Staff",required=True),
'date': fields.Date("Date"), 'date': fields.Date("Date"),
'staff_id': fields.Many2One("clinic.staff","Staff"),
'qty': fields.Integer("Qty"), 'qty': fields.Integer("Qty"),
'rate': fields.Float("Rate Avg."), 'rate': fields.Float("Rate Avg."),
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),
'company_id': fields.Many2One("company","Company"), 'company_id': fields.Many2One("company","Company"),
"type": fields.Selection([['staff','Staff'],["doctor","Doctor"],["nurse","Nurse"]],"Type"),
} }
_order="type"
_defaults={ _defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"), 'date': lambda *a: time.strftime("%Y-%m-%d"),
'company_id': lambda *a: get_active_company(), 'company_id': lambda *a: get_active_company(),
} }
def create(self,vals,**kw):
staff=get_model('clinic.staff').browse(vals['staff_id'])
vals['type']=staff.type
new_id=super().create(vals,**kw)
return new_id
LaborCostEntryLine.register() LaborCostEntryLine.register()