<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>

    <record id="view_project_task_form" model="ir.ui.view">
      <field name="name">project.task.form</field>
      <field name="model">project.task</field>
      <field name="inherit_id" ref="project.view_task_form2"/>
      <field name="arch" type="xml">
        <xpath expr="//field[@name='partner_id']" position="replace">
          <field name="partner_id" invisible="1"/>
        </xpath>
        <xpath expr="//field[@name='date_last_stage_update']" position="replace">
          <field name="date_last_stage_update" string="Última actualización de la etapa" readonly="1"/>
        </xpath>
        <field name="work_ids" position="before">
          <label for="activity_ids" string="Activities"/>
          <field name="activity_ids">
            <tree editable="top" colors="gray:state == 'cancel';blue:state == 'pending'">
              <field name="sequence" widget="handle"/>
              <field name="name"/>
              <field name="user_id" required="True"/>
              <field name="planned_date"/>
              <field name="done_date"/>
              <field name="state"/>
              <field name="hex_value" invisible="1"/>
              <button name="action_done" string="Done" type="object" icon="gtk-go-forward" help="Done" attrs="{'invisible':[('state','!=','pending'),('state','!=','cancel')]}"/>
              <button name="action_done" string="Pending" type="object" icon="gtk-go-back" help="Pending" attrs="{'invisible':[('state','!=','done')]}"/>
              <button name="action_cancel" string="Cancel" type="object" icon="gtk-cancel" help="Cancel" attrs="{'invisible':[('state','=','cancel')]}"/>
              <field name="description"/>
            </tree>
          </field>
        </field>
      </field>
    </record>

    <record id="view_project_task_kanban" model="ir.ui.view">
      <field name="name">project.task.kanban</field>
      <field name="model">project.task</field>
      <field name="inherit_id" ref="project.view_task_kanban"/>
      <field name="arch" type="xml">
        <field name="categ_ids" position="after">
          <field name="activities_progress"/>
          <field name="activity_ids" invisible="1"/>
        </field>
        <xpath expr="//div[@class='pull-left']" position="before">
          <div class="pull-left" groups="base.group_user">
            <field name="activities_progress" attrs="{'invisible':[('activity_ids', '=', [])]}" widget="sparkline_bar"/>
          </div>
        </xpath>
        <xpath expr="//ul[@class='oe_dropdown_menu']" position="replace">
          <ul class="oe_dropdown_menu">
            <t t-if="widget.view.is_action_enabled('edit')">
              <li>
                <a type="edit">Edit...</a>
              </li>
            </t>
            <t t-if="widget.view.is_action_enabled('delete')">
              <li>
                <a type="delete">Delete</a>
              </li>
            </t>
            <li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
          </ul>
        </xpath>
        <xpath expr="//field[@name='categ_ids']" position="attributes">
          <attribute name="widget">many2many_tags</attribute>
        </xpath>
      </field>
    </record>
  </data>
</openerp>
