'Create MTO procurement rule and link it to the generic MTO route'

def _create_or_update_mto_pull(self, routes_data):

    routes_data = (routes_data or self.get_routes_dict())
    for warehouse in self:
        routings = routes_data[warehouse.id][warehouse.delivery_steps]
        if warehouse.mto_pull_id:
            mto_pull = warehouse.mto_pull_id
            mto_pull.write(warehouse._get_mto_pull_rules_values(routings)[0])
        else:
            mto_pull = self.env['procurement.rule'].create(warehouse._get_mto_pull_rules_values(routings)[0])
    return mto_pull
