コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5266 ビュー
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.  

アバター
破棄
著作者

Can someone look into the code to make it work.

関連投稿 返信 ビュー 活動
1
3月 23
2363
3
8月 19
12803
7
7月 19
4759
0
6月 19
3168
2
9月 18
3195