summaryrefslogtreecommitdiff
path: root/fixco_custom/views/account_move.xml
blob: d5ae9ae7ce866ee7753e2e2e06d1976e47483746 (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
<?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>
    
                <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="reversed_entry_id" position="before">
                    <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="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="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>