Permalink
Browse files

[FIX] maintenance: make write override multi-compliant

The write method called self.stage_id which caused singleton error when
self contains more than one record
  • Loading branch information...
tutran81 authored and Elkasitu committed Oct 11, 2018
1 parent 227fc64 commit c2688e45f318629cc44d445cec65c67e1ccdc3f2
Showing with 2 additions and 2 deletions.
  1. +2 −2 addons/maintenance/models/maintenance.py
@@ -346,8 +346,8 @@ def write(self, vals):
if vals.get('owner_user_id'):
self.message_subscribe_users(user_ids=[vals['owner_user_id']])
res = super(MaintenanceRequest, self).write(vals)
if self.stage_id.done and 'stage_id' in vals:
self.write({'close_date': fields.Date.today()})
if 'stage_id' in vals:
self.filtered(lambda m: m.stage_id.done).write({'close_date': fields.Date.today()})
return res
@api.model

0 comments on commit c2688e4

Please sign in to comment.