← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp into lp:hr-timesheet

 

Pedro Manuel Baeza has proposed merging lp:~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp into lp:hr-timesheet.

Requested reviews:
  HR Core Editors (hr-core-editors)

For more details, see:
https://code.launchpad.net/~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp/+merge/219821

[FIX] hr_timesheet_sheet: Fix error if there is no project associated to task.
[FIX] hr_timesheet_sheet: Tree view for hr.analytic.timesheet inherited instead of overwritten, to allow other modules to modifiy this view (for example, hr_timesheet_department).
[IMP] hr_timesheet_sheet: Remove obsolete type labels on XML views.
[IMP] hr_timesheet_sheet: Change domain on task to allow various states.
-- 
https://code.launchpad.net/~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp/+merge/219821
Your team HR Core Editors is requested to review the proposed merge of lp:~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp into lp:hr-timesheet.
=== modified file 'hr_timesheet_task/hr_analytic_timesheet_view.xml'
--- hr_timesheet_task/hr_analytic_timesheet_view.xml	2013-04-10 16:14:47 +0000
+++ hr_timesheet_task/hr_analytic_timesheet_view.xml	2014-05-16 11:45:34 +0000
@@ -1,56 +1,35 @@
 <openerp>
     <data>
-        #---------------------------------------------------------------------------------------------------------
-        # Add task on hr.analytic.timesheet
-        #---------------------------------------------------------------------------------------------------------
-            <record id="hr_timesheet_line_form" model="ir.ui.view">
+        <!-- Add task on hr.analytic.timesheet -->
+        <record id="hr_timesheet_line_form" model="ir.ui.view">
             <field name="name">hr.analytic.timesheet.form</field>
             <field name="model">hr.analytic.timesheet</field>
-            <field name="type">form</field>
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
             <field name="arch" type="xml">
                 <field name="user_id" position="after">
-                    <field name="task_id" context="{ 'account_id' : account_id}"
-                        domain="[('state','=','open'), ('project_id.analytic_account_id','=',account_id)]"/>
+                    <field name="task_id"
+                            context="{'account_id': account_id}"
+                            domain="['|', ('state', '!=', 'done'), ('state', '=', False), ('project_id.analytic_account_id','=',account_id)]"/>
                 </field>
             </field>
         </record>
-        <record id="hr_timesheet.hr_timesheet_line_tree" model="ir.ui.view">
+        <record id="hr_timesheet_line_tree" model="ir.ui.view">
             <field name="name">hr.analytic.timesheet.tree</field>
             <field name="model">hr.analytic.timesheet</field>
-            <field name="type">tree</field>
-            <field name="priority">2</field>
+            <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
             <field name="arch" type="xml">
-                <tree editable="top" string="Timesheet Lines">
-                    <field name="date" on_change="on_change_date(date)"/>
-                    <field domain="[('type','=','normal'), ('state','=','open')]" name="account_id"/>
-                    <field name="task_id" context="{'account_id' : account_id}"
-                        domain="[('state','=','open'), ('project_id.analytic_account_id','=',account_id)]"/>
-                    <field name="name"/>
-                    <field name="unit_amount"
-                        on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id, journal_id)"
-                        sum="Total time" widget="float_time"/>
-                    <field name="user_id" on_change="on_change_user_id(user_id)" required="1"/>
-                    <field name="journal_id" invisible="1"/>
-                    <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"/>
-                    <field name="product_uom_id"
-                        on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id, journal_id)"
-                        invisible="1"/>
-                    <field name="amount" sum="Total cost" invisible="1"/>
-                    <field name="general_account_id" invisible="1"/>
-                </tree>
+                <field name="account_id" position="after">
+                    <field name="task_id"
+                            context="{'account_id': account_id}"
+                            domain="['|', ('state', '!=', 'done'), ('state', '=', False), ('project_id.analytic_account_id','=',account_id)]"/>
+                </field>
             </field>
         </record>
-        #---------------------------------------------------------------------------------------------------------
-        # Add task on search hr.analytic.timesheet
-        #---------------------------------------------------------------------------------------------------------
-            <record id="hr_timesheet_line_search" model="ir.ui.view">
+        <!-- Add task on search hr.analytic.timesheet -->
+        <record id="hr_timesheet_line_search" model="ir.ui.view">
             <field name="name">hr.analytic.timesheet.search</field>
             <field name="model">hr.analytic.timesheet</field>
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
-            <field name="type">search</field>
             <field name="arch" type="xml">
                 <field name="date" position="after">
                     <field name="task_id"/>

=== modified file 'hr_timesheet_task/hr_timesheet_sheet_view.xml'
--- hr_timesheet_task/hr_timesheet_sheet_view.xml	2013-03-28 17:30:55 +0000
+++ hr_timesheet_task/hr_timesheet_sheet_view.xml	2014-05-16 11:45:34 +0000
@@ -6,7 +6,6 @@
             <field name="name">hr_timesheet_sheet.sheet.filter</field>
             <field name="model">hr_timesheet_sheet.sheet</field>
             <field name="inherit_id" ref="hr_timesheet_sheet.view_hr_timesheet_sheet_filter"/>
-            <field name="type">search</field>
             <field name="arch" type="xml">
                 <filter name="to_approve" position="after">
                     <separator orientation="vertical"/>
@@ -37,13 +36,13 @@
                     expr="/form/sheet/notebook/page[@string='Details']/field[@name='timesheet_ids']/tree[@string='Timesheet Activities']/field[@name='account_id']"
                     position="after">
                     <field name="task_id" context="{'account_id' : account_id}"
-                        domain="[('state','=','open'), ('project_id.analytic_account_id','=',account_id)]"/>
+                        domain="['|', ('state', '!=', 'done'), ('state', '=', False), ('project_id.analytic_account_id','=',account_id)]"/>
                 </xpath>
                 <xpath
                     expr="/form/sheet/notebook/page[@string='Details']/field[@name='timesheet_ids']/form[@string='Timesheet Activities']/field[@name='account_id']"
                     position="after">
                     <field name="task_id" context="{'account_id' : account_id}"
-                        domain="[('state','=','open'), ('project_id.analytic_account_id','=',account_id)]"/>
+                        domain="['|', ('state', '!=', 'done'), ('state', '=', False), ('project_id.analytic_account_id','=',account_id)]"/>
                 </xpath>
             </field>
         </record>

=== modified file 'timesheet_task/project_task.py'
--- timesheet_task/project_task.py	2014-05-06 08:36:59 +0000
+++ timesheet_task/project_task.py	2014-05-16 11:45:34 +0000
@@ -58,8 +58,9 @@
         # project triggers on task are not called
         res = super(ProjectTask, self)._store_set_values(cr, uid, ids, fields, context=context)
         for row in self.browse(cr, SUPERUSER_ID, ids, context=context):
-            project = row.project_id
-            project.write({'parent_id': project.parent_id.id})
+            if row.project_id:
+                project = row.project_id
+                project.write({'parent_id': project.parent_id.id})
         return res
 
 


Follow ups