summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/views/pos_session_view.xml
blob: 3381b4070063119ed433d3f12d830330848355e7 (plain)
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
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_pos_session_form" model="ir.ui.view">
        <field name="name">pos.session.form.view</field>
        <field name="model">pos.session</field>
        <field name="arch" type="xml">
            <form string="Point of Sale Session" create="0">
                <header>
                    <button name="open_cashbox_pos" type="object" string="Open Session"
                        attrs="{'invisible' : ['|', ('cash_control', '=', False), ('state', '!=', 'new_session')]}" class="oe_highlight"
                         context="{'balance': 'start'}"/>
                    <button name="open_frontend_cb" type="object" string="Continue Selling"
                        attrs="{'invisible' : ['|', ('rescue', '=', True), ('state', 'not in', ['opening_control', 'opened'])]}"/>
                    <button id="end_session_opened" name="action_pos_session_closing_control" type="object" string="End of Session"
                        attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', '!=', 'opened')]}"
                        class="oe_highlight"/>
                    <button id="validate_opened" name="action_pos_session_closing_control" type="object" string="Close Session &amp; Post Entries"
                        attrs="{'invisible' : ['|', ('cash_control', '=', True),('state', '!=', 'opened')]}"
                        class="oe_highlight"/>
                    <button id="validate_closing_control" name="action_pos_session_validate" type="object" string="Close Session &amp; Post Entries" states="closing_control"
                        class="oe_highlight"/>

                    <field name="state" widget="statusbar" statusbar_visible="opened,closing_control,closed" nolabel="1" />
                </header>
                <sheet>
                    <field name="cash_register_id" invisible="1"/>
                    <field name="failed_pickings" invisible="1"/>
                    <field name="rescue" invisible="1"/>
                    <div class="oe_button_box" name="button_box">
                        <button name="action_view_order"
                            class="oe_stat_button"
                            icon="fa-shopping-basket"
                            type="object">
                            <field name="order_count" widget="statinfo" string="Orders"/>
                        </button>
                        <button class="oe_stat_button" name="action_stock_picking" type="object" icon="fa-truck" attrs="{'invisible':[('picking_count', '=', 0)]}">
                            <field name="picking_count" widget="statinfo" string="Pickings" attrs="{'invisible': [('failed_pickings', '!=', False)]}"/>
                            <field name="picking_count" widget="statinfo" string="Pickings" class="text-danger" attrs="{'invisible': [('failed_pickings', '=', False)]}"/>
                        </button>
                        <button
                            name="action_show_payments_list"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-dollar"
                            >
                            <field name="total_payments_amount" widget="statinfo" string="Payments"/>
                        </button>
                        <button
                            name="show_journal_items"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-bars"
                            string="Journal Items"
                            attrs="{'invisible':[('move_id', '=', False)]}"
                            groups="account.group_account_readonly"
                            >
                        </button>
                    </div>
                    <h1 class="oe_title">
                        <field name="name" attrs="{'invisible': [('name','=','/')]}" class="oe_inline"/>
                    </h1>
                    <group>
                        <field name="cash_control" invisible="1" />
                        <field name="user_id"/>
                        <field name="currency_id" invisible="1"/>
                        <field name="config_id"/>
                        <field name="move_id" readonly="1" groups="account.group_account_readonly" />
                        <field name="start_at" attrs="{'invisible' : [('state', '=', 'opening_control')]}"/>
                        <field name="stop_at" attrs="{'invisible' : [('state', '!=', 'closed')]}"/>
                    </group>
                    <notebook>
                        <page string="Cash Control" name="cash_control" attrs="{'invisible' : [('cash_control', '=', False)]}">
                            <group class="col-md-12" style="margin-left: 140px;">
                                <group class="col-md-7">
                                    <div style="margin:0;padding:0;">
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['opening_control', 'closed'])]}">
                                            <field style="text-align:right;margin:0;padding:0;" name="cash_register_total_entry_encoding" widget="monetary" options="{'currency_field': 'currency_id'}" string="+ Transactions"/>
                                        </group>
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', '!=', 'closed')]}">
                                            <field style="text-align:right;margin:0;padding:0;" name="cash_real_transaction" widget="monetary" options="{'currency_field': 'currency_id'}" string="+ Transactions"/>
                                        </group>
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['opening_control', 'closed'])]}">
                                            <field style="text-align:right;margin:0;padding:0;" name="cash_register_balance_end" widget="monetary" options="{'currency_field': 'currency_id'}" string="= Expected in Cash"/>
                                        </group>
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', '!=', 'closed')]}">
                                            <field style="text-align:right;margin:0;padding:0;" name="cash_real_expected" widget="monetary" options="{'currency_field': 'currency_id'}" string="= Expected"/>
                                        </group>
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['opening_control'])]}">
                                            <field style="text-align:right;margin:0;padding:0;" name="cash_register_balance_end_real" widget="monetary" options="{'currency_field': 'currency_id'}" string="Actual in Cash"/>
                                        </group>
                                    </div>
                                    <div style="margin:0;padding:0;">
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['opening_control'])]}">
                                            <button class="oe_inline oe_link" name="%(action_pos_box_out)d" type="action" attrs="{'invisible' : [('state', '=', 'closed')]}">Cash In/Out</button>
                                        </group>
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', '=', 'opening_control')]}">
                                        </group>
                                        <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', '=', 'opening_control')]}">
                                            <button class="oe_inline oe_link" name="open_cashbox_pos" type="object" attrs="{'invisible': [('state', '!=', 'closing_control')]}" context="{'balance': 'close'}">Set Closing Cash</button>
                                        </group>
                                    </div>
                                </group>
                            </group>

                            <div class="col-md-4" attrs="{'invisible' : [('state', '!=', 'closing_control')]}" style="height: 30px">
                                <group class="oe_subtotal_footer">
                                    <field name="cash_register_difference" widget="monetary" options="{'currency_field': 'currency_id'}" decoration-danger="cash_register_difference != 0"/>
                                </group>
                            </div>
                            <div class="col-md-4" attrs="{'invisible' : [('state', '!=', 'closed')]}" style="height: 30px">
                                <group class="oe_subtotal_footer">
                                    <field name="cash_real_difference" widget="monetary" options="{'currency_field': 'currency_id'}" decoration-danger="cash_real_difference != 0"/>
                                </group>
                            </div>
                        </page>
                    </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="activity_ids"/>
                    <field name="message_follower_ids"/>
                    <field name="message_ids"/>
                </div>
            </form>
        </field>
    </record>

    <record id="view_pos_session_tree" model="ir.ui.view">
        <field name="name">pos.session.tree.view</field>
        <field name="model">pos.session</field>
        <field name="arch" type="xml">
            <tree string="Point of Sale Session" create="0" sample="1">
                <field name="name" decoration-bf="1"/>
                <field name="config_id" />
                <field name="user_id" widget="many2one_avatar_user"/>
                <field name="start_at" />
                <field name="stop_at" />
                <field name="state" widget="badge" decoration-info="state in ('opening_control')" decoration-success="state in ('opened', 'closed')" decoration-warning="state == 'closing_control'" />
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="view_pos_session_kanban">
        <field name="name">pos.session.kanban</field>
        <field name="model">pos.session</field>
        <field name="arch" type="xml">
            <kanban class="o_kanban_mobile" create="0" sample="1">
                <field name="config_id" />
                <field name="name" />
                <field name="user_id" />
                <field name="start_at" />
                <field name="state" />
                <templates>
                    <t t-name="kanban-box">
                        <div t-attf-class="oe_kanban_card oe_kanban_global_click">
                            <div class="o_kanban_record_top">
                                <div class="o_kanban_record_headings">
                                    <strong class="o_kanban_record_title"><span><field name="config_id"/></span></strong>
                                </div>
                                <field name="state" widget="label_selection" options="{'classes': {'opening_control': 'default',
                                        'opened': 'success', 'closing_control': 'warning', 'closed': 'warning'}}"/>
                            </div>
                            <div class="o_kanban_record_body">
                                <field name="name" />
                            </div>
                            <div class="o_kanban_record_bottom">
                                <div class="oe_kanban_bottom_left">
                                    <span><field name="start_at" /></span>
                                </div>
                                <div class="oe_kanban_bottom_right">
                                    <field name="user_id" widget="many2one_avatar_user"/>
                                </div>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>

    <record id="view_pos_session_search" model="ir.ui.view">
        <field name="name">pos.session.search.view</field>
        <field name="model">pos.session</field>
        <field name="arch" type="xml">
            <search string="Point of Sale Session">
                <field name="name"/>
                <field name="config_id" />
                <field name="user_id" />
                <filter name="my_sessions" string="My Sessions" domain="[('user_id', '=', uid)]"/>
                <separator/>
                <filter name="open_sessions" string="In Progress" domain="[('state', '=', 'opened')]"/>
                <separator/>
                <filter string="Opening Date" name="start_date" date="start_at" />
                <group expand="0" string="Group By">
                    <filter string="Opened By" name="user" domain="[]" context="{'group_by' : 'user_id'}"/>
                    <filter string="Point of Sale" name="point_of_sale" domain="[]" context="{'group_by': 'config_id'}"/>
                    <filter string="Status" name="status" domain="[]" context="{'group_by': 'state'}"/>
                    <filter string="Opening Date" name="opening_date" domain="[]" context="{'group_by': 'start_at'}"/>
                    <filter string="Closing Date" name="closing_date" domain="[]" context="{'group_by': 'stop_at'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_pos_session" model="ir.actions.act_window">
        <field name="name">Sessions</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">pos.session</field>
        <field name="view_mode">tree,kanban,form</field>
        <field name="search_view_id" ref="view_pos_session_search" />
        <field name="help" type="html">
            <p class="o_view_nocontent_empty_folder">
                No sessions found
            </p><p>
                A session is a period of time, usually one day, during which you sell through the Point of Sale.
            </p>
        </field>
    </record>

    <record id="mail_activity_old_session" model="mail.activity.type">
        <field name="name">Session open over 7 days</field>
        <field name="summary">note</field>
        <field name="category">default</field>
        <field name="res_model_id" ref="model_pos_session"/>
        <field name="icon">fa-tasks</field>
        <field name="delay_count">0</field>
    </record>


    <record model="ir.ui.view" id="closing_balance_confirm">
        <field name="name">Confirming balance closing</field>
        <field name="model">closing.balance.confirm.wizard</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form>
                <group>
                    <span>There is a difference between the expected and actual closing in cash. Are you sure you want to close the session and post the accounting entries?</span>
                </group>
                <footer>
                    <button name="confirm_closing_balance" string="Confirm" type="object" class="oe_highlight, btn-primary" />
                    <button string="Discard" special="cancel" class="oe_highlight, btn-secondary"/>
                </footer>
            </form>
        </field>
    </record>

    <menuitem
        id="menu_pos_session_all"
        parent="menu_point_of_sale"
        action="action_pos_session"
        sequence="2"
        groups="group_pos_manager"/>
</odoo>