permission

conv_bal
watcha.h@almacom.co.th 2015-01-15 00:49:17 +07:00
parent 3ab94a7f6e
commit f8ebf4c30c
10 changed files with 56 additions and 34 deletions

View File

@ -3,6 +3,6 @@
<field name="code"/> <field name="code"/>
<field name="parent_id"/> <field name="parent_id"/>
<field name="pick_out_journal_id"/> <field name="pick_out_journal_id"/>
<field name="branch_id" required="1"/>
<field name="company_id" invisible="1"/> <field name="company_id" invisible="1"/>
<field name="branch_id" invisible="1"/>
</form> </form>

View File

@ -1,5 +1,6 @@
<list model="clinic.department"> <list model="clinic.department">
<field name="name"/> <field name="name"/>
<field name="code"/> <field name="code"/>
<field name="branch_id"/>
<field name="parent_id"/> <field name="parent_id"/>
</list> </list>

View File

@ -8,7 +8,8 @@
<field name="name"/> <field name="name"/>
<field name="branch_id"/> <field name="branch_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="categ_id"/> <!--<field name="categ_id"/>-->
<field name="doctor_id"/>
<field name="type_id"/> <field name="type_id"/>
<field name="image" preview='1'/> <field name="image" preview='1'/>
</list> </list>

View File

@ -25,21 +25,10 @@
</field> </field>
</group> </group>
</tab> </tab>
<!--
<tab string="Dialyzer">
<field name="stock_journal_id"/>
</tab>
<tab string="Schedule">
<separator string='Transfer nurses to cycle item'/>
<field name="schd_from"/>
<field name="schd_to"/>
<button string="Transfer" type="primary" icon="arrow-right" method="schd_confirm"/>
</tab>
<tab string="Testing"> <tab string="Testing">
<button string="Dummy" type="default" method="run_script"/> <button string="Dummy" type="default" method="run_script"/>
<button string="Reset Import" icon="repeat" type="default" method="reset_last_import"/> <!--<button string="Reset Import" icon="repeat" type="default" method="reset_last_import"/>-->
</tab> </tab>
-->
</tabs> </tabs>
<foot> <foot>
</foot> </foot>

View File

@ -8,9 +8,9 @@
<field name="number"/> <field name="number"/>
<field name="type" required="1"/> <field name="type" required="1"/>
<field name="name"/> <field name="name"/>
<field name="branch_id" required="1"/>
<field name="name_eng"/> <field name="name_eng"/>
<field name="nick_name"/> <field name="nick_name"/>
<field name="branch_id" required="1"/>
<field name="department_id"/> <field name="department_id"/>
<field name="company_id" invisible="1"/> <field name="company_id" invisible="1"/>
<tabs> <tabs>

View File

@ -1,5 +1,5 @@
<form model="clinic.staff.rotation" show_company="1"> <form model="clinic.staff.rotation" show_company="1">
<field name="staff_id"/> <field name="staff_id" required="1"/>
<field name="level_id"/> <field name="level_id"/>
<field name="from_company_id"/> <field name="from_company_id"/>
<field name="to_company_id"/> <field name="to_company_id"/>

View File

@ -5,13 +5,12 @@ from netforce.access import get_active_company, get_active_user, set_active_user
from . import utils from . import utils
class Patient(Model): class Patient(Model):
_name="clinic.patient" _name="clinic.patient"
_string="Patient" _string="Patient"
_audit_log=True _audit_log=True
_multi_company=True _multi_company=True
_key=['number'] _key=['number','branch_id']
def _get_age(self,ids,context): def _get_age(self,ids,context):
res={} res={}

View File

@ -89,12 +89,34 @@ class ClinicSetting(Model):
return True return True
def run_script(self,ids,context={}): def run_script(self,ids,context={}):
for inv in get_model("account.invoice").search_browse([]): dts={}
inv.write({ for pt in get_model('clinic.patient').search_browse([]):
'due_date': '2%s'%(inv.due_date[1:]), doctor=pt.doctor_id
'date': '2%s'%(inv.due_date[1:]), if not dts.get(doctor.id):
dts[doctor.id]=[]
dts[doctor.id].append(pt.id)
x=0
y=0
c=1
for doctor_id, pt_ids in dts.items():
st=set()
b_ids=[pt.branch_id.id for pt in get_model('clinic.patient').browse(pt_ids)]
for b_id in b_ids:
st.update({b_id})
if len(st)>1:
if doctor_id:
doctor=get_model('clinic.staff').browse(doctor_id)
doctor.write({
'branch_id': 5,
}) })
print("Done") print('%s %s'%(doctor_id, st))
# update doctor to ratchawat branch
x+=1
else:
y+=1
c+=1
print("RD ", x)
print("Other", y)
def reset_last_import(self,ids,context={}): def reset_last_import(self,ids,context={}):
res=get_model("clinic.report.payment.matching").search_read([],['date'],order="date desc") res=get_model("clinic.report.payment.matching").search_read([],['date'],order="date desc")

View File

@ -8,7 +8,7 @@ class Staff(Model):
_string="Staff" _string="Staff"
_audit_log=True _audit_log=True
_multi_company=True _multi_company=True
_key=["number","name"] _key=["name","branch_id"]
def _get_age(self,ids,context={}): def _get_age(self,ids,context={}):
res={} res={}
@ -135,6 +135,11 @@ class Staff(Model):
return num return num
get_model("sequence").increment_number(seq_id,context=context) get_model("sequence").increment_number(seq_id,context=context)
def _get_branch(self,context={}):
b_ids=get_model('clinic.branch').search([])
if b_ids:
return b_ids[0]
_defaults={ _defaults={
'active': True, 'active': True,
"state": "temporary", "state": "temporary",
@ -142,6 +147,7 @@ class Staff(Model):
"date": lambda *a: time.strftime("%Y-%m-%d"), "date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number, "number": _get_number,
"company_id": lambda *a: get_active_company(), "company_id": lambda *a: get_active_company(),
'branch_id': _get_branch,
} }
_order="date desc,number desc" _order="date desc,number desc"
@ -190,10 +196,9 @@ class Staff(Model):
vals=[] vals=[]
for obj in self.browse(ids): for obj in self.browse(ids):
level=obj.level_id level=obj.level_id
lname="" name=obj.name or ""
if level: if level:
lname=level.name name+=" (%s)"%(level.name or "")
name="%s (%s)"%(obj.name,lname)
vals.append((obj.id,name)) vals.append((obj.id,name))
return vals return vals
@ -205,7 +210,12 @@ class Staff(Model):
dom=[["name","ilike","%"+name+"%"]] dom=[["name","ilike","%"+name+"%"]]
level_ids=get_model('clinic.staff.level').search(dom) level_ids=get_model('clinic.staff.level').search(dom)
ids2=[x['id'] for x in self.search_read([domain],['level_id']) if x['level_id'][0] in level_ids] ids2=[]
for x in self.search_read([domain],['level_id']):
if x['level_id']:
level_id=x['level_id'][0]
if level_id in level_ids:
ids2.append(x['id'])
ids=list(set(ids1+ids2)) ids=list(set(ids1+ids2))
return self.name_get(ids,context=context) return self.name_get(ids,context=context)

View File

@ -1,18 +1,18 @@
sharing setting sharing setting
- filter by branch - filter by branch
- patient -> ok - patient -> ok
- staff -> ok - staff -> not yet
- nurse ยังไม่มีรายชื่อสาขาที่เขาเลือก - nurse ยังไม่มีรายชื่อสาขาที่เขาเลือก -> ok
- doctor ยังไม่ match ก้ับคนไข้ - doctor ยังไม่ match ก้ับคนไข้ ****
- visit -> ok - visit -> ok
- hd case -> ok - hd case -> ok
- cycle item -> ok - cycle item -> ok
- department -> ok - department -> ok
- sickbed -> ok - sickbed -> ok
- schedule -> - schedule -> ok
- dialyser - dialyser
- add popup to new dialyser - add popup to new dialyser -> not yet ****
- running number - running number
user: user: