Jigar Amin (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-821261-jam into
lp:openobject-addons.
Requested reviews:
Bhumika (OpenERP) (sbh-openerp)
Raphael Collet (OpenERP) (rco-openerp)
Related bugs:
Bug #821261 in OpenERP Addons: "Task from sale order - can invoice both"
https://bugs.launchpad.net/openobject-addons/+bug/821261
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-821261-jam/+merge/79940
Changes :
- Bug #821261 : "Task from sale order - can invoice both".
- Issue 1 : "The analytic account from SO does not link as a project in
task." has been fixed with this branch.
Kindly Review This,
Thank You
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-821261-jam/+merge/79940
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-821261-jam.
=== modified file 'project_mrp/project_procurement.py'
--- project_mrp/project_procurement.py 2011-09-16 11:38:32 +0000
+++ project_mrp/project_procurement.py 2011-10-20 10:57:24 +0000
@@ -19,9 +19,7 @@
#
##############################################################################
-from osv import fields, osv, orm
-
-import tools
+from osv import fields, osv
class procurement_order(osv.osv):
_name = "procurement.order"
@@ -34,7 +32,20 @@
return True
def action_produce_assign_service(self, cr, uid, ids, context=None):
+ line_pool=self.pool.get('sale.order.line')
for procurement in self.browse(cr, uid, ids, context=context):
+ # project_id = the product's associated project if it exists,
+ # the sales order's associated project otherwise
+ if procurement.product_id.project_id:
+ project_id = procurement.product_id.project_id.id
+ else:
+ project_id = False
+ line_ids = line_pool.search(cr, uid , [('procurement_id', '=', procurement.id)])
+ for line in line_pool.browse(cr, uid, line_ids):
+ if line.order_id.project_id:
+ project_id = line.order_id.project_id.id
+ break
+
self.write(cr, uid, [procurement.id], {'state': 'running'})
planned_hours = procurement.product_qty
task_id = self.pool.get('project.task').create(cr, uid, {
@@ -47,7 +58,7 @@
'procurement_id': procurement.id,
'description': procurement.note,
'date_deadline': procurement.date_planned,
- 'project_id': procurement.product_id.project_id and procurement.product_id.project_id.id or False,
+ 'project_id': project_id,
'state': 'draft',
'company_id': procurement.company_id.id,
},context=context)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp