fix 15 item per page & improve staff

conv_bal
watcha.h@almacom.co.th 2015-03-11 08:44:02 +07:00
parent 7fea2255bf
commit 50be363ce0
8 changed files with 69 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<form model="clinic.department" show_company="1">
<head>
<button string="Options" dropdown="1">
<!--<item string='Create Sickbed' action="clinic_create_sickbed"/>-->
<item string='Share Access' method="share_access" confirm="Are you sure?"/>
</button>
</head>
<field name="name"/>
@ -12,7 +12,7 @@
<field name="branch_id" required="1"/>
<field name="company_id" invisible="1"/>
<related>
<field name="staffs"/>
<field name="patients"/>
<!--<field name="staffs"/>-->
<!--<field name="patients"/>-->
</related>
</form>

View File

@ -10,6 +10,7 @@
<field name="number"/>
<field name="name"/>
<field name="type"/>
<field name="location"/>
<!--<field name="branch_id"/>-->
<!--<field name="department_id"/>-->
<!--<field name="level_id"/>-->

View File

@ -30,5 +30,32 @@ class Department(Model):
}
_order="code"
def share_access(self,ids,context={}):
obj=self.browse(ids)[0]
model_name='clinic.department'
model_id=None
for model in get_model("model").search_read([['name',model_name]],['name']):
model_id=model['id']
if not model_id:
model_id=get_model("model").create({'name': model_name,'string': 'Clinic Deparment'}),
share_id=None
for share in get_model('share.access').search_read([['model_id','=', model_id]],['name']):
share_id=share['id']
if not share_id:
share_id=get_model('share.access').create({
'model_id': model_id,
'default_accesss': 'custom',
'filter_type': 'rw',
'select_profile': [],
})
return {
'next': {
'action': 'clinic_department',
'active_id': obj.id,
'mode': 'form',
},
'flash': 'Department % s is shared sucessfully'%obj.name,
}
Department.register()

View File

@ -1029,6 +1029,18 @@ class HDCase(Model):
for payment in obj.payments:
context['payment_id']=payment.id
data=self.get_report_payment_data(context=context)
#XXX
count=15-len(data['lines'])
for i in range(count):
data['lines'].append({
'no': '',
'product_name': '',
'description': '',
'uom_name': '',
'qty': None,
'price': None,
'amount': None,
})
pages.append(data)
if pages:
pages[-1]["is_last_page"]=True

View File

@ -136,6 +136,13 @@ class ClinicSetting(Model):
if user_id !=1:
print("Only admin!!")
return
for st in get_model("clinic.staff").search_browse([]):
st.write({
'note':' ',
})
print('Done!')
return
visits={}
for visit in get_model("clinic.visit").search_browse([]):
key='%s-%s'%(visit.visit_date, visit.patient_id.id)

View File

@ -570,6 +570,18 @@ class Shop(Model):
for obj in get_model('clinic.shop').browse(ids):
context['refer_id']=obj.id
data=get_model('clinic.shop').get_page(context=context)
#XXX fix 15 per page
count=15-len(data['lines'])
for i in range(count):
data['lines'].append({
'no': '',
'product_name': '',
'description': '',
'uom_name': '',
'qty': None,
'price': None,
'amount': None,
})
pages.append(data)
if pages:
pages[-1]["is_last_page"]=True

View File

@ -93,6 +93,12 @@ class Staff(Model):
'name_check': name.replace(" ",""), # remove all space for make sure
}
return res
def _get_location(self,ids,context={}):
res={}
for obj in self.browse(ids):
res[obj.id]=",".join([d.code for d in obj.departments])
return res
_fields={
'employee_id': fields.Many2One("hr.employee","Employee"),
@ -149,6 +155,7 @@ class Staff(Model):
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
"partner_id": fields.Many2One("partner","Contact"),
'departments': fields.Many2Many("clinic.department","Departments"),
"location": fields.Char("Location",function="_get_location",store=True),
}
def _get_number(self,context={}):