(self, col_name, country_col='country_id')
Provide a helper for dea validation via constrain
        Params:
            col_name: ``str`` Name of db column to constrain
            country_col: ``str`` Name of db country column to verify
        Raises:
            ValidationError: If constrain is a failure
            AttributeError: If country column is not valid or is null in db
Provide a helper for dea validation via constrain
        Params:
            col_name: ``str`` Name of db column to constrain
            country_col: ``str`` Name of db country column to verify
        Raises:
            ValidationError: If constrain is a failure
            AttributeError: If country column is not valid or is null in db
Provide a helper for dea validation via constrain Params : col_name : str Name of db column to constrain country_col : str Name of db country column to verify Raises : ValidationError : If constrain is a failure AttributeError : If country column is not valid or is null in db
def _dea_constrains_helper(self, col_name, country_col='country_id'):
        """ Provide a helper for dea validation via constrain
        Params:
            col_name: ``str`` Name of db column to constrain
            country_col: ``str`` Name of db country column to verify
        Raises:
            ValidationError: If constrain is a failure
            AttributeError: If country column is not valid or is null in db
        """

        for rec_id in self:
            if getattr(rec_id, country_col).code == 'US':
                if self._dea_is_valid(rec_id[col_name]):
                    return
                col_obj = self.env['ir.model.fields'].search([
                    ('name', '=', col_name),
                    ('model', '=', rec_id._name),
                ],
                    limit=1,
                )
                raise ValidationError(
                    _('Invalid %s was supplied.') % col_obj.display_name,
                )
def _dea_constrains_helper ( self , col_name , country_col = 'country_id' ) : for rec_id in self : if getattr ( rec_id , country_col ) . code == 'US' : if self . _dea_is_valid ( rec_id [ col_name ] ) : return col_obj = self . env [ 'ir.model.fields' ] . search ( [ ( 'name' , '=' , col_name ) , ( 'model' , '=' , rec_id . _name ) , ] , limit = 1 , ) raise ValidationError ( _ ( 'Invalid %s was supplied.' ) % col_obj . display_name , )