diff --git a/netforce_clinic/actions/clinic_cycle_daily.xml b/netforce_clinic/actions/clinic_cycle_daily.xml
deleted file mode 100644
index 29643ad..0000000
--- a/netforce_clinic/actions/clinic_cycle_daily.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
- Cycle Daily
- multi_view
- clinic.cycle.daily
- [["All",[]],["Draft",[["state","=","draft"]]],["Confirmed",[["state","=","confirmed"]]]]
- list,form
- clinic_menu
-
diff --git a/netforce_clinic/actions/clinic_cycle_monthly.xml b/netforce_clinic/actions/clinic_cycle_monthly.xml
deleted file mode 100644
index b4eadea..0000000
--- a/netforce_clinic/actions/clinic_cycle_monthly.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
- Cycle Monthly
- multi_view
- clinic.cycle.monthly
- [["All",[]],["Draft",[["state","=","draft"]]],["Approved",[["state","=","approved"]]]]
- list,form
- clinic_menu
-
diff --git a/netforce_clinic/layouts/clinic_cycle_daily_form.xml b/netforce_clinic/layouts/clinic_cycle_daily_form.xml
deleted file mode 100644
index 1bb97f7..0000000
--- a/netforce_clinic/layouts/clinic_cycle_daily_form.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
diff --git a/netforce_clinic/layouts/clinic_cycle_daily_list.xml b/netforce_clinic/layouts/clinic_cycle_daily_list.xml
deleted file mode 100644
index 51127b5..0000000
--- a/netforce_clinic/layouts/clinic_cycle_daily_list.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/netforce_clinic/layouts/clinic_cycle_item_form.xml b/netforce_clinic/layouts/clinic_cycle_item_form.xml
index a55db67..df84332 100644
--- a/netforce_clinic/layouts/clinic_cycle_item_form.xml
+++ b/netforce_clinic/layouts/clinic_cycle_item_form.xml
@@ -16,7 +16,7 @@
-
+
diff --git a/netforce_clinic/layouts/clinic_cycle_monthly_form.xml b/netforce_clinic/layouts/clinic_cycle_monthly_form.xml
deleted file mode 100644
index f987de1..0000000
--- a/netforce_clinic/layouts/clinic_cycle_monthly_form.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
diff --git a/netforce_clinic/layouts/clinic_cycle_monthly_list.xml b/netforce_clinic/layouts/clinic_cycle_monthly_list.xml
deleted file mode 100644
index ef6acec..0000000
--- a/netforce_clinic/layouts/clinic_cycle_monthly_list.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/netforce_clinic/layouts/clinic_schedule_calendar.xml b/netforce_clinic/layouts/clinic_schedule_calendar.xml
index be3ed6f..ef4a9a1 100644
--- a/netforce_clinic/layouts/clinic_schedule_calendar.xml
+++ b/netforce_clinic/layouts/clinic_schedule_calendar.xml
@@ -3,5 +3,7 @@
+
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index c34efbb..fd11d04 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -1,5 +1,6 @@
from . import utils
from . import setting
+from . import fin_setting
from . import setting_product
from . import setting_level
from . import setting_policy
@@ -33,17 +34,10 @@ from . import hd_case_dialyzer
from . import dialyzer
from . import cycle
from . import cycle_item
-from . import cycle_item_nurse
-from . import cycle_item_other
from . import cycle_item_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 gen_visit_time
-from . import fin_setting
from . import payment
from . import account_payment
from . import account_invoice
@@ -76,6 +70,7 @@ from . import import_product
from . import import_patient
from . import import_visit
from . import import_hd_case
+from . import import_uc
from . import vascular_access
from . import hospital
from . import labor_cost
@@ -86,7 +81,6 @@ from . import labor_cost_entry
from . import labor_cost_entry_line
from . import sickbed
from . import product_categ
-from . import import_uc
from . import make_apt
from . import make_apt_line
from . import matching_payment
diff --git a/netforce_clinic/models/cycle_daily.py b/netforce_clinic/models/cycle_daily.py
deleted file mode 100644
index 1cabe78..0000000
--- a/netforce_clinic/models/cycle_daily.py
+++ /dev/null
@@ -1,194 +0,0 @@
-import time
-
-from netforce.model import Model, fields, get_model
-from netforce.access import get_active_company, get_active_user
-from netforce.utils import get_data_path
-
-class CycleDaily(Model):
- _name="clinic.cycle.daily"
- _string="Cycle Daily"
-
- 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"),
- 'date': fields.Date("Date", required=True, search=True),
- 'cycle_items': fields.One2Many("clinic.cycle.item","cycle_daily_id", "Cycle Items"),
- 'cycle_monthly_id': fields.Many2One("clinic.cycle.monthly","Monthly"),
- '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"),
- }
-
- _defaults={
- 'company_id': lambda *a: get_active_company(),
- 'date': 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('date','')
- if date:
- vals['name']=date
- super().write(ids,vals,**kw)
-
- def confirm(self,ids,context={}):
- obj=self.browse(ids)[0]
- obj.write({
- 'state': 'confirmed',
- })
- all_vals={}
- for line in obj.lines:
- staff=line.staff_id
- level=line.level_id
- amt=line.amount or 0.0
- qty=line.qty or 0
- if not all_vals.get(staff.id):
- all_vals[staff.id]={
- 'level_id': level.id,
- 'type': line.type,
- 'qty': 0,
- 'amount': 0,
- }
- all_vals[staff.id]['amount']+=amt
- all_vals[staff.id]['qty']+=qty
- lines=[]
- for staff_id, vals in all_vals.items():
- vals.update({'staff_id': staff_id})
- lines.append(('create',vals))
-
- mname=obj.date[0:7].replace("-","/")
- mobj=get_model("clinic.cycle.monthly")
- res=mobj.search_browse([['name','=',mname]])
- mid=None
- monthly=None
- if res:
- mid=res[0]['id']
- monthly=mobj.browse(mid)
- # find other cycle daily and summary salary of staff
- for daily in monthly.cycle_dailies:
- # don't include amount the same date
- if daily.date==obj.date:
- continue
- for line in daily.lines:
- amt=line.amount or 0.0
- qty=line.qty or 0
- staff=line.staff_id
- vals=all_vals.get(staff.id,None)
- if vals:
- vals['amount']+=amt
-
- lines=[]
- for staff_id, vals in all_vals.items():
- vals.update({'staff_id': staff_id})
- lines.append(('create',vals))
-
- # update staff amount
- staff_ids=all_vals.keys()
- for line in monthly.lines:
- staff=line.staff_id
- if staff.id in staff_ids:
- line.delete()
-
- monthly.write({
- 'lines': lines,
- })
- else:
- mid=mobj.create({
- 'name': mname,
- 'lines': lines,
- })
- monthly=mobj.browse(mid)
- if not monthly:
- return
-
- obj.write({
- 'cycle_monthly_id': mid,
- })
-
- return {
- 'next': {
- 'name': 'clinic_cycle_monthly',
- 'mode': 'form',
- 'active_id': monthly.id,
- },
- 'flash':'Cycle %s has been confirmed and %s has been updated'%(obj.name,monthly.name)
- }
-
- def recheck_item(self,ids,context={}):
- # copy cost of nurse and doctor from cycle item
- obj=self.browse(ids)[0]
- lines=[]
- ctx=context.copy()
- context['called']=True
- # sorted by sequence of cycle
- for cycle_item in sorted(obj.cycle_items, key=lambda x: x.cycle_id.sequence):
- lines+=cycle_item.validate(context=context)
- obj.write({
- 'lines': lines,
- })
- context=ctx
- return {
- 'next': {
- 'name': 'clinic_cycle_daily',
- 'mode': 'form',
- 'active_id': obj.id,
- },
- 'flash':'Recheck successfully',
- }
-
- def to_draft(self,ids,context={}):
- obj=self.browse(ids)[0]
- # remove journal entry
- obj.write({
- 'state': 'draft',
- })
- return {
- 'next': {
- 'name': 'clinic_cycle_daily',
- 'mode': 'form',
- 'active_id': obj.id,
- },
- 'flash':'Draft!',
- }
-
- 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
-
- def view_cycle_monthly(self,ids,context):
- obj=self.browse(ids)[0]
- monthly=obj.cycle_monthly_id
- return {
- 'next': {
- 'name': 'clinic_monthly',
- 'mode': 'form',
- 'active_id': monthly.id,
- },
- }
-
-CycleDaily.register()
diff --git a/netforce_clinic/models/cycle_daily_line.py b/netforce_clinic/models/cycle_daily_line.py
deleted file mode 100644
index a021e7b..0000000
--- a/netforce_clinic/models/cycle_daily_line.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from netforce.model import Model, fields
-from netforce.access import get_active_company
-
-class CycleDailyLine(Model):
- _name="clinic.cycle.daily.line"
- _string="Cycle Daily Line"
-
- _fields={
- "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"),
- '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),
- 'date': fields.Date("Date"),
- }
-
- _defaults={
- 'company_id': lambda *a: get_active_company(),
- }
-
-
-CycleDailyLine.register()
diff --git a/netforce_clinic/models/cycle_item.py b/netforce_clinic/models/cycle_item.py
index c988178..7314afe 100644
--- a/netforce_clinic/models/cycle_item.py
+++ b/netforce_clinic/models/cycle_item.py
@@ -28,24 +28,18 @@ class CycleItem(Model):
'name': fields.Char("Name",function="_get_all",function_multi=True,store=True),
'date': fields.Date("Date",search=True),
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",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"),
- 'nurses': fields.One2Many("clinic.cycle.item.nurse",'cycle_item_id','Nurses'),
- 'nurse_id': fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]),
+ 'lines': fields.One2Many("clinic.cycle.item.line",'cycle_item_id','Nurses'),
'sequence': fields.Char("Sequence",function="_get_all",function_multi=True,store=True),
- "state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True),
'user_id': fields.Many2One("base.user","Validator"),
- "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
'company_id': fields.Many2One("company", "Company"),
'branch_id': fields.Many2One("clinic.branch", "Branch"),
'department_id': fields.Many2One("clinic.department", "Department"),
+ "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
+ "state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True),
}
- def _get_vark(self,context={}):
- st=get_model("clinic.setting").browse(1)
- return st.var_k or 0
-
def _get_branch(self,context={}):
b_ids=get_model('clinic.branch').search([])
if b_ids:
@@ -58,10 +52,9 @@ class CycleItem(Model):
_defaults={
'state': 'draft',
- 'company_id': lambda *a: get_active_company(),
'date': lambda *a: time.strftime("%Y-%m-%d"),
'user_id': lambda *a: get_active_user(),
- 'var_k': _get_vark,
+ 'company_id': lambda *a: get_active_company(),
'branch_id': _get_branch,
'department_id': _get_department,
}
@@ -70,25 +63,8 @@ class CycleItem(Model):
_sql_constraints=[
("cycle_item_uniq","unique (cycle_id,date,company_id,branch_id,department_id)","Cycle item should be unique"),
]
-
- def get_cycle_daily(self,date):
- dom=[]
- print("get ", date)
- dom.append(['date','=',date])
- 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.daily').create({
- 'date':date,
- 'name':date,
- })
- return cd_id
-
def create(self, vals,**kw):
- print('kw ', kw)
new_id=super().create(vals,**kw)
self.function_store([new_id])
return new_id
@@ -144,27 +120,40 @@ class CycleItem(Model):
def view_schedule(self,ids,context={}):
obj=self.browse(ids)[0]
+ company=obj.company_id
+ branch=obj.branch_id
+ department=obj.department_id
+ cycle=obj.cycle_id
date=obj.date
- schd_ids=get_model('clinic.schedule').search([['date','=',date]])
+ dom=[
+ ['date','=',date],
+ ['company_id','=',company.id],
+ ['branch_id','=',branch.id],
+ ['department_id','=',department.id],
+ ]
+ schd_ids=get_model('clinic.schedule').search(dom)
schedule_id=None
if schd_ids:
schedule_id=schd_ids[0]
if not schedule_id:
lines=[]
- for lnurse in obj.nurses:
- nurse=lnurse.nurse_id
+ for line in obj.lines:
+ nurse=line.nurse_id
level=nurse.level_id
lines.append(('create',{
- 'cycle_id': obj.cycle_id.id,
+ 'cycle_id': cycle.id,
'cycle_item_id': obj.id,
'nurse_id': nurse.id,
'level_id': level.id ,
'note': '',
}))
schedule_id=get_model('clinic.schedule').create({
+ 'branch_id': branch.id,
+ 'department_id': department.id,
+ 'company_id': company.id,
'date': date,
- 'time_start': '%s 08:00:00'%date, #XXX
- 'time_stop': '%s 21:00:00'%date, #XXX
+ 'time_start': '%s %s'%(date,cycle.time_start),
+ 'time_stop': '%s %s'%(date,cycle.time_stop),
'lines': lines,
})
return {
@@ -174,18 +163,6 @@ class CycleItem(Model):
'active_id': schedule_id,
},
}
-
- def view_cycle_daily(self,ids,context={}):
- obj=self.browse(ids)[0]
- if not obj.cycle_daily_id:
- raise Exception("Please validate cycle item")
- return {
- 'next': {
- 'name': 'clinic_cycle_daily',
- 'mode': 'form',
- 'active_id': obj.cycle_daily_id.id,
- }
- }
def load_nurse_from_schedule(self,ids,context={}):
obj=self.browse(ids)[0]
diff --git a/netforce_clinic/models/cycle_item_line.py b/netforce_clinic/models/cycle_item_line.py
index d044d65..edafd6c 100644
--- a/netforce_clinic/models/cycle_item_line.py
+++ b/netforce_clinic/models/cycle_item_line.py
@@ -1,34 +1,13 @@
-from netforce.model import Model, fields, get_model
-from netforce.access import get_active_company
+from netforce.model import Model, fields
class CycleItemLine(Model):
_name="clinic.cycle.item.line"
- _string="Cycle Item Line"
+ _string="Cycle Item Nurse"
- def all_amount(self,ids,context={}):
- res={}
- for obj in self.browse(ids):
- res[obj.id]={
- 'amount': (obj.qty or 0)*(obj.rate or 0.0),
- }
- return res
-
_fields={
- 'item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
- 'level_id': fields.Many2One("clinic.staff.level", "Level",domain=[['type','=','nurse']]),
- 'qty': fields.Integer("Qty"),
- 'var_a': fields.Float("A"),
- 'var_b': fields.Float("B"),
- 'formular_org': fields.Char("FML1 (Setting)", size=100),
- 'formular': fields.Char("FML2", size=100),
- 'rate': fields.Float("Rate"),
- 'amount': fields.Float("Result",scale=2),
- 'company_id': fields.Many2One('company','Company'),
- "state": fields.Selection([["fail","Fail"],["success","Success"]],"Status",),
- }
-
- _defaults={
- "company_id": lambda *a: get_active_company(),
+ 'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
+ 'level_id': fields.Many2One("clinic.staff.level", "Level",),
+ 'nurse_id': fields.Many2One("clinic.staff",'Nurse',domain=[['type','=','nurse']]),
}
CycleItemLine.register()
diff --git a/netforce_clinic/models/cycle_item_nurse.py b/netforce_clinic/models/cycle_item_nurse.py
deleted file mode 100644
index 360a5c1..0000000
--- a/netforce_clinic/models/cycle_item_nurse.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from netforce.model import Model, fields, get_model
-from netforce.access import get_active_company
-
-class CycleItemNurse(Model):
- _name="clinic.cycle.item.nurse"
- _string="Cycle Item Nurse"
-
- _fields={
- 'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
- 'level_id': fields.Many2One("clinic.staff.level", "Level",),
- 'nurse_id': fields.Many2One("clinic.staff",'Nurse',domain=[['type','=','nurse']]),
- }
-
- _defaults={
- "company_id": lambda *a: get_active_company(),
- }
-
-CycleItemNurse.register()
diff --git a/netforce_clinic/models/cycle_item_other.py b/netforce_clinic/models/cycle_item_other.py
deleted file mode 100644
index 7d53c0d..0000000
--- a/netforce_clinic/models/cycle_item_other.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from netforce.model import Model, fields, get_model
-from netforce.access import get_active_company
-
-class CycleItemOther(Model):
- _name="clinic.cycle.item.other"
- _string="Cycle Item Other"
-
- _fields={
- 'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item",required=True),
- 'level_id': fields.Many2One("clinic.staff.level", "Level",),
- 'staff_id': fields.Many2One("clinic.staff",'Staff'),
- }
-
- _defaults={
- "company_id": lambda *a: get_active_company(),
- }
-
-CycleItemOther.register()
diff --git a/netforce_clinic/models/cycle_monthly.py b/netforce_clinic/models/cycle_monthly.py
deleted file mode 100644
index 26d4aca..0000000
--- a/netforce_clinic/models/cycle_monthly.py
+++ /dev/null
@@ -1,109 +0,0 @@
-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"),
- 'cycle_dailies': fields.One2Many("clinic.cycle.daily","cycle_monthly_id", "Cycle Dialy"),
- '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(),
- 'name': lambda *a: time.strftime("%Y/%m"),
- '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
-
- def to_draft(self,ids,context={}):
- obj=self.browse(ids)[0]
- obj.write({
- 'state': 'draft',
- })
- return {
- 'next': {
- 'name': 'clinic_cycle_monthly',
- 'mode': 'form',
- 'active_id': obj.id,
- },
- 'flash': '%s has been set to draft'%obj.name
- }
-
-CycleMonthly.register()
diff --git a/netforce_clinic/models/cycle_monthly_line.py b/netforce_clinic/models/cycle_monthly_line.py
deleted file mode 100644
index 456ca15..0000000
--- a/netforce_clinic/models/cycle_monthly_line.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import time
-
-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"
-
- def _get_max_cycle(self,ids,context={}):
- res={}
- for obj in self.browse(ids):
- staff=obj.staff_id
- res[obj.id]=staff.max_cycle
- return res
-
- _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"),
- 'date': fields.Date("Date"),
- '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),
- 'max_cycle': fields.Float('Max Cycle',function="_get_max_cycle"),
- }
-
- _defaults={
- 'company_id': lambda *a: get_active_company(),
- 'date': lambda *a: time.strftime("%Y-%m-%d"),
- }
-
-
-CycleMonthlyLine.register()
diff --git a/netforce_clinic/models/schedule.py b/netforce_clinic/models/schedule.py
index 16511c0..7def79c 100644
--- a/netforce_clinic/models/schedule.py
+++ b/netforce_clinic/models/schedule.py
@@ -179,12 +179,12 @@ class Schedule(Model):
})
cycles.update({cycle.name})
- for item_id, nurses in items.items():
+ for item_id, lines in items.items():
item=get_model("clinic.cycle.item").browse(item_id)
- for nurse in item.nurses:
- nurse.delete()
+ for line in item.lines:
+ line.delete()
item.write({
- 'nurses': nurses,
+ 'lines': lines,
})
cycles=list(reversed(list(cycles)))
diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py
index 38561e7..1521711 100644
--- a/netforce_clinic/models/setting.py
+++ b/netforce_clinic/models/setting.py
@@ -93,15 +93,29 @@ class ClinicSetting(Model):
def run_script(self,ids,context={}):
obj=self.browse(ids)[0]
#sickbed: update department
- for sb in get_model('clinic.sickbed').search_browse([]):
- hdcs=sorted(sb.hd_cases, key=lambda a: a.id)
- if hdcs:
- hdc=hdcs[0]
- #patient=hdc.patient_id
- sb.write({
- 'department_id': hdc.department_id.id,
- })
+ #for sb in get_model('clinic.sickbed').search_browse([]):
+ #hdcs=sorted(sb.hd_cases, key=lambda a: a.id)
+ #if hdcs:
+ #hdc=hdcs[0]
+ ##patient=hdc.patient_id
+ #sb.write({
+ #'department_id': hdc.department_id.id,
+ #})
# create new cycle item
+ # TODO
+ # copy old schedule
+ # copy old nurse to schedule
+ # delete old cycle item
+ # confirm schedule
+ # set visit & hd case to cycle item
+ old_schd=[]
+ for schd in get_model("clinic.schedule").search_browse([]):
+ if schd.lines:
+ print("x")
+ pass
+ for citem in get_model("clinic.cycle.item").search_browse([]):
+ if citem.lines:
+ print("y")
print("Done!")
def reset_last_import(self,ids,context={}):
diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py
index c541ab2..d43fa4b 100644
--- a/netforce_clinic/models/staff.py
+++ b/netforce_clinic/models/staff.py
@@ -62,7 +62,7 @@ class Staff(Model):
if obj.type=='doctor':
hids=get_model("clinic.hd.case.staff").search([['staff_id','=',obj.id]])
elif obj.type=='nurse':
- item_ids=[item['cycle_item_id'][0] for item in get_model("clinic.cycle.item.nurse").search_read([['nurse_id','=',obj.id]],['cycle_item_id'])]
+ item_ids=[item['cycle_item_id'][0] for item in get_model("clinic.cycle.item.line").search_read([['nurse_id','=',obj.id]],['cycle_item_id'])]
for item in get_model("clinic.cycle.item").browse(item_ids):
for hdcase in item.hd_cases:
hids.append(hdcase.id)
@@ -115,7 +115,7 @@ class Staff(Model):
'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"),
"hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"),
"hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"), # not need to use (it's slow to load)
- "cycle_item_nurses": fields.One2Many("clinic.cycle.item.nurse","nurse_id","Cycle Items"),
+ "cycle_item_nurses": fields.One2Many("clinic.cycle.item.line","nurse_id","Cycle Items"),
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
}
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index dfcf121..c7b6bf0 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,4 +1,8 @@
todo:
+ - XXXX
+ - make a script to generate cycle item
+ - accounting
+
- filter data
1. company
2. branch
@@ -10,18 +14,18 @@ todo:
- script
- after split department
- cycle item should be see only that department
-
- accounting
- doctor detail
- import match hn
-
- visit summary -> ok
+
- calendar
- search calendar
- remove
- multi company
- running number for each branch
-
+ - make an appoitment
+ -
=======
generate visit ใหม่ -> ok
popup select dyalyzer -> ok