lunch_orders_views.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="lunch_order_view_search" model="ir.ui.view">
  4. <field name="name">lunch.order.search</field>
  5. <field name="model">lunch.order</field>
  6. <field name="arch" type="xml">
  7. <search string="Search">
  8. <field name="name" string="Product" filter_domain="['|', ('name', 'ilike', self), ('note', 'ilike', self)]"/>
  9. <field name="user_id"/>
  10. <filter name='is_mine' string="My Orders" domain="[('user_id', '=', uid)]"/>
  11. <separator/>
  12. <filter name="not_confirmed" string="Not Received" domain="[('state', '!=', ('confirmed'))]"/>
  13. <filter name="confirmed" string="Received" domain="[('state', '=', 'confirmed')]"/>
  14. <filter name="cancelled" string="Cancelled" domain="[('state', '=', 'cancelled')]"/>
  15. <separator/>
  16. <filter name="date_filter" string="Today" domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]" />
  17. <separator/>
  18. <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
  19. <group expand="0" string="Group By">
  20. <filter name="group_by_user" string="User" context="{'group_by': 'user_id'}"/>
  21. <filter name="group_by_supplier" string="Vendor" context="{'group_by': 'supplier_id'}"/>
  22. <filter name="group_by_date" string="Order Date" context="{'group_by': 'date:day'}" help="Vendor Orders by Date"/>
  23. </group>
  24. </search>
  25. </field>
  26. </record>
  27. <record id="lunch_order_view_tree" model="ir.ui.view">
  28. <field name="name">lunch.order.tree</field>
  29. <field name="model">lunch.order</field>
  30. <field name="arch" type="xml">
  31. <tree string="Order lines Tree" create="false" edit="false" decoration-muted="state == 'cancelled'" class="o_lunch_list" expand="1">
  32. <header>
  33. <button name="action_confirm" type="object" string="Receive"/>
  34. </header>
  35. <field name='date'/>
  36. <field name='supplier_id'/>
  37. <field name='product_id'/>
  38. <field name="display_toppings" class="o_text_overflow"/>
  39. <field name='note' class="o_text_overflow"/>
  40. <field name='user_id'/>
  41. <field name="lunch_location_id"/>
  42. <field name="currency_id" invisible="1"/>
  43. <field name='price' sum="Total" string="Price" widget="monetary"/>
  44. <field name='state' widget="badge" decoration-warning="state == 'new'" decoration-success="state == 'confirmed'" decoration-info="state == 'sent'" decoration-danger="state == 'ordered'"/>
  45. <field name="company_id" groups="base.group_multi_company"/>
  46. <field name="display_reorder_button" invisible="1"/>
  47. <field name="notified" invisible="1"/>
  48. <button name="action_reorder" string="Re-order" type="object" icon="fa-history" attrs="{'invisible': [('display_reorder_button', '=', False)]}" groups="lunch.group_lunch_user"/>
  49. <button name="action_confirm" string="Confirm" type="object" icon="fa-check" attrs="{'invisible': [('state', '!=', 'sent')]}" groups="lunch.group_lunch_manager"/>
  50. <button name="action_cancel" string="Cancel" type="object" icon="fa-times" attrs="{'invisible': [('state', 'in', ['cancelled', 'confirmed'])]}" groups="lunch.group_lunch_manager"/>
  51. <button name="action_reset" string="Reset" type="object" icon="fa-undo" attrs="{'invisible': [('state', '!=', 'cancelled')]}" groups="lunch.group_lunch_manager"/>
  52. <button name="action_notify" string="Send Notification" type="object" icon="fa-envelope" attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('notified', '=', True)]}" groups="lunch.group_lunch_manager"/>
  53. <groupby name="supplier_id">
  54. <field name="show_order_button" invisible="1" />
  55. <field name="show_confirm_button" invisible="1" />
  56. <button string="Send Orders" type="object" name="action_send_orders" attrs="{'invisible': [('show_order_button', '=', False)]}"/>
  57. <button string="Confirm Orders" type="object" name="action_confirm_orders" attrs="{'invisible': [('show_confirm_button', '=', False)]}"/>
  58. </groupby>
  59. </tree>
  60. </field>
  61. </record>
  62. <record id='lunch_order_view_kanban' model='ir.ui.view'>
  63. <field name="name">lunch.order.kanban</field>
  64. <field name="model">lunch.order</field>
  65. <field name="arch" type="xml">
  66. <kanban create="false" edit="false">
  67. <field name="product_id"/>
  68. <field name="note"/>
  69. <field name="state"/>
  70. <field name="user_id"/>
  71. <field name="date"/>
  72. <field name="company_id"/>
  73. <field name="currency_id"/>
  74. <field name="notified"/>
  75. <templates>
  76. <t t-name="kanban-box">
  77. <div class="oe_kanban_global_click">
  78. <div class="o_kanban_record_top">
  79. <div class="o_kanban_record_headings">
  80. <strong class="o_kanban_record_title"><field name="product_id"/></strong>
  81. </div>
  82. <field name="state" widget="label_selection" options="{'classes': {'new': 'default', 'confirmed': 'success', 'cancelled':'danger'}}"/>
  83. </div>
  84. <div>
  85. <field name="note"/>
  86. </div>
  87. <div class="row">
  88. <div class="col-6">
  89. <i class="fa fa-money" role="img" aria-label="Money" title="Money"/> <field name="price"/>
  90. </div>
  91. <div class="col-6 text-end">
  92. <i class="fa fa-clock-o" role="img" aria-label="Date" title="Date"/> <field name="date"/>
  93. </div>
  94. </div>
  95. <div class="row mt4">
  96. <div class="col-6">
  97. <a class="btn btn-sm btn-success" role="button" name="action_order" string="Order" type="object" attrs="{'invisible': [('state', 'in', ['sent', 'ordered', 'confirmed'])]}" groups="lunch.group_lunch_manager">
  98. <i class="fa fa-phone" role="img" aria-label="Order button" title="Order button"/>
  99. </a>
  100. <a class="btn btn-sm btn-primary" role="button" name="action_send" string="Send" type="object" attrs="{'invisible': [('state', '!=', 'ordered')]}" groups="lunch.group_lunch_manager">
  101. <i class="fa fa-paper-plane" role="img" aria-label="Send button" title="Send button"/>
  102. </a>
  103. <a class="btn btn-sm btn-info" role="button" name="action_confirm" string="Receive" type="object" attrs="{'invisible': [('state','!=','sent')]}" groups="lunch.group_lunch_manager">
  104. <i class="fa fa-check" role="img" aria-label="Receive button" title="Receive button"/>
  105. </a>
  106. <a class="btn btn-sm btn-danger" role="button" name="action_cancel" string="Cancel" type="object" attrs="{'invisible': [('state','in', ['cancelled', 'confirmed'])]}" groups="lunch.group_lunch_manager">
  107. <i class="fa fa-times" role="img" aria-label="Cancel button" title="Cancel button"/>
  108. </a>
  109. <a class="btn btn-sm btn-info" role="button" name="action_notify" string="Send Notification" type="object" attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('notified', '=', True)]}" groups="lunch.group_lunch_manager">
  110. <i class="fa fa-envelope" role="img" aria-label="Send notification" title="Send notification"/>
  111. </a>
  112. </div>
  113. <div class="col-6">
  114. <span class="float-end">
  115. <field name="user_id" widget="many2one_avatar_user"/>
  116. </span>
  117. </div>
  118. </div>
  119. </div>
  120. </t>
  121. </templates>
  122. </kanban>
  123. </field>
  124. </record>
  125. <record id="lunch_order_view_pivot" model="ir.ui.view">
  126. <field name="name">lunch.order.pivot</field>
  127. <field name="model">lunch.order</field>
  128. <field name="arch" type="xml">
  129. <pivot sample="1">
  130. <field name="date" type="col"/>
  131. <field name="supplier_id" type="row"/>
  132. </pivot>
  133. </field>
  134. </record>
  135. <record id="lunch_order_view_graph" model="ir.ui.view">
  136. <field name="name">lunch.order.graph</field>
  137. <field name="model">lunch.order</field>
  138. <field name="arch" type="xml">
  139. <graph sample="1">
  140. <field name="product_id"/>
  141. </graph>
  142. </field>
  143. </record>
  144. <record id="lunch_order_action" model="ir.actions.act_window">
  145. <field name="name">My Orders</field>
  146. <field name="res_model">lunch.order</field>
  147. <field name="view_mode">tree,kanban,pivot</field>
  148. <field name="search_view_id" ref="lunch_order_view_search"/>
  149. <field name="context">{"search_default_is_mine":1, "search_default_group_by_date": 1, 'show_reorder_button': True}</field>
  150. <field name="help" type="html">
  151. <p class="o_view_nocontent_empty_folder">
  152. No previous order found
  153. </p><p>
  154. There is no previous order recorded. Click on "My Lunch" and then create a new lunch order.
  155. </p>
  156. </field>
  157. </record>
  158. <record id="lunch_order_action_by_supplier" model="ir.actions.act_window">
  159. <field name="name">Today's Orders</field>
  160. <field name="res_model">lunch.order</field>
  161. <field name="view_mode">tree,kanban</field>
  162. <field name="search_view_id" ref="lunch_order_view_search"/>
  163. <field name="context">{"search_default_group_by_supplier":1, "search_default_date_filter":1}</field>
  164. <field name="help" type="html">
  165. <p class="o_view_nocontent_empty_folder">
  166. Nothing to order today
  167. </p><p>
  168. Here you can see today's orders grouped by vendors.
  169. </p>
  170. </field>
  171. </record>
  172. <record id="lunch_order_action_control_suppliers" model="ir.actions.act_window">
  173. <field name="name">Control Vendors</field>
  174. <field name="res_model">lunch.order</field>
  175. <field name="view_mode">tree,kanban,pivot</field>
  176. <field name="search_view_id" ref="lunch_order_view_search"/>
  177. <field name="context">{"search_default_group_by_supplier":1}</field>
  178. <field name="help" type="html">
  179. <p class="o_view_nocontent_empty_folder">
  180. No lunch order yet
  181. </p><p>
  182. Summary of all lunch orders, grouped by vendor and by date.
  183. </p><p>
  184. Click on the <span class="fa fa-phone text-success" role="img" aria-label="Order button" title="Order button"/> to announce that the order is ordered.<br/>
  185. Click on the <span class="fa fa-check text-success" role="img" aria-label="Receive button" title="Receive button"/> to announce that the order is received.<br/>
  186. Click on the <span class="fa fa-times-circle text-danger" role="img" aria-label="Cancel button" title="Cancel button"/> red X to announce that the order isn't available.
  187. </p>
  188. </field>
  189. </record>
  190. <record id="lunch_order_view_form" model="ir.ui.view">
  191. <field name="name">lunch.order.view.form</field>
  192. <field name="model">lunch.order</field>
  193. <field name="arch" type="xml">
  194. <form class="flex-column">
  195. <field name="company_id" invisible="1"/>
  196. <field name="date" invisible="1"/>
  197. <field name="currency_id" invisible="1"/>
  198. <field name="quantity" invisible="1"/>
  199. <field name="product_id" invisible="1"/>
  200. <field name="state" invisible="1"/>
  201. <field name="category_id" invisible="1"/>
  202. <field name="available_toppings_1" invisible="1"/>
  203. <field name="available_toppings_2" invisible="1"/>
  204. <field name="available_toppings_3" invisible="1"/>
  205. <field name="supplier_id" invisible="1"/>
  206. <field name="order_deadline_passed" invisible="1"/>
  207. <field name="available_today" invisible="1"/>
  208. <div class="d-flex">
  209. <div class="flex-grow-0 pe-5">
  210. <field name="image_1920" widget="image" class="o_lunch_image" options="{'image_preview': 'image_128'}"/>
  211. </div>
  212. <div class="flex-grow-1 pe-5">
  213. <h2><field name="name"/></h2>
  214. <h3 class="pt-3"><field name="price"/></h3>
  215. </div>
  216. </div>
  217. <div class="o_lunch_wizard">
  218. <div class="row py-3 py-md-0">
  219. <div class="o_td_label col-3 col-md-2">
  220. <field name="topping_label_1" nolabel="1" attrs="{'invisible': [('available_toppings_1', '=', False)]}" class="o_form_label"/>
  221. </div>
  222. <div class="col-9 col-md-10">
  223. <field name="topping_ids_1" attrs="{'invisible': [('available_toppings_1', '=', False)]}" widget="many2many_checkboxes" nolabel="1" domain="[('topping_category', '=', 1), ('supplier_id', '=', supplier_id)]" class="o_field_widget o_quick_editable"/>
  224. </div>
  225. </div>
  226. <div class="row">
  227. <div class="o_td_label col-3 col-md-2">
  228. <field name="topping_label_2" nolabel="1" attrs="{'invisible': [('available_toppings_2', '=', False)]}" class="o_form_label"/>
  229. </div>
  230. <div class="col-9 col-md-10">
  231. <field name="topping_ids_2" attrs="{'invisible': [('available_toppings_2', '=', False)]}" widget="many2many_checkboxes" nolabel="1" domain="[('topping_category', '=', 2), ('supplier_id', '=', supplier_id)]" class="o_field_widget o_quick_editable"/>
  232. </div>
  233. </div>
  234. <div class="row">
  235. <div class="o_td_label col-3 col-md-2">
  236. <field name="topping_label_3" nolabel="1" attrs="{'invisible': [('available_toppings_3', '=', False)]}" class="o_form_label"/>
  237. </div>
  238. <div class="col-9 col-md-10">
  239. <field name="topping_ids_3" attrs="{'invisible': [('available_toppings_3', '=', False)]}" widget="many2many_checkboxes" nolabel="1" domain="[('topping_category', '=', 3), ('supplier_id', '=', supplier_id)]" class="o_field_widget o_quick_editable"/>
  240. </div>
  241. </div>
  242. <div class="row">
  243. <div class="o_td_label col-3 col-md-2">
  244. <label for="product_description" class="o_form_label"/>
  245. </div>
  246. <div class="col-9 col-md-10">
  247. <field name="product_description" nolabel="1" class="o_field_widget o_quick_editable"/>
  248. </div>
  249. </div>
  250. <div class="row">
  251. <div class="o_td_label col-3 col-md-2">
  252. <label for="note" class="o_form_label" />
  253. </div>
  254. <div class="col-9 col-md-10">
  255. <field name="note" nolabel="1" placeholder="Information, allergens, ..." class="o_field_widget o_quick_editable"/>
  256. </div>
  257. </div>
  258. <div class="row" attrs="{'invisible': [('order_deadline_passed', '=', False)]}">
  259. <div class="col-12">
  260. <div class="alert alert-warning" role="alert">
  261. The orders for this vendor have already been sent.
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. <footer>
  267. <button string="Save" special="save" data-hotkey="v" class="oe_highlight" invisible="not context.get('active_id', False)"/>
  268. <button string="Add To Cart" name="add_to_cart" type="object" class="oe_highlight" invisible="context.get('active_id', False)" attrs="{'invisible': [('order_deadline_passed', '=', True)]}" data-hotkey="w"/>
  269. <button string="Discard" special="cancel" data-hotkey="z"/>
  270. </footer>
  271. </form>
  272. </field>
  273. </record>
  274. </odoo>