diff --git a/subscription_oca/models/sale_subscription.py b/subscription_oca/models/sale_subscription.py index 4cc562ee496..250f97a006f 100644 --- a/subscription_oca/models/sale_subscription.py +++ b/subscription_oca/models/sale_subscription.py @@ -451,8 +451,8 @@ def write(self, values): def create(self, values): if "recurring_rule_boundary" in values: if not values["recurring_rule_boundary"]: - template_id = self.env["sale.subscription.template"].search( - [("id", "=", values["template_id"])] + template_id = self.env["sale.subscription.template"].browse( + values["template_id"] ) date_start = values["date_start"] if not isinstance(values["date_start"], date): @@ -464,7 +464,7 @@ def create(self, values): values["date_start"] = values["recurring_next_date"] values["stage_id"] = ( self.env["sale.subscription.stage"] - .search([("type", "=", "pre")], order="sequence desc")[-1] + .search([("type", "=", "pre")], order="sequence desc", limit=1) .id ) return super(SaleSubscription, self).create(values)