add branch

conv_bal
watcha.h@almacom.co.th 2015-01-14 18:00:14 +07:00
parent 35ca91bde5
commit d1a45db132
18 changed files with 52 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<form model="clinic.branch" show_company="1"> <form model="clinic.branch" show_company="1">
<field name="name"/> <field name="name"/>
<field name="parent_id"/> <field name="parent_id"/>
<field name="company_id" invisible="1"/> <field name="company_id"/>
</form> </form>

View File

@ -1,4 +1,5 @@
<list model="clinic.branch"> <list model="clinic.branch">
<field name="name"/> <field name="name"/>
<field name="parent_id"/> <field name="parent_id"/>
<field name="company_id"/>
</list> </list>

View File

@ -10,7 +10,7 @@
<field name="color"/> <field name="color"/>
<field name="duration"/> <field name="duration"/>
<field name="note"/> <field name="note"/>
<field name="company_id" invisible="1"/> <!--<field name="company_id" invisible="1"/>-->
<related> <related>
<field name="cycle_items"/> <field name="cycle_items"/>
<field name="visits"/> <field name="visits"/>

View File

@ -15,6 +15,7 @@
<field name="department_id" span="2"/> <field name="department_id" span="2"/>
<field name="cycle_item_id" span="2" domain="[['cycle_id','=',cycle_id]]"/> <field name="cycle_item_id" span="2" domain="[['cycle_id','=',cycle_id]]"/>
<field name="visit_id" span="2"/> <field name="visit_id" span="2"/>
<field name="branch_id" span="2"/>
<field name="req_fee" span="2" invisible="1"/> <field name="req_fee" span="2" invisible="1"/>
<field name="company_id" span="2" invisible="1"/> <!-- to show company name, don't remove --> <field name="company_id" span="2" invisible="1"/> <!-- to show company name, don't remove -->
<field name="hct_include" span="2" invisible="1"/> <field name="hct_include" span="2" invisible="1"/>

View File

@ -51,7 +51,7 @@
<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/> <item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>
</item> </item>
<item string="Settings" perm="clinic_settings"> <item string="Settings" perm="clinic_settings">
<!--<item string="Branches" action="clinic_branch"/>--> <item string="Branches" action="clinic_branch"/>
<item string="Departments" action="clinic_department"/> <item string="Departments" action="clinic_department"/>
<item string="Hospitals" action="clinic_hospital"/> <item string="Hospitals" action="clinic_hospital"/>
<item string="Nationalities" action="clinic_nation"/> <item string="Nationalities" action="clinic_nation"/>

View File

@ -17,6 +17,7 @@
<field name="categ_id"/> <field name="categ_id"/>
<field name="doctor_id"/> <field name="doctor_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="branch_id"/>
<tabs> <tabs>
<tab string="General Information"> <tab string="General Information">
<group span="6" columns="1"> <group span="6" columns="1">

View File

@ -6,7 +6,7 @@
<field name="number"/> <field name="number"/>
<field name="trt_no"/> <field name="trt_no"/>
<field name="name"/> <field name="name"/>
<field name="company_id"/> <field name="branch_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="categ_id"/> <field name="categ_id"/>
<field name="type_id"/> <field name="type_id"/>

View File

@ -8,6 +8,7 @@
<field name="name"/> <field name="name"/>
<field name="available"/> <field name="available"/>
<field name="sequence"/> <field name="sequence"/>
<field name="branch_id"/>
<field name="note"/> <field name="note"/>
<field name="company_id" invisible="1"/> <field name="company_id" invisible="1"/>
<related> <related>

View File

@ -11,6 +11,7 @@
<field name="name_eng"/> <field name="name_eng"/>
<field name="nick_name"/> <field name="nick_name"/>
<field name="department_id"/> <field name="department_id"/>
<field name="company_id" invisible="1"/>
<tabs> <tabs>
<tab string="General"> <tab string="General">
<group span="6" columns="1"> <group span="6" columns="1">
@ -21,7 +22,7 @@
<field name="nation_id"/> <field name="nation_id"/>
<field name="categ_id" domain="[['type','=',type]]"/> <field name="categ_id" domain="[['type','=',type]]"/>
<field name="state"/> <field name="state"/>
<field name="company_id"/> <field name="branch_id"/>
</group> </group>
<group span="6" columns="1"> <group span="6" columns="1">
<field name="image"/> <field name="image"/>

View File

@ -9,7 +9,7 @@
</top> </top>
<field name="number"/> <field name="number"/>
<field name="name"/> <field name="name"/>
<field name="company_id"/> <field name="branch_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="level_id"/> <field name="level_id"/>
<field name="categ_id"/> <field name="categ_id"/>

View File

@ -15,6 +15,7 @@
<field name="time_start" onchange="onchange_datefrom"/> <field name="time_start" onchange="onchange_datefrom"/>
<field name="cycle_id" onchange="onchange_cycle" required="1"/> <field name="cycle_id" onchange="onchange_cycle" required="1"/>
<field name="department_id"/> <field name="department_id"/>
<field name="branch_id"/>
</group> </group>
<group span="6" columns="1"> <group span="6" columns="1">
<field name="patient_id" onchange="onchange_patient"/> <field name="patient_id" onchange="onchange_patient"/>

View File

@ -7,7 +7,7 @@ class Cycle(Model):
_name="clinic.cycle" _name="clinic.cycle"
_string="Cycle" _string="Cycle"
_key=["name"] _key=["name"]
_multi_company=True #_multi_company=True
def _get_duration(self,ids,context={}): def _get_duration(self,ids,context={}):
res={} res={}

View File

@ -125,6 +125,7 @@ class HDCase(Model):
'req_fee': fields.Integer("Request Expense"), 'req_fee': fields.Integer("Request Expense"),
'hd_case_id': fields.Many2One("clinic.hd.case","HD",function="_get_all",function_multi=True), # XXX 'hd_case_id': fields.Many2One("clinic.hd.case","HD",function="_get_all",function_multi=True), # XXX
'company_id': fields.Many2One("company","Company"), 'company_id': fields.Many2One("company","Company"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -209,6 +210,7 @@ class HDCase(Model):
if patient_id: if patient_id:
patient=get_model('clinic.patient').browse(patient_id) patient=get_model('clinic.patient').browse(patient_id)
department=patient.department_id department=patient.department_id
branch=patient.branch_id
cycle=patient.cycle_id cycle=patient.cycle_id
partner=patient.type_id.contact_id partner=patient.type_id.contact_id
if partner: if partner:
@ -216,6 +218,7 @@ class HDCase(Model):
else: else:
data['fee_partner_id']=None data['fee_partner_id']=None
data['department_id']=department.id data['department_id']=department.id
data['branch_id']=branch.id
data['cycle_id']=cycle.id data['cycle_id']=cycle.id
data['patient_type_id']=patient.type_id.id data['patient_type_id']=patient.type_id.id
if patient.type_id.hct_include: if patient.type_id.hct_include:

View File

@ -100,6 +100,7 @@ class Patient(Model):
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"), 'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
'department_id': fields.Many2One("clinic.department","Department"), 'department_id': fields.Many2One("clinic.department","Department"),
'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"), 'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):

View File

@ -1,5 +1,5 @@
from netforce.model import Model, fields, get_model from netforce.model import Model, fields, get_model
from netforce.access import get_active_company from netforce.access import get_active_company, get_active_user
class SickBed(Model): class SickBed(Model):
_name="clinic.sickbed" _name="clinic.sickbed"
@ -35,13 +35,25 @@ class SickBed(Model):
"state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"), "state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"),
'sequence': fields.Integer("Sequence"), 'sequence': fields.Integer("Sequence"),
'note': fields.Text("Note"), 'note': fields.Text("Note"),
'branch_id': fields.Many2One("clinic.branch","Branch",required=True, search=True),
} }
def _get_sickbed(self,context={}):
user_id=get_active_user()
staffs=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
branch_id=None
if staffs:
staff=staffs[0]
if staff.branch_id:
branch_id=staff.branch_id.id
return branch_id
_defaults={ _defaults={
'available': True, 'available': True,
"company_id": lambda *a: get_active_company(), "company_id": lambda *a: get_active_company(),
'sequence': 0, 'sequence': 0,
'state': 'available', 'state': 'available',
'branch_id': _get_sickbed,
} }
_order="sequence" _order="sequence"

View File

@ -116,6 +116,7 @@ class Staff(Model):
"hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"), "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) "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.nurse","nurse_id","Cycle Items"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):

View File

@ -51,6 +51,7 @@ class Visit(Model):
'visit_date': fields.Date('Visit Date'), 'visit_date': fields.Date('Visit Date'),
'cycle_color': fields.Char('Color',function="_get_all",function_multi=True,store=True), 'cycle_color': fields.Char('Color',function="_get_all",function_multi=True,store=True),
'note': fields.Text('Note'), 'note': fields.Text('Note'),
'branch_id': fields.Many2One("clinic.branch","Branch"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -163,6 +164,7 @@ class Visit(Model):
'time_stop': obj.time_stop, 'time_stop': obj.time_stop,
'cycle_id' : obj.cycle_id.id, 'cycle_id' : obj.cycle_id.id,
'visit_id': obj.id, 'visit_id': obj.id,
'branch_id': obj.branch_id.id,
'lines':[], 'lines':[],
'dialyzers': [], 'dialyzers': [],
'staffs': [], 'staffs': [],
@ -279,8 +281,15 @@ class Visit(Model):
elif patient.department_id: elif patient.department_id:
department_id=patient.department_id.id department_id=patient.department_id.id
branch_id=None
if visit.branch_id:
branch_id=visit.branch_id.id
elif patient.branch_id:
branch_id=patient.branch_id.id
print("branch_id ", branch_id)
data['doctor_id']=doctor.id data['doctor_id']=doctor.id
data['department_id']=department_id data['department_id']=department_id
data['branch_id']=branch_id
if not patient.doctor_id: if not patient.doctor_id:
patient.write({ patient.write({
@ -289,8 +298,10 @@ class Visit(Model):
else: else:
doctor=patient.doctor_id doctor=patient.doctor_id
department=patient.department_id department=patient.department_id
branch=patient.branch_id
data['doctor_id']=doctor.id data['doctor_id']=doctor.id
data['department_id']=department.id data['department_id']=department.id
data['branch_id']=branch.id
return data return data

View File

@ -1 +1,10 @@
onclick hd case on staff sharing setting
- filter by branch
- patient
- staff
- visit
- hd case
- cycle item
- sickbed
- add popup to new dialyser
- running number