Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5204 Lượt xem
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.  

Ảnh đại diện
Huỷ bỏ
Tác giả

Can someone look into the code to make it work.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 23
2342
3
thg 8 19
12735
READONLY PRICE UNIT Đã xử lý
7
thg 7 19
4729
0
thg 6 19
3094
2
thg 9 18
3170