mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] Using with_context for synchronizing
This commit is contained in:
@@ -155,7 +155,6 @@ class HotelNode(models.Model):
|
||||
'email': user['email'],
|
||||
'active': user['active'],
|
||||
'remote_user_id': user['id'],
|
||||
'is_synchronizing': True,
|
||||
}))
|
||||
else:
|
||||
user_ids.append((0, 0, {
|
||||
@@ -164,13 +163,12 @@ class HotelNode(models.Model):
|
||||
'email': user['email'],
|
||||
'active': user['active'],
|
||||
'remote_user_id': user['id'],
|
||||
'is_synchronizing': True,
|
||||
}))
|
||||
vals.update({'user_ids': user_ids})
|
||||
|
||||
wdb.set_trace()
|
||||
|
||||
self.write(vals)
|
||||
self.with_context({
|
||||
'is_synchronizing': True,
|
||||
}).write(vals)
|
||||
|
||||
|
||||
except (odoorpc.error.RPCError, odoorpc.error.InternalError, urllib.error.URLError) as err:
|
||||
|
||||
@@ -85,7 +85,7 @@ class HotelNodeUser(models.Model):
|
||||
raise ValidationError(msg)
|
||||
|
||||
try:
|
||||
if 'is_synchronizing' in vals:
|
||||
if 'is_synchronizing' not in self._context:
|
||||
partner = self.env["res.partner"].search([('email', '=', vals['login'])])
|
||||
if partner.id:
|
||||
vals['partner_id'] = partner.id
|
||||
@@ -148,9 +148,9 @@ class HotelNodeUser(models.Model):
|
||||
_("Odoo version in node: %s") % node.odoo_version
|
||||
_logger.error(msg)
|
||||
raise ValidationError(msg)
|
||||
|
||||
|
||||
try:
|
||||
if 'is_synchronizing' not in vals:
|
||||
if 'is_synchronizing' not in self._context:
|
||||
noderpc = odoorpc.ODOO(node.odoo_host, node.odoo_protocol, node.odoo_port)
|
||||
noderpc.login(node.odoo_db, node.odoo_user, node.odoo_password)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user