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

« back to all changes in this revision

Viewing changes to tender_flow/tender_flow.py

[MERGE] Merge UF-1763

Show diffs side-by-side

added added

removed removed

Lines of Context:
536
536
    
537
537
    _SELECTION_TENDER_STATE = [('draft', 'Draft'),('comparison', 'Comparison'), ('done', 'Closed'),]
538
538
    
539
 
    def on_product_change(self, cr, uid, id, product_id, context=None):
 
539
    def on_product_change(self, cr, uid, id, product_id, uom_id, product_qty, context=None):
540
540
        '''
541
541
        product is changed, we update the UoM
542
542
        '''
543
543
        prod_obj = self.pool.get('product.product')
544
544
        result = {'value': {}}
545
545
        if product_id:
546
 
            result['value']['product_uom'] = prod_obj.browse(cr, uid, product_id, context=context).uom_po_id.id
 
546
            uom_id = prod_obj.browse(cr, uid, product_id, context=context).uom_po_id.id
 
547
 
 
548
        result = self.onchange_uom_qty(cr, uid, id, uom_id, product_qty)
 
549
        
 
550
        if uom_id:
 
551
            result['value']['product_uom'] = uom_id
547
552
            
548
553
        return result
 
554
 
 
555
    def onchange_uom_qty(self, cr, uid, ids, uom_id, qty):
 
556
        '''
 
557
        Check round of qty according to the UoM
 
558
        '''
 
559
        res = {}
 
560
 
 
561
        if qty:
 
562
            res = self.pool.get('product.uom')._change_round_up_qty(cr, uid, uom_id, qty, 'qty', result=res)
 
563
 
 
564
        return res
549
565
    
550
566
    def _get_total_price(self, cr, uid, ids, field_name, arg, context=None):
551
567
        '''