You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
10 KiB

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <odoo>
  3. <!--
  4. VIEWS
  5. -->
  6. <!-- FORM VIEW -->
  7. <record id="mail_activity_view_form_board" model="ir.ui.view">
  8. <field name="name">mail.activity.boards.view.form</field>
  9. <field name="model">mail.activity</field>
  10. <field name="priority">30</field>
  11. <field name="arch" type="xml">
  12. <form string="Activity Form" create="false" edit="false" delete="false">
  13. <sheet string="Activity">
  14. <button name="open_origin" type="object" class="centre oe_link" nolabel="1">
  15. <h1><field name="res_name"/></h1>
  16. </button>
  17. <field name="activity_category" invisible="1" />
  18. <field name="res_model" invisible="1"/>
  19. <field name="res_model_id" invisible="1"/>
  20. <field name="res_id" invisible="1"/>
  21. <group>
  22. <group>
  23. <field name="activity_type_id" required="1" options="{'no_create': True, 'no_open': True}"/>
  24. <field name="res_model_id_name"/>
  25. <field name="calendar_event_id" invisible="1"/>
  26. <field name="create_date" invisible="1"/>
  27. </group>
  28. <group>
  29. <field name="date_deadline"
  30. attrs="{'invisible': [('activity_category', '=', 'meeting')]}"/>
  31. <field name="calendar_event_id_start" string="Start meeting"
  32. attrs="{'invisible': [('calendar_event_id','=', False)]}"/>
  33. <field name="duration" widget="float_time"
  34. attrs="{'invisible': ['|',('duration', '=', False),
  35. ('calendar_event_id','=', False)]}"/>
  36. <field name="user_id" options="{'no_open': True}"/>
  37. </group>
  38. </group>
  39. <group attrs="{'invisible': ['|',('calendar_event_id','=', False),('calendar_event_id_partner_ids','=', False)]}">
  40. <field name="calendar_event_id_partner_ids" mode="kanban"/>
  41. </group>
  42. <group>
  43. <field name="summary" placeholder="e.g. Discuss proposal"/>
  44. <field name="note" placeholder="Log a note..."/>
  45. </group>
  46. </sheet>
  47. </form>
  48. </field>
  49. </record>
  50. <!-- TREE VIEW -->
  51. <record id="mail_activity_view_tree" model="ir.ui.view">
  52. <field name="name">mail.activity.boards.view.tree</field>
  53. <field name="model">mail.activity</field>
  54. <field name="inherit_id" ref="mail.mail_activity_view_tree"/>
  55. <field name="arch" type="xml">
  56. <xpath expr="//tree" position="attributes">
  57. <attribute name="default_order"/>
  58. <attribute name="decoration-danger">(date_deadline &lt; current_date)</attribute>
  59. <attribute name="decoration-warning">(date_deadline == current_date)</attribute>
  60. <attribute name="decoration-success">(date_deadline &gt; current_date)</attribute>
  61. </xpath>
  62. </field>
  63. </record>
  64. <!-- KANBAN VIEW -->
  65. <record id="mail_activity_view_kanban" model="ir.ui.view">
  66. <field name="name">mail.activity.boards.view.kanban</field>
  67. <field name="model">mail.activity</field>
  68. <field name="priority" eval="10"/>
  69. <field name="arch" type="xml">
  70. <kanban default_group_by="activity_type_id" class="_kanban_small_column o_opportunity_kanban" create="0" _order="date_deadline"
  71. group_create="false" group_delete="false" group_edit="false">
  72. <field name="user_id"/>
  73. <field name="res_id"/>
  74. <field name="res_name"/>
  75. <field name="res_model"/>
  76. <field name="summary"/>
  77. <field name="date_deadline"/>
  78. <field name="state"/>
  79. <field name="icon"/>
  80. <field name="activity_type_id"/>
  81. <field name="activity_category"/>
  82. <templates>
  83. <t t-name="kanban-box">
  84. <div t-attf-class="oe_kanban_content oe_kanban_global_click">
  85. <div class="oe_kanban_content">
  86. <div>
  87. <strong class="o_kanban_record_subtitle">
  88. <span t-attf-class="fa #{record.icon.raw_value}" />
  89. <field name="summary"/>
  90. </strong>
  91. </div>
  92. <div>
  93. <strong class="o_kanban_record_title"><field name="res_name"/></strong>
  94. </div>
  95. <div class="o_kanban_record_bottom">
  96. <div class="oe_kanban_bottom_left">
  97. <t t-set="act_date" t-value="new Date(record.date_deadline.raw_value)"/>
  98. <t t-if="act_date &lt; (new Date())">
  99. <span t-attf-class="text-danger"><i class="fa fa-clock-o"/></span>
  100. <t t-if="record.activity_category.raw_value!='meeting'">
  101. <span t-attf-class="text-danger">
  102. <field name="date_deadline" t-options='{"widget": "date"}'/>
  103. </span>
  104. </t>
  105. <t t-else="">
  106. <span t-attf-class="text-danger">
  107. <field name="calendar_event_id_start" t-options='{"widget": "date"}'/>
  108. </span>
  109. </t>
  110. </t>
  111. <t t-else="">
  112. <span><i class="fa fa-clock-o"/></span>
  113. <t t-if="record.activity_category.raw_value!='meeting'">
  114. <span>
  115. <field name="date_deadline" t-options='{"widget": "date"}'/>
  116. </span>
  117. </t>
  118. <t t-else="">
  119. <field name="calendar_event_id_start" t-options='{"widget": "date"}'/>
  120. </t>
  121. </t>
  122. </div>
  123. <div class="oe_kanban_bottom_right">
  124. <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)"
  125. t-att-title="record.user_id.value"
  126. t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </t>
  132. </templates>
  133. </kanban>
  134. </field>
  135. </record>
  136. <!-- SEARCH VIEW -->
  137. <record id="mail_activity_view_search" model="ir.ui.view">
  138. <field name="name">mail.activity.boards.view.search</field>
  139. <field name="model">mail.activity</field>
  140. <field name="inherit_id" ref="mail.mail_activity_view_search"/>
  141. <field name="priority" eval="2"/>
  142. <field name="mode">primary</field>
  143. <field name="arch" type="xml">
  144. <xpath expr='//field[@name="res_model_id"]' position='before'>
  145. <field name="user_id"/>
  146. <field name="res_name" string="Origin"/>
  147. </xpath>
  148. <xpath expr='//filter[@name="activities_my"]' position='after'>
  149. <filter string="Act. next month" name="activities_month"
  150. domain="[('date_deadline', '&lt;', (context_today()+datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"
  151. help="Show activities scheduled for next month."/>
  152. <filter string="Act. next 6 months" name="activities_6_month"
  153. domain="[('date_deadline', '&lt;', (context_today()+datetime.timedelta(days=180)).strftime('%Y-%m-%d'))]"
  154. help="Show activities scheduled for next 6 months."/>
  155. <separator/>
  156. </xpath>
  157. <xpath expr='//search/group' position='inside'>
  158. <filter string="User" name='assigned_user' context="{'group_by':'user_id'}"/>
  159. <filter string="Origin" name='origin' context="{'group_by': 'res_model_id'}"/>
  160. </xpath>
  161. </field>
  162. </record>
  163. <!--
  164. ACTION
  165. -->
  166. <record model="ir.actions.act_window" id="open_boards_activities">
  167. <field name="name">Activities</field>
  168. <field name="res_model">mail.activity</field>
  169. <field name="view_type">form</field>
  170. <field name="view_mode">kanban,form</field>
  171. <field name="domain">[]</field>
  172. <field name="context">{}</field>
  173. <field name="view_ids"
  174. eval="[(5, 0, 0),
  175. (0, 0, {'view_mode': 'kanban', 'view_id': ref('mail_activity_view_kanban')}),
  176. (0, 0, {'view_mode': 'tree', 'view_id': ref('mail_activity_view_tree')}),
  177. (0, 0, {'view_mode': 'form', 'view_id': ref('mail_activity_view_form_board')}),
  178. (0, 0, {'view_mode': 'calendar'}),
  179. (0, 0, {'view_mode': 'pivot'}),
  180. (0, 0, {'view_mode': 'graph'})]"/>
  181. <field name="search_view_id" ref="mail_activity_view_search"/>
  182. </record>
  183. <!--
  184. Menus
  185. -->
  186. <menuitem
  187. id="board_menu_activities"
  188. name="Activities"
  189. parent="base.menu_board_root"
  190. action="open_boards_activities"
  191. sequence="1"/>
  192. </odoo>