~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to account_override/account_invoice_view.xml

  • Committer: Quentin THEURET
  • Date: 2016-03-04 12:15:00 UTC
  • Revision ID: qt@tempo-consulting.fr-20160304121500-u2ay8zrf83ih9fu3
US-826 [IMP] Change the way to check if products is not consistent on add multiple line wizard

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
    <data>
4
4
 
5
5
    <!--
 
6
        Invoice Lines
 
7
    -->
 
8
        <record id="invoice_line_form_2" model="ir.ui.view">
 
9
            <field name="name">account.invoice.line.form.2</field>
 
10
            <field name="model">account.invoice.line</field>
 
11
            <field name="type">tree</field>
 
12
            <field name="inherit_id" ref="account.view_invoice_line_tree"/>
 
13
            <field name="arch" type="xml">
 
14
                <data>
 
15
                    <xpath expr="/tree/field[@name='name']" position="before">
 
16
                        <field name="line_number"/>
 
17
                        <field name="is_corrected" invisible="1"/>
 
18
                        <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
 
19
                    </xpath>
 
20
                </data>
 
21
            </field>
 
22
        </record>
 
23
 
 
24
    <!--
 
25
        Supplier Invoice
 
26
    -->
 
27
        <record id="invoice_supplier_form_3" model="ir.ui.view">
 
28
            <field name="name">account.invoice.supplier.form.3</field>
 
29
            <field name="model">account.invoice</field>
 
30
            <field name="type">form</field>
 
31
            <field name="inherit_id" ref="account.invoice_supplier_form"/>
 
32
            <field name="priority">20</field>
 
33
            <field name="arch" type="xml">
 
34
                <data>
 
35
                    <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='account_id']" position="attributes">
 
36
                        <attribute name="domain">[('company_id', '=', company_id), ('restricted_area', '=', 'in_invoice')]</attribute>
 
37
                    </xpath>
 
38
                    <xpath expr="/form/group[1]/field[@name='partner_id']" position="attributes">
 
39
                        <attribute name="on_change">onchange_partner_id(type,partner_id,date_invoice,payment_term,partner_bank_id,company_id,is_inkind_donation,is_intermission,is_debit_note,is_direct_invoice)</attribute>
 
40
                    </xpath>
 
41
                    <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before">
 
42
                        <field name="line_number"/>
 
43
                    </xpath>
 
44
                    <xpath expr="//field[@name='date_invoice']" position="before">
 
45
                        <field name="document_date"/>
 
46
                    </xpath>
 
47
                    <xpath expr="//field[@name='period_id']" position="replace">
 
48
                    </xpath>
 
49
                    <xpath expr="//label[@string='(keep empty to use the current period)']" position="replace">
 
50
                    </xpath>
 
51
                    <button name='invoice_cancel' position="replace">
 
52
                        <!-- The widget boolean permit to the attrs to work efficiently -->
 
53
                        <field name="purchase_ids" invisible="1" widget="boolean" readonly="1" />
 
54
                        <button name="invoice_cancel" string="Cancel" icon="gtk-cancel" attrs="{'invisible': ['|', ('state', 'in', ['open', 'paid']), ('purchase_ids', '!=', False)]}" confirm="You are about to cancel this invoice. Do you want to proceed?"/>
 
55
                    </button>
 
56
                    <xpath expr="//button[@name='invoice_open']" position="after" >
 
57
                        <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/>
 
58
                        <newline/>
 
59
                        <field name="can_merge_lines" invisible="1"/>
 
60
                        <button name="button_merge_lines" type="object"
 
61
                            colspan="3"
 
62
                            string="Merge Lines by Account" icon="gtk-convert"
 
63
                            confirm="You are about to merge invoice lines; are you sure you want to proceed ? THIS OPERATION CAN NOT BE UNDONE"
 
64
                            attrs="{'invisible': [('can_merge_lines', '!=', True)]}"/>
 
65
                    </xpath>
 
66
               </data>
 
67
            </field>
 
68
        </record>
 
69
 
 
70
    <!-- Change account_id domain -->
 
71
        <record id="invoice_line_form3" model="ir.ui.view">
 
72
            <field name="name">account.invoice.line.form</field>
 
73
            <field name="model">account.invoice.line</field>
 
74
            <field name="type">form</field>
 
75
            <field name="priority" eval="20"/>
 
76
            <field name="inherit_id" ref="account.view_invoice_line_form"/>
 
77
            <field name="arch" type="xml">
 
78
              <xpath expr="//field[@name='account_id']" position="attributes">
 
79
                  <attribute name="domain">[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('restricted_area', '=', 'invoice_lines')]</attribute>
 
80
              </xpath>
 
81
            </field>
 
82
        </record>
 
83
 
 
84
    <!--
6
85
        Delete some field from account_invoice tree:
7
86
        - Salesman or User (user_id)
8
87
        - Total amount (amount_total)
9
88
        - Untaxed (amount_untaxed)
 
89
        Add some elements:
 
90
        - Document date
10
91
    -->
11
92
        <record id="inherit_invoice_tree" model="ir.ui.view">
12
93
            <field name="name">inherit.invoice.tree</field>
16
97
            <field name="priority">17</field>
17
98
            <field name="arch" type="xml">
18
99
                <data>
 
100
                    <xpath expr="/tree/field[@name='date_invoice']" position="before">
 
101
                        <field name="document_date"/>
 
102
                        <field name="supplier_reference"/>
 
103
                    </xpath>
19
104
                    <xpath expr="/tree/field[@name='user_id']" position="replace">
20
105
                    </xpath>
21
106
                    <xpath expr="/tree/field[@name='amount_untaxed']" position="replace">
35
120
        - Salesman or user (user_id)
36
121
        - Total (amount_total)
37
122
        - Responsible button (group by)
 
123
        - Proforma button
 
124
        - Invoices button
 
125
        - Unpaid button
 
126
        And add some ones:
 
127
        - Open button
 
128
        - Paid button
38
129
    -->
39
130
        <record id="inherit_view_account_invoice_filter" model="ir.ui.view">
40
131
            <field name="name">inherit.view.account.invoice.filter</field>
44
135
            <field name="priority">17</field>
45
136
            <field name="arch" type="xml">
46
137
                <data>
 
138
                    <xpath expr="/search/group[1]/filter[@name='proforma']" position="replace">
 
139
                    </xpath>
 
140
                    <xpath expr="/search/group[1]/filter[@name='invoices']" position="replace">
 
141
                    </xpath>
 
142
                    <xpath expr="/search/group[1]/filter[@name='unpaid']" position="attributes">
 
143
                      <attribute name="string">Open</attribute>
 
144
                      <attribute name="help">Open Invoices</attribute>
 
145
                    </xpath>
47
146
                    <xpath expr="/search/group[1]/field[@name='user_id']" position="replace">
48
147
                    </xpath>
49
148
                    <xpath expr="/search/group[3]/filter[@string='Responsible']" position="replace">
50
149
                    </xpath>
 
150
                    <xpath expr="/search/group[2]/field[@name='period_id']" position="after">
 
151
                        <field name="supplier_reference"/>
 
152
                    </xpath>
 
153
                    <xpath expr="/search/group[1]/separator[1]" position="replace">
 
154
                    </xpath>
 
155
                    <xpath expr="/search/group[1]/filter[@name='unpaid']" position="after">
 
156
                        <filter name="paid" icon="terp-dolar" string="Paid" domain="[('state', '=', 'paid')]"/>
 
157
                    </xpath>
51
158
                </data>
52
159
            </field>
53
160
        </record>
54
161
 
55
162
    <!--
56
 
        Delete total from Search view for Sales Receipt and Supplier Vouchers (from account_voucher module)
 
163
        Delete some elements from Stock transfer voucher (customer invoices):
 
164
        - period_id
 
165
        - label with "keep empty…"
 
166
        Add some others elements:
 
167
        - document_date
57
168
    -->
58
 
        <record id="inherit_view_voucher_tree" model="ir.ui.view">
59
 
            <field name="name">inherit.view.voucher.tree</field>
60
 
            <field name="model">account.voucher</field>
61
 
            <field name="type">tree</field>
62
 
            <field name="inherit_id" ref="account_voucher.view_voucher_tree"/>
63
 
            <field name="arch" type="xml">
64
 
                <data>
65
 
                    <xpath expr="/tree/field[@name='amount']" position="attributes">
66
 
                        <attribute name="sum"></attribute>
67
 
                    </xpath>
68
 
                </data>
69
 
            </field>
70
 
        </record>
 
169
        <record id="invoice_form_4" model="ir.ui.view">
 
170
            <field name="name">account.invoice.supplier.form.4</field>
 
171
            <field name="model">account.invoice</field>
 
172
            <field name="type">form</field>
 
173
            <field name="inherit_id" ref="account.invoice_form"/>
 
174
            <field name="priority">22</field>
 
175
            <field name="arch" type="xml">
 
176
                <data>
 
177
                    <xpath expr="//field[@name='date_invoice']" position="before">
 
178
                        <field name="document_date"/>
 
179
                    </xpath>
 
180
                    <xpath expr="//field[@name='period_id']" position="replace">
 
181
                    </xpath>
 
182
                    <xpath expr="//label[@string='(keep empty to use the current period)']" position="replace">
 
183
                    </xpath>
 
184
                </data>
 
185
            </field>
 
186
        </record>
 
187
 
 
188
    <!-- Delete payment lines link from invoices -->
 
189
        <delete model="ir.actions.act_window" search="[('name', 'ilike', '%Payment Lines%')]"/>
 
190
 
 
191
    <!-- Add Split Invoice Button on invoices -->
 
192
        <record id="invoice_form_3" model="ir.ui.view">
 
193
            <field name="name">account.invoice.form.3</field>
 
194
            <field name="model">account.invoice</field>
 
195
            <field name="type">form</field>
 
196
            <field name="inherit_id" ref="account.invoice_form"/>
 
197
            <field name="priority">40</field>
 
198
            <field name="arch" type="xml">
 
199
                <button name='invoice_open' position="after">
 
200
                    <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/>
 
201
                </button>
 
202
            </field>
 
203
        </record>
 
204
 
 
205
        <!--
 
206
            Debit Note views
 
207
        -->
 
208
 
 
209
        <!-- Debit note list -->
 
210
        <record id="view_debit_note_tree" model="ir.ui.view">
 
211
            <field name="name">Debit Note</field>
 
212
            <field name="model">account.invoice</field>
 
213
            <field name="type">tree</field>
 
214
            <field name="priority">19</field>
 
215
            <field name="arch" type="xml">
 
216
                <tree string="Note" colors="blue:state in ('draft');black:state in ('proforma','proforma2','open');gray:state in ('cancel')">
 
217
                    <field name="document_date"/>
 
218
                    <field name="date_invoice"/>
 
219
                    <field name="number"/>
 
220
                    <field name="partner_id"/>
 
221
                    <field name="name"/>
 
222
                    <field name="date_due"/>
 
223
                    <field name="origin"/>
 
224
                    <field name="currency_id"/>
 
225
                    <field name="residual"/>
 
226
                    <field name="amount_total"/>
 
227
                    <field name="state"/>
 
228
                </tree>
 
229
            </field>
 
230
        </record>
 
231
 
 
232
        <!-- Debit Note form -->
 
233
        <record id="view_debit_note_form" model="ir.ui.view">
 
234
            <field name="name">debit.note.form</field>
 
235
            <field name="model">account.invoice</field>
 
236
            <field name="type">form</field>
 
237
            <field name="priority">60</field>
 
238
            <field name="arch" type="xml">
 
239
                <form string="Debit Note" hide_duplicate_button="1">
 
240
                    <group colspan="4" col="8">
 
241
                        <field name="journal_id" domain="[('is_current_instance','=',True)]" on_change="onchange_journal_id(journal_id)"/>
 
242
                        <field name="number"/>
 
243
                        <field name="type" invisible="1"/>
 
244
                        <field name="currency_id" width="50"/>
 
245
                        <button name="%(account.action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" />
 
246
                        <newline/>
 
247
                        <field string="Customer" name="partner_id" domain="[('customer', '=', True)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id, False, False, True, False)" context="{'search_default_customer': 1}"/>
 
248
                        <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
 
249
                        <newline/>
 
250
                        <field name="document_date"/>
 
251
                        <field name="date_invoice"/>
 
252
                    </group>
 
253
                    <group colspan="4" col="8">
 
254
                        <button name="button_debit_note_import_invoice" string="Import invoice" states="draft" type="object" icon="gtk-save-as" colspan="2"
 
255
                            help="Import invoice that come from the default account given in Company configuration ('Import invoice default account for Debit Note')"/>
 
256
                        <group colspan="2"/>
 
257
                    </group>
 
258
                    <notebook colspan="4">
 
259
                        <page string="Invoice">
 
260
                            <field domain="[('company_id', '=', company_id), ('restricted_area', '=', 'out_invoice'), ('is_intersection_counterpart', '=', False)]" name="account_id" />
 
261
                            <field name="name"/>
 
262
                            <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">
 
263
                                <tree editable="top" string="Invoice Line" noteditable="1" hide_new_button="1">
 
264
                                    <field name="name"/>
 
265
                                    <field name="account_id" domain="[('restricted_area', '=', 'invoice_lines')]"/>
 
266
                                    <field name="quantity"/>
 
267
                                    <field name="uos_id" string="UoM"/>
 
268
                                    <field name="price_unit"/>
 
269
                                    <field name="price_subtotal"/>
 
270
                                    <field name="inactive_product" invisible="1" />
 
271
                                    <field name="inactive_error" invisible="1" />
 
272
                                </tree>
 
273
                            </field>
 
274
                            <group col="8" colspan="4">
 
275
                                <label string="" colspan="3"/>
 
276
                                <field name="reconciled"/>
 
277
                                <field name="amount_total"/>
 
278
                                <label string="" colspan="3"/>
 
279
                                <field name="state"/>
 
280
                                <field name="residual"/>
 
281
                            </group>
 
282
                            <group col="8" colspan="4">
 
283
                                <button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
 
284
                                <button name="%(account.action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
 
285
                                <button name='%(account.action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
 
286
                                <button name="invoice_open" type="object" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
 
287
                                <button name="%(account.account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
 
288
                            </group>
 
289
                        </page>
 
290
                        <page string="Other Info">
 
291
                            <field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
 
292
                            <newline/>
 
293
                            <field name="date_due"/>
 
294
                            <field name="user_id"/>
 
295
                            <newline/>
 
296
                            <field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id" />
 
297
                            <field name="origin"/>
 
298
                            <field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id" />
 
299
                            <field name="move_id" />
 
300
                            <separator colspan="4" string="Additional Information"/>
 
301
                            <field colspan="4" name="comment" nolabel="1"/>
 
302
                        </page>
 
303
                        <page string="Payments">
 
304
                            <field name="payment_ids" colspan="4" nolabel="1">
 
305
                                <tree string="Payments">
 
306
                                    <field name="date"/>
 
307
                                    <field name="ref"/>
 
308
                                    <field name="name"/>
 
309
                                    <field name="journal_id" />
 
310
                                    <field name="debit"/>
 
311
                                    <field name="credit"/>
 
312
                                    <field name="amount_currency"/>
 
313
                                    <field name="currency_id"/>
 
314
                                </tree>
 
315
                            </field>
 
316
                        </page>
 
317
                    </notebook>
 
318
                </form>
 
319
            </field>
 
320
        </record>
 
321
 
 
322
        <!--
 
323
            In-kind Donation views
 
324
        -->
 
325
 
 
326
        <!-- In-kind Donation list -->
 
327
        <record id="view_inkind_donation_tree" model="ir.ui.view">
 
328
            <field name="name">inkind.donation.form</field>
 
329
            <field name="model">account.invoice</field>
 
330
            <field name="type">tree</field>
 
331
            <field name="priority">19</field>
 
332
            <field name="arch" type="xml">
 
333
                <tree string="In-kind Donation" colors="blue:state in ('draft');black:state in ('proforma','proforma2','open');gray:state in ('cancel')" hide_new_button="1">
 
334
                    <field name="document_date" />
 
335
                    <field name="date_invoice"/>
 
336
                    <field name="number"/>
 
337
                    <field name="partner_id"/>
 
338
                    <field name="name"/>
 
339
                    <field name="origin"/>
 
340
                    <field name="currency_id"/>
 
341
                    <field name="amount_total"/>
 
342
                    <field name="state"/>
 
343
                </tree>
 
344
            </field>
 
345
        </record>
 
346
 
 
347
        <!-- In-kind Donation form -->
 
348
        <record id="view_inkind_donation_form" model="ir.ui.view">
 
349
            <field name="name">inkind.donation.form</field>
 
350
            <field name="model">account.invoice</field>
 
351
            <field name="type">form</field>
 
352
            <field name="priority">63</field>
 
353
            <field name="arch" type="xml">
 
354
                <form string="In-kind Donation" hide_duplicate_button="1">
 
355
                    <group colspan="4" col="8">
 
356
                        <field name="journal_id" domain="[('is_current_instance','=',True), ('type', '=', 'inkind')]" on_change="onchange_journal_id(journal_id)"/>
 
357
                        <field name="number"/>
 
358
                        <field name="type" invisible="1"/>
 
359
                        <field name="is_inkind_donation" invisible="1"/>
 
360
                        <field name="currency_id" width="50"/>
 
361
                        <button name="%(account.action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" />
 
362
                        <newline/>
 
363
                        <field string="Donor" name="partner_id" domain="[('supplier', '=', True)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id, is_inkind_donation)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
 
364
                        <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" string="Address"/>
 
365
                        <newline/>
 
366
                        <field name="document_date"/>
 
367
                        <field name="date_invoice" />
 
368
                        <newline/>
 
369
                        <group colspan="8" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
 
370
                          <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/>
 
371
                            <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
 
372
                        </group>
 
373
                        <group colspan="8" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
 
374
                            <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/>
 
375
                            <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
 
376
                        </group>
 
377
                        <newline/>
 
378
                        <field name="analytic_distribution_id" invisible="1"/>
 
379
                        <group colspan="2"/>
 
380
                        <field name="company_id" invisible="1"/>
 
381
                    </group>
 
382
                    <notebook colspan="4">
 
383
                        <page string="Invoice">
 
384
                            <field invisible="1" domain="[('company_id', '=', company_id), ('restricted_area', '=', 'donation_header')]" name="account_id"/>
 
385
                            <field name="fake_account_id" domain="[('company_id', '=', company_id), ('restricted_area', '=', 'donation_header')]"/>
 
386
                            <field name="reference_type" nolabel="1" size="0"/>
 
387
                            <field name="reference" nolabel="1"/>
 
388
                            <field name="name"/>
 
389
                            <field name="origin"/>
 
390
                            <newline/>
 
391
                            <label string="" colspan="2"/>
 
392
                            <field name="check_total" required="2"/>
 
393
                            <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">
 
394
                                <tree editable="top" string="Donation Lines" noteditable="1" hide_new_button="1">
 
395
                                    <field name="line_number"/>
 
396
                                    <field name="is_corrected" invisible="1"/>
 
397
                                    <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
 
398
                                    <field name="product_id"/>
 
399
                                    <field name="account_id" domain="[('restricted_area', '=', 'donation_lines')]"/>
 
400
                                    <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection"
 
401
                                        context="{'d_journal_id': parent.journal_id , 'd_partner_id': parent.partner_id, 'd_address_invoice_id':parent.address_invoice_id,'d_date_invoice': parent.date_invoice, 'd_register_posting_date': parent.register_posting_date, 'd_account_id': parent.account_id, 'd_partner_bank_id': parent.partner_bank_id, 'd_payment_term': parent.payment_term, 'd_name': parent.name, 'd_origine': parent.origin, 'd_address_contact_id': parent.address_contact_id, 'd_user_id': parent.user_id, 'd_comment': parent.comment}"
 
402
                                        />
 
403
                                    <field name="analytic_distribution_state_recap" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
 
404
                                    <field name="analytic_distribution_state" invisible="1"/>
 
405
                                    <field name="have_analytic_distribution_from_header" invisible="1"/>
 
406
                                    <field name="quantity"/>
 
407
                                    <field name="price_unit"/>
 
408
                                    <field name="price_subtotal"/>
 
409
                                    <field name="name"/>
 
410
                                    <field name="inactive_product" invisible="1" />
 
411
                                    <field name="inactive_error" invisible="1" />
 
412
                                </tree>
 
413
                            </field>
 
414
                            <group col="8" colspan="4">
 
415
                                <label string="" colspan="2"/>
 
416
                                <field name="have_donation_certificate" invisible="1"/>
 
417
                                <button name="button_donation_certificate" type="object" string="No Donation certificate" icon="terp-mail-replied" readonly="1" attrs="{'invisible': [('have_donation_certificate', '!=', False)]}"/>
 
418
                                <button name="button_donation_certificate" type="object" string="Donation certificate" icon="terp-mail-replied" attrs="{'invisible': [('have_donation_certificate', '=', False)]}"/>
 
419
                                <field name="state"/>
 
420
                                <field name="amount_total"/>
 
421
                            </group>
 
422
                            <group col="2" colspan="4" states="draft">
 
423
                                <label string=""/>
 
424
                                <button name="invoice_open" type="object" states="draft" string="Validate" icon="gtk-go-forward"/>
 
425
                            </group>
 
426
                            <group col="2" colspan="4" states="open,paid">
 
427
                                <button name="invoice_cancel" states="open" string="Cancel" icon="gtk-cancel" confirm="Do you confirm Donation received cancellation?"/>
 
428
                                <button name="%(account.account_invoices)d" string="Print Donation" type="action" icon="gtk-print" states="open,paid"/>
 
429
                            </group>
 
430
                        </page>
 
431
                    </notebook>
 
432
                </form>
 
433
            </field>
 
434
        </record>
 
435
 
 
436
        <!--
 
437
            Intermission Voucher views
 
438
        -->
 
439
 
 
440
        <!-- Intermission Voucher list -->
 
441
        <record id="view_intermission_tree" model="ir.ui.view">
 
442
            <field name="name">intermission.tree</field>
 
443
            <field name="model">account.invoice</field>
 
444
            <field name="type">tree</field>
 
445
            <field name="priority">19</field>
 
446
            <field name="arch" type="xml">
 
447
                <tree string="Intermission Voucher" colors="blue:state in ('draft');black:state in ('proforma','proforma2','open');gray:state in ('cancel')">
 
448
                    <field name="document_date" string="I/MI voucher date"/>
 
449
                    <field name="date_invoice"/>
 
450
                    <field name="number"/>
 
451
                    <field name="partner_id"/>
 
452
                    <field name="name"/>
 
453
                    <field name="origin"/>
 
454
                    <field name="currency_id"/>
 
455
                    <field name="amount_total"/>
 
456
                    <field name="state"/>
 
457
                </tree>
 
458
            </field>
 
459
        </record>
 
460
 
 
461
        <!-- Intermission Voucher Form -->
 
462
        <record id="view_intermission_form" model="ir.ui.view">
 
463
            <field name="name">intermission.form</field>
 
464
            <field name="model">account.invoice</field>
 
465
            <field name="type">form</field>
 
466
            <field name="priority">64</field>
 
467
            <field name="arch" type="xml">
 
468
                <form string="Intermission Voucher" hide_duplicate_button="1">
 
469
                    <group colspan="4" col="8">
 
470
                        <field name="fake_journal_id" domain="[('is_current_instance','=',True)]" />
 
471
                        <field name="number"/>
 
472
                        <field name="type" invisible="1"/>
 
473
                        <field name="is_intermission" invisible="1"/>
 
474
                        <field name="fake_currency_id"/>
 
475
                        <newline/>
 
476
                        <field string="Partner" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id, False, is_intermission)" domain="[('by_invoice_type', '=', True), ('partner_type', '=', 'intermission')]" context="{'type': context.get('type')}"/>
 
477
                        <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" string="Partner address"/>
 
478
                        <newline/>
 
479
                        <field name="document_date" string="I/MI voucher date"/>
 
480
                        <field name="date_invoice"/>
 
481
                        <newline/>
 
482
                        <group colspan="8" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
 
483
                          <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/>
 
484
                            <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
 
485
                        </group>
 
486
                        <group colspan="8" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
 
487
                            <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/>
 
488
                            <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
 
489
                        </group>
 
490
                        <field name="analytic_distribution_id" invisible="1"/>
 
491
                        <group colspan="2"/>
 
492
                    </group>
 
493
                    <notebook colspan="4">
 
494
                        <page string="Invoice">
 
495
                            <field invisible="1" domain="[('company_id', '=', company_id), ('restricted_area', '=', 'intermission_header')]" name="account_id" />
 
496
                            <field name="fake_account_id" domain="[('restricted_area', '=', 'intermission_header')]"/>
 
497
                            <field name="name" string="Reference"/>
 
498
                            <newline/>
 
499
                            <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" context="{'is_intermission': True}">
 
500
                                <tree string="Intermission Voucher Lines">
 
501
                                    <field name="is_corrected" invisible="1"/>
 
502
                                    <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
 
503
                                    <field name="name"/>
 
504
                                    <field name="account_id" domain="[('restricted_area', '=', 'intermission_lines')]"/>
 
505
                                    <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection"
 
506
                                        context="{'d_journal_id': parent.journal_id , 'd_partner_id': parent.partner_id, 'd_address_invoice_id':parent.address_invoice_id,'d_date_invoice': parent.date_invoice, 'd_register_posting_date': parent.register_posting_date, 'd_account_id': parent.account_id, 'd_partner_bank_id': parent.partner_bank_id, 'd_payment_term': parent.payment_term, 'd_name': parent.name, 'd_origine': parent.origin, 'd_address_contact_id': parent.address_contact_id, 'd_user_id': parent.user_id, 'd_comment': parent.comment, 'is_intermission': True}"
 
507
                                        />
 
508
                                    <field name="analytic_distribution_state_recap" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
 
509
                                    <field name="analytic_distribution_state" invisible="1"/>
 
510
                                    <field name="have_analytic_distribution_from_header" invisible="1"/>
 
511
                                    <field name="quantity"/>
 
512
                                    <field name="uos_id" string="UOM" invisible="1" />
 
513
                                    <field name="price_unit"/>
 
514
                                    <field name="price_subtotal"/>
 
515
                                    <field name="inactive_product" invisible="1" />
 
516
                                    <field name="inactive_error" invisible="1" />
 
517
                                </tree>
 
518
                                <form string="Intermission Voucher Lines">
 
519
                                    <notebook>
 
520
                                        <page string="Line">
 
521
                                            <field name="name"/>
 
522
                                            <field name="account_id" domain="[('restricted_area', '=', 'intermission_lines')]"/>
 
523
                                            <field name="quantity"/>
 
524
                                            <field name="uos_id" string="UOM" invisible="1"/>
 
525
                                            <field name="price_unit"/>
 
526
                                            <field name="price_subtotal"/>
 
527
                                        </page>
 
528
                                        <page string="Notes">
 
529
                                            <field name="note" nolabel="1" colspan="4"/>
 
530
                                        </page>
 
531
                                    </notebook>
 
532
                                </form>
 
533
                            </field>
 
534
                            <group col="8" colspan="4">
 
535
                                <label string="" colspan="3"/>
 
536
                                <field name="state"/>
 
537
                                <field name="amount_total"/>
 
538
                            </group>
 
539
                            <group col="2" colspan="4" states="draft">
 
540
                                <label string=""/>
 
541
                                <button name="invoice_open" type="object" states="draft" string="Validate" icon="gtk-go-forward"/>
 
542
                            </group>
 
543
                            <group col="2" colspan="4" states="open,paid">
 
544
                                <label string=""/>
 
545
                                <button name="%(account.account_invoices)d" string="Print Intermission Voucher" type="action" icon="gtk-print" states="open,paid"/>
 
546
                            </group>
 
547
                        </page>
 
548
                        <page string="Other Info">
 
549
                            <field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
 
550
                            <newline/>
 
551
                            <field name="date_due"/>
 
552
                            <field name="user_id"/>
 
553
                            <newline/>
 
554
                            <field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id" />
 
555
                            <field name="origin"/>
 
556
                            <field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id" />
 
557
                            <field name="move_id" />
 
558
                            <separator colspan="4" string="Additional Information"/>
 
559
                            <field colspan="4" name="comment" nolabel="1"/>
 
560
                        </page>
 
561
                    </notebook>
 
562
                </form>
 
563
            </field>
 
564
        </record>
 
565
 
 
566
        <!--
 
567
            Delete some elements on customer invoices:
 
568
            - fiscal_position field
 
569
            - proforma button (invoice_proforma2)
 
570
            - payment_term field
 
571
            - tax frame
 
572
            - compute tax button (button_reset_taxes)
 
573
            - amount untaxed field
 
574
            - amount tax field
 
575
            Update some other ones:
 
576
            - account_id field to add a domain on accounts regarding "ACCOUNT_RESTRICTED_AREA" variable
 
577
        -->
 
578
        <record id="inherit_invoice_form" model="ir.ui.view">
 
579
            <field name="name">inherit.invoice.form</field>
 
580
            <field name="model">account.invoice</field>
 
581
            <field name="type">form</field>
 
582
            <field name="inherit_id" ref="account.invoice_form"/>
 
583
            <field name="priority">61</field>
 
584
            <field name="arch" type="xml">
 
585
                <data>
 
586
                    <xpath expr="/form" position="attributes">
 
587
                        <attribute name="string">Stock Transfer Voucher</attribute>
 
588
                    </xpath>
 
589
                    <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='account_id']" position="attributes">
 
590
                        <attribute name="domain">[('company_id', '=', company_id), ('restricted_area', '=', 'out_invoice')]</attribute>
 
591
                    </xpath>
 
592
                    <field name="fiscal_position" position="replace"/>
 
593
                    <field name="payment_term" position="replace"/>
 
594
                    <field name="tax_line" position="replace"/>
 
595
                    <button name="button_reset_taxes" position="replace"/>
 
596
                    <button name="invoice_proforma2" position="replace"/>
 
597
                    <xpath expr="/form/notebook/page[@string='Invoice']/group[2]" position="replace">
 
598
                        <group col="8" colspan="4">
 
599
                            <label string="" colspan="3"/>
 
600
                            <field name="reconciled"/>
 
601
                            <field name="amount_total"/>
 
602
                            <label string="" colspan="3"/>
 
603
                            <field name="state"/>
 
604
                            <field name="residual"/>
 
605
                            <field name="is_debit_note" invisible="1"/>
 
606
                        </group>
 
607
                        <group col="8" colspan="4">
 
608
                            <button name="invoice_cancel" states="proforma2,open" string="Cancel" icon="gtk-cancel"/>
 
609
                            <button name="%(account.action_account_invoice_refund)d" type='action' string='Refund' icon="gtk-execute" attrs="{'invisible': ['|', ('state', 'in', ['draft']), ('type', 'in', ['in_refund', 'out_refund'])]}"/>
 
610
                            <button name='%(account.action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
 
611
                            <button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward" type="object"/>
 
612
                            <button name="%(account.account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
 
613
                        </group>
 
614
                    </xpath>
 
615
                    <xpath expr="//page[@string='Payments']" position="replace">
 
616
                    </xpath>
 
617
                </data>
 
618
            </field>
 
619
        </record>
 
620
 
 
621
        <!--
 
622
            Debit note actions
 
623
        -->
 
624
 
 
625
        <!-- Display debit note list (only invoice that have 'is_debit_note' to True)-->
 
626
        <record id="action_debit_note" model="ir.actions.act_window">
 
627
            <field name="name">Debit Note</field>
 
628
            <field name="res_model">account.invoice</field>
 
629
            <field name="view_type">form</field>
 
630
            <field name="view_mode">tree,form,calendar,graph</field>
 
631
            <field eval="False" name="view_id"/>
 
632
            <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '!=', False), ('is_inkind_donation', '=', False)]</field>
 
633
            <field name="context">{'type':'out_invoice', 'journal_type': 'sale', 'is_debit_note': True}</field>
 
634
            <field name="search_view_id" ref="account.view_account_invoice_filter"/>
 
635
        </record>
 
636
 
 
637
        <!-- Link between previous action and Debit Note tree view -->
 
638
        <record model="ir.actions.act_window.view" id="act_debit_note_tree">
 
639
            <field name="sequence" eval="5"/>
 
640
            <field name="view_mode">tree</field>
 
641
            <field name="view_id" ref="view_debit_note_tree"/>
 
642
            <field name="act_window_id" ref="action_debit_note"/>
 
643
        </record>
 
644
 
 
645
        <!-- Link between action and Debit Note form view -->
 
646
        <record model="ir.actions.act_window.view" id="act_debit_note_form">
 
647
            <field name="sequence" eval="10"/>
 
648
            <field name="view_mode">form</field>
 
649
            <field name="view_id" ref="view_debit_note_form"/>
 
650
            <field name="act_window_id" ref="action_debit_note"/>
 
651
        </record>
 
652
 
 
653
        <!-- Donation search view filter -->
 
654
        <record id="view_account_invoice_filter_donation" model="ir.ui.view">
 
655
            <field name="name">view.account.invoice.filter.donation</field>
 
656
            <field name="model">account.invoice</field>
 
657
            <field name="type">search</field>
 
658
            <field name="priority">20</field>
 
659
            <field name="arch" type="xml">
 
660
                <search string="Search Donation">
 
661
                   <group col="10" colspan="4">
 
662
                        <filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
 
663
                        <filter name="open" icon="terp-camera_test" string="Open" domain="[('state','=','open')]" help="Open Invoices"/>
 
664
                        <filter name="cancelled" icon="terp-dialog-close" string="Cancelled" domain="[('state','=','cancel')]" help="Cancelled Invoices"/>
 
665
                        <separator orientation="vertical"/>
 
666
                        <field name="number"/>
 
667
                        <field name="partner_id"/>
 
668
                        <field name="origin"/>
 
669
                        <field name="amount_total"/>
 
670
                    </group>
 
671
                    <newline/>
 
672
                    <group col="10" colspan="4">
 
673
                        <field name="journal_id" widget="selection" select='1'/>
 
674
                        <field name="period_id" select='1' string="Period"/>
 
675
                    </group>
 
676
                    <newline/>
 
677
                    <group expand="0" string="Group By...">
 
678
                        <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
 
679
                        <separator orientation="vertical"/>
 
680
                        <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
 
681
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]"  context="{'group_by':'state'}"/>
 
682
                        <separator orientation="vertical"/>
 
683
                        <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
 
684
                        <filter string="Posting Date" icon="terp-go-month" domain="[]"  context="{'group_by':'date_invoice'}"/>
 
685
                        <filter string="Due Date" icon="terp-go-month" domain="[]"  context="{'group_by':'date_due'}"/>
 
686
                    </group>
 
687
               </search>
 
688
            </field>
 
689
        </record>
 
690
 
 
691
        <!-- Display in-kind donation list (only invoice that have 'is_inkind_donation' to True)-->
 
692
        <record id="action_inkind_donation" model="ir.actions.act_window">
 
693
            <field name="name">Donation</field>
 
694
            <field name="res_model">account.invoice</field>
 
695
            <field name="view_type">form</field>
 
696
            <field name="view_mode">tree,form,calendar,graph</field>
 
697
            <field eval="False" name="view_id"/>
 
698
            <field name="domain">[('type','=','in_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', True)]</field>
 
699
            <field name="context">{'type':'in_invoice', 'journal_type': 'inkind'}</field>
 
700
            <field name="search_view_id" ref="view_account_invoice_filter_donation"/>
 
701
        </record>
 
702
 
 
703
        <!-- Link between previous action and In-kind Donation tree view -->
 
704
        <record model="ir.actions.act_window.view" id="act_inkind_donation_tree">
 
705
            <field name="sequence" eval="6"/>
 
706
            <field name="view_mode">tree</field>
 
707
            <field name="view_id" ref="view_inkind_donation_tree"/>
 
708
            <field name="act_window_id" ref="action_inkind_donation"/>
 
709
        </record>
 
710
 
 
711
        <!-- Link between action and In-kind Donation form view -->
 
712
        <record model="ir.actions.act_window.view" id="act_inkind_donation_form">
 
713
            <field name="sequence" eval="11"/>
 
714
            <field name="view_mode">form</field>
 
715
            <field name="view_id" ref="view_inkind_donation_form"/>
 
716
            <field name="act_window_id" ref="action_inkind_donation"/>
 
717
        </record>
 
718
 
 
719
        <!-- Display Intermission voucher OUT -->
 
720
        <record id="action_intermission_out" model="ir.actions.act_window">
 
721
            <field name="name">Intermission Voucher OUT</field>
 
722
            <field name="res_model">account.invoice</field>
 
723
            <field name="view_type">form</field>
 
724
            <field name="view_mode">tree,form,calendar,graph</field>
 
725
            <field eval="False" name="view_id"/>
 
726
            <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', True)]</field>
 
727
            <field name="context">{'type':'out_invoice', 'journal_type': 'intermission', 'is_intermission': True, 'intermission_type': 'out'}</field>
 
728
            <field name="search_view_id" ref="account.view_account_invoice_filter"/>
 
729
        </record>
 
730
 
 
731
        <!-- Link between previous action and Intermission tree view -->
 
732
        <record model="ir.actions.act_window.view" id="act_intermission_tree_out">
 
733
            <field name="sequence" eval="5"/>
 
734
            <field name="view_mode">tree</field>
 
735
            <field name="view_id" ref="view_intermission_tree"/>
 
736
            <field name="act_window_id" ref="action_intermission_out"/>
 
737
        </record>
 
738
 
 
739
        <!-- Link between action and Intermission form view -->
 
740
        <record model="ir.actions.act_window.view" id="act_intermission_form_out">
 
741
            <field name="sequence" eval="10"/>
 
742
            <field name="view_mode">form</field>
 
743
            <field name="view_id" ref="view_intermission_form"/>
 
744
            <field name="act_window_id" ref="action_intermission_out"/>
 
745
        </record>
 
746
 
 
747
        <!-- Display Intermission voucher IN -->
 
748
        <record id="action_intermission_in" model="ir.actions.act_window">
 
749
            <field name="name">Intermission Voucher IN</field>
 
750
            <field name="res_model">account.invoice</field>
 
751
            <field name="view_type">form</field>
 
752
            <field name="view_mode">tree,form,calendar,graph</field>
 
753
            <field name="view_id" ref="view_intermission_form"/>
 
754
            <field name="domain">[('type','=','in_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', True)]</field>
 
755
            <field name="context">{'type':'in_invoice', 'journal_type': 'intermission', 'is_intermission': True, 'intermission_type': 'in'}</field>
 
756
            <field name="search_view_id" ref="account.view_account_invoice_filter"/>
 
757
        </record>
 
758
 
 
759
        <!-- Link between previous action and Intermission tree view -->
 
760
        <record model="ir.actions.act_window.view" id="act_intermission_tree_in">
 
761
            <field name="sequence" eval="5"/>
 
762
            <field name="view_mode">tree</field>
 
763
            <field name="view_id" ref="view_intermission_tree"/>
 
764
            <field name="act_window_id" ref="action_intermission_in"/>
 
765
        </record>
 
766
 
 
767
        <!-- Link between action and Intermission form view -->
 
768
        <record model="ir.actions.act_window.view" id="act_intermission_form_in">
 
769
            <field name="sequence" eval="10"/>
 
770
            <field name="view_mode">form</field>
 
771
            <field name="view_id" ref="view_intermission_form"/>
 
772
            <field name="act_window_id" ref="action_intermission_in"/>
 
773
        </record>
 
774
 
 
775
        <!-- Fix customer invoice display with a bypass on 'is_debit_note' set to True -->
 
776
        <record id="account.action_invoice_tree1" model="ir.actions.act_window">
 
777
            <field name="name">Customer Invoices</field>
 
778
            <field name="res_model">account.invoice</field>
 
779
            <field name="view_type">form</field>
 
780
            <field name="view_mode">tree,form,calendar,graph</field>
 
781
            <field eval="False" name="view_id"/>
 
782
            <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', False)]</field>
 
783
            <field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field>
 
784
            <field name="search_view_id" ref="account.view_account_invoice_filter"/>
 
785
            <field name="help">With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.</field>
 
786
        </record>
 
787
 
 
788
        <!-- Fix supplier invoice display with a bypass on 'is_inkind_donation' set to True -->
 
789
        <record id="account.action_invoice_tree2" model="ir.actions.act_window">
 
790
            <field name="name">Supplier Invoices</field>
 
791
            <field name="res_model">account.invoice</field>
 
792
            <field name="view_type">form</field>
 
793
            <field name="view_mode">tree,form,calendar,graph</field>
 
794
            <field eval="False" name="view_id"/>
 
795
            <field name="domain">[('type','=','in_invoice'), ('is_direct_invoice', '=', False), ('is_inkind_donation', '=', False), ('is_debit_note', "=", False), ('is_intermission', '=', False)]</field>
 
796
            <field name="context">{'type':'in_invoice', 'journal_type': 'purchase'}</field>
 
797
            <field name="search_view_id" ref="account.view_account_invoice_filter"/>
 
798
            <field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers.
 
799
                OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice
 
800
                from your supplier according to what you purchased or received.</field>
 
801
        </record>
 
802
 
 
803
        <!--
 
804
            Debit Note Menu
 
805
        -->
 
806
 
 
807
        <!-- Debit Note Menu in "Customer Invoices" -->
 
808
        <menuitem action="action_debit_note" id="menu_action_debit_note" parent="account.menu_finance_receivables" sequence="10"/>
 
809
 
 
810
        <!-- In-kind Donation Menu in "Supplier Invoices" -->
 
811
        <menuitem action="action_inkind_donation" id="menu_action_inkind_donation" parent="account.menu_finance_payables" sequence="11"/>
 
812
 
 
813
        <!-- Intermission Voucher OUT in "Customer Invoices" -->
 
814
        <menuitem action="action_intermission_out" id="menu_action_intermission_out" parent="account.menu_finance_receivables" sequence="10"/>
 
815
 
 
816
        <!-- Intermission Voucher IN in "Supplier Invoices" -->
 
817
        <menuitem action="action_intermission_in" id="menu_action_intermission_in" parent="account.menu_finance_payables" sequence="12"/>
 
818
 
 
819
        <!--
 
820
            Account invoice report redefinition
 
821
        -->
 
822
 
 
823
        <report
 
824
            auto="False"
 
825
            id="account.account_invoices"
 
826
            model="account.invoice"
 
827
            name="account.invoice2"
 
828
            rml="account_override/report/account_print_invoice.rml"
 
829
            string="Print report"
 
830
            target_filename="${eval(_get_invoice_report_name)}"
 
831
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/',''))"
 
832
            attachment_use="1"
 
833
            multi="True"/>
71
834
 
72
835
    </data>
73
836
</openerp>