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

« back to all changes in this revision

Viewing changes to kit/wizard/kit_selection.py

  • Committer: duy.vo at msf
  • Date: 2012-09-18 21:05:00 UTC
  • mfrom: (1175 unifield-wm)
  • mto: This revision was merged to the branch mainline in revision 1188.
  • Revision ID: duy.vo@geneva.msf.org-20120918210500-qw8i815ns8xtk3bv
UF-1055: Merged with trunk 1175

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from msf_outgoing import INTEGRITY_STATUS_SELECTION
29
29
 
 
30
 
30
31
class kit_selection(osv.osv_memory):
31
32
    '''
32
33
    kit selection
213
214
                        # we create a Fo line by copying related Fo line. we then execute procurement creation function, and process the procurement
214
215
                        # the merge into the actual Po is forced
215
216
                        # copy the original sale order line, reset po_cft to 'po' (we don't want a new tender if any)
216
 
                        values.update({'po_cft': 'po',
 
217
                        values.update({'line_number': obj.corresponding_so_line_id_kit_selection.line_number, # the Fo is not draft anyway (sourced), following sequencing policy, split Fo line maintains original one
 
218
                                       'po_cft': 'po',
217
219
                                       'product_uom_qty': pol.product_qty*qty,
218
220
                                       'product_uom': uom_id,
219
221
                                       'product_uos_qty': pol.product_qty*qty,
220
222
                                       'product_uos': uom_id,
221
223
                                       'so_back_update_dest_po_id_sale_order_line': obj.order_line_id_kit_selection.order_id.id,
 
224
                                       'so_back_update_dest_pol_id_sale_order_line': obj.order_line_id_kit_selection.id,
222
225
                                       })
223
226
                        # copy existing sol
224
227
                        last_line_id = sol_obj.copy(cr, uid, last_line_id, values, context=ctx_keep_info)
231
234
                        wf_service.trg_validate(uid, 'procurement.order', new_proc_id, 'button_check', cr)
232
235
                        # if original po line is confirmed, we action_confirm new line
233
236
                        if obj.order_line_id_kit_selection.state == 'confirmed':
 
237
                            # the correct line number according to new line number policy is set in po_line_values_hook of order_line_number/order_line_number.py/procurement_order
234
238
                            new_po_ids = pol_obj.search(cr, uid, [('procurement_id', '=', new_proc_id)], context=context)
235
239
                            pol_obj.action_confirm(cr, uid, new_po_ids, context=context)
236
240
                    else:
245
249
                    # create a new pol
246
250
                    # update values for pol structure
247
251
                    values.update({'product_qty': pol.product_qty*qty})
 
252
                    # following new sequencing policy, we check if resequencing occur (behavior 1).
 
253
                    # if not (behavior 2), the split line keeps the same line number as original line
 
254
                    if not pol_obj.allow_resequencing(cr, uid, [obj.order_line_id_kit_selection.id], context=context):
 
255
                        # set default value for line_number as the same as original line
 
256
                        values.update({'line_number': obj.order_line_id_kit_selection.line_number})
248
257
                    
249
258
                    if last_line_id:
250
259
                        # the existing purchase order line has already been updated, we create a new one