def update(request, run_ids, values):
    """Updates the fields of the selected test run.

    :param run_ids: give one or more run IDs. It could be an integer, a
        string containing comma separated IDs, or a list of int each of them is
        a run ID.
    :type run_ids: int, str or list
    :param dict values: a mapping containing these data to update specified
        runs.

        * plan: (int) TestPlan.plan_id
        * product: (int) Product.id
        * build: (int) Build.id
        * manager: (int) Auth.User.id
        * default_tester: Intege Auth.User.id
        * summary: (str)
        * estimated_time: (TimeDelta) in format ``2h30m30s`` which is recommended or ``HH:MM:SS``.
        * product_version: (int)
        * plan_text_version: (int)
        * notes: (str)
        * status: (int) 0:RUNNING 1:FINISHED

    :return: list of mappings of the updated test runs.
    :rtype: list[dict]

    .. versionchanged:: 4.5
       Argument ``errata_id`` is removed.

    Example::

        # Update status to finished for run 1 and 2
        TestRun.update([1, 2], {'status': 1})
    """
    from datetime import datetime

    from tcms.core import forms
    from tcms.testruns.forms import XMLRPCUpdateRunForm

    if values.get("product_version") and not values.get("product"):
        raise ValueError('Field "product" is required by product_version')

    if values.get("estimated_time"):
        values["estimated_time"] = pre_process_estimated_time(values.get("estimated_time"))

    form = XMLRPCUpdateRunForm(values)
    if values.get("product_version"):
        form.populate(product_id=values["product"])

    if form.is_valid():
        trs = TestRun.objects.filter(pk__in=pre_process_ids(value=run_ids))
        _values = dict()
        if form.cleaned_data["plan"]:
            _values["plan"] = form.cleaned_data["plan"]

        if form.cleaned_data["build"]:
            _values["build"] = form.cleaned_data["build"]

        if form.cleaned_data["manager"]:
            _values["manager"] = form.cleaned_data["manager"]

        if "default_tester" in values:
            default_tester = form.cleaned_data["default_tester"]
            if values.get("default_tester") and default_tester:
                _values["default_tester"] = default_tester
            else:
                _values["default_tester"] = None

        if form.cleaned_data["summary"]:
            _values["summary"] = form.cleaned_data["summary"]

        if values.get("estimated_time") is not None:
            _values["estimated_time"] = form.cleaned_data["estimated_time"]

        if form.cleaned_data["product_version"]:
            _values["product_version"] = form.cleaned_data["product_version"]

        if "notes" in values:
            if values["notes"] in (None, ""):
                _values["notes"] = values["notes"]
            if form.cleaned_data["notes"]:
                _values["notes"] = form.cleaned_data["notes"]

        if form.cleaned_data["plan_text_version"]:
            _values["plan_text_version"] = form.cleaned_data["plan_text_version"]

        if isinstance(form.cleaned_data["status"], int):
            if form.cleaned_data["status"]:
                _values["stop_date"] = datetime.now()
            else:
                _values["stop_date"] = None

        trs.update(**_values)
    else:
        raise ValueError(forms.errors_to_list(form))

    query = {"pk__in": trs.values_list("pk", flat=True)}
    return TestRun.to_xmlrpc(query)