improve hd case staff
parent
168badd98f
commit
d7743fb6fc
|
@ -1,4 +1,9 @@
|
|||
<form model="clinic.hd.case.staff">
|
||||
<head>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Recompute Labor Cost" method="recompute_cost"/>
|
||||
</button>
|
||||
</head>
|
||||
<field name="hd_case_id"/>
|
||||
<field name="type"/>
|
||||
<field name="staff_id"/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields
|
||||
from netforce.model import Model, fields, get_model
|
||||
|
||||
class HDCaseStaff(Model):
|
||||
_name="clinic.hd.case.staff"
|
||||
|
@ -41,6 +41,14 @@ class HDCaseStaff(Model):
|
|||
'priop': 'personal',
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
def recompute_cost(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
hdcase=obj.hd_case_id
|
||||
citem=hdcase.cycle_item_id
|
||||
for lc in get_model('clinic.labor.cost').search_browse([['cycle_item_id','=',citem.id]]):
|
||||
lc.compute()
|
||||
print("Done!")
|
||||
|
||||
HDCaseStaff.register()
|
||||
|
||||
|
|
Loading…
Reference in New Issue