Skip to Content
Menu
This question has been flagged
4312 Views
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
Discard
Author

Can someone look into the code to make it work.

Related Posts Replies Views Activity
1
Mar 23
1251
3
Aug 19
11085
7
Jul 19
3597
0
Jun 19
2246
2
Sep 18
2433