Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • unique records creation with account_number and company_id in avalara-salestax

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 397
    Comment on it

    To use constraints on unique records creation with account_number and company_id in avalara-salestax in OpenERP/Odoo follow below steps-

    Step-1 Go to avalara_salestax module.
    Step-2 avalara_salestax->avalara_salestax.py.
    Step-3 After that used below code in avalara_salestax.py file.

     _sql_constraints = [
            ('code_company_uniq', 'unique (company_code)', 'Avalara setting is already available for this company code'),
            ('account_number_company_uniq', 'unique (account_number, company_id)', 'The account number must be unique per company!'),
        ]
    
        def _get_avatax_config_company(self, cr, uid, context=None):
            """ Returns the AvaTax configuration for the user company """
            user_obj = self.pool.get('res.users')
            user = user_obj.browse(cr, uid, uid, context=context)
            avatax_config_ids = self.search(cr, uid, [('company_id', '=', user.company_id.id)], context=context)
            return avatax_config_ids and self.browse(cr, uid, avatax_config_ids[0], context=context) or False
    
    avalara_salestax()
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: