openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #01146
lp:~yann-papouin/ocb-addons/6.1-bug-1249345-sale-recreate-packing-duplicates into lp:ocb-addons/6.1
Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/6.1-bug-1249345-sale-recreate-packing-duplicates into lp:ocb-addons/6.1.
Requested reviews:
OpenERP Community Backports Team (ocb)
Related bugs:
Bug #1249345 in OpenERP Community Backports (Addons): "[6.1][7.0][trunk][sale] Recreate Packing create duplicates"
https://bugs.launchpad.net/ocb-addons/+bug/1249345
For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-1249345-sale-recreate-packing-duplicates/+merge/194523
Change _create_pickings_and_procurements to avoid recreating procurement when they are still valid
--
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-1249345-sale-recreate-packing-duplicates/+merge/194523
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/6.1-bug-1249345-sale-recreate-packing-duplicates into lp:ocb-addons/6.1.
=== modified file 'sale/sale.py'
--- sale/sale.py 2013-10-28 11:57:54 +0000
+++ sale/sale.py 2013-11-08 14:38:31 +0000
@@ -825,6 +825,19 @@
date_planned = self._get_date_planned(cr, uid, order, line, order.date_order, context=context)
if line.product_id:
+
+ if line.state == 'confirmed':
+ # Do not recreate existing procurement
+ if line.procurement_id and line.procurement_id.state in ('confirmed', 'running', 'ready', 'done', 'waiting'):
+ continue
+ elif line.state == 'exception':
+ # Reset line state to confirmed
+ self.pool.get('sale.order.line').button_confirm(cr, uid, [line.id])
+ # Cancel existing move if a canceled procurement exists
+ if line.procurement_id and line.procurement_id.state == 'cancel'\
+ and line.procurement_id.move_id and line.procurement_id.move_id.state not in ('done', 'cancel'):
+ move_obj.action_cancel(cr, uid, [line.procurement_id.move_id.id])
+
if line.product_id.product_tmpl_id.type in ('product', 'consu'):
if not picking_id:
picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context))
@@ -1137,7 +1150,7 @@
def copy_data(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []})
+ default.update({'state': 'draft', 'move_ids': [], 'procurement_id': False, 'invoiced': False, 'invoice_lines': []})
return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context)
def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False,
Follow ups