8
8
<field name="model">account.invoice</field>
9
9
<field name="type">form</field>
10
10
<field name="inherit_id" ref="account.invoice_supplier_form"/>
11
<field name="priority">30</field>
11
12
<field name="arch" type="xml">
13
<field name='account_id' position="before">
14
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context"/>
15
<field name="have_analytic_distribution" invisible="1"/>
18
<xpath expr="/form//field[@name='invoice_line']" position="before">
14
<xpath expr="/form/notebook" position="before">
20
<group attrs="{'invisible': [('have_analytic_distribution', '=', True)]}" colspan="6">
22
<p style="color: blue; padding-left: 15px;">Please add an analytic distribution on this invoice before creating some invoice lines!</p>
26
<xpath expr="/form//field[@name='invoice_line']" position="attributes">
27
<attribute name="attrs">{'readonly': [('have_analytic_distribution', '=', False)]}</attribute>
16
<group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
17
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/>
18
<button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4"/>
20
<group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
21
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/>
22
<button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4"/>
24
<field name="analytic_distribution_id" invisible="1"/>
29
27
<xpath expr="//tree[@string='Invoice lines']/field[@name='account_analytic_id']" position="replace">
30
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context"/>
36
<!-- Delete old analytic field -->
28
<field name="inactive_product" invisible="1" />
29
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
30
<field name="analytic_distribution_state_recap"/>
31
<field name="have_analytic_distribution_from_header" invisible="1"/>
32
<field name="analytic_distribution_state" invisible="1"/>
33
<field name="is_allocatable" invisible="1"/>
35
<xpath expr="//tree[@string='Invoice lines']" position="attributes">
36
<attribute name="colors">red:analytic_distribution_state == 'invalid' or inactive_product == True;black:analytic_distribution_state in ('none','valid') and inactive_product == False</attribute>
38
<xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before">
39
<field name="is_corrected" invisible="1"/>
40
<button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
46
<record id="invoice_form_2" model="ir.ui.view">
47
<field name="name">account.invoice.supplier.form.2</field>
48
<field name="model">account.invoice</field>
49
<field name="type">form</field>
50
<field name="inherit_id" ref="account.invoice_form"/>
51
<field name="priority">35</field>
52
<field name="arch" type="xml">
54
<xpath expr="/form/notebook" position="before">
55
<group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
56
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/>
57
<button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4"/>
59
<group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
60
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/>
61
<button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4"/>
63
<field name="analytic_distribution_id" invisible="1"/>
70
<record id="view_invoice_line_tree_2" model="ir.ui.view">
71
<field name="name">account.invoice.line.tree.2</field>
72
<field name="model">account.invoice.line</field>
73
<field name="type">tree</field>
74
<field name="inherit_id" ref="account.view_invoice_line_tree"/>
75
<field name="arch" type="xml">
77
<xpath expr="/tree" position="replace">
78
<tree string="Invoice Line" colors="red:inactive_product == True or analytic_distribution_state in ('invalid');blue:inactive_product == False and analytic_distribution_state in ('valid');black:inactive_product == False and analytic_distribution_state in ('none')">
80
<field name="inactive_product" invisible="1" />
81
<field name="account_id" domain="[('restricted_area', '=', 'invoice_lines')]"/>
82
<button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
83
<field name="analytic_distribution_state_recap"/>
84
<field name="have_analytic_distribution_from_header" invisible="1"/>
85
<field name="analytic_distribution_state" invisible="1"/>
86
<field name="is_allocatable" invisible="1"/>
87
<field name="quantity"/>
88
<field name="uos_id" string="UoM"/>
89
<field name="price_unit"/>
90
<field name="price_subtotal"/>
97
<!-- Delete old analytic field and new items for analytic distribution -->
37
98
<record id="invoice_line_form" model="ir.ui.view">
38
99
<field name="name">account.invoice.line.form</field>
39
100
<field name="model">account.invoice.line</field>
40
101
<field name="type">form</field>
41
102
<field name="inherit_id" ref="account.view_invoice_line_form"/>
42
103
<field name="arch" type="xml">
43
<field name="account_analytic_id" position="replace" />
104
<field name="account_analytic_id" position="replace">
106
<group colspan="2" col="4">
107
<button name="button_analytic_distribution" string="Change analytic distribution" type="object" icon="terp-check" context="context" colspan="1" attrs="{'invisible': ['|','|', ('newline', '=', True),('analytic_distribution_state', '!=', 'valid'), ('is_allocatable', '=', False)]}" />
108
<button name="button_analytic_distribution" string="Change analytic distribution" type="object" icon="terp-emblem-important" context="context" colspan="1" attrs="{'invisible': ['|','|', ('newline', '=', True), ('analytic_distribution_state', '=', 'valid'), ('is_allocatable', '=', False)]}" />
109
<field name="analytic_distribution_state_recap" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
110
<field name="have_analytic_distribution_from_header" invisible="1"/>
112
<field name="analytic_distribution_state" invisible="1"/>
113
<field name="newline" invisible="1" />
114
<field name="is_allocatable" invisible="1"/>
120
<record id="view_account_invoice_doc_date_refund" model="ir.ui.view">
121
<field name="name">account.invoice.refund.doc_date.form</field>
122
<field name="model">account.invoice.refund</field>
123
<field name="type">form</field>
124
<field name="inherit_id" ref="account.view_account_invoice_refund"/>
125
<field name="arch" type="xml">
126
<field name="period" position="replace"/>
127
<field name="date" position="replace">
128
<field name="document_date"/>
129
<field name="date" on_change="onchange_date(date)"/>