diff --git a/stock_location_tray/models/stock_location.py b/stock_location_tray/models/stock_location.py index b7bb04351..95ea4747a 100644 --- a/stock_location_tray/models/stock_location.py +++ b/stock_location_tray/models/stock_location.py @@ -82,7 +82,9 @@ class StockLocation(models.Model): ) location.ensure_one() view = self.env.ref("stock.view_location_form") - action = self.env.ref("stock.action_location_form").read()[0] + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.action_location_form" + ) action.update( { "res_id": location.id, diff --git a/stock_location_tray/models/stock_location_tray_type.py b/stock_location_tray/models/stock_location_tray_type.py index e89edc990..71aa0776e 100644 --- a/stock_location_tray/models/stock_location_tray_type.py +++ b/stock_location_tray/models/stock_location_tray_type.py @@ -106,7 +106,9 @@ class StockLocationTrayType(models.Model): ) def open_locations(self): - action = self.env.ref("stock.action_location_form").read()[0] + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.action_location_form" + ) action["domain"] = [("tray_type_id", "in", self.ids)] if len(self.ids) == 1: action["context"] = {"default_tray_type_id": self.id}