summaryrefslogtreecommitdiff
path: root/addons/hr_holidays_attendance/views/hr_employee_views.xml
blob: 53cc6d53e90d8cf85757a1be5be89709fe0f45f1 (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
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

    <record id="hr_user_view_form" model="ir.ui.view">
        <field name="name">hr.user.preferences.view.form.attendance.inherit</field>
        <field name="model">res.users</field>
        <field name="inherit_id" ref="hr_attendance.hr_user_view_form"/>
        <field name="arch" type="xml">
            <!-- Hide Attendance button -->
            <xpath expr="//button[@id='hr_attendance_button']" position="attributes">
                <attribute name="attrs">
                    {'invisible': ['|', '|', '&amp;',
                        ('hr_presence_state', '=', 'present'),
                        ('attendance_state', '=', 'checked_out'),
                        ('is_absent', '=', True),
                        ('id', '=', False),
                    ]}
                </attribute>
            </xpath>
            <!-- Merge invisible attr of both module -->
            <xpath expr="//button[@id='hr_presence_button']" position="attributes">
                <attribute name="attrs">
                    {'invisible': ['|', '|', '|',
                        ('is_absent', '=', True),
                        ('hr_presence_state', '=', 'absent'),
                        ('attendance_state', '=', 'checked_in'),
                        ('id', '=', False),
                    ]}
                </attribute>
            </xpath>
        </field>
    </record>

    <record id="hr_employee_view_form" model="ir.ui.view">
        <field name="name">hr.employee.holidays.attendance.inherit</field>
        <field name="model">hr.employee</field>
        <field name="inherit_id" ref="hr_attendance.view_employee_form_inherit_hr_attendance"/>
        <field name="arch" type="xml">
            <!-- Hide Attendance button -->
            <xpath expr="//button[@id='hr_attendance_button']" position="attributes">
                <attribute name="attrs">
                    {'invisible': ['|', '|', '&amp;',
                        ('hr_presence_state', '=', 'present'),
                        ('attendance_state', '=', 'checked_out'),
                        ('is_absent', '=', True),
                        ('id', '=', False),
                    ]}
                </attribute>
            </xpath>
            <!-- Merge invisible attr of both module -->
            <xpath expr="//button[@id='hr_presence_button']" position="attributes">
                <attribute name="attrs">
                    {'invisible': ['|', '|', '|',
                        ('is_absent', '=', True),
                        ('hr_presence_state', '=', 'absent'),
                        ('attendance_state', '=', 'checked_in'),
                        ('id', '=', False),
                    ]}
                </attribute>
            </xpath>
        </field>
    </record>

</odoo>