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"></attribute>
  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" width="24" height="24" class="oe_kanban_avatar"/>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </t>
  131. </templates>
  132. </kanban>
  133. </field>
  134. </record>
  135. <!-- SEARCH VIEW -->
  136. <record id="mail_activity_view_search" model="ir.ui.view">
  137. <field name="name">mail.activity.boards.view.search</field>
  138. <field name="model">mail.activity</field>
  139. <field name="inherit_id" ref="mail.mail_activity_view_search"/>
  140. <field name="priority" eval="2"/>
  141. <field name="mode">primary</field>
  142. <field name="arch" type="xml">
  143. <xpath expr='//field[@name="res_model_id"]' position='before'>
  144. <field name="user_id"/>
  145. <field name="res_name" string="Origin"/>
  146. </xpath>
  147. <xpath expr='//filter[@name="activities_my"]' position='after'>
  148. <filter string="Act. next month" name="activities_month"
  149. domain="[('date_deadline', '&lt;', (context_today()+datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"
  150. help="Show activities scheduled for next month."/>
  151. <filter string="Act. next 6 months" name="activities_6_month"
  152. domain="[('date_deadline', '&lt;', (context_today()+datetime.timedelta(days=180)).strftime('%Y-%m-%d'))]"
  153. help="Show activities scheduled for next 6 months."/>
  154. <separator/>
  155. </xpath>
  156. <xpath expr='//search/group' position='inside'>
  157. <filter string="User" context="{'group_by':'user_id'}"/>
  158. <filter string="Origin" context="{'group_by': 'res_model_id'}"/>
  159. </xpath>
  160. </field>
  161. </record>
  162. <!--
  163. ACTION
  164. -->
  165. <record model="ir.actions.act_window" id="open_boards_activities">
  166. <field name="name">Activities</field>
  167. <field name="res_model">mail.activity</field>
  168. <field name="view_type">form</field>
  169. <field name="view_mode">kanban,form</field>
  170. <field name="domain">[]</field>
  171. <field name="context">{}</field>
  172. <field name="view_ids"
  173. eval="[(5, 0, 0),
  174. (0, 0, {'view_mode': 'kanban', 'view_id': ref('mail_activity_view_kanban')}),
  175. (0, 0, {'view_mode': 'tree', 'view_id': ref('mail_activity_view_tree')}),
  176. (0, 0, {'view_mode': 'form', 'view_id': ref('mail_activity_view_form_board')}),
  177. (0, 0, {'view_mode': 'calendar'}),
  178. (0, 0, {'view_mode': 'pivot'}),
  179. (0, 0, {'view_mode': 'graph'})]"/>
  180. <field name="search_view_id" ref="mail_activity_view_search"/>
  181. </record>
  182. <!--
  183. Menus
  184. -->
  185. <menuitem
  186. id="board_menu_activities"
  187. name="Activities"
  188. parent="base.menu_board_root"
  189. action="open_boards_activities"
  190. sequence="1"/>
  191. </odoo>