update store function from staff rotation

conv_bal
watcha.h@almacom.co.th 2015-03-11 14:46:24 +07:00
parent 9907973d8d
commit 34f4f66312
4 changed files with 26 additions and 7 deletions

View File

@ -40,9 +40,10 @@
<field name="account_patients" nolabel="1">
<list>
<field name="type_id"/>
<!--<field name="patient_id" domain='[["type_id","=",type_id]]'/>-->
<field name="patient_id"/>
<field name="patient_id" domain='[["type_id","=",type_id]]'/>
<field name="partner_id" domain='[["is_patient","=","true"]]'/>
<field name="hn"/>
<field name="card_no"/>
</list>
</field>
</tab>

View File

@ -136,10 +136,19 @@ class ClinicSetting(Model):
if user_id !=1:
print("Only admin!!")
return
for st in get_model("clinic.staff").search_browse([]):
st.write({
'note':' ',
})
obj=self.browse(ids)[0]
lines=[]
for pt in get_model("clinic.patient").search_browse([]):
lines.append(('create',{
'patient_id': pt.id,
'partner_id': pt.partner_id.id,
'type_id': pt.type_id.id,
'hn': pt.hn_no,
'card_no': pt.card_no,
}))
obj.write({
'account_patients': lines,
})
print('Done!')
return

View File

@ -9,6 +9,8 @@ class SettingAccountPatient(Model):
"patient_id": fields.Many2One("clinic.patient","Patient",domain=[["state","=","admit"]]),
'partner_id': fields.Many2One("partner","Contact"),
'type_id': fields.Many2One("clinic.patient.type","Type"),
'hn': fields.Char("HN"),
'card_no': fields.Char("ID Card",size=13),
}
_order="type_id,patient_id"

View File

@ -1,6 +1,6 @@
import time
from netforce.model import Model, fields
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
class StaffRotation(Model):
@ -55,10 +55,17 @@ class StaffRotation(Model):
def create(self,vals,**kw):
id=super().create(vals,**kw)
self.function_store([id])
#XXX
get_model("clinic.staff").function_store([vals['staff_id']])
return id
def write(self,ids,vals,**kw):
super().write(ids,vals,**kw)
self.function_store(ids)
#XXX
staff_ids=[]
for obj in self.browse(ids):
staff_ids.append(obj.staff_id.id)
get_model("clinic.staff").function_store(staff_ids)
StaffRotation.register()