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

« back to all changes in this revision

Viewing changes to tender_flow/tender_flow.py

  • Committer: Quentin THEURET
  • Date: 2016-02-19 10:31:08 UTC
  • Revision ID: qt@tempo-consulting.fr-20160219103108-cgx8vw33ss2rf3nm
US-826 [IMP] Add a warning message when add a product on a tender when the product category is non-consistent with the tender category

Show diffs side-by-side

added added

removed removed

Lines of Context:
862
862
    
863
863
    _SELECTION_TENDER_STATE = [('draft', 'Draft'),('comparison', 'Comparison'), ('done', 'Closed'),]
864
864
    
865
 
    def on_product_change(self, cr, uid, id, product_id, uom_id, product_qty, context=None):
 
865
    def on_product_change(self, cr, uid, id, product_id, uom_id, product_qty, categ, context=None):
866
866
        '''
867
867
        product is changed, we update the UoM
868
868
        '''
888
888
        if uom_id:
889
889
            result['value']['product_uom'] = uom_id
890
890
 
 
891
        if categ and product_id:
 
892
            # Check consistency of product
 
893
            consistency_message = prod_obj.check_consistency(cr, uid, product_id, categ, context=context)
 
894
            if consistency_message:
 
895
                result.setdefault('warning', {})
 
896
                result['warning'].setdefault('title', 'Warning')
 
897
                result['warning'].setdefault('message', '')
 
898
 
 
899
                result['warning']['message'] = '%s \n %s' % \
 
900
                    (result.get('warning', {}).get('message', ''), consistency_message)
 
901
 
891
902
        return result
892
903
 
893
904
    def onchange_uom_qty(self, cr, uid, ids, uom_id, qty):