Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Function fields in OpenERP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.01k
    Comment on it

    Function fields in OpenERP:


    A functional field is a field whose value is calculated by a function and Fields that do not directly store into the DB but compute their value instead

    Parameters:

    fnct, arg=None, fnct_inv=None, fnct_inv_arg=None, type="float",
     fnct_search=None, obj=None, method=False, store=False, multi=False
    
      Here
    1. fnct is the function or method that will compute the field value. It should be declared before declaration of the functional field.
    2. fnct_inv is the function or method which will allow writing values in that field.
    3. type is the field type name returned by the function. It can be any field type name except function.
    4. fnct_search allows you to define the searching behavior on that field.
    5. method whether the field is computed by a method (of an object) or a global function
    6. store If you want to store field in database or not. Default is False.
    7. multi is a group name. All fields with the same multi parameter will be calculated in a single function call.

    Example

     'testrest':fields.function(get_reste, store=True, string='Restant',type='integer'),
     def get_reste(self, cr, uid, ids, field_name, arg, context):
        x = {}
        for record in self.browse(cr, uid, ids ,context):
                if record.statut !=  'entree':
                    x[record.id]= record.testrest + record.entree_nbr
        return x

 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: