Odoo Help


How to pass field values into custom method or function?

on 7/14/14, 7:08 PM 3,163 views

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?




| 5 4 7
Bikaner, India

OpenERP Developer at SunARC Technology

On 7/15/14, 1:13 AM

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


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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/14/14, 7:08 PM
Seen: 3163 times
Last updated: 1/7/16, 9:30 AM