Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
5228 มุมมอง
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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 23
2344
3
ส.ค. 19
12751
READONLY PRICE UNIT แก้ไขแล้ว
7
ก.ค. 19
4739
0
มิ.ย. 19
3112
2
ก.ย. 18
3172