remain old profile
							parent
							
								
									19489e8ff5
								
							
						
					
					
						commit
						378914c021
					
				| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
<inherit model="base.user" inherit="user_form">
 | 
					<inherit model="base.user" inherit="user_form">
 | 
				
			||||||
    <field name="pin_code" position="after">
 | 
					    <field name="pin_code" position="after">
 | 
				
			||||||
        <field name="department_profile_id"/>
 | 
					        <field name="department_profile_id"/>
 | 
				
			||||||
 | 
					        <field name="old_profile_id"/>
 | 
				
			||||||
    </field>
 | 
					    </field>
 | 
				
			||||||
</inherit>
 | 
					</inherit>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@ class User(Model):
 | 
				
			||||||
    _fields={
 | 
					    _fields={
 | 
				
			||||||
        'department_profile_id': fields.Many2One("clinic.department.profile","Department Profile"),
 | 
					        'department_profile_id': fields.Many2One("clinic.department.profile","Department Profile"),
 | 
				
			||||||
        'department_id': fields.Many2One("clinic.department","Current Department"),
 | 
					        '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()
 | 
					User.register()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,6 +165,9 @@ class SelectCompany(Model):
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            context['profile_id']=obj.check_profile(context=context) 
 | 
					            context['profile_id']=obj.check_profile(context=context) 
 | 
				
			||||||
            pf_id=obj.share_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({
 | 
					            user.write({
 | 
				
			||||||
                'department_id': None, #all include department
 | 
					                'department_id': None, #all include department
 | 
				
			||||||
                'profile_id': pf_id,
 | 
					                'profile_id': pf_id,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue