diff --git a/shopinvader_cart_expiry/migrations/14.0.1.0.3/post-migrate.py b/shopinvader_cart_expiry/migrations/14.0.1.0.3/post-migrate.py index bf16a67391..336feae3a2 100644 --- a/shopinvader_cart_expiry/migrations/14.0.1.0.3/post-migrate.py +++ b/shopinvader_cart_expiry/migrations/14.0.1.0.3/post-migrate.py @@ -16,7 +16,7 @@ def migrate(cr, version): with api.Environment.manage(): env = api.Environment(cr, SUPERUSER_ID, {}) domain = [("cart_expiry_delay", ">", 0)] - for backend in env.search(domain): + for backend in env["shopinvader.backend"].search(domain): backend = backend.with_company(backend.company_id.id).sudo_tech() expiry_date = fields.Datetime.from_string(fields.Datetime.now()) delta_arg = {backend.cart_expiry_delay_unit: backend.cart_expiry_delay} diff --git a/shopinvader_cart_expiry/models/shopinvader_backend.py b/shopinvader_cart_expiry/models/shopinvader_backend.py index 19970c05fe..223d3193ab 100644 --- a/shopinvader_cart_expiry/models/shopinvader_backend.py +++ b/shopinvader_cart_expiry/models/shopinvader_backend.py @@ -35,7 +35,10 @@ def _scheduler_manage_cart_expiry(self, domain=False): domain = expression.AND([domain, [("cart_expiry_delay", ">", 0)]]) for backend in self.search(domain): description = _("Manage cart expired for backend %s") % backend.name - backend.with_delay(description=description).manage_cart_expiry() + backend.with_delay( + description=description, + identity_key="shopinvader_manage_cart_expiry_%s" % (str(backend.id),), + ).manage_cart_expiry() def _get_cart_expiry_delay_domain(self): expiry_date = fields.Datetime.from_string(fields.Datetime.now())