[IMP]project_mrp,analytic_contract_project :Fix the problem for creating SO with service type product

bzr revid: cha@tinyerp.com-20120724061051-5ojujboykewg0wwy
This commit is contained in:
Ajay Chauhan (OpenERP) 2012-07-24 11:40:51 +05:30
parent 4d847243d1
commit 7f7595bba7
2 changed files with 6 additions and 5 deletions

View File

@ -78,6 +78,7 @@ class task(osv.osv):
def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
task_browse = self.browse(cr, uid, task_id, context=context)
self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task <em>%s</em> has been <b>created</b>.") % (task_browse.name), context=context)
if task_browse.project_id.analytic_account_id:
self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task <em>%s</em> has been <b>created</b>.") % (task_browse.name), context=context)
return task_id
task()

View File

@ -45,9 +45,9 @@ class procurement_order(osv.osv):
def _convert_qty_company_hours(self, cr, uid, procurement, context=None):
product_uom = self.pool.get('product.uom')
company_time_uom_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
if procurement.product_uom.id != company_time_uom_id:
planned_hours = product_uom._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, company_time_uom_id)
company_time_uom_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id
if procurement.product_uom.id != company_time_uom_id.id and procurement.product_uom.category_id.id == company_time_uom_id.category_id.id:
planned_hours = product_uom._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, company_time_uom_id.id)
else:
planned_hours = procurement.product_qty
return planned_hours
@ -71,7 +71,7 @@ class procurement_order(osv.osv):
task_id = project_task.create(cr, uid, {
'name': '%s:%s' % (procurement.origin or '', procurement.product_id.name),
'date_deadline': procurement.date_planned,
'planned_hours':planned_hours,
'planned_hours': planned_hours,
'remaining_hours': planned_hours,
'user_id': procurement.product_id.product_manager.id,
'notes': procurement.note,