From b984eb4c2af3e9f8fe7a49f9762406edad2b2e70 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Fri, 13 Feb 2015 17:48:38 +0700 Subject: [PATCH] prevent user to create/write/delete sickbed but can still update status of sickbed --- netforce_clinic/models/hd_case.py | 7 +++++++ netforce_clinic/models/product_categ.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index d74723e..8c87a26 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -907,9 +907,13 @@ class HDCase(Model): obj.write({ 'state': 'completed', }) + #FIXME allow user to write sickbed status + user_id=get_active_user() + set_active_user(1) obj.sickbed_id.write({ 'state': 'available', }) + set_active_user(user_id) return { 'next': { 'name': 'clinic_hd_case', @@ -1236,6 +1240,8 @@ class HDCase(Model): #################################################3 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 obj.sickbed_id: obj.sickbed_id.write({ @@ -1245,6 +1251,7 @@ class HDCase(Model): sb.write({ 'state': 'not_available', }) + set_active_user(user_id) self.function_store(ids) super().write(ids,vals,**kw) obj=self.browse(ids)[0] diff --git a/netforce_clinic/models/product_categ.py b/netforce_clinic/models/product_categ.py index 5d89d19..211cf11 100644 --- a/netforce_clinic/models/product_categ.py +++ b/netforce_clinic/models/product_categ.py @@ -3,7 +3,7 @@ from netforce.model import Model, fields class ProductCateg(Model): _inherit="product.categ" _fields={ - 'expense': fields.Boolean("Expense"), + 'expense': fields.Boolean("Show On HD Case Expense Tab"), } _defaults={