当我尝试从生物识别考勤机导入用户时,我收到错误:
TypeError: import_users() takes exactly 5 arguments (2 given)
这是我的班级:
class BiometricUser(models.TransientModel):
_name = 'biometric.user.wizard'
biometric_device = fields.Many2one(
'biometric.machine', 'Biometric device',
)
def import_users(self, cr, uid, ids, context):
"""
wrapper function
"""
for biometric_import_user in self.browse(cr, uid, ids, context):
biometric_import_user.create_users_in_openerp()
@api.model
def create_users_in_openerp(self):
self.biometric_device.create_user()
答案 0 :(得分:1)
将 @ api.model 更改为 @ api.multi 并将(cr,uid,ids,context)更改为 self
尝试使用以下代码:
@api.multi
def import_users(self):
"""
wrapper function
"""
for biometric_import_user in self:
biometric_import_user.create_users_in_openerp()
@api.multi
def create_users_in_openerp(self):
self.biometric_device.create_user()