File: lunch_orders_views.xml

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (277 lines) | stat: -rw-r--r-- 16,971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="lunch_order_view_search" model="ir.ui.view">
        <field name="name">lunch.order.search</field>
        <field name="model">lunch.order</field>
        <field name="arch" type="xml">
            <search string="Search">
                <field name="name" string="Product" filter_domain="['|', ('name', 'ilike', self), ('note', 'ilike', self)]"/>
                <field name="user_id"/>
                <filter name='is_mine' string="My Orders" domain="[('user_id', '=', uid)]"/>
                <separator/>
                <filter name="not_confirmed" string="Not Received" domain="[('state', '!=', ('confirmed'))]"/>
                <filter name="confirmed" string="Received" domain="[('state', '=', 'confirmed')]"/>
                <filter name="cancelled" string="Cancelled" domain="[('state', '=', 'cancelled')]"/>
                <separator/>
                <filter name="date_filter" string="Today" domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]" />
                <separator/>
                <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
                <group expand="0" string="Group By">
                    <filter name="group_by_user" string="User" context="{'group_by': 'user_id'}"/>
                    <filter name="group_by_supplier" string="Vendor" context="{'group_by': 'supplier_id'}"/>
                    <filter name="group_by_date" string="Order Date" context="{'group_by': 'date:day'}" help="Vendor Orders by Date"/>
                </group>
            </search>
        </field>
    </record>

    <record id="lunch_order_view_tree" model="ir.ui.view">
        <field name="name">lunch.order.list</field>
        <field name="model">lunch.order</field>
        <field name="arch" type="xml">
            <list string="Order lines List" create="false" edit="false" decoration-muted="state == 'cancelled'" expand="1">
                <header>
                    <button name="action_confirm" type="object" string="Receive"/>
                </header>
                <field name='date' readonly="state != 'new'"/>
                <field name='supplier_id'/>
                <field name='product_id'/>
                <field name="display_toppings" class="o_text_overflow"/>
                <field name='note' class="o_text_overflow"/>
                <field name='user_id' widget='many2one_avatar_user' readonly="state != 'new'"/>
                <field name="lunch_location_id"/>
                <field name="currency_id" column_invisible="True"/>
                <field name='price' sum="Total" string="Price" widget="monetary"/>
                <field name='state' widget="badge" decoration-warning="state == 'new'" decoration-success="state == 'confirmed'" decoration-info="state == 'sent'" decoration-danger="state == 'ordered'"/>
                <field name="company_id" groups="base.group_multi_company"/>
                <field name="display_reorder_button" column_invisible="True"/>
                <field name="notified" column_invisible="True"/>
                <button name="action_reorder" string="Re-order" type="object" icon="fa-history" invisible="not display_reorder_button or not display_add_button" groups="lunch.group_lunch_user"/>
                <button name="action_confirm" string="Confirm" type="object" icon="fa-check" invisible="state != 'sent'" groups="lunch.group_lunch_manager"/>
                <button name="action_cancel" string="Cancel" type="object" icon="fa-times" invisible="state in ['cancelled', 'confirmed']" groups="lunch.group_lunch_manager"/>
                <button name="action_reset" string="Reset" type="object" icon="fa-undo" invisible="state != 'cancelled'" groups="lunch.group_lunch_manager"/>
                <button name="action_notify" string="Send Notification" type="object" icon="fa-envelope" invisible="state != 'confirmed' or notified" groups="lunch.group_lunch_manager"/>
                <groupby name="supplier_id">
                    <field name="show_order_button" invisible="1" />
                    <field name="show_confirm_button" invisible="1" />
                    <button string="Send Orders" type="object" name="action_send_orders" invisible="not show_order_button"/>
                    <button string="Confirm Orders" type="object" name="action_confirm_orders" invisible="not show_confirm_button"/>
                </groupby>
            </list>
        </field>
    </record>

    <record id='lunch_order_view_kanban' model='ir.ui.view'>
        <field name="name">lunch.order.kanban</field>
        <field name="model">lunch.order</field>
        <field name="arch" type="xml">
            <kanban create="false" edit="false">
                <field name="currency_id"/>
                <field name="notified"/>
                <templates>
                    <t t-name="card">
                        <div class="d-flex">
                            <field name="product_id" class="fw-bold fs-5"/>
                            <field name="state" widget="label_selection" options="{'classes': {'new': 'default', 'confirmed': 'success', 'cancelled':'danger'}}" class="ms-auto"/>
                        </div>
                        <field name="note"/>
                        <div class="row">
                            <div class="col-6">
                                <i class="fa fa-money" role="img" aria-label="Money" title="Money"/> <field name="price"/>
                            </div>
                            <div class="col-6 text-end">
                                <i class="fa fa-clock-o" role="img" aria-label="Date" title="Date"/> <field name="date" readonly="state != 'new'"/>
                            </div>
                        </div>
                        <div class="row mt4">
                            <div class="col-6">
                                <a class="btn btn-sm btn-success" role="button" name="action_order" string="Order" type="object" invisible="state in ['sent', 'ordered', 'confirmed']" groups="lunch.group_lunch_manager">
                                    <i class="fa fa-phone" role="img" aria-label="Order button" title="Order button"/>
                                </a>
                                <a class="btn btn-sm btn-primary" role="button" name="action_send" string="Send" type="object" invisible="state != 'ordered'" groups="lunch.group_lunch_manager">
                                    <i class="fa fa-paper-plane" role="img" aria-label="Send button" title="Send button"/>
                                </a>
                                <a class="btn btn-sm btn-info" role="button" name="action_confirm" string="Receive" type="object" invisible="state != 'sent'" groups="lunch.group_lunch_manager">
                                    <i class="fa fa-check" role="img" aria-label="Receive button" title="Receive button"/>
                                </a>
                                <a class="btn btn-sm btn-danger" role="button" name="action_cancel" string="Cancel" type="object" invisible="state in ['cancelled', 'confirmed']" groups="lunch.group_lunch_manager">
                                    <i class="fa fa-times" role="img" aria-label="Cancel button" title="Cancel button"/>
                                </a>
                                <a class="btn btn-sm btn-info" role="button" name="action_notify" string="Send Notification" type="object" invisible="state != 'confirmed' or notified" groups="lunch.group_lunch_manager">
                                    <i class="fa fa-envelope" role="img" aria-label="Send notification" title="Send notification"/>
                                </a>
                            </div>
                            <div class="col-6">
                                <field name="user_id" widget="many2one_avatar_user" readonly="state != 'new'" class="float-end"/>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>

    <record id="lunch_order_view_pivot" model="ir.ui.view">
        <field name="name">lunch.order.pivot</field>
        <field name="model">lunch.order</field>
        <field name="arch" type="xml">
            <pivot sample="1">
                <field name="date" type="col"/>
                <field name="supplier_id" type="row"/>
            </pivot>
        </field>
    </record>

    <record id="lunch_order_view_graph" model="ir.ui.view">
        <field name="name">lunch.order.graph</field>
        <field name="model">lunch.order</field>
        <field name="arch" type="xml">
            <graph sample="1">
                <field name="product_id"/>
            </graph>
        </field>
    </record>

    <record id="lunch_order_action" model="ir.actions.act_window">
        <field name="name">My Orders</field>
        <field name="res_model">lunch.order</field>
        <field name="view_mode">list,kanban,pivot</field>
        <field name="search_view_id" ref="lunch_order_view_search"/>
        <field name="context">{"search_default_is_mine":1, "search_default_group_by_date": 1, 'show_reorder_button': True}</field>
        <field name="help" type="html">
        <p class="o_view_nocontent_empty_folder">
            No previous order found
        </p><p>
            There is no previous order recorded. Click on "My Lunch" and then create a new lunch order.
        </p>
        </field>
    </record>

    <record id="lunch_order_action_by_supplier" model="ir.actions.act_window">
        <field name="name">Today's Orders</field>
        <field name="res_model">lunch.order</field>
        <field name="view_mode">list,kanban</field>
        <field name="search_view_id" ref="lunch_order_view_search"/>
        <field name="context">{"search_default_group_by_supplier":1, "search_default_date_filter":1}</field>
        <field name="help" type="html">
          <p class="o_view_nocontent_empty_folder">
            Nothing to order today
          </p><p>
            Here you can see today's orders grouped by vendors.
          </p>
        </field>
    </record>

    <record id="lunch_order_action_control_suppliers" model="ir.actions.act_window">
        <field name="name">Control Vendors</field>
        <field name="res_model">lunch.order</field>
        <field name="view_mode">list,kanban,pivot</field>
        <field name="search_view_id" ref="lunch_order_view_search"/>
        <field name="context">{"search_default_group_by_supplier":1}</field>
        <field name="help" type="html">
          <p class="o_view_nocontent_empty_folder">
            No lunch order yet
          </p><p>
            Summary of all lunch orders, grouped by vendor and by date.
          </p><p>
            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/>
            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/>
            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.
          </p>
        </field>
    </record>

    <record id="lunch_order_view_form" model="ir.ui.view">
        <field name="name">lunch.order.view.form</field>
        <field name="model">lunch.order</field>
        <field name="arch" type="xml">
            <form class="flex-column">
                <field name="company_id" invisible="1"/>
                <field name="date" invisible="1" readonly="state != 'new'"/>
                <field name="currency_id" invisible="1"/>
                <field name="quantity" invisible="1"/>
                <field name="product_id" invisible="1"/>
                <field name="state" invisible="1"/>
                <field name="category_id" invisible="1"/>
                <field name="available_toppings_1" invisible="1"/>
                <field name="available_toppings_2" invisible="1"/>
                <field name="available_toppings_3" invisible="1"/>
                <field name="supplier_id" invisible="1"/>
                <field name="order_deadline_passed" invisible="1"/>
                <field name="available_today" invisible="1"/>
                <div class="d-flex">
                    <div class="flex-grow-0 pe-5">
                        <field name="image_1920" widget="image" class="o_lunch_image" options="{'image_preview': 'image_128'}"/>
                    </div>
                    <div class="flex-grow-1 pe-5">
                        <h2><field name="name"/></h2>
                        <h3 class="pt-3"><field name="price"/></h3>
                    </div>
                </div>
                <div class="o_lunch_wizard">
                    <div class="row py-3 py-md-0">
                        <div class="o_td_label col-3 col-md-2">
                            <field name="topping_label_1" nolabel="1" invisible="not available_toppings_1" class="o_form_label"/>
                        </div>
                        <div class="col-9 col-md-10">
                            <field name="topping_ids_1" invisible="not available_toppings_1" widget="many2many_checkboxes" nolabel="1" domain="[('topping_category', '=', 1), ('supplier_id', '=', supplier_id)]" class="o_field_widget o_quick_editable"/>
                        </div>
                    </div>
                    <div class="row">
                        <div class="o_td_label col-3 col-md-2">
                            <field name="topping_label_2" nolabel="1" invisible="not available_toppings_2" class="o_form_label"/>
                        </div>
                        <div class="col-9 col-md-10">
                            <field name="topping_ids_2" invisible="not available_toppings_2" widget="many2many_checkboxes" nolabel="1" domain="[('topping_category', '=', 2), ('supplier_id', '=', supplier_id)]" class="o_field_widget o_quick_editable"/>
                        </div>
                    </div>
                    <div class="row">
                        <div class="o_td_label col-3 col-md-2">
                            <field name="topping_label_3" nolabel="1" invisible="not available_toppings_3" class="o_form_label"/>
                        </div>
                        <div class="col-9 col-md-10">
                            <field name="topping_ids_3" invisible="not available_toppings_3" widget="many2many_checkboxes" nolabel="1" domain="[('topping_category', '=', 3), ('supplier_id', '=', supplier_id)]" class="o_field_widget o_quick_editable"/>
                        </div>
                    </div>
                    <div class="row pb-2">
                        <div class="o_td_label col-3 col-md-2">
                            <label for="product_description" class="o_form_label"/>
                        </div>
                        <div class="col-9 col-md-10">
                            <field name="product_description" nolabel="1" class="o_field_widget o_quick_editable"/>
                        </div>
                    </div>
                    <div class="row">
                        <div class="o_td_label col-3 col-md-2">
                            <label for="note" class="o_form_label" />
                        </div>
                        <div class="col-9 col-md-10">
                            <field name="note" nolabel="1" placeholder="Information, allergens, ..." class="o_field_widget o_quick_editable"/>
                        </div>
                    </div>

                    <div class="row" invisible="not order_deadline_passed">
                        <div class="col-12">
                            <div class="alert alert-warning" role="alert">
                                The orders for this vendor have already been sent.
                            </div>
                        </div>
                    </div>
                    <div class="row" invisible="display_add_button">
                        <div class="col-12">
                            <div class="alert alert-warning" role="alert">
                                Your wallet does not contain enough money to order that. To add some money to your wallet, please contact your lunch manager.
                            </div>
                        </div>
                    </div>
                </div>
                <footer>
                    <button string="Add To Cart" name="add_to_cart" type="object" class="oe_highlight" invisible="order_deadline_passed or not display_add_button" data-hotkey="w"/>
                    <button string="Discard" special="cancel" data-hotkey="x"/>
                </footer>
            </form>
        </field>
    </record>

</odoo>