summaryrefslogtreecommitdiff
path: root/fixco_custom/views/account_move.xml
blob: 1327e77358d7ef2065a31eaf2a080a5e30c4f699 (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
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <data>
        <record id="account_move_form_inherit" model="ir.ui.view">
            <field name="name">Account Move</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_move_form"/>
            <field name="arch" type="xml">

                <button name="action_post" position="after">
                    <button name="fixco_custom.action_view_invoice_reklas" string="Reklas"
                        type="action" class="btn-primary"  attrs="{'invisible': [('state', '!=', 'posted')]}"/>
                    <button name="pending_refund"
                        string="Pengajuan Refund"
                        type="object"
                        class="btn-primary"
                        attrs="{'invisible': [
                            '|',
                                ('move_type', '!=', 'entry'),
                                '|',
                                    ('state', '!=', 'posted'),
                                    ('approval_refund', 'in', ('pending','approved','rejected'))
                        ]}"/>

                    <button name="reject_refund" string="Tolak Pengajuan Refund"
                        type="object" class="btn-primary" attrs="{'invisible': [
                            '|',
                                ('move_type', '!=', 'entry'),
                                '|',
                                    ('state', '!=', 'posted'),
                                    ('approval_refund', 'in', ('approved','rejected'))
                        ]}"/>
                    <!-- <button name="approve_refund" string="Approved Pengajuan Refund"
                        type="object" class="btn-primary"  attrs="{'invisible': [('state', '!=', 'posted'), ('move_type', '!=', 'entry'), ('approval_refund', 'in', ('approved','rejected'))]}"/> -->
                </button>
                <xpath expr="//header" position="inside">
                    <button name="action_open_po_item_wizard"
                            type="object"
                            string="Add PO Items"
                            class="oe_highlight"
                            attrs="{'invisible': ['|',
                                ('move_type','!=','in_invoice'),
                                ('state','!=','draft')
                            ]}"/>
                </xpath>

    
                <button name="open_reconcile_view" position="after">
                        <button type="object"  name="action_view_related_payment"
                            class="oe_stat_button"
                            icon="fa-pencil-square-o"
                            attrs="{'invisible': [('count_payment', '=', 0)]}">
                            <field name="count_payment" widget="statinfo" string="Payments"/>
                        </button>
                        <button type="object"  name="action_view_related_reverse"
                            class="oe_stat_button"
                            icon="fa-book"
                            attrs="{'invisible': [('count_reverse', '=', 0)]}">
                            <field name="count_reverse" widget="statinfo" string="Retur"/>
                        </button>
                </button>

                <xpath expr="//button[@name='%(account.action_view_account_move_reversal)d']" position="attributes">
                    <attribute name="context">{'default_journal_id': journal_id}</attribute>
                </xpath>
                
                <field name="payment_reference" position="after">
                    <field name="invoice_marketplace" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
                    <field name="faktur_pajak" readonly="1" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/>
                    <field name="transaction_type" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
                </field>

                <field name="partner_id" position="after">
                    <field name="address" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
                </field>
                <field name="amount_untaxed" position="after">
                    <field name="total_discount"/>
                </field>
                
                <field name="reversed_entry_id" position="before">
                    <field name="reklas_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
                    <field name="uangmuka" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
                    <field name="reklas" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
                    <field name="reklas_used" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
                    <field name="reklas_used_by" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
                </field>
                <field name="invoice_date" position="after">
                    <field name="approval_refund" readonly="1" attrs="{'invisible': [('move_type', 'not in', ('entry'))]}"/>
                    <field name="sale_id" readonly="1" attrs="{'invisible': [('move_type', 'not in', ('out_invoice','entry'))]}"/>
                    <field name="purchase_order_id" readonly="1" attrs="{'invisible': [('move_type', 'not in', ('in_invoice','entry'))]}"/>
                    <field name="picking_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
                    <field name="bill_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/>
                </field>
    
                <!-- ✅ Add the new Many2many field after invoice_vendor_bill_id -->
                <field name="invoice_vendor_bill_id" position="after">
                    <field name="purchase_id" invisible="1"/>
                    <field name="need_refund" invisible="1"/>
    
                    <label for="purchase_vendor_bill_ids" string="Auto-Complete" class="oe_edit_only"
                        attrs="{'invisible': ['|', ('state','!=','draft'), ('move_type', '!=', 'in_invoice')]}" />
    
                    <field name="purchase_vendor_bill_ids" nolabel="1"
                        attrs="{'invisible': ['|', ('state','!=','draft'), ('move_type', '!=', 'in_invoice')]}"
                        domain="partner_id and [('company_id', '=', company_id), ('partner_id.commercial_partner_id', '=', commercial_partner_id)] or [('company_id', '=', company_id)]"
                        placeholder="Select purchase orders or past bills"
                        context="{'show_total_amount': True}"
                        options="{'no_create': True, 'no_open': True}"/>
                </field>
    
                <!-- Purchase line_id on invoice line -->
                <xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='company_id']" position="after">
                    <field name="purchase_line_id" invisible="1"/>
                    <field name="purchase_order_id"
                        attrs="{'column_invisible': [('parent.move_type', '!=', 'in_invoice')]}"
                        optional="hide"/>
                </xpath>
    
                <xpath expr="//field[@name='line_ids']/tree/field[@name='company_id']" position="after">
                    <field name="purchase_line_id" invisible="1"/>
                </xpath>
    
            </field>
        </record>

        <record id="account_move_inherit_purchase_inherit" model="ir.ui.view">
            <field name="name">Account Move</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="purchase.view_move_form_inherit_purchase"/>
            <field name="arch" type="xml">
                <field name="purchase_line_id" position="attributes">
                    <attribute name="invisible">0</attribute>
                    <attribute name="optional">hide</attribute>
                    <attribute name="attrs">
                        {'column_invisible': [('parent.move_type', '!=', 'in_invoice')]}
                    </attribute>
                </field>
                <field name="quantity" position="after">
                    <field name="qty_outstanding" optional="hide"/>
                </field>
            </field>
        </record>

        <record id="view_account_invoice_filter_inherit_marketplace" model="ir.ui.view">
            <field name="name">account.move.filter.inherit.marketplace</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_account_invoice_filter"/>
            <field name="arch" type="xml">


                <!-- Tambah filter di search -->
                <xpath expr="//search" position="inside">
                    <field name="invoice_marketplace"
                        string="Invoice Marketplace"
                        filter_domain="[
                            ('invoice_marketplace', 'ilike', self)
                        ]"/>
                </xpath>

            </field>
        </record>

        <record id="account_move_tree_inherit" model="ir.ui.view">
            <field name="name">Account Move</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_invoice_tree"/>
            <field name="arch" type="xml">
                <field name="state" position="after">
                    <field name="uangmuka" optional="hide"/>
                    <field name="reklas" optional="hide"/>
                    <field name="reklas_used" optional="hide"/>
                    <field name="reklas_used_by" optional="hide"/>
                </field>
            </field>
        </record>
        <record id="account_move_tree_entry_inherit" model="ir.ui.view">
            <field name="name">account.move.tree.entry.inherit</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_move_tree"/>
            <field name="arch" type="xml">
                <field name="state" position="after">
                    <field name="efaktur_id" optional="hide"/>
                </field>
            </field>
        </record>


        <record id="view_move_tree_inherit_need_refund" model="ir.ui.view">
            <field name="name">account.move.tree.need.refund</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_invoice_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//tree" position="attributes">
                    <attribute name="decoration-danger">need_refund</attribute>
                </xpath>
                <xpath expr="//tree" position="inside">
                    <field name="need_refund" invisible="1"/>
                </xpath>
            </field>
        </record>

        <record id="action_export_faktur" model="ir.actions.server">
            <field name="name">Export Faktur ke XML</field>
            <field name="model_id" ref="account.model_account_move" />
            <field name="binding_model_id" ref="account.model_account_move" />
            <field name="state">code</field>
            <field name="code">action = records.export_faktur_to_xml()</field>
        </record>

        <record id="action_cancel_bills" model="ir.actions.server">
            <field name="name">Cancel Bills</field>
            <field name="model_id" ref="account.model_account_move" />
            <field name="binding_model_id" ref="account.model_account_move" />
            <field name="state">code</field>
            <field name="code">action = records.queue_job_cancel_bill()</field>
        </record>
    </data>
</odoo>