Odoo Help

0
0
Borni DHIFI
On 6/15/13, 8:34 AM

Hi,

you problem in _sql_constraints with intger value (integer by default = 0) .so you can use _constraints :

for example :

def _check_unique_vat(self, cr, uid, ids, context=None):
        if not context:
            context = {}            
        product_ids = []        
        this = self.browse(cr, uid, ids[0]) 
        if  this.vat :
            product_ids = self.search(cr, uid, [ ('vat', '=', this.vat)])
        if len(product_ids) > 1:
                    return False
        return True

    _constraints = [(_check_unique_vat,("Vat   must be unique ."), ['vat'] ),
                   (_check_vat_key, 'You provided an invalid "VAT"..', ['vat'])
                  ]

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 6/15/13, 7:33 AM
Seen: 1553 times
Last updated: 3/16/15, 8:10 AM