invoice policy

conv_bal
watcha.h 2014-11-27 22:14:31 +07:00
parent 0660116ec9
commit 4687c318ee
25 changed files with 273 additions and 77 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Period</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.period</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -6,6 +6,7 @@
<item string="Compute Labor Cost" method="compute" states='draft'/> <item string="Compute Labor Cost" method="compute" states='draft'/>
<item string="View Schedule" method="view_schedule"/> <item string="View Schedule" method="view_schedule"/>
<item string="View Cycle Daily" method="view_cycle_daily"/> <item string="View Cycle Daily" method="view_cycle_daily"/>
<item string="To Draft" method="to_draft" states="done" />
</button> </button>
</head> </head>
@ -55,7 +56,6 @@
</tabs> </tabs>
<foot> <foot>
<button string="Validate" type="success" method="validate" icon="ok" states="draft" /> <button string="Validate" type="success" method="validate" icon="ok" states="draft" />
<button string="To Draft" type="default" method="to_draft" icon="repeat" states="done" />
</foot> </foot>
<related> <related>
<field name="hd_cases"/> <field name="hd_cases"/>

View File

@ -10,19 +10,15 @@
<field name="name"/> <field name="name"/>
<field name="lines" nolabel="1"> <field name="lines" nolabel="1">
<list> <list>
<field name="date"/>
<field name="staff_id"/> <field name="staff_id"/>
<field name="level_id"/> <field name="level_id"/>
<field name="type"/> <field name="type"/>
<field name="qty" onchange="onchange_line"/> <field name="amount" onchange="onchange_line"/>
<field name="amount"/>
</list> </list>
<form> <form>
<field name="date"/>
<field name="staff_id"/> <field name="staff_id"/>
<field name="level_id"/> <field name="level_id"/>
<field name="type"/> <field name="type"/>
<field name="qty"/>
<field name="amount"/> <field name="amount"/>
</form> </form>
</field> </field>

View File

@ -45,18 +45,21 @@
</field> </field>
</tab> </tab>
<tab string="Expenses"> <tab string="Expenses">
<field name="lines" count="3" nolabel="1"> <group span="12" form_layout="stacked">
<list> <field name="lines" count="3" nolabel="1">
<field name="type"/> <list>
<field name="product_id" onchange="onchange_product"/> <field name="type"/>
<field name="description"/> <field name="product_id" onchange="onchange_product"/>
<field name="qty" onchange="onchange_line"/> <field name="description"/>
<field name="uom_id"/> <field name="qty" onchange="onchange_line"/>
<field name="price" onchange="onchange_line"/> <field name="uom_id"/>
<field name="amount" onchange="onchange_line"/> <field name="price" onchange="onchange_line"/>
</list> <field name="amount" onchange="onchange_line"/>
</field> </list>
<group span="8" form_layout="stacked" attrs='{"invisible":[["amount","=",0]]}'> </field>
</group>
<group span="8" form_layout="stacked">
<field name="invoice_policy"/>
</group> </group>
<group span="4" columns="1"> <group span="4" columns="1">
<field name="total"/> <field name="total"/>

View File

@ -52,12 +52,12 @@
<header string="LABOR COST"/> <header string="LABOR COST"/>
<item string="Nurse Fee Summary" action="clinic_report_nurse_fee_sum"/> <item string="Nurse Fee Summary" action="clinic_report_nurse_fee_sum"/>
<item string="Nurse Fee Detail" action="clinic_report_nurse_fee_detail"/> <item string="Nurse Fee Detail" action="clinic_report_nurse_fee_detail"/>
<!--<item string="Special Nurse" action="clinic_report_nurse_special"/>-->
</item> </item>
<item string="Settings"> <item string="Settings">
<item string="Branch" action="clinic_branch"/> <item string="Branch" action="clinic_branch"/>
<item string="Departments" action="clinic_department"/> <item string="Departments" action="clinic_department"/>
<item string="Nationalities" action="clinic_nation"/> <item string="Nationalities" action="clinic_nation"/>
<item string="Period" action="clinic_period"/>
<item string="Clinic Settings" action="clinic_setting"/> <item string="Clinic Settings" action="clinic_setting"/>
</item> </item>
</menu> </menu>

View File

@ -0,0 +1,22 @@
<form model="clinic.period">
<head>
<button string="Options" dropdown="1">
<item string="Copy" method="copy"/>
</button>
</head>
<group form_layout="stacked">
<field name="name" span="3"/>
<field name="date_start" span="3"/>
<field name="duration" span="3"/>
<field name="nmonth" span="3"/>
<field name="lines" nolabel="1">
<list>
<field name="date_start"/>
<field name="date_stop"/>
</list>
</field>
</group>
<foot>
<button string="Generate" type="default" icon="arrow-right" method="gen_period"/>
</foot>
</form>

View File

@ -0,0 +1,3 @@
<list model="clinic.period">
<field name="name"/>
</list>

View File

@ -1,6 +1,7 @@
<form model="clinic.setting" title="Clinic Settings"> <form model="clinic.setting" title="Clinic Settings">
<tabs> <tabs>
<tab string="HD Case"> <tab string="HD Case">
<separator string="Expenes"/>
<field name="products" nolabel="1"> <field name="products" nolabel="1">
<list> <list>
<field name="patient_type"/> <field name="patient_type"/>
@ -8,7 +9,8 @@
<field name="product_id" onchange="onchange_product"/> <field name="product_id" onchange="onchange_product"/>
<field name="description"/> <field name="description"/>
<field name="uom_id"/> <field name="uom_id"/>
<field name="qty" onchange="onchange_product"/> <field name="price" onchange="onchange_setting_line"/>
<field name="qty" onchange="onchange_setting_line"/>
<field name="amount"/> <field name="amount"/>
</list> </list>
<form> <form>
@ -17,10 +19,22 @@
<field name="product_id"/> <field name="product_id"/>
<field name="description"/> <field name="description"/>
<field name="uom_id"/> <field name="uom_id"/>
<field name="price"/>
<field name="qty"/> <field name="qty"/>
<field name="amount"/> <field name="amount"/>
</form> </form>
</field> </field>
<separator string="Invoice Policy"/>
<field name="invoice_policies" nolabel="1">
<list>
<field name="patient_type"/>
<field name="invoice_policy"/>
</list>
<form>
<field name="patient_type"/>
<field name="invoice_policy"/>
</form>
</field>
</tab> </tab>
<tab string="Labor Cost"> <tab string="Labor Cost">
<separator string="Nurse"/> <separator string="Nurse"/>
@ -44,17 +58,22 @@
<separator string="Doctor"/> <separator string="Doctor"/>
<field name="cost_per_case"/> <field name="cost_per_case"/>
</tab> </tab>
<!--<tab string="Testing">--> <tab string="Period">
<!--<group form_layout="stacked">--> <field name="period_id"/>
<!--<field name="file" span="3"/>--> </tab>
<!--<newline/>-->
<!--<button string="Make Visit" method="make_visit" span="2"/>--> <tab string="Import Testing">
<!--<newline/>--> <group form_layout="stacked">
<!--<button string="Make HD Case" method="make_done" span="2"/>--> <field name="file" span="3"/>
<!--<newline/>--> <newline/>
<!--<button string="Complete HD Case" method="make_complete" span="2"/>--> <button string="Make Visit" method="make_visit" span="2"/>
<!--</group>--> <newline/>
<!--</tab>--> <button string="Make HD Case" method="make_done" span="2"/>
<newline/>
<button string="Complete HD Case" method="make_complete" span="2"/>
</group>
</tab>
</tabs> </tabs>
<foot> <foot>
</foot> </foot>

View File

@ -42,6 +42,7 @@
<field name="cycle_id"/> <field name="cycle_id"/>
<field name="wage"/> <field name="wage"/>
<field name="max_cycle"/> <field name="max_cycle"/>
<field name="check_max_cycle"/>
</tab> </tab>
<tab string="Note"> <tab string="Note">
<field name="note" nolabel="1"/> <field name="note" nolabel="1"/>

View File

@ -2,6 +2,7 @@ from . import utils
from . import setting from . import setting
from . import setting_product from . import setting_product
from . import setting_level from . import setting_level
from . import setting_policy
from . import cause_chronic from . import cause_chronic
from . import comorbidity from . import comorbidity
from . import department from . import department
@ -63,3 +64,5 @@ from . import report_discontinue_patient
from . import report_nurse_fee_sum from . import report_nurse_fee_sum
from . import report_nurse_fee_detail from . import report_nurse_fee_detail
from . import branch from . import branch
from . import period
from . import period_line

View File

@ -3,7 +3,6 @@ import time
from netforce.model import Model, fields, get_model from netforce.model import Model, fields, get_model
from netforce.access import get_active_company, get_active_user from netforce.access import get_active_company, get_active_user
from netforce.utils import get_data_path from netforce.utils import get_data_path
from netforce.database import get_connection
class CycleDaily(Model): class CycleDaily(Model):
_name="clinic.cycle.daily" _name="clinic.cycle.daily"
@ -55,18 +54,17 @@ class CycleDaily(Model):
for line in obj.lines: for line in obj.lines:
staff=line.staff_id staff=line.staff_id
level=line.level_id level=line.level_id
qty=line.qty amt=line.amount or 0.0
amt=line.amount qty=line.qty or 0
if not all_vals.get(staff.id): if not all_vals.get(staff.id):
all_vals[staff.id]={ all_vals[staff.id]={
'level_id': level.id, 'level_id': level.id,
'type': line.type, 'type': line.type,
'date': obj.date,
'qty': 0, 'qty': 0,
'amount': 0, 'amount': 0,
} }
all_vals[staff.id]['qty']+=qty
all_vals[staff.id]['amount']+=amt all_vals[staff.id]['amount']+=amt
all_vals[staff.id]['qty']+=qty
lines=[] lines=[]
for staff_id, vals in all_vals.items(): for staff_id, vals in all_vals.items():
vals.update({'staff_id': staff_id}) vals.update({'staff_id': staff_id})
@ -80,9 +78,31 @@ class CycleDaily(Model):
if res: if res:
mid=res[0]['id'] mid=res[0]['id']
monthly=mobj.browse(mid) 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: for line in monthly.lines:
if line.date==obj.date: staff=line.staff_id
if staff.id in staff_ids:
line.delete() line.delete()
monthly.write({ monthly.write({
'lines': lines, 'lines': lines,
}) })

View File

@ -118,18 +118,31 @@ class CycleItem(Model):
levels={} levels={}
for line in obj.lines: for line in obj.lines:
level=line.level_id level=line.level_id
levels[level.id]=line.amount or 0 levels[level.id]={
'amount': line.amount or 0,
'qty': line.qty,
'level_id': level.id,
}
lines=[] lines=[]
# cost's nurses # cost's nurses
for nr in obj.nurses: for nr in obj.nurses:
nurse=nr.nurse_id nurse=nr.nurse_id
level=nr.level_id level=nr.level_id
vals=levels.get(level.id)
rate,amt,qty=0.0,0.0,0
level_id=level.id
if vals:
level_id=vals['level_id']
amt=vals['amount']
qty=vals['qty']
if qty:
rate=amt/qty
lines.append(('create',{ lines.append(('create',{
'cycle_id': obj.cycle_id.id, 'cycle_id': obj.cycle_id.id,
'staff_id': nurse.id, 'staff_id': nurse.id,
'level_id': nurse.level_id.id, 'level_id': level_id,
'rate': levels.get(level.id, 0.0), 'rate': rate,
'type': 'nurse', 'type': 'nurse',
'qty': 1, 'qty': 1,
})) }))

View File

@ -7,6 +7,13 @@ class CycleMonthlyLine(Model):
_name="clinic.cycle.monthly.line" _name="clinic.cycle.monthly.line"
_string="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={ _fields={
"cycle_monthly_id": fields.Many2One("clinic.cycle.monthly","Cycle Monthly"), "cycle_monthly_id": fields.Many2One("clinic.cycle.monthly","Cycle Monthly"),
'staff_id': fields.Many2One("clinic.staff", "Staff"), 'staff_id': fields.Many2One("clinic.staff", "Staff"),
@ -17,6 +24,7 @@ class CycleMonthlyLine(Model):
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),
'company_id': fields.Many2One("company","Company"), 'company_id': fields.Many2One("company","Company"),
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True), "type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True),
'max_cycle': fields.Float('Max Cycle',function="_get_max_cycle"),
} }
_defaults={ _defaults={

View File

@ -79,6 +79,7 @@ class HDCase(Model):
"total_nurse": fields.Integer("Total Nurse",function="get_staff",function_multi=True), "total_nurse": fields.Integer("Total Nurse",function="get_staff",function_multi=True),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']],function="get_staff",function_multi=True), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']],function="get_staff",function_multi=True),
'nu': fields.Char("N/U"), 'nu': fields.Char("N/U"),
"invoice_policy": fields.Selection([("fee","Only fee"),("fee_med","Fee & Medicine")],"Invoice Policy"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -711,13 +712,19 @@ class HDCase(Model):
for st_prod in st.products: for st_prod in st.products:
if patient.type==st_prod.patient_type: if patient.type==st_prod.patient_type:
prod=st_prod.product_id prod=st_prod.product_id
price=st_prod.price
qty=st_prod.qty
amt=st_prod.amount
if not amt:
amt=qty*price
vals['lines'].append(('create',{ vals['lines'].append(('create',{
'product_id': prod.id, 'product_id': prod.id,
'uom_id': st_prod.uom_id.id, 'uom_id': st_prod.uom_id.id,
'type': st_prod.type, 'type': st_prod.type,
'description': st_prod.description, 'description': st_prod.description,
'qty': st_prod.qty, 'price': price,
'amount': st_prod.amount, 'qty': qty,
'amount': amt,
})) }))
categ_name=utils.PATIENT_TYPE.get(patient.type) categ_name=utils.PATIENT_TYPE.get(patient.type)

View File

@ -10,7 +10,7 @@ class Hdcaseline(Model):
"uom_id": fields.Many2One("uom","UOM",required=True,search=True), "uom_id": fields.Many2One("uom","UOM",required=True,search=True),
"price":fields.Float("Price"), "price":fields.Float("Price"),
"amount":fields.Float("Amount"), "amount":fields.Float("Amount"),
"type": fields.Selection([("fee","Fee"),("others","Others")],"Type",required=True), "type": fields.Selection([("fee","Fee"),('medicine','Medicine'),("others","Others")],"Type",required=True),
} }
_defaults={ _defaults={

View File

@ -232,7 +232,7 @@ class Patient(Model):
'partner_id': partner_id, 'partner_id': partner_id,
}) })
del vals['addresses'] del vals['addresses']
print("create address for %s"%obj.name, ' ', addr_vals) print("create address for %s"%obj.name, ' ', addr_vals)
if obj.rm_remain_visit: if obj.rm_remain_visit:
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']]) visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']])

View File

@ -0,0 +1,50 @@
from datetime import datetime, timedelta
import time
from netforce.model import Model, fields
class Period(Model):
_name="clinic.period"
_string="Period"
_fields={
"name": fields.Char("Name",required=True,search=True),
'date_start': fields.Date("Start Date",required=True),
'duration': fields.Integer("Day in Period",required=True),
'nmonth': fields.Integer("Number of Month",required=True),
'lines': fields.One2Many("clinic.period.line","period_id", "Lines"),
}
def _get_start(self,context={}):
year=time.strftime("%Y")
return '%s-01-01'%year
_defaults={
'name': lambda *a: time.strftime("%Y"),
'date_start': _get_start,
'duration': 30,
'nmonth': 12,
}
def gen_period(self,ids,context={}):
obj=self.browse(ids)[0]
for line in obj.lines:
line.delete()
fmt="%Y-%m-%d"
start=obj.date_start
lines=[]
for i in range(obj.nmonth):
start=datetime.strptime(start,fmt)
stop=start+timedelta(days=obj.duration)
lines.append(('create',{
'date_start': start.strftime(fmt),
'date_stop': stop.strftime(fmt),
}))
print(i+1, ' ', start.strftime(fmt), ' ', stop.strftime(fmt))
stop=stop+timedelta(days=1)
start=stop.strftime(fmt)
obj.write({
'lines': lines,
})
Period.register()

View File

@ -0,0 +1,20 @@
from netforce.model import Model, fields
class PeriodLine(Model):
_name="clinic.period.line"
_string="Period Line"
_fields={
"period_id": fields.Many2One("clinic.period", "Period"),
#'date_start': fields.Date("Date Start"),
#'date_stop': fields.Date("Date Stop"),
'date_start': fields.Char("Date Start"),
'date_stop': fields.Char("Date Stop"),
'state': fields.Selection([['draft','Draft'],['done','Done']],"State"),
}
_defaults={
'state': 'draft',
}
PeriodLine.register()

View File

@ -79,9 +79,11 @@ class ReportNurseFeeSum(Model):
if nurse_id: if nurse_id:
if nurse_id!=nurse.id: if nurse_id!=nurse.id:
continue continue
#level=nurse.level_id
#level_name=level and level.name or ""
line={ line={
'nurse_id': nurse.id, 'nurse_id': nurse.id,
'nurse_name': nurse.name or '', 'nurse_name': '%s'%(nurse.name),
'sub_lines': [], 'sub_lines': [],
} }
total_amt=0.0 total_amt=0.0

View File

@ -16,8 +16,10 @@ class ClinicSetting(Model):
'file': fields.File("File"), 'file': fields.File("File"),
'levels': fields.One2Many("clinic.setting.level","setting_id","Levels"), 'levels': fields.One2Many("clinic.setting.level","setting_id","Levels"),
'products': fields.One2Many("clinic.setting.product","setting_id","Products"), 'products': fields.One2Many("clinic.setting.product","setting_id","Products"),
'invoice_policies': fields.One2Many("clinic.setting.policy","setting_id","Invoice Policies"),
'cost_per_case': fields.Float("Cost Per Case"), 'cost_per_case': fields.Float("Cost Per Case"),
'company_id': fields.Many2One("company", 'Company'), 'company_id': fields.Many2One("company", 'Company'),
'period_id': fields.Many2One("clinic.period","Period"),
} }
_defaults={ _defaults={
@ -160,7 +162,6 @@ class ClinicSetting(Model):
# prevent timeout # prevent timeout
if count > 10: if count > 10:
break break
#print(date)
visit=get_visit(date=date,state='draft') visit=get_visit(date=date,state='draft')
print(date, ' ', visit) print(date, ' ', visit)
if visit: if visit:
@ -170,35 +171,9 @@ class ClinicSetting(Model):
#allow37=line['allow37'] #allow37=line['allow37']
hct=line.get('hct') hct=line.get('hct')
medical=line.get('medical') or line.get("eponame") or "" medical=line.get('medical') or line.get("eponame") or ""
medical_cost=line.get('medical_cost') or line.get('allow37') or 0.0
inject_service=line.get('inject_service') or line.get("epoadm29") or ""
vals={ vals={
'hct': hct and hct or 0, 'hct': hct and hct or 0,
'lines': [],
} }
if medical:
prods=get_model("product").search_browse([['name','=',medical]])
if prods:
prod=prods[0]
vals['lines'].append(('create',{
'type': 'other',
'product_id': prod.id,
'description': prod.name,
'uom_id': prod.uom_id.id,
'qty': 1,
'price': medical_cost,
'amount': medical_cost,
}))
if inject_service:
vals['lines'].append(('create',{
'type': 'other',
'product_id': 55, #XXX
'description': prod.name,
'uom_id': prod.uom_id.id,
'qty': 1,
'price': medical_cost,
'amount': medical_cost,
}))
hd_case=get_model("clinic.hd.case").browse(hd_case_id) hd_case=get_model("clinic.hd.case").browse(hd_case_id)
hd_case.write(vals) hd_case.write(vals)
count+=1 count+=1
@ -235,7 +210,6 @@ class ClinicSetting(Model):
inject_service=line.get('inject_service') or line.get("EPOadm29") or "" inject_service=line.get('inject_service') or line.get("EPOadm29") or ""
vals={ vals={
'hct': hct and hct or 0, 'hct': hct and hct or 0,
'lines': [],
} }
if medical: if medical:
prods=get_model("product").search_browse([['name','=',medical]]) prods=get_model("product").search_browse([['name','=',medical]])
@ -304,9 +278,21 @@ class ClinicSetting(Model):
raise Exception("Not found uom 'Unit'") raise Exception("Not found uom 'Unit'")
line['uom_id']=uom.id line['uom_id']=uom.id
line['description']=prod.name line['description']=prod.name
price=prod.sale_price or 0.0
line['price']=price
qty=line['qty'] or 0 qty=line['qty'] or 0
amt=qty*(prod.sale_price or 0.0) amt=qty*price
line['amount']=amt line['amount']=amt
return data return data
def onchange_setting_line(self,context={}):
data=context['data']
path=context['path']
line=get_data_path(data,path,parent=True)
qty=line['qty'] or 0
price=line['price'] or 0
amt=qty*price
line['amount']=amt
return data
ClinicSetting.register() ClinicSetting.register()

View File

@ -0,0 +1,13 @@
from netforce.model import Model, fields, get_model
class SettingPolicy(Model):
_name="clinic.setting.policy"
_string="Setting Policy"
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting"),
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Type",required=True),
"invoice_policy": fields.Selection([("fee","Only fee"),("fee_med","Fee & Medicine")],"Invoice Policy"),
}
SettingPolicy.register()

View File

@ -6,11 +6,12 @@ class SettingProduct(Model):
_fields={ _fields={
"setting_id": fields.Many2One("clinic.setting","Setting"), "setting_id": fields.Many2One("clinic.setting","Setting"),
"type": fields.Selection([("fee","Fee"),("others","Others")],"Type",required=True), "type": fields.Selection([("fee","Fee"),('medicine','Medicine'),("others","Others")],"Type",required=True),
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Patient Type",required=True), "patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Patient Type",required=True),
'uom_id': fields.Many2One("uom","UOM", required=True), 'uom_id': fields.Many2One("uom","UOM", required=True),
"product_id": fields.Many2One("product","Product"), "product_id": fields.Many2One("product","Product"),
'description': fields.Char("Description"), 'description': fields.Char("Description"),
'price': fields.Float("Price"),
'qty': fields.Integer("Qty"), 'qty': fields.Integer("Qty"),
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),
} }

View File

@ -92,6 +92,7 @@ class Staff(Model):
'date': fields.Date("Register Date"), 'date': fields.Date("Register Date"),
'wage': fields.Float("Wage", function="_get_base",function_multi=True), 'wage': fields.Float("Wage", function="_get_base",function_multi=True),
'max_cycle': fields.Integer("Max Cycle", function="_get_base",function_multi=True), 'max_cycle': fields.Integer("Max Cycle", function="_get_base",function_multi=True),
'check_max_cycle': fields.Boolean("Check Max Cycle"),
'hire_date': fields.Date("Hire Date"), 'hire_date': fields.Date("Hire Date"),
'resign_date': fields.Date("Resign Date"), 'resign_date': fields.Date("Resign Date"),
"documents": fields.One2Many("document","related_id","Documents"), "documents": fields.One2Many("document","related_id","Documents"),

View File

@ -214,8 +214,13 @@ class Visit(Model):
visits=self.search_browse([['patient_id','=',patient_id]],order="number desc") visits=self.search_browse([['patient_id','=',patient_id]],order="number desc")
if visits: if visits:
visit=visits[0] visit=visits[0]
data['doctor_id']=visit.doctor_id.id doctor=visit.doctor_id
data['department_id']=visit.department_id.id department=visit.department_id
if not department:
patient=get_model("clinic.patient").browse(patient_id)
department=patient.department_id
data['doctor_id']=doctor.id
data['department_id']=department.id
else: else:
data['doctor_id']=None data['doctor_id']=None
data['department_id']=None data['department_id']=None

View File

@ -1,3 +1,20 @@
=====
first:
match payment
second:
record with period
- setting
- set current period
- master data
- period
- lines
date_from , date_to
- fee nurse sum report
- can select by period
- cycle daily
- confirm
- submit according period
====== ======
DROP TABLE clinic_cycle_dialy_line; DROP TABLE clinic_cycle_dialy_line;
drop table clinic_cycle_item_line; drop table clinic_cycle_item_line;