summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-10-10 19:14:30 +0200
committerChristophe Simonis <chs@odoo.com>2017-10-10 19:14:30 +0200
commit0be264b29eac11a5dec5e6565d23d4ea86bd905a (patch)
tree79362f2340c89cb3cf2e8d8a467f357b7c7a8326 /odoo/fields.py
parentcf753a7fdf1739dcf37d2ad74f4c8efb3d4ff3b3 (diff)
parente1104ac344cbc349a46b22339b13dfe9cbab8bcb (diff)
[MERGE] forward port branch 11.0 up to e1104ac344c
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index 780a1c318bc..f04c4139b6f 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -2245,14 +2245,13 @@ class One2many(_RelationalMulti):
elif act[0] == 6:
record = records[-1]
comodel.browse(act[2]).write({inverse: record.id})
- query = "SELECT id FROM %s WHERE %s=%%s AND id <> ALL(%%s)" % (comodel._table, inverse)
- comodel._cr.execute(query, (record.id, act[2] or [0]))
- lines = comodel.browse([row[0] for row in comodel._cr.fetchall()])
+ domain = self.domain(records) if callable(self.domain) else self.domain
+ domain = domain + [(inverse, 'in', records.ids), ('id', 'not in', act[2] or [0])]
inverse_field = comodel._fields[inverse]
if inverse_field.ondelete == 'cascade':
- lines.unlink()
+ comodel.search(domain).unlink()
else:
- lines.write({inverse: False})
+ comodel.search(domain).write({inverse: False})
class Many2many(_RelationalMulti):