~dorian-kemps/unifield-web/US-11908

« back to all changes in this revision

Viewing changes to addons/openerp/controllers/root.py

  • Committer: jf
  • Date: 2023-12-15 14:19:27 UTC
  • mfrom: (5053.2.1 web-US-11587)
  • Revision ID: jfb@tempo-consulting.fr-20231215141927-1vrzo513hx39jvpg
US-11587 [IMP] Popup to ask Department

lp:~jfb-tempo-consulting/unifield-web/US-11587

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
            tools = None
162
162
 
163
163
        user_info = rpc.RPCProxy("res.users").read([rpc.session.uid],
164
 
                                                   ['force_password_change', 'new_signature_required', 'nb_email_asked', 'display_email_popup'],
 
164
                                                   ['force_password_change', 'new_signature_required', 'nb_email_asked', 'display_email_popup',
 
165
                                                    'display_department_popup', 'nb_department_asked', 'context_department_id'],
165
166
                                                   rpc.session.context)[0]
166
167
        force_password_change = user_info['force_password_change']
167
168
        signature_required = user_info.get('new_signature_required')
168
169
        email_required = user_info.get('display_email_popup')
169
170
        nb_email_asked = user_info['nb_email_asked'] or 0
 
171
 
 
172
        department_required = user_info.get('display_department_popup')
 
173
        nb_department_asked = user_info.get('nb_department_asked') or 0
 
174
        department_list = []
 
175
        selected_department = user_info.get('context_department_id') and user_info.get('context_department_id')[0] or False
 
176
        if department_required:
 
177
            department_list = rpc.RPCProxy('res.users').list_department(rpc.session.context)
 
178
            if not department_list:
 
179
                department_required = False
 
180
 
170
181
        widgets= openobject.pooler.get_pool()\
171
182
            .get_controller('/openerp/widgets')\
172
183
            .user_home_widgets(ctx)
223
234
                    display_warning=display_warning,
224
235
                    refresh_timeout=refresh_timeout,
225
236
                    email_required=email_required,
226
 
                    nb_email_asked=nb_email_asked)
 
237
                    nb_email_asked=nb_email_asked,
 
238
                    department_required=department_required,
 
239
                    nb_department_asked=nb_department_asked,
 
240
                    department_list=department_list,
 
241
                    selected_department=selected_department)
227
242
 
228
243
    @expose()
229
244
    def do_login(self, *arg, **kw):