refactor
parent
ba6adec611
commit
4a3b4da09a
|
@ -1,8 +1,8 @@
|
|||
<action>
|
||||
<field name="string">Cycle Dialy</field>
|
||||
<field name="string">Cycle Daily</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.cycle.dialy</field>
|
||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirmed",[["state","=","confirmed"]]],["Done",[["state","=","done"]]]]</field>
|
||||
<field name="model">clinic.cycle.daily</field>
|
||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirmed",[["state","=","confirmed"]]]]</field>
|
||||
<field name="modes">list,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -1,11 +0,0 @@
|
|||
<action>
|
||||
<field name="string">Cycle Dialy</field>
|
||||
<field name="view_cls">report_view</field>
|
||||
<field name="model">clinic.cycle.item</field>
|
||||
<!--<field name="domain">[["order_id.state","in",["confirmed","done"]]]</field>-->
|
||||
<field name="group_fields">date</field>
|
||||
<field name="group_select">cycle_id</field>
|
||||
<!--<field name="group_select">partner_id,product_id,user_id,order_id</field>-->
|
||||
<!--<field name="sum_fields">amount</field>-->
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -0,0 +1,8 @@
|
|||
<action>
|
||||
<field name="string">Cycle Monthly</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.cycle.monthly</field>
|
||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Approved",[["state","=","approved"]]]]</field>
|
||||
<field name="modes">list,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -1,8 +1,8 @@
|
|||
<action>
|
||||
<field name="string">HD Case Dialy</field>
|
||||
<field name="string">HD Case Daily</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.hd.case.dialy</field>
|
||||
<field name="report_template">hd_case_dialy</field>
|
||||
<field name="report_template_xls">hd_case_dialy</field>
|
||||
<field name="model">clinic.hd.case.daily</field>
|
||||
<field name="report_template">hd_case_daily</field>
|
||||
<field name="report_template_xls">hd_case_daily</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -1,4 +1,4 @@
|
|||
<form model="clinic.cycle.dialy">
|
||||
<form model="clinic.cycle.daily">
|
||||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
|
@ -38,7 +38,7 @@
|
|||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
<button string="Confirm" type="success" method="confirm" states="draft" />
|
||||
<button string="Confirm" type="success" method="confirm" icon="ok" states="draft" />
|
||||
</foot>
|
||||
<related>
|
||||
<field name="cycle_items">
|
|
@ -1,4 +1,4 @@
|
|||
<list model="clinic.cycle.dialy" colors='{"#cfc":[["state","=","confirmed"]],"#dbdbdb":[["state","=","cancelled"]]}'>
|
||||
<list model="clinic.cycle.daily" colors='{"#cfc":[["state","=","confirmed"]],"#dbdbdb":[["state","=","cancelled"]]}'>
|
||||
<field name="name"/>
|
||||
<field name="state"/>
|
||||
</list>
|
|
@ -5,7 +5,7 @@
|
|||
<item string="Load Nurses" method="load_nurse_from_schedule" states='draft'/>
|
||||
<item string="Compute Labor Cost" method="compute" states='draft'/>
|
||||
<item string="View Schedule" method="view_schedule"/>
|
||||
<item string="View Cycle Dialy" method="view_cycle_dialy"/>
|
||||
<item string="View Cycle Daily" method="view_cycle_daily"/>
|
||||
</button>
|
||||
</head>
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
<field name="user_id"/>
|
||||
</tab>
|
||||
<tab string="Other Info">
|
||||
<field name="cycle_dialy_id" domain="[['date','=',date]]"/>
|
||||
<field name="cycle_daily_id" domain="[['date','=',date]]"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<field name="name"/>
|
||||
<field name="duration"/>
|
||||
<field name="sequence"/>
|
||||
<field name="color"/>
|
||||
<!--<field name="color"/>-->
|
||||
</list>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<form model="clinic.cycle.monthly">
|
||||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="To Draft" method="to_draft" states="approved"/>
|
||||
</button>
|
||||
</head>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<field name="month"/>
|
||||
<field name="lines" nolabel="1">
|
||||
<list>
|
||||
<field name="staff_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="type"/>
|
||||
<field name="qty" onchange="onchange_line"/>
|
||||
<field name="rate" onchange="onchange_line"/>
|
||||
<field name="amount"/>
|
||||
</list>
|
||||
<form>
|
||||
<field name="staff_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="type"/>
|
||||
<field name="qty"/>
|
||||
<field name="rate"/>
|
||||
<field name="amount"/>
|
||||
</form>
|
||||
</field>
|
||||
<group span="12">
|
||||
<field name="total" span="2" offset="10"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Approval">
|
||||
<field name="user_id"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
<button string="Approve" type="success" method="approve" icon="ok" states="draft" />
|
||||
</foot>
|
||||
<related>
|
||||
<field name="cycle_dailies">
|
||||
<list colors='{"#cfc":[["state","=","done"]]}'>
|
||||
<field name="cycle_daily_id"/>
|
||||
<field name="date"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
</related>
|
||||
</form>
|
|
@ -0,0 +1,4 @@
|
|||
<list model="clinic.cycle.monthly">
|
||||
<field name="name"/>
|
||||
<field name="state"/>
|
||||
</list>
|
|
@ -1,3 +1,3 @@
|
|||
<form model="clinic.hd.case.dialy">
|
||||
<form model="clinic.hd.case.daily">
|
||||
<field name="date" span="2"/>
|
||||
</form>
|
|
@ -29,7 +29,8 @@
|
|||
<item string="Cycles">
|
||||
<item string="Cycles" action="clinic_cycle"/>
|
||||
<item string="Cycle Items" action="clinic_cycle_item"/>
|
||||
<item string="Cycle Dialy" action="clinic_cycle_dialy"/>
|
||||
<item string="Cycle Daily" action="clinic_cycle_daily"/>
|
||||
<item string="Cycle Monthly" action="clinic_cycle_monthly"/>
|
||||
</item>
|
||||
<item string="Schedules" action="clinic_schedule">
|
||||
<item string="Schedules" action="clinic_schedule"/>
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
<button string="Options" dropdown="1">
|
||||
<item string="Copy" method="copy"/>
|
||||
<item string="Copy By Duration" action="clinic_schedule_copy"/>
|
||||
<item string="Copy Nurses To Schedule" action="clinic_load_nurses"/>
|
||||
<item string="Copy Nurses To Cycle Item" method="copy2cycle_item"/>
|
||||
<item string="Copy Nurses To Schedule" action="clinic_load_nurses" states="draft"/>
|
||||
<item string="Copy Nurses To Cycle Item" method="copy2cycle_item" states="draft"/>
|
||||
<item string="Clear Nurses" method="clear" states="draft"/>
|
||||
<item string="To Draft" method="to_draft" states="confirmed"/>
|
||||
</button>
|
||||
</head>
|
||||
<tabs>
|
||||
|
@ -36,6 +37,5 @@
|
|||
</tabs>
|
||||
<foot>
|
||||
<button string="Confirm" type="success" icon="ok" method="confirm" states="draft" />
|
||||
<button string="To Draft" type="default" icon="repeat" method="to_draft" states="confirmed" />
|
||||
</foot>
|
||||
</form>
|
||||
|
|
|
@ -32,8 +32,10 @@ from . import cycle
|
|||
from . import cycle_item
|
||||
from . import cycle_item_nurse
|
||||
from . import cycle_item_line
|
||||
from . import cycle_dialy
|
||||
from . import cycle_dialy_line
|
||||
from . import cycle_daily
|
||||
from . import cycle_daily_line
|
||||
from . import cycle_monthly
|
||||
from . import cycle_monthly_line
|
||||
from . import gen_visit
|
||||
from . import gen_visit_line
|
||||
from . import fin_setting
|
||||
|
|
|
@ -4,9 +4,9 @@ from netforce.model import Model, fields
|
|||
from netforce.access import get_active_company, get_active_user
|
||||
from netforce.utils import get_data_path
|
||||
|
||||
class CycleDialy(Model):
|
||||
_name="clinic.cycle.dialy"
|
||||
_string="Cycle Dialy"
|
||||
class CycleDaily(Model):
|
||||
_name="clinic.cycle.daily"
|
||||
_string="Cycle Daily"
|
||||
|
||||
def _get_all(self,ids,context={}):
|
||||
res={}
|
||||
|
@ -22,9 +22,9 @@ class CycleDialy(Model):
|
|||
_fields={
|
||||
"name": fields.Char("Name"),
|
||||
'date': fields.Date("Date", required=True, search=True),
|
||||
'cycle_items': fields.One2Many("clinic.cycle.item","cycle_dialy_id", "Cycle Items"),
|
||||
'lines': fields.One2Many("clinic.cycle.dialy.line","cycle_dialy_id", "Lines"),
|
||||
"state": fields.Selection([("draft","Draft"),('confirmed','Confirmed'),("done","Done")],"Status",required=True),
|
||||
'cycle_items': fields.One2Many("clinic.cycle.item","cycle_daily_id", "Cycle Items"),
|
||||
'lines': fields.One2Many("clinic.cycle.daily.line","cycle_daily_id", "Lines"),
|
||||
"state": fields.Selection([("draft","Draft"),('confirmed','Confirmed')],"Status",required=True),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
'total': fields.Float("Total",function="_get_all", function_multi=True),
|
||||
'user_id': fields.Many2One("base.user","User"),
|
||||
|
@ -51,7 +51,7 @@ class CycleDialy(Model):
|
|||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_dialy',
|
||||
'name': 'clinic_cycle_daily',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
|
@ -73,7 +73,7 @@ class CycleDialy(Model):
|
|||
context=ctx
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_dialy',
|
||||
'name': 'clinic_cycle_daily',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
|
@ -88,7 +88,7 @@ class CycleDialy(Model):
|
|||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_dialy',
|
||||
'name': 'clinic_cycle_daily',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
|
@ -110,4 +110,4 @@ class CycleDialy(Model):
|
|||
data['total']=total
|
||||
return data
|
||||
|
||||
CycleDialy.register()
|
||||
CycleDaily.register()
|
|
@ -1,12 +1,12 @@
|
|||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class CycleDialyLine(Model):
|
||||
_name="clinic.cycle.dialy.line"
|
||||
_string="Cycle Dialy Line"
|
||||
class CycleDailyLine(Model):
|
||||
_name="clinic.cycle.daily.line"
|
||||
_string="Cycle Daily Line"
|
||||
|
||||
_fields={
|
||||
"cycle_dialy_id": fields.Many2One("clinic.cycle.dialy","Cycle Dialy"),
|
||||
"cycle_daily_id": fields.Many2One("clinic.cycle.daily","Cycle Daily"),
|
||||
'cycle_id': fields.Many2One("clinic.cycle", "Cycle"),
|
||||
'staff_id': fields.Many2One("clinic.staff", "Staff"),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Level"),
|
||||
|
@ -23,4 +23,4 @@ class CycleDialyLine(Model):
|
|||
}
|
||||
|
||||
|
||||
CycleDialyLine.register()
|
||||
CycleDailyLine.register()
|
|
@ -42,7 +42,7 @@ class CycleItem(Model):
|
|||
'name': fields.Char("Name", function="_get_all",function_multi=True),
|
||||
'date': fields.Date("Date",search=True),
|
||||
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True),
|
||||
'cycle_dialy_id': fields.Many2One("clinic.cycle.dialy", "Cycle Dialy",search=True),
|
||||
'cycle_daily_id': fields.Many2One("clinic.cycle.daily", "Cycle Daily",search=True),
|
||||
'lines': fields.One2Many("clinic.cycle.item.line","item_id", "Lines"),
|
||||
'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"),
|
||||
'hd_cases': fields.One2Many("clinic.hd.case","cycle_item_id", "HD Cases"),
|
||||
|
@ -79,16 +79,16 @@ class CycleItem(Model):
|
|||
("cycle_item_uniq","unique (cycle_id,date,company_id)","Cycle item should be unique"),
|
||||
]
|
||||
|
||||
def get_cycle_diary(self,date):
|
||||
def get_cycle_daily(self,date):
|
||||
dom=[]
|
||||
print("get ", date)
|
||||
dom.append(['date','=',date])
|
||||
cd_ids=get_model('clinic.cycle.dialy').search(dom)
|
||||
cd_ids=get_model('clinic.cycle.daily').search(dom)
|
||||
cd_id=None
|
||||
if cd_ids:
|
||||
cd_id=cd_ids[0]
|
||||
else:
|
||||
cd_id=get_model('clinic.cycle.dialy').create({
|
||||
cd_id=get_model('clinic.cycle.daily').create({
|
||||
'date':date,
|
||||
'name':date,
|
||||
})
|
||||
|
@ -98,7 +98,7 @@ class CycleItem(Model):
|
|||
def create(self, vals,**kw):
|
||||
date=vals['date']
|
||||
cycle_id=vals['cycle_id']
|
||||
vals['cycle_dialy_id']=self.get_cycle_diary(date)
|
||||
vals['cycle_daily_id']=self.get_cycle_daily(date)
|
||||
|
||||
cycle=get_model("clinic.cycle").browse(cycle_id)
|
||||
vals['sequence']='%s-%s'%(date,cycle.sequence) #date-sequence
|
||||
|
@ -109,13 +109,12 @@ class CycleItem(Model):
|
|||
obj=self.browse(ids)[0]
|
||||
cycle=obj.cycle_id
|
||||
date=vals.get('date') and vals.get('date') or obj.date
|
||||
vals['cycle_dialy_id']=self.get_cycle_diary(date)
|
||||
vals['cycle_daily_id']=self.get_cycle_daily(date)
|
||||
vals['sequence']='%s-%s'%(obj.date,cycle.sequence) #date-sequence
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def validate(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
# copy list of nurse to cycle.dialy.line
|
||||
levels={}
|
||||
for line in obj.lines:
|
||||
level=line.level_id
|
||||
|
@ -172,9 +171,9 @@ class CycleItem(Model):
|
|||
'type': type,
|
||||
}))
|
||||
|
||||
cycle_dialy=obj.cycle_dialy_id
|
||||
cycle_daily=obj.cycle_daily_id
|
||||
# clear cost line
|
||||
for line in cycle_dialy.lines:
|
||||
for line in cycle_daily.lines:
|
||||
cycle=line.cycle_id
|
||||
if obj.cycle_id.id==cycle.id: # only own cycle
|
||||
line.delete()
|
||||
|
@ -217,7 +216,7 @@ class CycleItem(Model):
|
|||
if context.get('called'):
|
||||
return lines
|
||||
|
||||
cycle_dialy.write({
|
||||
cycle_daily.write({
|
||||
'lines': lines,
|
||||
})
|
||||
|
||||
|
@ -227,9 +226,9 @@ class CycleItem(Model):
|
|||
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_dialy',
|
||||
'name': 'clinic_cycle_daily',
|
||||
'mode': 'form',
|
||||
'active_id': cycle_dialy.id,
|
||||
'active_id': cycle_daily.id,
|
||||
},
|
||||
'flash': 'Cycle Item has been validated, please see the detail of cost below.',
|
||||
}
|
||||
|
@ -407,15 +406,15 @@ class CycleItem(Model):
|
|||
}
|
||||
}
|
||||
|
||||
def view_cycle_dialy(self,ids,context={}):
|
||||
def view_cycle_daily(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
if not obj.cycle_dialy_id:
|
||||
if not obj.cycle_daily_id:
|
||||
raise Exception("Please validate cycle item")
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_dialy',
|
||||
'name': 'clinic_cycle_daily',
|
||||
'mode': 'form',
|
||||
'active_id': obj.cycle_dialy_id.id,
|
||||
'active_id': obj.cycle_daily_id.id,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company, get_active_user
|
||||
from netforce.utils import get_data_path
|
||||
|
||||
class CycleMonthly(Model):
|
||||
_name="clinic.cycle.monthly"
|
||||
_string="Cycle Monthly"
|
||||
|
||||
def _get_all(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
total=0.0
|
||||
for line in obj.lines:
|
||||
total+=(line.amount or 0)
|
||||
res[obj.id]={
|
||||
'total': total,
|
||||
}
|
||||
return res
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Name"),
|
||||
'month': fields.Date("Month", required=True, search=True),
|
||||
'cycle_dailies': fields.One2Many("clinic.cycle.daily","cycle_monthly_id", "Cycle Dialies"),
|
||||
'lines': fields.One2Many("clinic.cycle.monthly.line","cycle_monthly_id", "Lines"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
'total': fields.Float("Total",function="_get_all", function_multi=True),
|
||||
'user_id': fields.Many2One("base.user","User"),
|
||||
"state": fields.Selection([("draft","Draft"),('approved','Approved')],"Status",required=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'company_id': lambda *a: get_active_company(),
|
||||
'month': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'name': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'user_id': lambda *a: get_active_user(),
|
||||
'state': 'draft',
|
||||
}
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
date=vals.get('month','')
|
||||
if date:
|
||||
vals['name']=date
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def approve(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({
|
||||
'state': 'approved',
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_monthly',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
'flash':'Approved',
|
||||
}
|
||||
|
||||
def recheck_daily(self,ids,context={}):
|
||||
# copy cost of nurse and doctor from cycle item
|
||||
obj=self.browse(ids)[0]
|
||||
lines=[]
|
||||
ctx=context.copy()
|
||||
context['called']=True
|
||||
for cycle_daily in obj.dailies:
|
||||
lines+=cycle_daily.confirm(context=context)
|
||||
obj.write({
|
||||
'lines': lines,
|
||||
})
|
||||
context=ctx
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_monthly',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
'flash':'Recheck successfully',
|
||||
}
|
||||
|
||||
def onchange_line(self,context={}):
|
||||
data=context['data']
|
||||
path=context['path']
|
||||
line=get_data_path(data,path,parent=True)
|
||||
qty=line['qty']
|
||||
rate=line['rate']
|
||||
line['amount']=qty*rate
|
||||
total=0.0
|
||||
for line in data['lines']:
|
||||
qty=line['qty']
|
||||
rate=line['rate']
|
||||
total+=qty*rate
|
||||
data['total']=total
|
||||
return data
|
||||
|
||||
CycleMonthly.register()
|
|
@ -0,0 +1,24 @@
|
|||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class CycleMonthlyLine(Model):
|
||||
_name="clinic.cycle.monthly.line"
|
||||
_string="Cycle Monthly Line"
|
||||
|
||||
_fields={
|
||||
"cycle_monthly_id": fields.Many2One("clinic.cycle.monthly","Cycle Monthly"),
|
||||
'staff_id': fields.Many2One("clinic.staff", "Staff"),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Level"),
|
||||
'qty': fields.Integer("Qty"),
|
||||
'rate': fields.Float("Rate"),
|
||||
'amount': fields.Float("Amount"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'company_id': lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
|
||||
CycleMonthlyLine.register()
|
|
@ -65,12 +65,12 @@ class ReportNurseFeeDetail(Model):
|
|||
staff=get_model("clinic.staff").browse(staff_id)
|
||||
staff_name=staff.name
|
||||
dom.append(['staff_id','=',staff.id])
|
||||
records=get_model('clinic.cycle.dialy.line').search_browse(dom)
|
||||
dlines=get_model('clinic.cycle.daily.line').search_browse(dom)
|
||||
# group by date
|
||||
all_vals={}
|
||||
for record in records:
|
||||
date=record.date
|
||||
staff=record.staff_id
|
||||
for dline in dlines:
|
||||
date=dline.date
|
||||
staff=dline.staff_id
|
||||
if staff_type:
|
||||
if staff_type!=staff.type:
|
||||
continue
|
||||
|
@ -82,8 +82,8 @@ class ReportNurseFeeDetail(Model):
|
|||
'staff_name': staff.name or "",
|
||||
'amount': 0,
|
||||
}
|
||||
all_vals[key]['qty']+=record.qty or 0
|
||||
all_vals[key]['amount']+=record.amount or 0
|
||||
all_vals[key]['qty']+=dline.qty or 0
|
||||
all_vals[key]['amount']+=dline.amount or 0
|
||||
|
||||
lines=[]
|
||||
total_amount=0.0
|
||||
|
|
|
@ -92,14 +92,14 @@ class ReportNurseFeeSum(Model):
|
|||
dom.append(['date','=',date])
|
||||
dom.append(['staff_id','=',nurse.id])
|
||||
amt=0
|
||||
results=get_model("clinic.cycle.dialy.line").search_read(dom,['amount','cycle_dialy_id'])
|
||||
cycle_dialy_id=None
|
||||
results=get_model("clinic.cycle.daily.line").search_read(dom,['amount','cycle_daily_id'])
|
||||
cycle_daily_id=None
|
||||
if results:
|
||||
for result in results:
|
||||
amt+=result['amount'] or 0.0
|
||||
cycle_dialy_id=result['cycle_dialy_id'][0]
|
||||
cycle_daily_id=result['cycle_daily_id'][0]
|
||||
line['sub_lines'].append({
|
||||
'cycle_dialy_id': cycle_dialy_id,
|
||||
'cycle_daily_id': cycle_daily_id,
|
||||
'amt': amt,
|
||||
'last': False,
|
||||
})
|
||||
|
|
|
@ -16,7 +16,8 @@ class Schedule(Model):
|
|||
count=0
|
||||
for line in obj.lines:
|
||||
nurse=line.nurse_id
|
||||
st+='%s %s\n'%(nurse.name, nurse.level_id.name or "")
|
||||
level=line.level_id
|
||||
st+='%s %s\n'%(nurse.name, level.name or "")
|
||||
count+=1
|
||||
res[obj.id]='%s'%(st if count else 'No nurse')
|
||||
return res
|
||||
|
@ -65,12 +66,28 @@ class Schedule(Model):
|
|||
obj.write({
|
||||
'state': 'confirmed',
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_schedule',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
'flash': 'Schedule %s has been confirmed'%obj.date,
|
||||
}
|
||||
|
||||
def to_draft(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({
|
||||
'state': 'draft',
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_schedule',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
'flash': 'Schedule %s has been set to draft'%obj.date,
|
||||
}
|
||||
|
||||
|
||||
def copy(self,ids,context={}):
|
||||
|
|
|
@ -7,7 +7,12 @@ class ScheduleLine(Model):
|
|||
def _get_level(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
res[obj.id]=obj.nurse_id.level_id.id
|
||||
nurse=obj.nurse_id
|
||||
level=nurse.level_id
|
||||
level_id=None
|
||||
if level:
|
||||
level_id=level.id
|
||||
res[obj.id]=level_id
|
||||
return res
|
||||
|
||||
_fields={
|
||||
|
|
Loading…
Reference in New Issue