[FIX] project: fixed yml issue

bzr revid: hmo@tinyerp.com-20101027113715-b6973r91ravjljjg
This commit is contained in:
Harry (OpenERP) 2010-10-27 17:07:15 +05:30
parent 529163fd9e
commit a91878d868
4 changed files with 41 additions and 40 deletions

View File

@ -134,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}:
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
work_ids:
- date: '2010-05-31 15:04:22'
hours: 10.0
@ -149,7 +149,7 @@
-
Make a work task entry 'Training on OpenERP xml views' of 10 hours
-
!record {model: project.task, id: project_task_technicaltraining0}:
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
work_ids:
- date: '2010-06-01 15:04:46'
hours: 10.0
@ -164,7 +164,7 @@
-
Make a work task entry 'Training on workflows' of 10 hours
-
!record {model: project.task, id: project_task_technicaltraining0}:
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
work_ids:
- date: '2010-06-02 15:05:24'
hours: 10.0
@ -200,7 +200,7 @@
-
Make a work task entry 'Training on reports and wizards' of 10 hours
-
!record {model: project.task, id: project_task_technicaltraining0}:
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
work_ids:
- date: '2010-05-31 15:08:40'
hours: 10.0
@ -251,7 +251,7 @@
-
Make a work task entry 'Training on yml' of 5 hours
-
!record {model: project.task, id: project_task_technicaltraining0}:
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
work_ids:
- date: '2010-05-31 16:55:27'
hours: 5.0

View File

@ -32,6 +32,7 @@ class project_task(osv.osv):
# force inherit from project.project_task so that
# calendar.todo.active is masked oute
'active': base_project_task._columns['active'],
'date_deadline': base_project_task._columns['date_deadline'],
'write_date': fields.datetime('Write Date'),
'create_date': fields.datetime('Create Date', readonly=True),
'attendee_ids': fields.many2many('calendar.attendee', \

View File

@ -10,7 +10,7 @@
Create task 'Plan all projects'
-
!record {model: project.task, id: project_task_planallprojects0}:
date_deadline: '2010-06-07 12:00:00'
date_deadline: '2010-06-07'
date_end: '2010-06-04 14:00:00'
date_start: '2010-06-01 17:25:32'
name: Plan all projects

View File

@ -80,42 +80,42 @@ class project_work(osv.osv):
vals_line = {}
context = kwargs.get('context', {})
if not context.get('no_analytic_entry',False):
obj_task = task_obj.browse(cr, uid, vals['task_id'])
result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
vals_line['user_id'] = vals['user_id']
vals_line['product_id'] = result['product_id']
vals_line['date'] = vals['date'][:10]
#calculate quantity based on employee's product's uom
vals_line['unit_amount'] = vals['hours']
obj_task = task_obj.browse(cr, uid, vals['task_id'])
result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
vals_line['user_id'] = vals['user_id']
vals_line['product_id'] = result['product_id']
vals_line['date'] = vals['date'][:10]
#calculate quantity based on employee's product's uom
vals_line['unit_amount'] = vals['hours']
default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
if result['product_uom_id'] != default_uom:
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False
if acc_id:
vals_line['account_id'] = acc_id
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
if res.get('value'):
vals_line.update(res['value'])
vals_line['general_account_id'] = result['general_account_id']
vals_line['journal_id'] = result['journal_id']
vals_line['amount'] = 0.0
vals_line['product_uom_id'] = result['product_uom_id']
amount = vals_line['unit_amount']
prod_id = vals_line['product_id']
unit = False
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context)
default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
if result['product_uom_id'] != default_uom:
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False
if acc_id:
vals_line['account_id'] = acc_id
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
if res.get('value'):
vals_line.update(res['value'])
vals_line['general_account_id'] = result['general_account_id']
vals_line['journal_id'] = result['journal_id']
vals_line['amount'] = 0.0
vals_line['product_uom_id'] = result['product_uom_id']
amount = vals_line['unit_amount']
prod_id = vals_line['product_id']
unit = False
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context)
# Compute based on pricetype
amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id,
prod_id, amount, False, unit, context=context)
if amount_unit and 'amount' in amount_unit.get('value',{}):
updv = { 'amount': amount_unit['value']['amount'] }
obj_timesheet.write(cr, uid, [timeline_id], updv, context=context)
vals['hr_analytic_timesheet_id'] = timeline_id
# Compute based on pricetype
amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id,
prod_id, amount, False, unit, context=context)
if amount_unit and 'amount' in amount_unit.get('value',{}):
updv = { 'amount': amount_unit['value']['amount'] }
obj_timesheet.write(cr, uid, [timeline_id], updv, context=context)
vals['hr_analytic_timesheet_id'] = timeline_id
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
def write(self, cr, uid, ids, vals, context=None):