This question has been flagged

Hello, I am trying to pass in the field values of a form into a custom method when a user clicks on a button.  The method is supposed to process the information entered in the form, but not necessarily to create a new record on some model.  So far the only method that accepts the field values of a form is the create() method, which uses the vals{}.  Is there a way to pass in the field values to a custom method/function other than create?

Avatar
Discard
Best Answer

You can pass the field values in the custom  method/function using browse method,

Example:-

 def method_name(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        values={}        
        for val in self.browse(cr, uid, ids, context=context):
             values['field1'] = val.column1
             values['field2'] = val.column2
             values['field3'] = val.column3
        return values

Avatar
Discard