~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_outgoing/msf_outgoing.py

  • Committer: jf
  • Date: 2014-07-28 15:51:36 UTC
  • mfrom: (2204.2.3 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20140728155136-8k3p19xpb3dztrp0
Tags: pilot3.1b3
UFTP-257 [FIX] Application Error when splitting the quantities in reception and receiving the quantities to be more than the items previously ordered.
UTP-1113 [FIX] IR to an external C.U. sourced to stock creates not run messages in sync
UTP-1089 [FIX] Selection of batch number issue in PPL
UTP-1075 [FIX] Not possible to validate PO with products by nomenclature if sourced from an IR
UTP-1070 [FIX] PICK / PACK issue
lp:~unifield-team/unifield-wm/utp-1070-1075-1089-1113

Show diffs side-by-side

added added

removed removed

Lines of Context:
3150
3150
            picking = wizard.picking_id
3151
3151
 
3152
3152
            move_data = {}
 
3153
            for move in picking.move_lines:
 
3154
                if move.id not in move_data:
 
3155
                    move_data.setdefault(move.id, {
 
3156
                            'initial_qty': move.product_qty,
 
3157
                            'processed_qty': 0.00,
 
3158
                            'move': move,
 
3159
                            'first': True,
 
3160
                        })
3153
3161
 
3154
3162
            # Create the new ppl object
3155
3163
            ppl_number = picking.name.split("/")[1]
3181
3189
            # For each processed lines, save the processed quantity to update the draft picking ticket
3182
3190
            # and create a new line on PPL
3183
3191
            for line in wizard.move_ids:
3184
 
                first = False
 
3192
                first = move_data[line.move_id.id]['first']
3185
3193
 
3186
3194
                orig_qty = line.move_id.product_qty
3187
3195
                if line.move_id.original_qty_partial and line.move_id.original_qty_partial != -1:
3193
3201
                        'processed_qty': 0.00,
3194
3202
                        'move': line.move_id,
3195
3203
                    })
3196
 
                    first = True
3197
3204
 
3198
3205
                if line.uom_id.id != line.move_id.product_uom.id:
3199
3206
                    processed_qty = uom_obj._compute_qty(cr, uid, line.uom_id.id, line.quantity, line.move_id.product_uom.id)
3217
3224
                # Update or create the validate picking ticket line
3218
3225
                if first:
3219
3226
                    move_obj.write(cr, uid, [line.move_id.id], values, context=context)
 
3227
                    move_data[line.move_id.id]['first'] = False
3220
3228
                else:
3221
3229
                    # Split happened during the validation
3222
3230
                    # Copy the stock move and set the quantity
3249
3257
                    'non_stock_noupdate': False,
3250
3258
                })
3251
3259
 
3252
 
 
3253
3260
            # For each move, check if there is remaining quantity
3254
3261
            for move_vals in move_data.itervalues():
3255
3262
                # The quantity after the validation does not correspond to the picking ticket quantity
3267
3274
                    if backorder_qty != 0.00:
3268
3275
                        move_obj.write(cr, uid, [original_move_id], {'product_qty': backorder_qty}, context=context)
3269
3276
 
 
3277
                if move_vals['processed_qty'] == 0.00:
 
3278
                    move_obj.write(cr, uid, [move_vals['move'].id], {'product_qty': 0.00}, context=context)
 
3279
 
3270
3280
            wf_service = netsvc.LocalService("workflow")
3271
3281
            wf_service.trg_validate(uid, 'stock.picking', new_ppl_id, 'button_confirm', cr)
3272
3282
            # simulate check assign button, as stock move must be available