diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-02-26 14:28:06 +0000 |
|---|---|---|
| committer | Victor Feyens <vfe@odoo.com> | 2020-02-26 14:31:31 +0000 |
| commit | f4bcf2c3f922d54bbea93cabedfe60e8c6b1c6c9 (patch) | |
| tree | d6381ce94062c2cf5220bb95ea54dd285179adc7 | |
| parent | caa0e52d4b57463eb609062a9f48751d12cda5dd (diff) | |
[IMP] base: batch records (un)archiving
This allows detailed reporting in write overrides.
Expl:
When (un)archiving multiple records together (from a view list, or in batch call),
you will only see one record at a time in `write` overrides. This means you
won't be able to return meaningful and complete messages to the end user.
Before:
1) Archive A & B
2) "You cannot archive A"
3) Archive B
4) "You cannot archive B"
After:
1) Archive A & B
2) "You cannot archive A & B"
closes odoo/odoo#46358
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
| -rw-r--r-- | odoo/models.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/odoo/models.py b/odoo/models.py index cf4eebde3b0..afe8b5345a2 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -4876,8 +4876,9 @@ Record ids: %(records)s def toggle_active(self): """ Inverse the value of the field ``(x_)active`` on the records in ``self``. """ - for record in self: - record[self._active_name] = not record[self._active_name] + active_recs = self.filtered(self._active_name) + active_recs[self._active_name] = False + (self - active_recs)[self._active_name] = True def action_archive(self): """ Set (x_)active=False on a recordset, by calling toggle_active to |
