Пример #1
0
 def write(self, cr, uid, ids, vals, context=None):
     '''
         Encrypt credit card number before writing to database
         @param self : The object pointer
         @param cr: A database cursor
         @param uid: ID of the user currently logged in
         @param ids: List of ids selected
         @param vals: Dictionary of Values.
         @param context: A standard dictionary
         @return:True.
     '''
     if context is None:
         context = {}
     context.update({'cc_no': 'no_mask'})
     if not isinstance(ids, list):
         ids = [ids]
     for record in self.browse(cr, uid, ids, context=context):
         if vals.get('cc_number', False):
             res = rsa_encrypt.encrypt(vals.get('cc_number', False),
                                       record.key)
             res['cc_number'] = res['enc_value']
             del res['enc_value']
             vals.update(res)
     result = super(res_partner_bank, self).write(cr, uid, ids, vals,
                                                  context)
     return result
Пример #2
0
 def create(self, cr, uid, vals, context=None):
     """ 
         Encrypt credit card number before writing to database
         @param self : The object pointer
         @param cr: A database cursor
         @param uid: ID of the user currently logged in
         @param vals: Dictionary of Values.
         @param context: A standard dictionary
         @return:ID of newly created record.
     """
     if context is None:
         context = {}
     if vals.get('cc_number', False):
         res = rsa_encrypt.encrypt(vals.get('cc_number', False))
         res['cc_number'] = res['enc_value']
         del res['enc_value']
         vals.update(res)
     result = super(res_partner_bank, self).create(cr, uid, vals, context)
     return result
Пример #3
0
 def create(self, cr, uid, vals, context=None):
     """ 
         Encrypt credit card number before writing to database
         @param self : The object pointer
         @param cr: A database cursor
         @param uid: ID of the user currently logged in
         @param vals: Dictionary of Values.
         @param context: A standard dictionary
         @return:ID of newly created record.
     """
     if context is None:
         context = {}
     if vals.get('cc_number', False):
         res = rsa_encrypt.encrypt(vals.get('cc_number', False))
         res['cc_number'] = res['enc_value']
         del res['enc_value']
         vals.update(res)
     result = super(account_voucher, self).create(cr, uid, vals, context)
     return result
Пример #4
0
 def write(self, cr, uid, ids, vals, context=None):
     '''
         Encrypt credit card number before writing to database
         @param self : The object pointer
         @param cr: A database cursor
         @param uid: ID of the user currently logged in
         @param ids: List of ids selected
         @param vals: Dictionary of Values.
         @param context: A standard dictionary
         @return:True.
     '''
     if context is None:
         context = {}
     context.update({'cc_no':'no_mask'})
     if not isinstance(ids,list):
         ids = [ids]
     for record in self.browse(cr, uid, ids, context=context):
         if vals.get('cc_number', False):
             res = rsa_encrypt.encrypt(vals.get('cc_number', False), record.key)
             res['cc_number'] = res['enc_value']
             del res['enc_value']
             vals.update(res)
     result = super(res_partner_bank, self).write(cr, uid, ids, vals, context)
     return result
Пример #5
0
            @param vals: Dictionary of Values.
            @param context: A standard dictionary
            @return:True.
        '''
        if context is None:
            context = {}
<<<<<<< HEAD
        context=dict(context)     
=======
>>>>>>> c1979f64b3360c86d60e00c92be0271d89f97f2d
        context.update({'cc_no':'no_mask'})
        if not isinstance(ids,list):
            ids = [ids]
        for record in self.browse(cr, uid, ids, context=context):
            if vals.get('cc_number', False):
                res = rsa_encrypt.encrypt(vals.get('cc_number', False), record.key)
                res['cc_number'] = res['enc_value']
                del res['enc_value']
                vals.update(res)
        result = super(account_voucher, self).write(cr, uid, ids, vals, context)
        return result
    
    def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
        '''
            Decrypt credit card number after reading from database and display last four digits if there is 
            no no_mask in context
            @param self : The object pointer
            @param cr: A database cursor
            @param uid: ID of the user currently logged in
            @param ids: List of ids selected
            @param fields: List of fields