summaryrefslogtreecommitdiff
path: root/addons/l10n_ch/views/account_invoice_view.xml
blob: 3de4c658e60b86af2bb57c2d1b6eac1d46c55e6a (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
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="isr_invoice_form" model="ir.ui.view">
            <field name="name">l10n_ch.account.invoice.form</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_move_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='is_move_sent']" position="after">
                    <field name="l10n_ch_isr_sent" invisible="1"/>
                    <field name="l10n_ch_currency_name" invisible="1" readonly="1"/>
                </xpath>

                <xpath expr="//button[@id='account_invoice_payment_btn']" position="before">
                    <button id="l10n_ch_btn_isr_print_highlight"
                        name="isr_print"
                        string="Print ISR"
                        type="object"
                        attrs="{'invisible':['|', '|', '|', '|',
                            ('move_type', 'not in', ('out_invoice', 'out_refund')),
                            ('l10n_ch_isr_sent', '=', True),
                            ('state', '!=', 'posted'),
                            ('payment_state', 'not in', ('not_paid', 'partial')),
                            ('l10n_ch_currency_name', 'not in', ['EUR', 'CHF'])]}"
                        class="oe_highlight"
                        groups="base.group_user"
                        />
                </xpath>

                <xpath expr="//button[@id='account_invoice_payment_btn']" position="before">
                    <button id="btn_isr_print_normal"
                        name="isr_print"
                        string="Print ISR"
                        type="object"
                        attrs="{'invisible':['|', '|', '|', '|',
                            ('move_type', 'not in', ('out_invoice', 'out_refund')),
                            ('l10n_ch_isr_sent', '=', False),
                            ('state', '!=', 'posted'),
                            ('payment_state', 'not in', ('not_paid', 'partial')),
                            ('l10n_ch_currency_name', 'not in', ['EUR', 'CHF'])]}"
                        groups="base.group_user"
                        />
                    <button
                        name="print_ch_qr_bill"
                        string="Print QR-bill"
                        type="object"
                        attrs="{'invisible':['|', ('state', '!=', 'posted'),
                                             '|', ('l10n_ch_isr_sent', '=', True),
                                             '|', ('move_type', '!=', 'out_invoice'),
                                             ('l10n_ch_currency_name', 'not in', ['EUR', 'CHF'])]}"
                        groups="base.group_user"
                        class="oe_highlight"
                        />
                    <button
                        name="print_ch_qr_bill"
                        string="Print QR-bill"
                        type="object"
                        attrs="{'invisible':['|', ('state', '!=', 'posted'),
                                             '|', ('l10n_ch_isr_sent', '=', False),
                                             '|', ('move_type', '!=', 'out_invoice'),
                                             ('l10n_ch_currency_name', 'not in', ['EUR', 'CHF'])]}"
                        groups="base.group_user"
                        />
                </xpath>
                <header position="after">
                    <field name="l10n_ch_isr_needs_fixing" invisible="1"/>
                    <div groups="account.group_account_invoice" class="alert alert-warning" role="alert" style="margin-bottom:0px;" attrs="{'invisible': [('l10n_ch_isr_needs_fixing', '=', False)]}">
                        Please fill in a correct ISR reference in the payment reference.  The banks will refuse your payment file otherwise.
                    </div>
                </header>
            </field>
        </record>

        <record id="isr_invoice_search_view" model="ir.ui.view">
            <field name="name">l10n_ch.invoice.select</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_account_invoice_filter"/>
            <field name="mode">primary</field>
            <field name="arch" type="xml">
                <xpath expr="//search" position="inside">
                    <field name="l10n_ch_isr_number" string="ISR reference number"/>
                </xpath>
            </field>
        </record>

        <!--Overridden action (and primary child view), so the filter are only
        available for customer invoices-->
        <record id="account.action_move_out_invoice_type" model="ir.actions.act_window">
            <field name="name">Customer Invoices</field>
            <field name="res_model">account.move</field>
            <field name="search_view_id" ref="isr_invoice_search_view"/>
        </record>
    </data>
</odoo>