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"> <form model="clinic.department" show_company="1">
<head> <head>
<button string="Options" dropdown="1"> <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> </button>
</head> </head>
<field name="name"/> <field name="name"/>
@ -12,7 +12,7 @@
<field name="branch_id" required="1"/> <field name="branch_id" required="1"/>
<field name="company_id" invisible="1"/> <field name="company_id" invisible="1"/>
<related> <related>
<field name="staffs"/> <!--<field name="staffs"/>-->
<field name="patients"/> <!--<field name="patients"/>-->
</related> </related>
</form> </form>

View File

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

View File

@ -31,4 +31,31 @@ class Department(Model):
_order="code" _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() Department.register()

View File

@ -1029,6 +1029,18 @@ class HDCase(Model):
for payment in obj.payments: for payment in obj.payments:
context['payment_id']=payment.id context['payment_id']=payment.id
data=self.get_report_payment_data(context=context) 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) pages.append(data)
if pages: if pages:
pages[-1]["is_last_page"]=True pages[-1]["is_last_page"]=True

View File

@ -136,6 +136,13 @@ class ClinicSetting(Model):
if user_id !=1: if user_id !=1:
print("Only admin!!") print("Only admin!!")
return return
for st in get_model("clinic.staff").search_browse([]):
st.write({
'note':' ',
})
print('Done!')
return
visits={} visits={}
for visit in get_model("clinic.visit").search_browse([]): for visit in get_model("clinic.visit").search_browse([]):
key='%s-%s'%(visit.visit_date, visit.patient_id.id) 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): for obj in get_model('clinic.shop').browse(ids):
context['refer_id']=obj.id context['refer_id']=obj.id
data=get_model('clinic.shop').get_page(context=context) 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) pages.append(data)
if pages: if pages:
pages[-1]["is_last_page"]=True pages[-1]["is_last_page"]=True

View File

@ -94,6 +94,12 @@ class Staff(Model):
} }
return res 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={ _fields={
'employee_id': fields.Many2One("hr.employee","Employee"), 'employee_id': fields.Many2One("hr.employee","Employee"),
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),
@ -149,6 +155,7 @@ class Staff(Model):
'branch_id': fields.Many2One("clinic.branch","Branch", search=True), 'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
"partner_id": fields.Many2One("partner","Contact"), "partner_id": fields.Many2One("partner","Contact"),
'departments': fields.Many2Many("clinic.department","Departments"), 'departments': fields.Many2Many("clinic.department","Departments"),
"location": fields.Char("Location",function="_get_location",store=True),
} }
def _get_number(self,context={}): def _get_number(self,context={}):