<odoo>
  <data>
      <record id="repo_trigger_form" model="ir.ui.view">
        <field name="name">runbot.trigger.form</field>
        <field name="model">runbot.trigger</field>
        <field name="arch" type="xml">
          <form>
            <header>
            </header>
            <sheet>
              <widget name="web_ribbon" title="Archived" bg_color="bg-danger" invisible="active"/>
              <field name="active" invisible="1"/>
              <group name="Base config">
                <group>
                  <field name="name"/>
                  <field name="sequence"/>
                  <field name="category_id" required='1'/>
                  <field name="project_id" default=""/>
                  <field name="config_id"/>
                  <field name="config_data" widget="runbotjsonb"/>
                  <field name="report_view_id"/>
                </group>
                <group>
                  <field name="description"/>
                  <field name="batch_dependent"/>
                  <field name="upgrade_dumps_trigger_id"/>
                  <field name="upgrade_step_id"/>
                  <field name="version_domain" widget="domain" options="{'model': 'runbot.version', 'in_dialog': True}"/>
                </group>
              </group>
              <group>
                <group string="Repositories">
                  <field name="repo_ids" nolabel="1" colspan="2"/>
                </group>
                <group string="Dependencies">
                  <field name="dependency_ids" nolabel="1" colspan="2"/>
                </group>
                <group string="Starts after" invisible="manual" colspan="2">
                  <field 
                      name="starts_after_ids"
                      domain="[('category_id', '=', category_id), ('manual', '=', False), ('project_id', '=', project_id), ('id', '!=', id), ('id', 'not in', starts_before_ids)]"
                      widget="many2many_tags">
                  </field>
                </group>
                <group string="Starts before" invisible="manual" colspan="2">
                  <field 
                      name="starts_before_ids"
                      domain="[('category_id', '=', category_id), ('manual', '=', False), ('project_id', '=', project_id), ('id', '!=', id), ('id', 'not in', starts_after_ids)]"
                      widget="many2many_tags">
                  </field>
                </group>
                <group string="Module filters">
                  <field name="module_filters" nolabel="1" colspan="4">
                    <list string="Module filters" editable="bottom">
                      <field name="repo_id"  domain="['|', ('id', 'in', parent.repo_ids), ('id', 'in', parent.dependency_ids)]"/>
                      <field name="modules"/>
                      <field name="description"/>
                    </list>
                  </field>
                </group>
                <button class="btn btn-sm btn-primary" type="object" name="action_test_modules_filters" title="Test filters">List modules</button>
              </group>
              <group>
                <group>
                  <field name="hide"/>
                  <field name="manual"/>
                  <field name="restore_trigger_id"/>
                </group>
                <group>
                  <field name="ci_context"/>
                  <field name="ci_url"/>
                  <field name="ci_description"/>
                  <field name="ci_send_all"/>
                </group>
              </group>
              <group string="Managing Team (nightly failure, manual start, ...)"></group>
              <field name="team_ids">
                <list>
                  <field name="name"/>
                  <field name="github_team"/>
                  <field name="user_ids" widget="many2many_tags"/>
                </list>
              </field>
            </sheet>
            <chatter/>
          </form>
        </field>
      </record>

      <record id="trigger_view_tree" model="ir.ui.view">
        <field name="name">runbot.trigger.list</field>
        <field name="model">runbot.trigger</field>
        <field name="arch" type="xml">
            <list string="Repositories">
                <field name="name"/>
                <field name="category_id"/>
                <field name="project_id"/>
                <field name="config_id"/>
                <field name="ci_context"/>
                <field name="repo_ids" widget="many2many_tags"/>
                <field name="dependency_ids" widget="many2many_tags"/>
                <field name="starts_after_ids" widget="many2many_tags"/>
                <field name="manual"/>
            </list>
        </field>
      </record>
    
      <record id="repo_trigger_dependency_form" model="ir.ui.view">
        <field name="name">runbot.trigger.dependency.form</field>
        <field name="model">runbot.trigger.dependency</field>
        <field name="arch" type="xml">
          <form>
            <sheet>
              <group>
                <field name="dependency_id"/>
                <field name="dependant_id"/>
              </group>
            </sheet>
          </form>
        </field>
      </record>

      <record id="repo_trigger_dependency_tree" model="ir.ui.view">
        <field name="name">runbot.trigger.dependency.list</field>
        <field name="model">runbot.trigger.dependency</field>
        <field name="arch" type="xml">
          <list>
            <field name="dependency_id"/>
            <field name="dependant_id"/>
          </list>
        </field>
      </record>


      <record id="repo_trigger_category_form" model="ir.ui.view">
        <field name="name">runbot.category.form</field>
        <field name="model">runbot.category</field>
        <field name="arch" type="xml">
          <form>
            <sheet>
              <group name="category_group">
                <field name="name"/>
                <field name="icon"/>
                <field name="view_id"/>
              </group>
            </sheet>
          </form>
        </field>
      </record>

      <record id="repo_form" model="ir.ui.view">
        <field name="name">runbot.repo.form</field>
        <field name="model">runbot.repo</field>
        <field name="arch" type="xml">
          <form>
            <header>
            </header>
            <sheet>
              <group string="Base values">
                <group>
                  <field name="name"/>
                  <field name="project_id"/>
                  <field name="sequence"/>
                  <field name="mode"/>
                </group>
                <group>
                  <field name="modules"/>
                  <field name="server_files"/>
                  <field name="manifest_files"/>
                  <field name="addons_paths"/>
                  <field name="upgrade_paths"/>
                </group>
                <group colspan="4">
                  <field name="remote_ids">
                    <list string="Remotes" editable="bottom">
                      <field name="name"/>
                      <field name="sequence"/>
                      <field name="fetch_heads" string="Branch"/>
                      <field name="fetch_pull" string="PR"/>
                      <field name="send_status"/>
                      <field name="token" password="True"/>
                    </list>
                  </field>
                </group>
              </group>
              <group string="Advanced options">
                <group>
                  <field name="forbidden_regex"/>
                  <field name="invalid_branch_message"/>
                </group>
                <group>
                  <field name="identity_file"/>
                  <field name="single_version"/>
                </group>

                <group string="debug">
                  <field name="hook_time" groups="base.group_no_one"/>
                </group>
              </group>
            </sheet>
            <chatter/>
          </form>
        </field>
    </record>

    <record id="remote_form" model="ir.ui.view">
        <field name="name">runbot.remote.form</field>
        <field name="model">runbot.remote</field>
        <field name="arch" type="xml">
          <form>
            <header>
              <button name="action_check_token" string="Check token" type="object" class="oe_highlight" groups="runbot.group_runbot_admin"/>
            </header>
            <sheet>
              <group name="repo_group">
                <field name="name"/>
                <field name="sequence"/>
                <field name="repo_id"/>
                <field name="token"/>
                <field name="fetch_pull"/>
                <field name="fetch_heads"/>
                <field name="send_status"/>
              </group>
            </sheet>

            <chatter/>
          </form>
        </field>
    </record>

    <record id="remote_view_tree" model="ir.ui.view">
        <field name="name">runbot.remote.list</field>
        <field name="model">runbot.remote</field>
        <field name="arch" type="xml">
            <list string="Repositories">
                <field name="name"/>
                <field name="repo_id"/>
                <field name="fetch_pull"/>
                <field name="fetch_heads"/>
                <field name="send_status"/>
            </list>
        </field>
    </record>

    <record id="repo_view_tree" model="ir.ui.view">
        <field name="name">runbot.repo.list</field>
        <field name="model">runbot.repo</field>
        <field name="arch" type="xml">
            <list string="Repositories">
                <field name="sequence" widget="handle"/>
                <field name="name"/>
            </list>
        </field>
    </record>

    <record id="runbot_repos_action" model="ir.actions.act_window">
        <field name="name">Repositories</field>
        <field name="res_model">runbot.repo</field>
        <field name="view_mode">list,form</field>
    </record>

    <record id="runbot_triggers_action" model="ir.actions.act_window">
      <field name="name">Triggers</field>
      <field name="res_model">runbot.trigger</field>
      <field name="view_mode">list,form</field>
  </record>

  <record id="runbot_triggers_dependency_action" model="ir.actions.act_window">
      <field name="name">Triggers dependency</field>
      <field name="res_model">runbot.trigger.dependency</field>
      <field name="view_mode">list,form</field>
  </record>

    <record id="runbot_remotes_action" model="ir.actions.act_window">
        <field name="name">Remotes</field>
        <field name="res_model">runbot.remote</field>
        <field name="view_mode">list,form</field>
    </record>

    <record id="runbot_triggers_category_action" model="ir.actions.act_window">
        <field name="name">Trigger Categories</field>
        <field name="res_model">runbot.category</field>
        <field name="view_mode">list,form</field>
    </record>

  </data>
</odoo>
