diff --git a/stock_cycle_count/models/stock_cycle_count.py b/stock_cycle_count/models/stock_cycle_count.py index 53284762f..76ea41f5a 100644 --- a/stock_cycle_count/models/stock_cycle_count.py +++ b/stock_cycle_count/models/stock_cycle_count.py @@ -99,14 +99,15 @@ class StockCycleCount(models.Model): return True def action_view_inventory(self): - action = self.env.ref("stock.action_inventory_form") - result = action.read()[0] - result["context"] = {} + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.action_inventory_form" + ) + action["context"] = {} adjustment_ids = self.mapped("stock_adjustment_ids").ids if len(adjustment_ids) > 1: - result["domain"] = [("id", "in", adjustment_ids)] + action["domain"] = [("id", "in", adjustment_ids)] elif len(adjustment_ids) == 1: res = self.env.ref("stock.view_inventory_form", False) - result["views"] = [(res and res.id or False, "form")] - result["res_id"] = adjustment_ids and adjustment_ids[0] or False - return result + action["views"] = [(res and res.id or False, "form")] + action["res_id"] = adjustment_ids and adjustment_ids[0] or False + return action diff --git a/stock_cycle_count/models/stock_location.py b/stock_cycle_count/models/stock_location.py index ea315507f..1dd17dafd 100644 --- a/stock_cycle_count/models/stock_location.py +++ b/stock_cycle_count/models/stock_location.py @@ -113,8 +113,9 @@ class StockLocation(models.Model): def action_accuracy_stats(self): self.ensure_one() - action = self.env.ref("stock_cycle_count.act_accuracy_stats") - result = action.read()[0] - new_domain = result["domain"][:-1] + ", ('location_ids', 'in', active_ids)]" - result["domain"] = new_domain - return result + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock_cycle_count.act_accuracy_stats" + ) + new_domain = action["domain"][:-1] + ", ('location_ids', 'in', active_ids)]" + action["domain"] = new_domain + return action