cycle dialy
parent
096cbcbb13
commit
e129ccf370
|
@ -1,4 +1,4 @@
|
|||
<list model="clinic.cycle.dialy">
|
||||
<list model="clinic.cycle.dialy" colors='{"#cfc":[["state","=","confirmed"]],"#dbdbdb":[["state","=","cancelled"]]}'>
|
||||
<field name="name"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<field name="prof_license_expiry" attrs='{"invisible":[["type","in",["personal"]]]}'/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="base"/>
|
||||
<field name="max_cycle"/>
|
||||
</tab>
|
||||
<tab string="Note">
|
||||
<field name="note" nolabel="1"/>
|
||||
|
@ -69,7 +70,8 @@
|
|||
<field name="to_company_id"/>
|
||||
<field name="hire_date"/>
|
||||
<field name="resign_date"/>
|
||||
<!--<field name="wage"/>-->
|
||||
<field name="max_cycle"/>
|
||||
<field name="wage"/>
|
||||
<field name="note"/>
|
||||
</list>
|
||||
</field>
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
<field name="hire_date"/>
|
||||
<field name="resign_date"/>
|
||||
<field name="wage"/>
|
||||
<field name="max_cycle"/>
|
||||
<field name="note"/>
|
||||
</form>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<field name="to_company_id"/>
|
||||
<field name="hire_date"/>
|
||||
<field name="resign_date"/>
|
||||
<field name="max_cycle"/>
|
||||
<field name="wage"/>
|
||||
<field name="note"/>
|
||||
</list>
|
||||
|
|
|
@ -168,6 +168,32 @@ class CycleItem(Model):
|
|||
if obj.cycle_id.id==cycle.id: # only own cycle
|
||||
line.delete()
|
||||
|
||||
# group personal and cycle date
|
||||
glines={}
|
||||
for line in lines:
|
||||
mode,vals=line
|
||||
cycle_id=vals['cycle_id']
|
||||
personal_id=vals['personal_id']
|
||||
paid_amount=vals['paid_amount'] or 0
|
||||
key=(cycle_id,personal_id)
|
||||
if not key in glines.keys():
|
||||
glines[key]={
|
||||
'paid_amount': paid_amount,
|
||||
'type': vals['type'],
|
||||
}
|
||||
continue
|
||||
glines[key]['paid_amount']+=paid_amount
|
||||
|
||||
lines=[]
|
||||
for key,vals in glines.items():
|
||||
cycle_id,personal_id=key
|
||||
line={
|
||||
'cycle_id': cycle_id,
|
||||
'personal_id': personal_id,
|
||||
}
|
||||
line.update(vals)
|
||||
lines.append(('create',line))
|
||||
|
||||
cycle_dialy.write({
|
||||
'lines': lines,
|
||||
})
|
||||
|
|
|
@ -43,9 +43,14 @@ class Personal(Model):
|
|||
res={}
|
||||
for obj in self.browse(ids):
|
||||
base=0
|
||||
max_cycle=0
|
||||
for mv in obj.moves:
|
||||
base=mv.wage
|
||||
res[obj.id]=base
|
||||
max_cycle=mv.max_cycle
|
||||
res[obj.id]={
|
||||
'base': base,
|
||||
'max_cycle': max_cycle,
|
||||
}
|
||||
return res
|
||||
|
||||
_fields={
|
||||
|
@ -83,7 +88,8 @@ class Personal(Model):
|
|||
'level_id': fields.Many2One("clinic.personal.level", "Personal Level", function="_get_level"),
|
||||
'active': fields.Boolean("Active"),
|
||||
'date': fields.Date("Register Date"),
|
||||
'base': fields.Float("Base Amount", function="_get_base"),
|
||||
'base': fields.Float("Base Amount", function="_get_base",function_multi=True),
|
||||
'max_cycle': fields.Integer("Max Cycle", function="_get_base",function_multi=True),
|
||||
'hire_date': fields.Date("Hire Date"),
|
||||
'resign_date': fields.Date("Resign Date"),
|
||||
"documents": fields.One2Many("document","related_id","Documents"),
|
||||
|
|
|
@ -13,6 +13,7 @@ class PersonalMove(Model):
|
|||
"hire_date": fields.Date("Hire Date", search=True),
|
||||
"resign_date": fields.Date("Resign Date", search=True),
|
||||
"wage": fields.Float("Wage"),
|
||||
"max_cycle": fields.Integer("Max Cycle"),
|
||||
"note": fields.Text("Note"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model
|
||||
from netforce.database import get_connection
|
||||
from netforce.access import get_active_company
|
||||
|
@ -9,6 +11,10 @@ class Report(Model):
|
|||
def cycle_recent_widget(self,context={}):
|
||||
db=get_connection()
|
||||
company_id=get_active_company()
|
||||
#datenow=time.strftime("%Y-%m-%d")
|
||||
#time_start='%s 00:00:00'%(datenow)
|
||||
#time_stop='%s 23:59:59'%(datenow)
|
||||
#res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id where hd.company_id =%s and hd.date >= %s and hd.date <= %s group by c.name",company_id,time_start,time_stop)
|
||||
res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id where hd.company_id =%s group by c.name",company_id)
|
||||
data=[]
|
||||
for r in res:
|
||||
|
|
Loading…
Reference in New Issue