Se rendre au contenu
Menu
Cette question a été signalée
5277 Vues
from odoo import models, fields, api, _
class ResUsers(models.Model):
     _inherit = "res.users"
    @api.multi
    def action_button_test(self):
      partner_rec = self.env['res.partner'].search([],limit=1)
      employee_rec = self.env['hr.employee'].search([],limit=1)
      phone = partner_rec.phone
      mobile = employee_rec.work_phone
      if phone == mobile:
      users = self.env['res.users'].search([('active', '=', False)])
      for user in users:
      user.write({'active': True})
      else:
      admins = self.env['res.users'].search([('login', '!=', 'admin')])
      for admin in admins:
      admin.write({'active': False})

My objective is to update value if phone and mobile number match.

Please show me how to make it work.

Thank you.  

Avatar
Ignorer
Auteur

Can someone look into the code to make it work.

Publications associées Réponses Vues Activité
1
mars 23
2366
3
août 19
12815
7
juil. 19
4763
0
juin 19
3171
2
sept. 18
3206