prevent user to create/write/delete sickbed but can still update status of sickbed

conv_bal
watcha.h 2015-02-13 17:48:38 +07:00
parent f32fd7dc19
commit b984eb4c2a
2 changed files with 8 additions and 1 deletions

View File

@ -907,9 +907,13 @@ class HDCase(Model):
obj.write({ obj.write({
'state': 'completed', 'state': 'completed',
}) })
#FIXME allow user to write sickbed status
user_id=get_active_user()
set_active_user(1)
obj.sickbed_id.write({ obj.sickbed_id.write({
'state': 'available', 'state': 'available',
}) })
set_active_user(user_id)
return { return {
'next': { 'next': {
'name': 'clinic_hd_case', 'name': 'clinic_hd_case',
@ -1236,6 +1240,8 @@ class HDCase(Model):
#################################################3 #################################################3
if 'sickbed_id' in vals.keys(): if 'sickbed_id' in vals.keys():
user_id=get_active_user()
set_active_user(1)
if vals['sickbed_id']!=obj.sickbed_id.id and obj.state!='draft': if vals['sickbed_id']!=obj.sickbed_id.id and obj.state!='draft':
if obj.sickbed_id: if obj.sickbed_id:
obj.sickbed_id.write({ obj.sickbed_id.write({
@ -1245,6 +1251,7 @@ class HDCase(Model):
sb.write({ sb.write({
'state': 'not_available', 'state': 'not_available',
}) })
set_active_user(user_id)
self.function_store(ids) self.function_store(ids)
super().write(ids,vals,**kw) super().write(ids,vals,**kw)
obj=self.browse(ids)[0] obj=self.browse(ids)[0]

View File

@ -3,7 +3,7 @@ from netforce.model import Model, fields
class ProductCateg(Model): class ProductCateg(Model):
_inherit="product.categ" _inherit="product.categ"
_fields={ _fields={
'expense': fields.Boolean("Expense"), 'expense': fields.Boolean("Show On HD Case Expense Tab"),
} }
_defaults={ _defaults={