[FIX] crm: make crm.team.write work in batch again
When `_synchronize_alias` was introduced into crm.team.write, the write method become incompatible with batch writes because `_synchronize_alias` assumes `self` is a recordset of length 1 and performs attribute accesses directly on self, this makes the __get__ crash because it performs a `self.ensure_one()` With this commit, crm.team.write will iterate over the self recordset and call `_synchronize_alias` on every record of the recordset. This also solves a uninstallation problem in sale_crm because a write is performed on crm.team in an uninstall_hook. closes odoo/odoo#49088 X-original-commit: a9511cd42be365e58371d717b8197aac644eaf33 Signed-off-by: Raphael Collet (rco) <rco@openerp.com> Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
This commit is contained in:
@@ -108,9 +108,8 @@ class Team(models.Model):
|
||||
for team in self:
|
||||
team.alias_id.write(team.get_alias_values())
|
||||
if 'use_leads' in vals or 'use_opportunities' in vals:
|
||||
alias_values = self._synchronize_alias(vals)
|
||||
if alias_values:
|
||||
self.write(alias_values)
|
||||
for team in self:
|
||||
team.write(team._synchronize_alias(vals))
|
||||
return result
|
||||
|
||||
def _synchronize_alias(self, values):
|
||||
|
||||
Reference in New Issue
Block a user