c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #03204
[Bug 596658] Re: mrp immediate purchase merge
if we merge automatically, we need a code to split PO, so I propose to
invalidate this until we find another solution.
** Changed in: openobject-addons
Importance: Undecided => Wishlist
** Changed in: openobject-addons
Status: New => Won't Fix
--
mrp immediate purchase merge
https://bugs.launchpad.net/bugs/596658
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Addons Modules: Won't Fix
Bug description:
IMHO when mrp creates purchase order and we have draft PO with
- the same partner
- the same date
- the same pricelist
it should immediately add new PO line to existing PO not creating new PO.
I have checked the code below which should be placed instead of lines 1102 - 1110
po_obj = self.pool.get('purchase.order') # GG patch - search for existing PO to include the line into
po_ids = po_obj.search(cr, uid, [('state','=','draft'),('partner_id','=',partner_id),('location_id','=',procurement.location_id.id), ('pricelist_id','=',pricelist_id),], context=context)
for id in po_ids:
min_planned_date = DateTime.strptime(po_obj.browse(cr, uid, id, context).minimum_planned_date, '%Y-%m-%d %H:%M:%S')
if min_planned_date.day == newdate.day and min_planned_date.month == newdate.month and min_planned_date.year == newdate.year:
purchase_id = id
break
# date equation suppose that PO was just
# created for exactly the same condition. If date is different system creates separate PO
# which can be merged manually by user.
if purchase_id:
purchase = po_obj.browse(cr,uid,purchase_id,context=context)
po_obj.write(cr,uid,[purchase_id],{
'origin' : (purchase.origin and (purchase.origin + ', ') or '') + procurement.origin
}, context)
line.update({
'order_id': purchase_id,
})
self.pool.get('purchase.order.line').create(cr, uid, line)
else:
purchase_id = self.pool.get('purchase.order').create(cr, uid, {
'origin': procurement.origin,
'partner_id': partner_id,
'partner_address_id': address_id,
'location_id': procurement.location_id.id,
'pricelist_id': pricelist_id,
'order_line': [(0,0,line)],
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False
}) # GG patch end