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

« back to all changes in this revision

Viewing changes to threshold_value/threshold_value.py

[MERGE] Merge UF-1763

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
        '''
385
385
        if not context:
386
386
            context = {}
 
387
 
 
388
        if line_id and isinstance(line_id, list):
 
389
            line_id = line_id[0]
387
390
        
388
391
        cons = 0.00
389
392
        threshold_value = 0.00
420
423
 
421
424
    def onchange_product_id(self, cr, uid, ids, product_id, compute_method=False, consumption_method=False,
422
425
                                consumption_period_from=False, consumption_period_to=False, frequency=False,
423
 
                                safety_month=False, lead_time=False, supplier_lt=False, context=None):
 
426
                                safety_month=False, lead_time=False, supplier_lt=False, fixed_tv=0.00, 
 
427
                                fixed_qty=0.00, context=None):
424
428
        """ Finds UoM for changed product.
425
429
        @param product_id: Changed id of product.
426
430
        @return: Dictionary of values.
440
444
                                               consumption_period_from, consumption_period_to, frequency,
441
445
                                               safety_month, lead_time, supplier_lt, prod.uom_id.id, context=context)['threshold_value']
442
446
                res['value'].update({'fake_threshold_value': tv, 'threshold_value': tv})
443
 
            
444
 
        return res
445
 
    
 
447
 
 
448
                if prod.uom_id.id:
 
449
                    res = self.pool.get('product.uom')._change_round_up_qty(cr, uid, prod.uom_id.id, tv, ['fixed_threshold_value', 'fixed_product_qty', 'threshold_value', 'fake_threshold_value'], result=res)
 
450
                if prod.uom_id.id and fixed_tv:
 
451
                    res = self.pool.get('product.uom')._change_round_up_qty(cr, uid, prod.uom_id.id, fixed_tv, ['fixed_threshold_value'], result=res)
 
452
                if prod.uom_id.id and fixed_qty:
 
453
                    res = self.pool.get('product.uom')._change_round_up_qty(cr, uid, prod.uom_id.id, fixed_tv, ['fixed_product_qty'], result=res)
 
454
 
 
455
        return res
 
456
 
 
457
    def onchange_uom_qty(self, cr, uid, ids, uom_id, tv_qty, product_qty):
 
458
        '''
 
459
        Check round of qty according to UoM
 
460
        '''
 
461
        res = {}
 
462
        uom_obj = self.pool.get('product.uom')
 
463
 
 
464
        if tv_qty:
 
465
            res = uom_obj._change_round_up_qty(cr, uid, uom_id, tv_qty, 'fixed_threshold_value', result=res)
 
466
 
 
467
        if product_qty:
 
468
            res = uom_obj._change_round_up_qty(cr, uid, uom_id, product_qty, 'fixed_product_qty', result=res)
 
469
 
 
470
        return res
 
471
 
446
472
threshold_value_line()