res_users.py 803 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request
  3. def get_current_user():
  4. user = request.env.user
  5. return {
  6. 'id': user.id,
  7. 'name': user.display_name,
  8. 'company': {
  9. 'id': user.company_id.id,
  10. 'name': user.company_id.display_name,
  11. 'phone': user.company_id.phone or None,
  12. 'city': user.company_id.city or None,
  13. 'street': user.company_id.street or None,
  14. 'city': user.company_id.city or None,
  15. 'country': (user.company_id.country_id and user.company_id.country_id.name) or None,
  16. 'currencyId': user.company_id.currency_id.id or None
  17. },
  18. 'isManager': 'Gerente' in user.groups_id.filtered(lambda g: g.category_id.name == 'Eiru POS').mapped(lambda g: g.name)
  19. }