summaryrefslogtreecommitdiff
path: root/addons/hr_contract/views/hr_contract_views.xml
blob: bd46f27c43b320429a1630a58e149c3705e8c1cc (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
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?xml version="1.0" encoding="utf-8"?>
<odoo>

        <record id="act_hr_employee_2_hr_contract" model="ir.actions.act_window">
            <field name="name">Contracts</field>
            <field name="res_model">hr.contract</field>
            <field name="view_mode">kanban,tree,form</field>
            <field name="context">{
                'search_default_employee_id': [active_id],
                'default_employee_id': active_id,
                'search_default_group_by_state': 1
            }</field>
        </record>

        <record id="hr_hr_employee_view_form2" model="ir.ui.view">
            <field name="name">hr.hr.employee.view.form2</field>
            <field name="model">hr.employee</field>
            <field name="inherit_id" ref="hr.view_employee_form"/>
            <field name="arch" type="xml">
                <data>
                    <div name="button_box" position="inside">
                        <field name="contract_warning" invisible="1"/>
                        <button name="%(act_hr_employee_2_hr_contract)d"
                            class="oe_stat_button"
                            icon="fa-book"
                            type="action"
                            groups="hr_contract.group_hr_contract_manager">
                            <div attrs="{'invisible' : [('first_contract_date', '=', False)]}" class="o_stat_info">
                                <span class="o_stat_text text-success" attrs="{'invisible' : [('contract_warning', '=', True)]}" title="In Contract Since"> In Contract Since</span>
                                <span class="o_stat_value text-success" attrs="{'invisible' : [('contract_warning', '=', True)]}">
                                    <field name="first_contract_date" readonly="1"/>
                                </span>
                                <span class="o_stat_text text-danger" attrs="{'invisible' : [('contract_warning', '=', False)]}" title="In Contract Since">
                                    In Contract Since
                                </span>
                                <span class="o_stat_value text-danger" attrs="{'invisible' : [('contract_warning', '=', False)]}">
                                    <field name="first_contract_date" readonly="1"/>
                                </span>
                            </div>
                            <div attrs="{'invisible' : [('first_contract_date', '!=', False)]}" class="o_stat_info">
                                <span class="o_stat_value text-danger">
                                   <field name="contracts_count"/>
                                </span>
                                <span class="o_stat_text text-danger">
                                    Contracts
                                </span>
                            </div>
                        </button>
                    </div>
                    <xpath expr="//field[@name='user_id']" position="before">
                        <field name="first_contract_date" attrs="{'invisible' : [('first_contract_date', '=', False)]}" readonly="1"/>
                    </xpath>
                    <xpath expr="//field[@name='bank_account_id']" position="replace">
                        <field name="bank_account_id" context="{'display_partner':True}" attrs="{'invisible' : [('address_home_id', '=', False)]}"/>
                    </xpath>
                    <xpath expr="//field[@name='resource_calendar_id']" position="replace">
                        <field name="calendar_mismatch" invisible="1"/>
                        <label for="resource_calendar_id"/>
                        <div>
                            <field name="resource_calendar_id" required="1" nolabel="1"/>
                            <span attrs="{'invisible': [('calendar_mismatch', '=', False)]}"
                                class="fa fa-exclamation-triangle text-danger o_calendar_warning pl-3">
                            </span>
                            <span class="o_calendar_warning_tooltip text-danger">
                                Calendar Mismatch : The employee's calendar does not match its current contract calendar. This could lead to unexpected behaviors.
                            </span>
                        </div>
                    </xpath>
                </data>
            </field>
        </record>

        <record id="hr_employee_view_search" model="ir.ui.view">
            <field name="name">hr.employee.view.search</field>
            <field name="model">hr.employee</field>
            <field name="inherit_id" ref="hr.view_employee_filter"/>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//filter[@name='message_needaction']" position="after">
                        <separator/>
                        <filter string="Contract Warning" name="with_contract_warning" domain="[('contract_warning', '=', True)]"/>
                    </xpath>
                </data>
            </field>
        </record>

        <record id="hr_user_view_form" model="ir.ui.view">
        <field name="name">hr.user.preferences.view.form.contract.inherit</field>
        <field name="model">res.users</field>
        <field name="inherit_id" ref="hr.res_users_view_form_profile"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='employee_bank_account_id']" position="replace">
                <field name="employee_bank_account_id" context="{'display_partner':True}" attrs="{'readonly': [('can_edit', '=', False)]}"/>
            </xpath>
        </field>
    </record>

        <record id="hr_contract_view_search" model="ir.ui.view">
            <field name="name">hr.contract.search</field>
            <field name="model">hr.contract</field>
            <field name="arch" type="xml">
                <search string="Search Contract">
                    <field name="name" string="Contract"/>
                    <field name="date_start"/>
                    <field name="date_end"/>
                    <field name="employee_id"/>
                    <field name="job_id"/>
                    <field name="department_id" operator="child_of"/>
                    <field name="resource_calendar_id"/>
                    <filter string="Running" name="running" domain="[('state', '=', 'open')]"/>
                    <filter string="Need Action" name="to_renew" domain="['&amp;', ('state', '=', 'open'), ('kanban_state', '=', 'blocked')]"/>
                    <separator />
                    <filter string="Employed" name="current_employee" domain="[('employee_id.active', '=', True)]"/>
                    <separator/>
                    <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
                    <separator/>
                    <filter string="Late Activities" name="activities_overdue"
                        domain="[('my_activity_date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"
                        help="Show all records which have a next action date before today"/>
                    <filter string="Today Activities" name="activities_today"
                        domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
                    <filter string="Future Activities" name="activities_upcoming_all"
                        domain="[('my_activity_date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))]"/>
                    <group expand="0" string="Group By">
                        <filter string="Employee" name="employee" domain="[]" context="{'group_by': 'employee_id'}"/>
                        <filter string="Job Position" name="job" domain="[]" context="{'group_by': 'job_id'}"/>
                        <filter string="Status" name='group_by_state' domain="[]" context="{'group_by': 'state'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="hr_contract_view_form" model="ir.ui.view">
            <field name="name">hr.contract.form</field>
            <field name="model">hr.contract</field>
            <field name="arch" type="xml">
                <form string="Current Contract">
                    <header>
                        <field name="state" widget="statusbar" options="{'clickable': '1'}"/>
                    </header>
                    <sheet>
                    <div class="oe_button_box" name="button_box"/>
                    <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
                    <div class="oe_title pr-0" name="title">
                        <h1 class="d-flex flex-row justify-content-between">
                            <field name="name" class="text-truncate" placeholder="Contract Reference"/>
                            <field name="kanban_state" widget="state_selection"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="active" invisible="1"/>
                            <field name="employee_id"/>
                            <field name="department_id"/>
                            <field name="job_id"/>
                            <field name="company_id" groups="base.group_multi_company"/>
                            <field name="company_country_id" invisible="1"/>
                            <field name="structure_type_id" domain="['|', ('country_id', '=', False), ('country_id', '=', company_country_id)]"/>
                        </group>
                        <group name="duration_group">
                            <field name="date_start"/>
                            <field name="first_contract_date" attrs="{'invisible': ['|', ('first_contract_date', '=', False), ('first_contract_date', '=', 'date_start')]}"/>
                            <field name="date_end"/>
                            <field name="calendar_mismatch" invisible="1"/>
                            <label for="resource_calendar_id"/>
                            <div>
                                <field name="resource_calendar_id" required="1" nolabel="1"/>
                                <span attrs="{'invisible': ['|', ('calendar_mismatch', '=', False), ('state', '!=', 'open')]}"
                                    class="fa fa-exclamation-triangle text-danger o_calendar_warning pl-3">
                                </span>
                                <span class="o_calendar_warning_tooltip text-danger">
                                    Calendar Mismatch : The employee's calendar does not match this contract's calendar. This could lead to unexpected behaviors.
                                </span>
                            </div>
                            <field name="hr_responsible_id"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Contract Details" name="other">
                            <group name="notes_group" string="Notes">
                                <field name="notes" nolabel="1"/>
                            </group>
                        </page>
                        <page string="Salary Information" name="information">
                            <group name="main_info">
                                <group name="salary_and_advantages" string="Monthly Advantages in Cash">
                                    <label for="wage"/>
                                    <div class="o_row" name="wage">
                                        <field name="wage" nolabel="1"/>
                                        <span>/ month</span>
                                    </div>
                                </group>
                                <group string="Yearly Advantages" name="yearly_advantages"/>
                            </group>
                        </page>
                    </notebook>
                    </sheet>
                    <div class="oe_chatter">
                        <field name="message_follower_ids" groups="base.group_user"/>
                        <field name="activity_ids"/>
                        <field name="message_ids"/>
                    </div>
                </form>
            </field>
        </record>

        <record id="hr_contract_view_tree" model="ir.ui.view">
            <field name="name">hr.contract.tree</field>
            <field name="model">hr.contract</field>
            <field name="arch" type="xml">
                <tree string="Contracts" multi_edit="1" sample="1">
                    <field name="name" readonly="1"/>
                    <field name="employee_id" readonly="1" widget="many2one_avatar_employee"/>
                    <field name="job_id"/>
                    <field name="resource_calendar_id"/>
                    <field name="date_start" readonly="1"/>
                    <field name="date_end" readonly="1"/>
                    <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'close'" decoration-success="state == 'open'"/>
                    <field name="kanban_state" widget="state_selection" readonly="1"/>
                    <field name="wage" invisible="1"/>
                    <field name="message_needaction" invisible="1"/>
                    <field name="company_id" groups="base.group_multi_company" readonly="1"/>
                </tree>
            </field>
        </record>

        <record id="hr_contract_view_kanban" model="ir.ui.view">
            <field name="name">hr.contract.kanban</field>
            <field name="model">hr.contract</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_small_column" default_order="date_end" sample="1">
                    <field name="employee_id"/>
                    <field name="activity_state"/>
                    <field name="state"/>
                    <progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
                    <templates>
                    <t t-name="kanban-box">
                        <div class="oe_kanban_card oe_kanban_global_click">
                            <div class="o_dropdown_kanban dropdown" t-if="!selection_mode" groups="base.group_user">
                                <a class="dropdown-toggle o-no-caret btn" role="button" data-toggle="dropdown" data-display="static" href="#" aria-label="Dropdown menu" title="Dropdown menu">
                                    <span class="fa fa-ellipsis-v"/>
                                </a>
                                <div class="dropdown-menu" role="menu">
                                    <t t-if="widget.editable"><a role="menuitem" type="edit" class="dropdown-item">Edit Contract</a></t>
                                    <t t-if="widget.deletable"><a role="menuitem" type="delete" class="dropdown-item">Delete</a></t>
                                </div>
                            </div>
                            <div class="oe_kanban_content">
                                <div class="o_hr_contract_state">
                                    <strong class="o_kanban_record_title">
                                        <field name="name"/>
                                    </strong>
                                </div>
                                <div class="text-muted o_kanban_record_subtitle o_hr_contract_job_id">
                                    <field name="job_id"/>
                                </div>
                                <div class="oe_kanban_bottom_right">
                                    <span class="float-right">
                                        <field name="employee_id" widget="many2one_avatar_employee"/>
                                    </span>
                                    <span class="float-right mr4">
                                        <field name="kanban_state" widget="state_selection"/>
                                    </span>
                                </div>
                            </div>
                            <div class="oe_clear"></div>
                        </div>
                    </t>
                    </templates>
                </kanban>
            </field>
         </record>

        <record id="hr_contract_view_activity" model="ir.ui.view">
            <field name="name">hr.contract.activity</field>
            <field name="model">hr.contract</field>
            <field name="arch" type="xml">
                <activity string="Contracts">
                    <field name="employee_id"/>
                    <templates>
                        <div t-name="activity-box">
                            <img t-att-src="activity_image('hr.employee', 'image_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
                            <div>
                                <field name="name" display="full"/>
                                <field name="job_id" muted="1" display="full"/>
                            </div>
                        </div>
                    </templates>
                </activity>
            </field>
        </record>

        <record id="action_hr_contract" model="ir.actions.act_window">
            <field name="name">Contracts</field>
            <field name="res_model">hr.contract</field>
            <field name="view_mode">kanban,tree,form,activity</field>
            <field name="domain">[('employee_id', '!=', False)]</field>
            <field name="context">{'search_default_current':1, 'search_default_group_by_state': 1}</field>
            <field name="search_view_id" ref="hr_contract_view_search"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Create a new contract
              </p>
            </field>
        </record>

        <menuitem
            id="menu_human_resources_configuration_contract"
            name="Contracts"
            parent="hr.menu_human_resources_configuration"
            sequence="3"/>

        <menuitem
            id="hr_menu_contract"
            name="Contracts"
            action="action_hr_contract"
            parent="hr.menu_hr_employee_payroll"
            sequence="4"
            groups="hr_contract.group_hr_contract_manager"/>


</odoo>