Odoo Help

Welcome!

This community 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.

1

How to pass field values into custom method or function?

By
Eric
on 7/14/14, 7:08 PM 1,701 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?

1

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 7/15/14, 1:13 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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