[IMP]add expense line and add depend expense of hr in contract for calculation
[odoo/odoo.git] / addons / account_analytic_analysis / account_analytic_analysis_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5         <!--
6         Analytic Account form
7
8         Remove information on Account data => because they move on analysis sheet
9         create a page with invoicing informations
10        
11         <record id="account_analytic_account_invoice_stat_form" model="ir.ui.view">
12             <field name="name">account.analytic.account.invoice.stat.form.inherit</field>
13             <field name="model">account.analytic.account</field>
14             <field name="type">form</field>
15             <field name="inherit_id" ref="hr_timesheet_invoice.account_analytic_account_form_form"/>
16             <field eval="18" name="priority"/>
17             <field name="arch" type="xml">
18                 <group name="invoice_stats" position="inside">
19                     <field name="hours_qtt_non_invoiced" attrs="{'invisible': [('to_invoice','=',0)]}"/>
20                     <field name="ca_to_invoice" attrs="{'invisible': [('to_invoice','=',0)]}"/>
21                     <label string="" colspan="1"/>
22                     <button
23                         name="%(hr_timesheet_invoice.action_hr_timesheet_invoice_create_final)d"
24                         string="Create Invoice"
25                         type="action"
26                         attrs="{'readonly':[('ca_to_invoice','=',0.0)], 'invisible': [('to_invoice','=',0)]}"
27                         icon="gtk-go-forward"/>
28                 </group>
29             </field>
30         </record> -->
31         <act_window
32             id="action_sales_order_line"
33             name="Sales Order Lines"
34             res_model="sale.order.line"
35             src_model="account.analytic.account"
36             />
37          <act_window
38             id="action_timesheet_lines_tree"
39             name="Timesheet Lines"
40             res_model="account.analytic.line"
41             src_model="account.analytic.account"
42             />
43
44         <record id="hr_timesheet.account_analytic_account_form_form" model="ir.ui.view">
45             <field name="name">account.analytic.account.invoice.form.inherit</field>
46             <field name="model">account.analytic.account</field>
47             <field name="type">form</field>
48             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
49             <field eval="18" name="priority"/>
50             <field name="arch" type="xml">
51                 <xpath expr='//field[@name="parent_id"]' position='after'>
52                     <field name="template_id" on_change="on_change_template(template_id)"  domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
53                 </xpath>
54                 <xpath expr='//group[@name="project"]' position="after">
55                     <group col="6" colspan="3" class="oe_form_group_label_border">
56                         <field name="quantity_max"/><label string="/"/> <label string="Remaining"/> <field name="remaining_hours" nolabel="1"/>
57                     </group>
58                 </xpath>
59                 <xpath expr='//separator[@name="description"]' position='before'>
60                     <separator colspan="4" string="Invoicing" name="invoicing"/>
61                    <!--  <group colspan="4">
62                         <group col="2" colspan="1" class="oe_form_group_label_border">
63                             <label string=" "/><label string=" "/>
64                             <field name="fix_price_invoices"/>
65                             <field name="invoice_on_timesheets"/>
66                             <field name="charge_expenses"/>
67                         </group>
68                         <group col="2" colspan="1">
69                             <label string="Est.Tot"/>
70                             <label string="Invoiced"/>
71                             <field name="amount_max" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/>
72                             <field name="ca_invoiced" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/>
73                             <field name="quantity_max" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
74                             <field name="hours_qtt_invoiced" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
75                         </group>
76                         <group col="2" colspan="1" class="oe_form_group_odd_border">
77                             <label string="Remaining"/>
78                             <label string="To Invoice"/>
79                             <field name="remaining_ca" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/>
80                             <field name="ca_to_invoice" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/>
81                             <field name="remaining_hours" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
82                             <field name="hours_qtt_non_invoiced" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
83                         </group>
84                         <group col="2" colspan="1">
85                             <label string=" "/><label string=" "/>
86                             <button name="%(action_sales_order_line)d" string="Sales" type="action" context="{'default_project_id': active_id,'search_default_project_id': active_id}" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/>
87                             <button name="%(sale.action_order_line_tree2)d" string="Lines To Invoice" type="action" context="{'default_project_id': active_id,'search_default_project_id': active_id}" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/>
88                             <button name="%(action_timesheet_lines_tree)d" string="Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
89                 <button name="%(hr_timesheet_invoice.act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice)d" string="Invoice Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
90
91                         </group>
92                     </group> -->
93                     
94                     <group colspan="4" name="contract_lines" class="oe_form_group_label_border">
95                         <table name="contract_data">
96                             <tr name="title" >
97                                 <th ><div class="oe_field_label" ></div></th>
98                                 <td><div></div></td>
99                                 <th ><div class="oe_float_field_view" >Est. Total</div></th>
100                                 <th ><div class="oe_field_view" >Invoiced</div></th>
101                                 <th ><div class="oe_field_view" >Remaining</div></th>
102                                 <th ><div class="oe_float_field_view" >Ready to Invoice</div></th>
103                             </tr>
104                             <tr>
105                                 <th><div class="oe_field_label">Fix price Invoices</div></th>
106                                 <td><div><field name="fix_price_invoices" nolabel="1"/></div></td>
107                                 <td><div class="oe_float_field_view"><field name="amount_max" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/></div></td>
108                                 <td><div class="oe_field_view"><field name="ca_invoiced" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/></div></td>
109                                 <td><div class="oe_field_view"><field name="remaining_ca" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/></div></td>
110                                 <td><div class="oe_float_field_view"><field name="ca_to_invoice" nolabel="1" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/></div></td>
111                                 <td><button class="oe_title_button_right" name="%(action_sales_order_line)d" string="Sales" type="action" context="{'default_project_id': active_id,'search_default_project_id': active_id}" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/></td>
112                                 <td><button class="oe_title_button_left" name="%(sale.action_order_line_tree2)d" string="Lines To Invoice" type="action" context="{'default_project_id': active_id,'search_default_project_id': active_id}" attrs="{'invisible': [('fix_price_invoices','=',0)]}"/></td>
113                                                 </tr>
114                             <tr>
115                                <th><div class="oe_field_label">Invoice on timesheet</div></th>
116                                <td><div><field name="invoice_on_timesheets" nolabel="1"/></div></td>
117                                <td><div class="oe_float_field_view" ><field name="quantity_max" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/></div></td>
118                                <td><div class="oe_field_view" ><field name="hours_qtt_invoiced" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/></div></td>
119                                <td><div class="oe_field_view" ><field name="remaining_hours" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/></div></td>
120                                <td><div class="oe_float_field_view" ><field name="hours_qtt_non_invoiced" nolabel="1" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/></div></td>
121                                <td><button class="oe_title_button_right" name="%(account.action_account_tree1)d" string="Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/></td>
122                                <td><button class="oe_title_button_left" name="%(hr_timesheet_invoice.act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice)d" string="Invoice Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/></td>
123                            </tr>
124                            <tr>
125                                 <th><div class="oe_field_label" >Charge Expenses</div></th>
126                                 <td><div><field name="charge_expenses" nolabel="1"/></div></td>
127                                 <td><div class="oe_float_field_view" ><field name="expense_max" nolabel="1" attrs="{'invisible': [('charge_expenses','=',0)]}"/></div></td>
128                                 <td><div class="oe_field_view" ><field name="expense_invoiced" nolabel="1" attrs="{'invisible': [('charge_expenses','=',0)]}"/></div></td>
129                                 <td><div class="oe_field_view" ><field name="remaining_expense" nolabel="1" attrs="{'invisible': [('charge_expenses','=',0)]}"/></div></td>
130                                 <td><div class="oe_float_field_view"><field name="expense_to_invoice" nolabel="1" attrs="{'invisible': [('charge_expenses','=',0)]}"/></div></td>
131                             </tr> 
132                             <tr name="total">
133                                 <th><div class="oe_field_label" >Total</div></th>
134                                 <td><div></div></td>
135                                 <td><div class="oe_totals" ></div></td>
136                                 <td><div class="oe_totals_view" ></div></td>
137                                 <td><div class="oe_totals_view" ></div></td>
138                                 <td><div class="oe_totals" ></div></td>
139                             </tr>
140                         </table>
141                     </group>
142                         <group colspan="4" class="oe_form_group_label_border"> 
143                                 <field name="pricelist_id" />
144                                 <field name="to_invoice" widget="selection" />
145                         </group>
146                 </xpath>
147                 <!-- <notebook position="inside">
148                     <page string="Invoice Analysis">
149                         <separator colspan="4" string="Work Done Stats"/>
150
151                         <field name="total_cost"/>
152                         <field name="remaining_ca"/>
153                         <field name="ca_invoiced"/>
154                         <field name="ca_theorical"/>
155                         <newline/>
156                         <field name="hours_quantity"/>
157                         <field name="hours_qtt_invoiced"/>
158                         <field name="remaining_hours"/>
159                         <newline/>
160                         <separator colspan="4" string="Analysis Stats"/>
161
162                         <field name="revenue_per_hour"/>
163                         <field name="real_margin"/>
164                         <field name="real_margin_rate"/>
165                         <field name="theorical_margin"/>
166                         <separator colspan="4" string="Key Dates"/>
167
168                         <field name="last_invoice_date"/>
169                         <field name="last_worked_invoiced_date"/>
170                         <field name="last_worked_date"/>
171                     </page>
172                     <page string="Stats by month">
173                         <field colspan="4" name="month_ids" nolabel="1">
174                             <tree string="Month">
175                                 <field name="month"/>
176                                 <field name="unit_amount" widget="float_time"/>
177                             </tree>
178                         </field>
179                     </page>
180                     <page string="Stats by user">
181                         <field colspan="4" name="user_ids" nolabel="1">
182                             <tree string="Users">
183                                 <field name="user"/>
184                                 <field name="unit_amount" widget="float_time"/>
185                             </tree>
186                         </field>
187                     </page>
188                 </notebook> -->
189
190             </field>
191         </record>
192
193         <!-- Add information on Account analytic list for the project management -->
194         <record id="view_account_analytic_account_tree_c2c_2" model="ir.ui.view">
195             <field name="name">account.analytic.account.tree</field>
196             <field name="model">account.analytic.account</field>
197             <field name="inherit_id" ref="account.view_account_analytic_account_list"/>
198             <field name="type">tree</field>
199             <field name="arch" type="xml">
200                 <field name="quantity" position="replace">
201                     <field name="hours_quantity"/>
202                     <field name="hours_qtt_non_invoiced"/>
203                     <field name="remaining_hours"/>
204                     <field name="quantity_max"/>
205                 </field>
206             </field>
207         </record>
208
209         <record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
210             <field name="name">account.analytic.account.tree</field>
211             <field name="model">account.analytic.account</field>
212             <field name="inherit_id" ref="account.view_account_analytic_account_list"/>
213             <field name="type">tree</field>
214             <field name="arch" type="xml">
215                 <field name="date" position="before">
216                     <field name="last_invoice_date"/>
217                     <field name="ca_to_invoice"/>
218                 </field>
219             </field>
220         </record>
221         
222         <record id="template_of_contract_action" model="ir.actions.act_window">
223             <field name="name">Template Of Contract</field>
224             <field name="type">ir.actions.act_window</field>
225             <field name="res_model">account.analytic.account</field>
226             <field name="view_type">form</field>
227             <field name="view_mode">tree,form</field>
228             <field name="domain">[('type','=','template')]</field>
229             <field name="context">{'search_default_type':'template','default_type' : 'template'}</field>
230         </record>
231         <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config" />
232     </data>
233 </openerp>