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

« back to all changes in this revision

Viewing changes to kit/wizard/kit_selection.py

  • Committer: jf
  • Date: 2012-08-03 14:15:44 UTC
  • mfrom: (1071.2.4 uf-1303)
  • Revision ID: jf@tempo4-20120803141544-xaplb4ot6do2b7iz
UF-1311 [FIX] Column of local expense should not be all in bold
UF-1310 [FIX] A menu is missing in supply configuration
lp:~unifield-team/unifield-wm/uf-1310

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
 
 
31
30
class kit_selection(osv.osv_memory):
32
31
    '''
33
32
    kit selection
214
213
                        # we create a Fo line by copying related Fo line. we then execute procurement creation function, and process the procurement
215
214
                        # the merge into the actual Po is forced
216
215
                        # copy the original sale order line, reset po_cft to 'po' (we don't want a new tender if any)
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',
 
216
                        values.update({'po_cft': 'po',
219
217
                                       'product_uom_qty': pol.product_qty*qty,
220
218
                                       'product_uom': uom_id,
221
219
                                       'product_uos_qty': pol.product_qty*qty,
222
220
                                       'product_uos': uom_id,
223
221
                                       '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,
225
222
                                       })
226
223
                        # copy existing sol
227
224
                        last_line_id = sol_obj.copy(cr, uid, last_line_id, values, context=ctx_keep_info)
234
231
                        wf_service.trg_validate(uid, 'procurement.order', new_proc_id, 'button_check', cr)
235
232
                        # if original po line is confirmed, we action_confirm new line
236
233
                        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
238
234
                            new_po_ids = pol_obj.search(cr, uid, [('procurement_id', '=', new_proc_id)], context=context)
239
235
                            pol_obj.action_confirm(cr, uid, new_po_ids, context=context)
240
236
                    else:
249
245
                    # create a new pol
250
246
                    # update values for pol structure
251
247
                    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})
257
248
                    
258
249
                    if last_line_id:
259
250
                        # the existing purchase order line has already been updated, we create a new one
365
356
        assert context, 'No context defined, problem on method call'
366
357
        if isinstance(ids, (int, long)):
367
358
            ids = [ids]
368
 
 
 
359
            
369
360
        # result
370
361
        result = {'value': {'qty_kit_selection_line': 0.0,
371
362
                            'uom_id_kit_selection_line': False,
377
368
        result['value'].update({'price_unit_kit_selection_line': 'price_unit' in data['value'] and data['value']['price_unit'] or 0.0,
378
369
                                'qty_kit_selection_line': 'product_qty' in data['value'] and data['value']['product_qty'] or 0.0,
379
370
                                'uom_id_kit_selection_line': 'product_uom' in data['value'] and data['value']['product_uom'] or False})
380
 
 
381
 
        uom_id = result.get('value', {}).get('uom_id_kit_selection_line')
382
 
        qty = result.get('value', {}).get('qty_kit_selection_line')
383
 
        if qty:
384
 
            result = self.pool.get('product.uom')._change_round_up_qty(cr, uid, uom_id, qty, 'qty_kit_selection_line', result=result)
385
 
 
386
371
        # return result
387
372
        return result
388
373