[FIX] ir_actions: in overridden method exists, mark missing records in cache

This commit is contained in:
Raphael Collet
2015-09-30 11:01:07 +02:00
parent fabf90008d
commit d5ac2f7ab7
+7 -2
View File
@@ -22,7 +22,7 @@ from openerp.tools import ormcache
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools.translate import _
import openerp.workflow
from openerp.exceptions import UserError
from openerp.exceptions import MissingError, UserError
_logger = logging.getLogger(__name__)
@@ -401,7 +401,12 @@ class ir_actions_act_window(osv.osv):
@openerp.api.multi
def exists(self):
ids = self._existing()
return self.filtered(lambda rec: rec.id in ids)
existing = self.filtered(lambda rec: rec.id in ids)
if len(existing) < len(self):
# mark missing records in cache with a failed value
exc = MissingError(_("Record does not exist or has been deleted."))
(self - existing)._cache.update(openerp.fields.FailedValue(exc))
return existing
@openerp.api.model
@ormcache()