def setUp(self):
        super(TestStockCycleCount, self).setUp()
        self.res_users_model = self.env["res.users"]
        self.cycle_count_model = self.env["stock.cycle.count"]
        self.stock_cycle_count_rule_model = self.env["stock.cycle.count.rule"]
        self.inventory_model = self.env["stock.inventory"]
        self.stock_location_model = self.env["stock.location"]
        self.stock_move_model = self.env["stock.move"]
        self.stock_warehouse_model = self.env["stock.warehouse"]
        self.product_model = self.env["product.product"]
        self.quant_model = self.env["stock.quant"]
        self.move_model = self.env["stock.move"]

        self.company = self.env.ref("base.main_company")
        self.partner = self.env.ref("base.res_partner_1")
        self.g_stock_manager = self.env.ref("stock.group_stock_manager")
        self.g_stock_user = self.env.ref("stock.group_stock_user")

        # Create users:
        self.manager = self._create_user(
            "user_1", [self.g_stock_manager], self.company
        ).id
        self.user = self._create_user("user_2", [self.g_stock_user], self.company).id

        # Create warehouses:
        self.big_wh = self.stock_warehouse_model.create(
            {"name": "BIG", "code": "B", "cycle_count_planning_horizon": 30}
        )
        self.small_wh = self.stock_warehouse_model.create(
            {"name": "SMALL", "code": "S"}
        )

        # Create rules:
        self.rule_periodic = self._create_stock_cycle_count_rule_periodic(
            self.manager, "rule_1", [2, 7]
        )
        self.rule_turnover = self._create_stock_cycle_count_rule_turnover(
            self.manager, "rule_2", [100]
        )
        self.rule_accuracy = self._create_stock_cycle_count_rule_accuracy(
            self.manager, "rule_3", [5], self.big_wh.view_location_id.ids
        )
        self.zero_rule = self._create_stock_cycle_count_rule_zero(
            self.manager, "rule_4"
        )

        # Configure warehouses:
        self.rule_ids = [
            self.rule_periodic.id,
            self.rule_turnover.id,
            self.rule_accuracy.id,
            self.zero_rule.id,
        ]
        self.big_wh.write({"cycle_count_rule_ids": [(6, 0, self.rule_ids)]})

        # Create a location:
        self.count_loc = self.stock_location_model.create(
            {"name": "Place", "usage": "production"}
        )
        self.stock_location_model._parent_store_compute()

        # Create a cycle count:
        self.cycle_count_1 = self.cycle_count_model.with_user(self.manager).create(
            {
                "name": "Test cycle count",
                "cycle_count_rule_id": self.rule_periodic.id,
                "location_id": self.count_loc.id,
            }
        )

        # Create a product:
        self.product1 = self.product_model.create(
            {"name": "Test Product 1", "type": "product", "default_code": "PROD1"}
        )