From 378914c021c86d0167028046c854b1e42b5f7c85 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 17 Mar 2015 08:23:39 +0700 Subject: [PATCH] remain old profile --- netforce_clinic/layouts/clinic_user_form.xml | 1 + netforce_clinic/models/base_user.py | 2 +- netforce_clinic/models/select_company.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/netforce_clinic/layouts/clinic_user_form.xml b/netforce_clinic/layouts/clinic_user_form.xml index 367bf31..20f36fc 100644 --- a/netforce_clinic/layouts/clinic_user_form.xml +++ b/netforce_clinic/layouts/clinic_user_form.xml @@ -1,5 +1,6 @@ + diff --git a/netforce_clinic/models/base_user.py b/netforce_clinic/models/base_user.py index 37c0014..ea454c4 100644 --- a/netforce_clinic/models/base_user.py +++ b/netforce_clinic/models/base_user.py @@ -5,7 +5,7 @@ class User(Model): _fields={ 'department_profile_id': fields.Many2One("clinic.department.profile","Department Profile"), 'department_id': fields.Many2One("clinic.department","Current Department"), - 'department_include': fields.Selection([['yes','Yes'],['no','No']],"Include"), + 'old_profile_id': fields.Many2One('profile', "Old Profile"), } User.register() diff --git a/netforce_clinic/models/select_company.py b/netforce_clinic/models/select_company.py index 9a7edeb..145c601 100644 --- a/netforce_clinic/models/select_company.py +++ b/netforce_clinic/models/select_company.py @@ -165,6 +165,9 @@ class SelectCompany(Model): else: context['profile_id']=obj.check_profile(context=context) pf_id=obj.share_profile(context=context) + old_pf_id=user.old_profile_id.id + if old_pf_id: + pf_id=old_pf_id user.write({ 'department_id': None, #all include department 'profile_id': pf_id,