filter labor cost
parent
94d32420b5
commit
f33341d98f
|
@ -5,6 +5,12 @@
|
|||
</head>
|
||||
<group form_layout="stacked">
|
||||
<field name="cycle_item_id" span="3"/>
|
||||
<!--
|
||||
<field name="date" span="3"/>
|
||||
<field name="cycle_id" span="3"/>
|
||||
<field name="branch_id" span="3"/>
|
||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="3"/>
|
||||
-->
|
||||
</group>
|
||||
<tabs>
|
||||
<tab string="Computation">
|
||||
|
|
|
@ -9,6 +9,18 @@ class LaborCost(Model):
|
|||
_name_field="cycle_item_id"
|
||||
_key=['cycle_item_id']
|
||||
|
||||
def _get_store(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
item=obj.cycle_item_id
|
||||
res[obj.id]={
|
||||
'date': item.date,
|
||||
'cycle_id': item.cycle_id.id,
|
||||
'department_id': item.department_id.id,
|
||||
'branch_id': item.branch_id.id,
|
||||
}
|
||||
return res
|
||||
|
||||
def _get_all(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
|
@ -74,13 +86,16 @@ class LaborCost(Model):
|
|||
"doctor_lines": fields.One2Many("clinic.labor.cost.line", "labor_cost_id", "Doctor Lines",domain=[['type','=','doctor']]),
|
||||
"staff_lines": fields.One2Many("clinic.labor.cost.line", "labor_cost_id", "staff Lines",domain=[['type','=','staff']]),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
'date': fields.Date('Date',function="_get_store",function_multi=True,store=True,search=True),
|
||||
'cycle_id': fields.Many2One('clinic.cycle',"Cycle", function="_get_store",function_multi=True,store=True,search=True),
|
||||
'department_id': fields.Many2One('clinic.department',"Department", function="_get_store",function_multi=True,store=True,search=True),
|
||||
'branch_id': fields.Many2One('clinic.branch',"Branch", function="_get_store",function_multi=True,store=True,search=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'company_id': lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
|
||||
def compute(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
if not obj.manual:
|
||||
|
@ -380,5 +395,14 @@ class LaborCost(Model):
|
|||
total+=amt
|
||||
data['total_cost']=total
|
||||
return data
|
||||
|
||||
def create(self,vals,**kw):
|
||||
id=super().create(vals,**kw)
|
||||
self.function_store([id])
|
||||
return id
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
super().write(ids,vals,**kw)
|
||||
self.function_store(ids)
|
||||
|
||||
LaborCost.register()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.utils import get_data_path
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class LaborCostEntryLine(Model):
|
||||
|
@ -10,7 +9,7 @@ class LaborCostEntryLine(Model):
|
|||
_multi_company=True
|
||||
|
||||
_fields={
|
||||
'entry_id': fields.Many2One("clinic.labor.cost.entry","Entry",required=True),
|
||||
'entry_id': fields.Many2One("clinic.labor.cost.entry","Entry",required=True,on_delete="cascade"),
|
||||
'staff_id': fields.Many2One("clinic.staff","Staff",required=True),
|
||||
'date': fields.Date("Date"),
|
||||
'qty': fields.Integer("#HDCase"),
|
||||
|
|
|
@ -91,9 +91,16 @@ class ClinicSetting(Model):
|
|||
return True
|
||||
|
||||
def run_script(self,ids,context={}):
|
||||
db=get_connection()
|
||||
db.execute('update clinic_cycle_item set date_validate=write_time;')
|
||||
print("Done!")
|
||||
#db=get_connection()
|
||||
#db.execute('update clinic_cycle_item set date_validate=write_time;')
|
||||
dom=[]
|
||||
dom.append(['nurse_id','=',338])
|
||||
dom.append(['cycle_item_id.date','>=','2015-01-15'])
|
||||
dom.append(['cycle_item_id.date','<=','2015-01-15'])
|
||||
for tline in get_model("clinic.cycle.item.line").search_browse(dom):
|
||||
item=tline.cycle_item_id
|
||||
print(item.name)
|
||||
print("Done! ")
|
||||
|
||||
def reset_last_import(self,ids,context={}):
|
||||
res=get_model("clinic.report.payment.matching").search_read([],['date'],order="date desc")
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
todo:
|
||||
- import hd case ***
|
||||
- add script
|
||||
- report
|
||||
- doctor labort cost detail ***
|
||||
- how much hd of that doctor in that period
|
||||
-
|
||||
- matching payment ***
|
||||
|
||||
- popup messagging -> Ask DJ
|
||||
|
|
Loading…
Reference in New Issue