<odoo>
  <data>
    <record id="runbot_build_error_form" model="ir.ui.view">
      <field name="name">runbot.build.error.form</field>
      <field name="model">runbot.build.error</field>
      <field name="arch" type="xml">
        <form>
          <header>
            <field name="state" widget="statusbar" options="{'clickable': '1'}"/>
          </header>
          <sheet>
              <div name="button_box">
                <button class="oe_stat_button" type="object" icon="fa-exclamation-circle" name="action_get_build_link_record">
                  <field string="Builds Link" name="build_count" widget="statinfo"/>
                </button>
              </div>
              <widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" invisible="not test_tags"/>
              <button name="action_view_errors" string="See all linked errors" type="object" class="oe_highlight"/>
              <group string="Base info">
                <field name="name"/>
                <field name="error_content_ids" readonly="1">
                    <list limit="5">
                      <field name="content" readonly="1"/>
                      <!--field name="module_name" readonly="1"/-->
                      <!--field name="function" readonly="1"/-->
                      <!--field name="file_path" readonly="1"/-->
                      <field name="version_ids" widget="many2many_tags" optional="hide"/>
                      <field name="trigger_ids" widget="many2many_tags" optional="hide"/>
                      <field name="tag_ids" widget="many2many_tags" readonly="1" optional="hide"/>
                      <field name="random" optional="hide"/>
                      <field name="first_seen_date" widget="frontend_url" options="{'link_field': 'first_seen_build_id'}"/>
                      <field name="last_seen_date" widget="frontend_url" options="{'link_field': 'last_seen_build_id'}"/>
                      <field name="first_seen_build_id" column_invisible="True"/>
                      <field name="last_seen_build_id" column_invisible="True"/>
                    </list>
                </field>
              </group>
              <group>
                <group name="fixer_info" string="Fixing" col="2">
                  <field name="responsible"/>
                  <field name="customer"/>
                  <field name="team_id"/>
                  <field name="fixing_pr_id"/>
                  <field name="fixing_pr_url" widget="pull_request_url"/>
                  <field name="active"/>
                </group>
                <group name="appearance_info" string="Appearance" col="2">
                  <field name="version_ids" widget="many2many_tags"/>
                  <field name="trigger_ids" widget="many2many_tags"/>
                  <field name="tag_ids" widget="many2many_tags"/>
                  <field name="random"/>
                  <field name="first_seen_date" widget="frontend_url" options="{'link_field': 'first_seen_build_id'}"/>
                  <field name="last_seen_date" widget="frontend_url" options="{'link_field': 'last_seen_build_id'}"/>
                  <field name="graph_history"/>
                  <field name="first_seen_build_id" invisible="True"/>
                  <field name="last_seen_build_id" invisible="True"/>
                </group>
              </group>
              <group name="test_tags_group" string="Disabling">
                <field name="canonical_tags" class="text-nowrap overflow-x-auto"/>
                <button name="action_copy_canonical_tag" type="object" groups="runbot.group_runbot_admin">Disable test using canonical tag</button>
                <field name="test_tags" decoration-danger="True" readonly="1" groups="!runbot.group_runbot_admin"/>
                <field name="test_tags" decoration-danger="True" groups="runbot.group_runbot_admin"/>
                <field name="tags_min_version_id" invisible="not test_tags" options="{'no_create': True, 'no_create_edit':True}"/>
                <field name="tags_max_version_id" invisible="not test_tags" options="{'no_create': True, 'no_create_edit':True}" />
              </group>
              <group>
                <field name="previous_error_id" readonly="1" invisible="not previous_error_id" text-decoration-danger="True"/>
              </group>
              <notebook>
                <page string="Builds">
                  <field name="unique_build_error_link_ids" widget="one2many" context="{'hide_linked_error': 'True'}"/>
                </page>
                <page string="All links">
                  <field name="build_error_link_ids" widget="one2many"/>
                </page>
                <page string="Similary qualified Errors" groups="runbot.group_runbot_admin,runbot.group_runbot_error_manager" invisible="not common_qualifiers">
                  <div class="btn-group">
                    <button class="btn btn-sm btn-primary" type="object" name="action_view_similary_qualified">
                      View similary qualified errors
                    </button>
                  </div>
                  <field name="common_qualifiers" widget="runbotjsonb"/>
                  <field name="similar_ids" widget="one2many" options="{'not_delete': True, 'no_create': True}" readonly="1">
                    <list decoration-danger="test_tags and (fixing_pr_alive or not fixing_pr_id)"
                          decoration-success="fixing_pr_id and not test_tags and not fixing_pr_alive"
                          decoration-warning="test_tags and fixing_pr_id and not fixing_pr_alive"
                          >
                      <field name="id"/>
                      <field name="name" optional="show" readonly="1"/>
                      <field name="description" optional="hide" readonly="1"/>
                      <field name="first_seen_date" string="First Seen" optional="hide" readonly="1"/>
                      <field name="last_seen_date" string="Last Seen" readonly="1" options="{'link_field': 'last_seen_build_id'}"/>
                      <field name="last_seen_build_id" column_invisible="True"/>
                      <field name="error_count" readonly="1"/>
                      <field name="build_count" readonly="1"/>
                      <field name="team_id"/>
                      <field name="responsible" optional="show"/>
                      <field name="test_tags" optional="hide"/>
                      <field name="fixing_pr_id" optional="hide"/>
                      <field name="fixing_pr_alive" optional="hide"/>
                    </list>
                  </field>
                </page>
                <page string="Similary qualified Error Contents" groups="runbot.group_runbot_admin,runbot.group_runbot_error_manager" invisible="not common_qualifiers">
                  <div class="btn-group">
                    <button class="btn btn-sm btn-primary" type="object" name="action_view_similary_qualified_contents">
                      View Similary Contents
                    </button>
                  </div>
                  <field name="common_qualifiers" widget="runbotjsonb"/>
                  <field name="similar_content_ids" widget="one2many" options="{'not_delete': True, 'no_create': True}" readonly="1">
                    <list string="Error Contents"
                          decoration-danger="test_tags and (fixing_pr_alive or not fixing_pr_id)"
                          decoration-success="fixing_pr_id and not test_tags and not fixing_pr_alive"
                          decoration-warning="test_tags and fixing_pr_id and not fixing_pr_alive"
                          >
                        <field name="error_display_id" optional="show"/>
                        <field name="module_name" optional="show" readonly="1"/>
                        <field name="summary" optional="show" readonly="1"/>
                        <field name="random" string="Random"/>
                        <field name="first_seen_date" string="First Seen" optional="hide" readonly="1"/>
                        <field name="last_seen_date" string="Last Seen" readonly="1"/>
                        <field name="build_count" readonly="1"/>
                        <field name="team_id"/>
                        <field name="test_tags" optional="hide"/>
                        <field name="tags_min_version_id" string="Tags Min" optional="hide"/>
                        <field name="tags_max_version_id" string="Tags Max" optional="hide"/>
                        <field name="fixing_pr_id" optional="hide"/>
                        <field name="fixing_pr_alive" optional="hide"/>
                        <field name="fixing_pr_url" widget="url" text="view PR" readonly="1" invisible="not fixing_pr_url"/>
                        <field name="fingerprint" optional="hide"/>
                      </list>
                  </field>
                </page>
                <page string="Analogous Errors" groups="runbot.group_runbot_admin,runbot.group_runbot_error_manager" invisible="not unique_qualifiers">
                  <div class="btn-group">
                    <button class="btn btn-sm btn-primary" type="object" name="action_view_analogous_qualified">
                      View analogous errors
                    </button>
                  </div>
                  <field name="unique_qualifiers" widget="runbotjsonb"/>
                  <field name="analogous_ids" widget="one2many" options="{'not_delete': True, 'no_create': True}" readonly="1">
                    <list decoration-danger="test_tags and (fixing_pr_alive or not fixing_pr_id)"
                          decoration-success="fixing_pr_id and not test_tags and not fixing_pr_alive"
                          decoration-warning="test_tags and fixing_pr_id and not fixing_pr_alive"
                          >
                      <field name="id"/>
                      <field name="name" optional="show" readonly="1"/>
                      <field name="description" optional="hide" readonly="1"/>
                      <field name="first_seen_date" string="First Seen" optional="hide" readonly="1"/>
                      <field name="last_seen_date" string="Last Seen" readonly="1" options="{'link_field': 'last_seen_build_id'}"/>
                      <field name="last_seen_build_id" column_invisible="True"/>
                      <field name="error_count" readonly="1"/>
                      <field name="build_count" readonly="1"/>
                      <field name="team_id"/>
                      <field name="responsible" optional="show"/>
                      <field name="test_tags" optional="hide"/>
                      <field name="fixing_pr_id" optional="hide"/>
                      <field name="fixing_pr_alive" optional="hide"/>
                    </list>
                  </field>
                </page>
                <page string="Analogous Error Contents" groups="runbot.group_runbot_admin,runbot.group_runbot_error_manager" invisible="not unique_qualifiers">
                  <div class="btn-group">
                    <button class="btn btn-sm btn-primary" type="object" name="action_view_analogous_qualified_contents">
                      View Analogous Contents
                    </button>
                  </div>
                  <field name="unique_qualifiers" widget="runbotjsonb"/>
                  <field name="analogous_content_ids" widget="one2many" options="{'not_delete': True, 'no_create': True}" readonly="1">
                    <list string="Error Contents"
                          decoration-danger="test_tags and (fixing_pr_alive or not fixing_pr_id)"
                          decoration-success="fixing_pr_id and not test_tags and not fixing_pr_alive"
                          decoration-warning="test_tags and fixing_pr_id and not fixing_pr_alive"
                          >
                        <field name="error_display_id" optional="show"/>
                        <field name="module_name" optional="show" readonly="1"/>
                        <field name="summary" optional="show" readonly="1"/>
                        <field name="random" string="Random"/>
                        <field name="first_seen_date" string="First Seen" optional="hide" readonly="1"/>
                        <field name="last_seen_date" string="Last Seen" readonly="1"/>
                        <field name="build_count" readonly="1"/>
                        <field name="team_id"/>
                        <field name="test_tags" optional="hide"/>
                        <field name="tags_min_version_id" string="Tags Min" optional="hide"/>
                        <field name="tags_max_version_id" string="Tags Max" optional="hide"/>
                        <field name="fixing_pr_id" optional="hide"/>
                        <field name="fixing_pr_alive" optional="hide"/>
                        <field name="fixing_pr_url" widget="url" text="view PR" readonly="1" invisible="not fixing_pr_url"/>
                        <field name="fingerprint" optional="hide"/>
                      </list>
                  </field>
                </page>
                <page string="Frequency graphs">
                  <group>
                    <group>
                      <field name="graph_history"/>
                      <field name="graph_hourly_recurence"/>
                    </group>
                    <group>
                      <field name="graph_day_of_week_recurence"/>
                      <field name="graph_day_of_month_recurence"/>
                    </group>
                  </group>
                </page>
              </notebook>
          </sheet>
          <chatter/>
        </form>
      </field>
    </record>

    <record id="build_error_form" model="ir.ui.view">
        <field name="name">runbot.build.error.content.form</field>
        <field name="model">runbot.build.error.content</field>
        <field name="arch" type="xml">
          <form>
            <header>
              <button type="object" name="action_qualify" string="Qualify"/>
            </header>
            <sheet>
                <group>
                  <field name="error_id"/>
                </group>
                <group name="build_error_group" string="Base info" col="2">
                  <field name="content" readonly="1"/>
                  <field name="canonical_tag"/>
                  <field name="metadata" readonly="0" widget="runbotjsonb"/>
                  <field name="module_name" readonly="1"/>
                  <field name="function" readonly="1"/>
                  <field name="file_path" readonly="1"/>
                  <field name="qualifiers" readonly="1"/>
                </group>
                <group name="infos" string="" col="2">
                  <group>
                    <field name="version_ids" widget="many2many_tags"/>
                    <field name="trigger_ids" widget="many2many_tags"/>
                    <field name="tag_ids" widget="many2many_tags" readonly="1"/>
                  </group>
                </group>
                <group name="fixer_info" string="More info" col="2">
                  <group>
                    <field name="random"/>
                    <field name="first_seen_date"/>
                    <field name="first_seen_build_id" widget="frontend_url"/>
                  </group>
                  <group>
                    <field name="last_seen_date"/>
                    <field name="last_seen_build_id" widget="frontend_url"/>
                  </group>
                </group>               
                <notebook>
                  <page string="Builds">
                    <field name="build_error_link_ids" widget="one2many" options="{'not_delete': True, 'no_create': True}" readonly="1">
                      <list>
                        <field name="log_date"/>
                        <field name="host" groups="base.group_no_one"/>
                        <field name="dest"/>
                        <field name="version_id"/>
                        <field name="trigger_id"/>
                        <field name="description"/>
                        <field name="error_content_id" widget="many2one" string="Linked Error"/>
                        <field name="build_url" widget="url" readonly="1" text="View build"/>
                      </list>
                    </field>
                  </page>
                  <page string="Similary qualified">
                    <field name="similar_ids" widget="one2many" options="{'not_delete': True, 'no_create': True}" readonly="1">
                      <list>
                        <field name="create_date"/>
                        <field name="module_name"/>
                        <field name="summary"/>
                        <field name="random"/>
                        <field name="build_count"/>
                        <field name="responsible"/>
                        <field name="fixing_commit"/>
                        <field name="id"/>
                        <button type="object" name="get_formview_action" icon="fa-arrow-right" title="View similar error"/>
                      </list>
                    </field>
                  </page>
                  <page string="Debug" groups="base.group_no_one">
                    <group name="build_error_group">
                      <field name="fingerprint" readonly="1"/>
                      <field name="cleaned_content" readonly="1"/>
                      <field name="bundle_ids" widget="many2many_tags"/>
                    </group>
                  </page>
                </notebook>
            </sheet>
            <chatter/>
          </form>
        </field>
    </record>

  <record model="ir.ui.view" id="runbot_error_bulk_wizard_form">
        <field name="name">runbot_error_bulk_wizard</field>
        <field name="model">runbot.error.bulk.wizard</field>
        <field name="arch" type="xml">
          <form>
            <sheet>
              <group name="team_group">
                <field name="team_id"/>
                <field name="responsible_id"/>
              </group>
              <group name="Fix">
                <field name="fixing_pr_id"/>
              </group>
              <group>
                <field name="chatter_comment"/>
              </group>
              <group name="Close">
                <field name="archive"/> 
              </group>
              <footer>
                <button string="Submit" name="action_submit" type="object" class="btn-primary"/>
                <button string="Cancel" class="btn-secondary" special="cancel"/>
              </footer>
            </sheet>
          </form>
        </field>
    </record>

    <record id="runbot_open_bulk_wizard" model="ir.actions.act_window">
        <field name="name">Bulk Update Wizard</field>
        <field name="res_model">runbot.error.bulk.wizard</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
        <field name="view_id" ref="runbot_error_bulk_wizard_form"/>
        <field name="binding_model_id" ref="runbot.model_runbot_build_error"/>
        <field name="binding_view_types">list</field>
    </record>

    <record id="build_error_view_kanban" model="ir.ui.view">
      <field name="name">runbot.build.error.kanban</field>
      <field name="model">runbot.build.error</field>
      <field name="arch" type="xml">
          <kanban default_group_by="state" quick_create="false" default_order="last_seen_date desc">
              <templates>
                <t t-name="card">
                  <widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" invisible="not test_tags"/>
                  <field name="name" class="fw-bold fs-5"/>
                  <group>
                    <div class="d-flex align-items-center">
                      <i class="fa fa-clock-o me-2" title="Date interval from first seen to last seen"/>
                      <field name="first_seen_date" widget="remaining_days"/>
                      <i class="fa fa-long-arrow-right mx-2 oe_read_only" title="to"/>
                      <field name="last_seen_date" widget="remaining_days"/>
                    </div>

                    <div class="d-flex align-items-center gap-1">
                      <i class="fa fa-repeat" title="Number of occurence"/>
                      <field name="error_count"/>
                    </div>

                    <div class="d-flex align-items-center gap-1">
                      <i class="fa fa-code-fork" title="Concerned Odoo versions"/>
                      <field name="version_ids" widget="many2many_tags"/>
                    </div>
                    <div class="d-flex align-items-center gap-1">
                      <i class="fa fa-bullseye" title="Triggers"/>
                      <field name="trigger_ids" widget="many2many_tags"/>
                    </div>
                  </group>

                  <footer>
                    <div class="d-flex align-items-center gap-1">
                      <field name="activity_ids" widget="kanban_activity"/>
                    </div>
                    <div class="d-flex align-items-center gap-1 ms-auto">
                      <i class="fa fa-random text-danger" title="inconsistant" invisible="not random"/>
                      <i class="fa fa-users" title="Responsible team"/>
                      <field name="team_id"/> <i t-if="!record.team_id.raw_value">no team</i>
                      <i class="fa fa-address-card" title="Investigator"/>
                      <field name="customer" widget="many2one_avatar_user"/>
                      <i class="fa fa-wrench" title="Solver"/>
                      <field name="responsible" widget="many2one_avatar_user"/>
                      <field name="fixing_pr_url" widget="url" text="PR" invisible="not fixing_pr_url"/>
                    </div>
                  </footer>
                </t>
              </templates>
          </kanban>
      </field>
    </record>

    <record id="build_error_view_tree" model="ir.ui.view">
      <field name="name">runbot.build.error.list</field>
      <field name="model">runbot.build.error</field>
      <field name="arch" type="xml">
          <list string="Errors"
                decoration-danger="test_tags and (fixing_pr_alive or not fixing_pr_id)"
                decoration-success="fixing_pr_id and not test_tags and not fixing_pr_alive"
                decoration-warning="test_tags and fixing_pr_id and not fixing_pr_alive"
                multi_edit="1"
                >
              <header>
                <button name="%(runbot.runbot_open_bulk_wizard)d" string="Bulk Update" type="action" groups="runbot.group_runbot_admin,runbot.group_runbot_error_manager"/>
                <button name="action_view_errors" string="See all linked errors" type="object" class="oe_highlight"/>
              </header>
              <field name="name" optional="show" readonly="1"/>
              <field name="canonical_tags" optional="hide" readonly="1"/>
              <field name="description" optional="hide" readonly="1"/>
              <field name="random" string="Random"/>
              <field name="first_seen_date" string="First Seen" optional="hide" readonly="1"/>
              <field name="last_seen_date" string="Last Seen" readonly="1" options="{'link_field': 'last_seen_build_id'}"/>
              <field name="last_seen_build_id" column_invisible="True"/>
              <field name="error_count" readonly="1"/>
              <field name="build_count" readonly="1"/>
              <field name="team_id"/>
              <field name="responsible" optional="show"/>
              <field name="test_tags" optional="hide"/>
              <field name="tags_min_version_id" string="Tags Min" optional="hide"/>
              <field name="tags_max_version_id" string="Tags Max" optional="hide"/>
              <field name="fixing_pr_id" optional="hide"/>
              <field name="fixing_pr_alive" optional="hide"/>
              <field name="fixing_pr_url" widget="pull_request_url" text="view PR" readonly="1" invisible="not fixing_pr_url"/>
              <field name="graph_history" optional="show"/>
              <field name="graph_hourly_recurence" optional="hide"/>
              <field name="graph_day_of_week_recurence" optional="hide"/>
              <field name="graph_day_of_month_recurence" optional="hide"/>

          </list>
      </field>
  </record>

    <record id="build_error_content_view_tree" model="ir.ui.view">
        <field name="name">runbot.build.error.content.list</field>
        <field name="model">runbot.build.error.content</field>
        <field name="arch" type="xml">
            <list string="Errors"
                  decoration-danger="test_tags and (fixing_pr_alive or not fixing_pr_id)"
                  decoration-success="fixing_pr_id and not test_tags and not fixing_pr_alive"
                  decoration-warning="test_tags and fixing_pr_id and not fixing_pr_alive"
                  multi_edit="1"
                  create="false"
                  >
                <header>
                  <button name="action_find_duplicates" type="object" string="Find duplicates" display="always"/>
                  <button name="action_qualify" string="Qualify" type="object" groups="runbot.group_runbot_admin,runbot.group_runbot_error_manager"/>
                </header>
                <field name="error_display_id" optional="show"/>
                <field name="canonical_tag" optional="show" readonly="1"/>
                <field name="module_name" optional="hide" readonly="1"/>
                <field name="summary" optional="show" readonly="1"/>
                <field name="random" string="Random"/>
                <field name="first_seen_date" string="First Seen" optional="hide" readonly="1"/>
                <field name="last_seen_date" string="Last Seen" readonly="1"/>
                <field name="build_count" readonly="1"/>
                <field name="team_id"/>
                <field name="test_tags" optional="hide"/>
                <field name="tags_min_version_id" string="Tags Min" optional="hide"/>
                <field name="tags_max_version_id" string="Tags Max" optional="hide"/>
                <field name="fixing_pr_id" optional="hide"/>
                <field name="fixing_pr_alive" optional="hide"/>
                <field name="fixing_pr_url" widget="url" text="view PR" readonly="1" invisible="not fixing_pr_url"/>
                <field name="fingerprint" optional="hide"/>
            </list>
        </field>
    </record>

    <record id="build_error_search_view" model="ir.ui.view">
      <field name="name">runbot.build.error.filter</field>
      <field name="model">runbot.build.error</field>
      <field name="arch" type="xml">
        <search string="Search errors">
          <field name="content"/>
          <field name="canonical_tags"/>
          <field name="version_ids"/>
          <field name="responsible"/>
          <field name="team_id"/>
          <filter string="Assigned to me" name="my_errors" domain="[('responsible', '=', uid)]"/>
          <separator/>
          <filter string="Customer is me" name="my_errors_customer" domain="[('customer', '=', uid)]"/>
          <separator/>
          <filter string="Undeterministic" name="random_error" domain="[('random', '=', True)]"/>
          <filter string="Deterministic" name="random_error" domain="[('random', '=', False)]"/>
          <separator/>
          <filter string="Fixed" name="fixed_errors" domain="[('active', '=', False)]"/>
          <filter string="Not Fixed" name="not_fixed_errors" domain="[('active', '=', True)]"/>
          <separator/>
          <filter string="Not Assigned" name="not_assigned_errors" domain="[('responsible', '=', False)]"/>
          <filter string="Assigned" name="assigned_errors" domain="[('responsible', '!=', False)]"/>
          <separator/>
          <filter string="Having a PR" name="pr_set_errors" domain="[('fixing_pr_id', '!=', False)]"/>
          <filter string="Fixing PR is closed" name="pr_closed_errors" domain="[('fixing_pr_id', '!=', False), ('fixing_pr_id.alive', '=', False)]"/>
          <filter string="Fixing PR is open" name="pr_open_errors" domain="[('fixing_pr_id', '!=', False), ('fixing_pr_id.alive', '=', True)]"/>
          <separator/>
          <filter string="Test Tags" name="test_tagged_errors" domain="[('test_tags', '!=', False)]"/>
          <separator/>
          <filter string="Not seen in one month" name="not_seen_one_month" domain="[('last_seen_date','&lt;', (context_today() - datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"/>
          <searchpanel>
            <field name="team_id" select="multi" string="Assigned Team" icon="fa-users" enable_counters="1"/>
            <field name="customer" select="multi" string="Customer" icon="fa-address-card" enable_counters="1"/>
            <field name="trigger_ids" select="multi" string="Triggers" icon="fa-bullseye" enable_counters="1"/>
          </searchpanel>
        </search>
      </field>
    </record>

    <record id="build_error_content_search_view" model="ir.ui.view">
      <field name="name">runbot.build.error.content.log.filter</field>
      <field name="model">runbot.build.error.content</field>
      <field name="arch" type="xml">
        <search string="Search errors">
          <field name="content"/>
          <field name="module_name"/>
          <field name="function"/>
          <field name="version_ids"/>
          <field name="fingerprint"/>
          <filter name="group_error" string="By error" context="{'group_by':'error_id'}"/>
          <filter string="Undeterministic" name="random_error" domain="[('random', '=', True)]"/>
          <filter string="Deterministic" name="random_error" domain="[('random', '=', False)]"/>
          <separator/>
          <filter string="Qualified" name="qualified_errors" domain="[('qualifiers', '!=', False)]"/>
          <filter string="Not Qualified" name="not_qualified_errors" domain="[('qualifiers', '=', False)]"/>
          <separator/>
          <filter string="Fixed" name="fixed_errors" domain="[('error_id.active', '=', False)]"/>
          <filter string="Not Fixed" name="not_fixed_errors" domain="[('error_id.active', '=', True)]"/>
          <separator/>
          <filter string="Having a PR" name="pr_set_errors" domain="[('fixing_pr_id', '!=', False)]"/>
          <filter string="Fixing PR is closed" name="pr_closed_errors" domain="[('fixing_pr_id', '!=', False), ('fixing_pr_id.alive', '=', False)]"/>
          <filter string="Fixing PR is open" name="pr_open_errors" domain="[('fixing_pr_id', '!=', False), ('fixing_pr_id.alive', '=', True)]"/>
          <separator/>
          <filter string="Test Tags" name="test_tagged_errors" domain="[('test_tags', '!=', False)]"/>
          <separator/>
          <filter string="Not seen in one month" name="not_seen_one_month" domain="[('last_seen_date','&lt;', (context_today() - datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"/>
        </search>
      </field>
    </record>

    <record id="open_view_build_error_tree" model="ir.actions.act_window">
      <field name="name">Errors</field>
      <field name="res_model">runbot.build.error</field>
      <field name="path">error</field>
      <field name="view_mode">list,kanban,form</field>
      <field name="context">{'search_default_not_fixed_errors': True, 'active_test': False}</field>
    </record>

    <record id="open_view_build_error_content_tree" model="ir.actions.act_window">
        <field name="name">Build errors contents</field>
        <field name="path">error_content</field>
        <field name="res_model">runbot.build.error.content</field>
        <field name="view_mode">list,form</field>
        <field name="context">{'search_default_not_fixed_errors': True, 'active_test': False}</field>
    </record>

    <record id="build_error_regex_form" model="ir.ui.view">
        <field name="name">runbot.error.regex.form</field>
        <field name="model">runbot.error.regex</field>
        <field name="arch" type="xml">
          <form>
            <sheet>
              <group name="build_regex_group">
                <field name="regex"/>
                <field name="re_type"/>
                <field name="replacement" invisible="re_type != 'cleaning'"/>
              </group>
            </sheet>
            <chatter/>
          </form>
        </field>
    </record>

    <record id="build_error_regex_tree" model="ir.ui.view">
        <field name="name">runbot.error.regex.list</field>
        <field name="model">runbot.error.regex</field>
        <field name="arch" type="xml">
            <list string="Errors Regexes">
                <field name="sequence" widget="handle"/>
                <field name="regex"/>
                <field name="re_type"/>
                <field name="replacement"/>
            </list>
        </field>
    </record>

    <record id="runbot_regex_search_view" model="ir.ui.view">
      <field name="name">runbot.error.regex.filter</field>
      <field name="model">runbot.error.regex</field>
      <field name="arch" type="xml">
        <search string="Search regex">
          <field name="regex"/>
          <filter string="Filtering regex's" name="filtering_regex" domain="[(['re_type', '=', 'filter'])]"/>
          <filter string="Cleaning regex's" name="clening_regex" domain="[(['re_type', '=', 'cleaning'])]"/>
        </search>
      </field>
    </record>

    <record id="open_view_error_regex" model="ir.actions.act_window">
        <field name="name">Errors regex</field>
        <field name="res_model">runbot.error.regex</field>
        <field name="view_mode">list,form</field>
    </record>

    <record id="action_find_duplicates" model="ir.actions.server">
      <field name="name">Find Duplicates</field>
      <field name="model_id" ref="runbot.model_runbot_build_error_content"/>
      <field name="type">ir.actions.server</field>
      <field name="state">code</field>
      <field name="code">
          action = model._find_duplicates()
      </field>
    </record>

    <record id="build_error_qualify_regex_tree" model="ir.ui.view">
        <field name="name">runbot.error.qualify.regex.list</field>
        <field name="model">runbot.error.qualify.regex</field>
        <field name="arch" type="xml">
            <list string="Qualifying Regexes">
                <field name="sequence" widget="handle"/>
                <field name="regex" readonly="1"/>
                <field name="check_fields" readonly="1"/>
            </list>
        </field>
    </record>

    <record id="build_error_qualify_regex_form" model="ir.ui.view">
        <field name="name">runbot.error.qualify.regex.form</field>
        <field name="model">runbot.error.qualify.regex</field>
        <field name="arch" type="xml">
          <form>
            <header>
              <button type="object" name="action_generate_fields" string="Create corresponding fields"/>
            </header>
            <div class="alert alert-info" role="alert">
              The regular expresion must have at least one named group pattern e.g: <code>'(?P&lt;module&gt;\w+)'</code>
            </div>
            <sheet>
              <group name="Regex And Source">
                <field name="regex"/>
                <field name="check_canonical_tag"/>
                <field name="check_module_name"/>
                <field name="check_file_path"/>
                <field name="check_function"/>
                <field name="check_content"/>
              </group>
              <group>
                <field name="test_ids">
                  <list string="Test Samples" decoration-success="is_matching" decoration-danger="not is_matching">
                    <field name="error_content_id"/>
                    <field name="build_error_summary"/>
                    <field name="expected_result" widget="runbotjsonb"/>
                    <field name="result" widget="runbotjsonb" readonly="1"/>
                    <field name="is_matching" column_invisible="True"/>
                  </list>
                </field>
              </group>
            </sheet>
            <chatter/>
          </form>
        </field>
    </record>

    <record id="runbot_error_qualify_test_form" model="ir.ui.view">
      <field name="name">runbot.error.qualify.test.form</field>
        <field name="model">runbot.error.qualify.test</field>
        <field name="arch" type="xml">
          <form>
            <sheet>
              <group name="Error Sample">
                <field name="error_content_id"/>
                <field name="expected_result" widget="runbotjsonb"/>
              </group>
              <group name="Result">
                <field name="result" widget="runbotjsonb" readonly="1"/>
              </group>
              <group>
                <field name="build_error_content"/>
              </group>
            </sheet>
          </form>
        </field>
    </record>

    <record id="open_view_build_error_qualify_regex_tree" model="ir.actions.act_window">
        <field name="name">Build Errors Qualifying Regexes</field>
        <field name="res_model">runbot.error.qualify.regex</field>
        <field name="view_mode">list,form</field>
    </record>

    <record id="runbot_qualify_regex_search_view" model="ir.ui.view">
      <field name="name">runbot.qualify.regex.filter</field>
      <field name="model">runbot.error.qualify.regex</field>
      <field name="arch" type="xml">
        <search string="Search regex">
          <field name="regex"/>
        </search>
      </field>
    </record>

  </data>
</odoo>
