lunch_product_views.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="lunch_product_view_search" model="ir.ui.view">
  4. <field name="name">lunch.product.search</field>
  5. <field name="model">lunch.product</field>
  6. <field name="arch" type="xml">
  7. <search string="Product Search">
  8. <field name="name" string="Product"/>
  9. <field name="category_id" string="Category"/>
  10. <field name="supplier_id"/>
  11. <field name="description"/>
  12. <separator/>
  13. <filter name="available_today" string="Available Today" domain="[('supplier_id.available_today', '=', True)]"/>
  14. <separator/>
  15. <filter name="available_on_mon" string="Monday" domain="[('supplier_id.mon', '=', True)]"/>
  16. <filter name="available_on_tue" string="Tuesday" domain="[('supplier_id.tue', '=', True)]"/>
  17. <filter name="available_on_wed" string="Wednesday" domain="[('supplier_id.wed', '=', True)]"/>
  18. <filter name="available_on_thu" string="Thursday" domain="[('supplier_id.thu', '=', True)]"/>
  19. <filter name="available_on_fri" string="Friday" domain="[('supplier_id.fri', '=', True)]"/>
  20. <filter name="available_on_sat" string="Saturday" domain="[('supplier_id.sat', '=', True)]"/>
  21. <filter name="available_on_sun" string="Sunday" domain="[('supplier_id.sun', '=', True)]"/>
  22. <separator/>
  23. <filter name="inactive" string="Archived" domain="[('active', '=', False)]"/>
  24. <group expand="0" string="Group By">
  25. <filter name="group_by_supplier" string="Vendor" context="{'group_by': 'supplier_id'}"/>
  26. <filter name="group_by_category" string="Category" context="{'group_by': 'category_id'}"/>
  27. </group>
  28. <searchpanel>
  29. <field name="category_id" select="multi" string="Categories" icon="fa-cutlery" color="#875A7B" enable_counters="1"/>
  30. <field name="supplier_id" select="multi" string="Vendors" icon="fa-truck" enable_counters="1"/>
  31. </searchpanel>
  32. </search>
  33. </field>
  34. </record>
  35. <record id="lunch_product_view_tree" model="ir.ui.view">
  36. <field name="name">lunch.product.tree</field>
  37. <field name="model">lunch.product</field>
  38. <field name="arch" type="xml">
  39. <tree string="Products Tree">
  40. <field name="currency_id" invisible="1"/>
  41. <field name="name"/>
  42. <field name="category_id"/>
  43. <field name="supplier_id"/>
  44. <field name="company_id" groups="base.group_multi_company"/>
  45. <field name="description"/>
  46. <field name="price" widget="monetary"/>
  47. </tree>
  48. </field>
  49. </record>
  50. <record id="lunch_product_view_tree_order" model="ir.ui.view">
  51. <field name="name">lunch.product.tree.order</field>
  52. <field name="inherit_id" ref="lunch_product_view_tree"/>
  53. <field name="model">lunch.product</field>
  54. <field name="mode">primary</field>
  55. <field name="arch" type="xml">
  56. <xpath expr="//tree" position="attributes">
  57. <attribute name="js_class">lunch_list</attribute>
  58. <attribute name="create">0</attribute>
  59. </xpath>
  60. </field>
  61. </record>
  62. <record id="lunch_product_view_form" model="ir.ui.view">
  63. <field name="name">lunch.product.form</field>
  64. <field name="model">lunch.product</field>
  65. <field name="arch" type="xml">
  66. <form string="Products Form">
  67. <field name="company_id" invisible="1"/>
  68. <field name="currency_id" invisible="1"/>
  69. <sheet>
  70. <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
  71. <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
  72. <div class="oe_title">
  73. <label for="name" class="oe-edit-only"/>
  74. <h1>
  75. <field name='name'/>
  76. </h1>
  77. </div>
  78. <group>
  79. <group>
  80. <field name="active" invisible="1"/>
  81. <field name='category_id'/>
  82. <field name='supplier_id'/>
  83. <field name='price' widget="monetary"/>
  84. </group>
  85. <group>
  86. <field name="new_until"/>
  87. <field name="company_id" groups="base.group_multi_company"/>
  88. </group>
  89. <label for="description"/>
  90. <field name='description'/>
  91. </group>
  92. </sheet>
  93. </form>
  94. </field>
  95. </record>
  96. <record id="view_lunch_product_kanban_order" model="ir.ui.view">
  97. <field name="name">lunch.product.kanban</field>
  98. <field name="model">lunch.product</field>
  99. <field name="priority">999</field>
  100. <field name="arch" type="xml">
  101. <kanban js_class="lunch_kanban" create="0" edit="0" group_create="0" class="o_kanban_mobile">
  102. <field name="id"/>
  103. <field name="name"/>
  104. <field name="category_id"/>
  105. <field name="supplier_id"/>
  106. <field name="description"/>
  107. <field name="currency_id"/>
  108. <field name="company_id"/>
  109. <field name="is_new"/>
  110. <templates>
  111. <t t-name="kanban-box">
  112. <div class="oe_kanban_global_click o_kanban_record_has_image_fill">
  113. <field name="image_128" class="o_lunch_image o_kanban_image_fill_left" options="{'placeholder': '/lunch/static/img/lunch.png', 'size': [94, 94]}" widget="image"/>
  114. <div class="oe_kanban_details ml8">
  115. <div class="o_kanban_record_top">
  116. <div class="o_kanban_record_headings">
  117. <strong class="o_kanban_record_title">
  118. <div class="d-flex align-items-center justify-content-between">
  119. <div>
  120. <field class="pe-1" name="is_favorite" widget="boolean_favorite" nolabel="1"/>
  121. <strong><span t-esc="record.name.value"/></strong>
  122. </div>
  123. <div class="text-odoo">
  124. <div t-if="record.is_new.raw_value" class="o_lunch_new_product me-1 py-1 fs-6 badge rounded-pill text-bg-success">
  125. New
  126. </div>
  127. <field name="price" widget="monetary"/>
  128. </div>
  129. </div>
  130. </strong>
  131. <span class="o_kanban_record_subtitle"><span t-esc="record.supplier_id.value"/></span>
  132. </div>
  133. </div>
  134. <div class="o_kanban_record_bottom">
  135. <ul>
  136. <li t-out="record.description.value" class="text-muted"/>
  137. </ul>
  138. </div>
  139. </div>
  140. </div>
  141. </t>
  142. </templates>
  143. </kanban>
  144. </field>
  145. </record>
  146. <record id="view_lunch_product_kanban" model="ir.ui.view">
  147. <field name="name">lunch.product.kanban</field>
  148. <field name="model">lunch.product</field>
  149. <field name="priority">5</field>
  150. <field name="arch" type="xml">
  151. <kanban create="1" edit="0" class="o_kanban_mobile">
  152. <field name="id"/>
  153. <field name="name"/>
  154. <field name="category_id"/>
  155. <field name="supplier_id"/>
  156. <field name="description"/>
  157. <field name="currency_id"/>
  158. <templates>
  159. <t t-name="kanban-box">
  160. <div class="oe_kanban_global_click o_kanban_record_has_image_fill">
  161. <div class="o_kanban_image_fill_left d-none d-md-block"
  162. t-attf-style="background-image:url('#{kanban_image('lunch.product', 'image_128', record.id.raw_value)}')"/>
  163. <div class="oe_kanban_details">
  164. <div class="o_kanban_record_top">
  165. <div class="o_kanban_record_headings">
  166. <strong class="o_kanban_record_title">
  167. <div>
  168. <div class="float-end">
  169. <field name="price" widget="monetary"/>
  170. </div>
  171. <strong><span t-esc="record.name.value"/></strong>
  172. </div>
  173. </strong>
  174. <span class="o_kanban_record_subtitle"><span t-esc="record.supplier_id.value"/></span>
  175. </div>
  176. </div>
  177. <div class="o_kanban_record_bottom">
  178. <ul>
  179. <li t-out="record.description.value" class="text-muted"/>
  180. </ul>
  181. </div>
  182. </div>
  183. </div>
  184. </t>
  185. </templates>
  186. </kanban>
  187. </field>
  188. </record>
  189. <record id="lunch_product_action_statbutton" model="ir.actions.act_window">
  190. <field name="name">Products</field>
  191. <field name="res_model">lunch.product</field>
  192. <field name="view_mode">kanban,tree,form</field>
  193. <field name="context">{'search_default_group_by_supplier': 1}</field>
  194. <field name="help" type="html">
  195. <p class="o_view_nocontent_smiling_face">
  196. Create a new product for lunch
  197. </p><p>
  198. A product is defined by its name, category, price and vendor.
  199. </p>
  200. </field>
  201. </record>
  202. <record id="lunch_product_category_view_tree" model="ir.ui.view">
  203. <field name="name">Product category Tree</field>
  204. <field name="model">lunch.product.category</field>
  205. <field name="arch" type="xml">
  206. <tree string="Products List">
  207. <field name='name' string="Product Category"/>
  208. <field name="company_id" groups="base.group_multi_company"/>
  209. </tree>
  210. </field>
  211. </record>
  212. <record id="lunch_product_category_view_form" model="ir.ui.view">
  213. <field name="name">Product category Form</field>
  214. <field name="model">lunch.product.category</field>
  215. <field name="arch" type="xml">
  216. <form string="Product Categories Form">
  217. <sheet>
  218. <div class="oe_button_box" name="button_box">
  219. <button class="oe_stat_button" type="action" name="%(lunch.lunch_product_action_statbutton)d"
  220. context="{'search_default_category_id': active_id,'default_category_id': active_id}"
  221. attrs="{'invisible': [('product_count', '=', 0)]}"
  222. icon="fa-cutlery">
  223. <field string="Products" name="product_count" widget="statinfo"/>
  224. </button>
  225. </div>
  226. <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
  227. <div class="oe_title">
  228. <label for="name" class="oe-edit-only"/>
  229. <h1>
  230. <field name="name"/>
  231. </h1>
  232. </div>
  233. <label for="company_id" groups="base.group_multi_company"/>
  234. <field name="company_id" groups="base.group_multi_company"/>
  235. </sheet>
  236. </form>
  237. </field>
  238. </record>
  239. <record id="lunch_product_category_view_kanban" model="ir.ui.view">
  240. <field name="name">Product category Kanban</field>
  241. <field name="model">lunch.product.category</field>
  242. <field name="arch" type="xml">
  243. <kanban class="o_kanban_mobile">
  244. <field name="id"/>
  245. <templates>
  246. <t t-name="kanban-box">
  247. <div class="oe_kanban_global_click o_kanban_record_has_image_fill o_kanban_record">
  248. <div class="o_kanban_image_fill_left d-none d-md-block"
  249. t-attf-style="background-image:url('#{kanban_image('lunch.product.category', 'image_128', record.id.raw_value)}')"/>
  250. <div class="oe_kanban_details">
  251. <div class="o_kanban_record_top">
  252. <div class="o_kanban_record_headings">
  253. <div class="float-end">
  254. <button class="badge text-bg-primary" type="action"
  255. name="%(lunch.lunch_product_action_statbutton)d"
  256. context="{'search_default_category_id': active_id,'default_category_id': active_id}"
  257. attrs="{'invisible': [('product_count', '=', 0)]}">
  258. <field string="Products" name="product_count" widget="statinfo"/>
  259. </button>
  260. </div>
  261. </div>
  262. </div>
  263. <div class="o_kanban_record_body">
  264. <strong><field name="name"/></strong><br/>
  265. <field name="company_id" groups="base.group_multi_company"/>
  266. </div>
  267. </div>
  268. </div>
  269. </t>
  270. </templates>
  271. </kanban>
  272. </field>
  273. </record>
  274. <record id="lunch_product_category_view_search" model="ir.ui.view">
  275. <field name="name">lunch.product.category.search</field>
  276. <field name="model">lunch.product.category</field>
  277. <field name="arch" type="xml">
  278. <search>
  279. <field name="name"/>
  280. <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
  281. </search>
  282. </field>
  283. </record>
  284. <record id="lunch_product_action" model="ir.actions.act_window">
  285. <field name="name">Products</field>
  286. <field name="res_model">lunch.product</field>
  287. <field name="view_mode">tree,kanban,form</field>
  288. <field name="help" type="html">
  289. <p class="o_view_nocontent_smiling_face">
  290. Create a new product for lunch
  291. </p><p>
  292. A product is defined by its name, category, price and vendor.
  293. </p>
  294. </field>
  295. </record>
  296. <record id="lunch_product_action_order" model="ir.actions.act_window">
  297. <field name="name">Order Your Lunch</field>
  298. <field name="res_model">lunch.product</field>
  299. <field name="view_mode">kanban,tree</field>
  300. <field name="view_ids" eval="[
  301. (5, 0, 0),
  302. (0, 0, {'view_mode': 'kanban', 'view_id': ref('view_lunch_product_kanban_order')}),
  303. (0, 0, {'view_mode': 'tree', 'view_id': ref('lunch_product_view_tree_order')})
  304. ]"/>
  305. <field name="search_view_id" ref="lunch_product_view_search"/>
  306. <field name="context">{'search_default_available_today': 1}</field>
  307. <field name="domain">[]</field>
  308. <field name="help" type="html">
  309. <p class="o_view_nocontent_smiling_face">
  310. There is no product available today
  311. </p><p>
  312. To see some products, check if your vendors are available today and that you have configured some products
  313. </p>
  314. </field>
  315. </record>
  316. <record id="lunch_product_category_action" model="ir.actions.act_window">
  317. <field name="name">Product Categories</field>
  318. <field name="res_model">lunch.product.category</field>
  319. <field name="view_mode">tree,form,kanban</field>
  320. <field name="search_view_id" ref="lunch_product_category_view_search"/>
  321. <field name="help" type="html">
  322. <p class="o_view_nocontent_smiling_face">
  323. Create a new product category
  324. </p><p>
  325. Here you can access all categories for the lunch products.
  326. </p>
  327. </field>
  328. </record>
  329. </odoo>