[FIX] web_kanban: parent can be undefined in some cases
[odoo/odoo.git] / addons / hr_timesheet / hr_timesheet_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5         <record id="hr_timesheet_line_tree" model="ir.ui.view">
6             <field name="name">hr.analytic.timesheet.tree</field>
7             <field name="model">hr.analytic.timesheet</field>
8             <field name="arch" type="xml">
9                 <tree editable="top" string="Timesheet Activities">                  
10                     <field name="date" on_change="on_change_date(date)"/>
11                     <field name="user_id" on_change="on_change_user_id(user_id)" required="1" options='{"no_open": True}'
12                         context="{'default_groups_ref': ['base.group_user']}"/>
13                     <field name="name"/>
14                     <field domain="[('type','=','normal'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
15                     <field name="unit_amount" string="Duration" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" sum="Total time" widget="float_time"/>
16                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
17                     <field name="journal_id" invisible="1"/>
18                     <field name="amount" sum="Total cost" invisible="1"/>
19                     <field name="general_account_id" invisible="1"/>
20                     <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" required="1" domain="[('type','=','service')]" invisible="1"/>
21                 </tree>
22             </field>
23         </record>
24         <record id="hr_timesheet_line_form" model="ir.ui.view">
25             <field name="name">hr.analytic.timesheet.form</field>
26             <field name="model">hr.analytic.timesheet</field>
27             <field name="arch" type="xml">
28                 <form string="Timesheet Activities" version="7.0">
29                     <sheet>
30                     <group>
31                         <group>
32                             <field name="name"/>
33                             <field name="user_id" on_change="on_change_user_id(user_id)" required="1"
34                                 context="{'default_groups_ref': ['base.group_user']}"/>
35                         </group>
36                         <group>
37                             <field name="date" on_change="on_change_date(date)"/>
38                         </group>
39                     </group>
40                     <notebook>
41                         <page string="Information">
42                         <group>
43                             <group string="Product">
44                                 <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" required="1" domain="[('type','=','service')]"/>
45                                 <label string="Duration" for="unit_amount"/>
46                                 <div>
47                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" class="oe_inline"/>
48                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" class="oe_inline"/>
49                                 </div>
50                             </group>
51                             <group string="Accounting">
52                                 <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close'),('parent_id','!=',False)]" name="account_id" select="1"/>
53                                 <field name="amount"/>
54                                 <field name="general_account_id"/>
55                                 <field name="journal_id"/>
56                             </group>
57                         </group>
58                         </page>
59                     </notebook>
60                     </sheet>
61                 </form>
62             </field>
63         </record>
64
65         <record id="hr_timesheet_line_search" model="ir.ui.view">
66             <field name="name">hr.analytic.timesheet.search</field>
67             <field name="model">hr.analytic.timesheet</field>
68             <field name="arch" type="xml">
69                 <search string="Timesheet">
70                     <field name="date"/>
71                     <field name="user_id"/>
72                     <field name="account_id"/>
73                     <group expand="0" string="Group By...">
74                         <filter string="Users" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
75                         <filter string="Analytic account" icon="terp-folder-green" domain="[]" context="{'group_by':'account_id'}"/>
76                         <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
77                         <filter string="Timesheet Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" help="Timesheet by Month"/>
78                     </group>
79                 </search>
80             </field>
81         </record>
82
83         <record model="ir.actions.act_window" id="act_analytic_cost_revenue">
84             <field name="context">{'search_default_group_date': 1, 'search_default_group_journal': 1}</field>
85             <field name="domain">[('account_id','child_of', active_id)]</field>
86             <field name="name">Costs &amp; Revenues</field>
87             <field name="res_model">account.analytic.line</field>
88             <field name="src_model">account.analytic.account</field>
89             <field name="view_mode">tree,form</field>
90             <field name="view_type">form</field>
91             <field name="help" type="html">
92               <p>
93                 No activity yet on this contract.
94               </p><p>
95                 In OpenERP, contracts and projects are implemented using
96                 analytic account. So, you can track costs and revenues to analyse
97                 your margins easily.
98               </p><p>
99                 Costs will be created automatically when you register supplier
100                 invoices, expenses or timesheets.
101               </p><p>
102                 Revenues will be created automatically when you create customer
103                 invoices. Customer invoices can be created based on sale orders
104                 (fixed price invoices), on timesheets (based on the work done) or
105                 on expenses (e.g. reinvoicing of travel costs).
106               </p>
107             </field>
108         </record>
109
110  
111         <record id="account_analytic_account_timesheet_form" model="ir.ui.view">
112             <field name="name">account.analytic.account.invoice.form</field>
113             <field name="model">account.analytic.account</field>
114             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
115             <field name="arch" type="xml">
116                 <xpath expr='//div[@name="project"]' position='inside'>
117                     <field name="use_timesheets"/>
118                     <label for="use_timesheets"/>
119                 </xpath>
120                 <xpath expr='//div[@name="buttons"]' position='inside'>
121                     <button class="oe_inline oe_stat_button" type="action" name="%(act_analytic_cost_revenue)d" 
122                         icon="fa-usd"  string="Cost/Revenue" widget="statinfo"/>
123                 </xpath>
124             </field>
125         </record>
126         
127         <record id="act_hr_timesheet_accounts_form" model="ir.actions.act_window">
128             <field name="name">Timesheet Accounts</field>
129             <field name="type">ir.actions.act_window</field>
130             <field name="res_model">account.analytic.account</field>
131             <field name="view_type">form</field>
132             <field name="view_mode">tree,form</field>
133             <field name="domain">[('use_timesheets','=', True)]</field>
134             <field name="context">{'default_use_timesheets':1}</field>
135         </record>
136
137         <menuitem parent="hr.menu_hr_configuration" id="menu_timesheet_accounts" action="act_hr_timesheet_accounts_form" sequence="7" groups="base.group_hr_manager"/>
138         
139         <record id="act_hr_timesheet_line_evry1_all_form" model="ir.actions.act_window">
140             <field name="name">Timesheet Activities</field>
141             <field name="type">ir.actions.act_window</field>
142             <field name="res_model">hr.analytic.timesheet</field>
143             <field name="view_type">form</field>
144             <field name="view_mode">tree,form</field>
145             <field name="context">{"search_default_today":1}</field>
146             <field name="search_view_id" ref="hr_timesheet_line_search"/>
147             <field name="help" type="html">
148               <p class="oe_view_nocontent_create">
149                 Click to record activities.
150               </p><p>
151                 You can register and track your workings hours by project every
152                 day. Every time spent on a project will become a cost in the
153                 analytic accounting/contract and can be re-invoiced to
154                 customers if required.
155               </p>
156             </field>
157         </record>
158
159         <menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
160
161         <record id="hr_timesheet_employee_extd_form" model="ir.ui.view">
162             <field name="name">hr.timesheet.employee.extd_form</field>
163             <field name="model">hr.employee</field>
164             <field name="inherit_id" ref="hr.view_employee_form"/>
165             <field name="arch" type="xml">
166                 <xpath expr="//group[@name='active_group']" position="before">
167                     <group string="Timesheets">
168                         <field name="product_id" domain="[('type','=','service')]"/>
169                         <field name="journal_id"/>
170                     </group>
171                 </xpath>
172             </field>
173         </record>
174
175         <menuitem id="menu_hr_timesheet_reports" parent="hr.menu_hr_reporting" sequence="5" name="Timesheet"/>
176
177
178     </data>
179 </openerp>