parent
2030147fe0
commit
2d71f013e7
|
@ -31,13 +31,5 @@ class res_company(osv.osv):
|
|||
"forget to setup the right unit of measure in your employees.",
|
||||
),
|
||||
}
|
||||
|
||||
def write(self, cr, uid, ids,vals, context={}):
|
||||
task_ids=self.pool.get('project.task').search(cr, uid, [('state','in',['open', 'pending'])])
|
||||
if ('project_time_mode_id' in vals) and task_ids:
|
||||
raise osv.except_osv(_('Error !'), _('You cannot modify Project Time Unit as there are open or pending tasks created with current time unit.'))
|
||||
return super(res_company,self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
res_company()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -712,7 +712,25 @@ class project_work(osv.osv):
|
|||
}
|
||||
|
||||
_order = "date desc"
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
if 'hours' in vals and (not vals['hours']):
|
||||
vals['hours'] = 0.00
|
||||
if 'task_id' in vals:
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (vals.get('hours',0.0), vals['task_id']))
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids,vals,context={}):
|
||||
if 'hours' in vals and (not vals['hours']):
|
||||
vals['hours'] = 0.00
|
||||
if 'hours' in vals:
|
||||
for work in self.browse(cr, uid, ids, context):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (vals.get('hours',0.0), work.hours, work.task_id.id))
|
||||
return super(project_work,self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def unlink(self, cr, uid, ids, *args, **kwargs):
|
||||
for work in self.browse(cr, uid, ids):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours + %s where id=%s', (work.hours, work.task_id.id))
|
||||
return super(project_work,self).unlink(cr, uid, ids,*args, **kwargs)
|
||||
project_work()
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
<record id="project_task_116" model="project.task">
|
||||
<field name="planned_hours">38.0</field>
|
||||
<field name="remaining_hours">38.0</field>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="type_id" ref="project_tt_development"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="description">BoM, After sales returns, interventions. Traceability.</field>
|
||||
|
@ -280,7 +280,7 @@
|
|||
<record id="project_task_130" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="type_id" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Data importation + Doc</field>
|
||||
|
@ -288,7 +288,7 @@
|
|||
<record id="project_task_131" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="type_id" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Modifications asked by the customer.</field>
|
||||
|
@ -296,7 +296,7 @@
|
|||
<record id="project_task_184" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="type_id" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="priority">0</field>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
|
@ -306,7 +306,7 @@
|
|||
<field name="sequence">15</field>
|
||||
<field name="planned_hours">8.0</field>
|
||||
<field name="remaining_hours">8.0</field>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="type_id" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Internal testing + Software Install</field>
|
||||
|
@ -315,7 +315,7 @@
|
|||
<field name="sequence">17</field>
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="type_id" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="priority">2</field>
|
||||
<field name="state">open</field>
|
||||
|
@ -357,7 +357,6 @@
|
|||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">MRP; functional layer</field>
|
||||
<field name="state">done</field>
|
||||
<field eval="time.strftime('%Y-%m-%d 12:12')" name="date_close"/>
|
||||
</record>
|
||||
<record id="project_task_194" model="project.task">
|
||||
<field name="sequence">30</field>
|
||||
|
|
|
@ -65,10 +65,6 @@
|
|||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}:
|
||||
- state == "open"
|
||||
|
||||
|
||||
|
||||
|
||||
-
|
||||
Test for different project-states
|
||||
-
|
||||
|
@ -109,8 +105,6 @@
|
|||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}:
|
||||
- state == "open"
|
||||
|
||||
|
||||
-
|
||||
Test for task work allocation
|
||||
-
|
||||
|
@ -140,7 +134,7 @@
|
|||
-
|
||||
Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}:
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
work_ids:
|
||||
- date: '2010-05-31 15:04:22'
|
||||
hours: 10.0
|
||||
|
@ -155,7 +149,7 @@
|
|||
-
|
||||
Make a work task entry 'Training on OpenERP xml views' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}:
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
work_ids:
|
||||
- date: '2010-06-01 15:04:46'
|
||||
hours: 10.0
|
||||
|
@ -170,7 +164,7 @@
|
|||
-
|
||||
Make a work task entry 'Training on workflows' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}:
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
work_ids:
|
||||
- date: '2010-06-02 15:05:24'
|
||||
hours: 10.0
|
||||
|
@ -206,7 +200,7 @@
|
|||
-
|
||||
Make a work task entry 'Training on reports and wizards' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}:
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
work_ids:
|
||||
- date: '2010-05-31 15:08:40'
|
||||
hours: 10.0
|
||||
|
@ -257,7 +251,7 @@
|
|||
-
|
||||
Make a work task entry 'Training on yml' of 5 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}:
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
work_ids:
|
||||
- date: '2010-05-31 16:55:27'
|
||||
hours: 5.0
|
||||
|
|
Loading…
Reference in New Issue