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

Field.function store trigger won't update three fields

By
Kurt Heisel
on 3/27/15, 1:20 PM 782 views

I'm having an issue with the store option under fields.function with 3 fields on multi.  If I have the same trigger on three fields.function it will only update 2 of those fields.  In the below example only two of the fields will be updated if I change 'company_setting.'  I have verified that if I comment out one of the triggers on the 'working fields' the non-working field will start working.  That is, if field1 and field2 are updating and field3 isnt, I can comment out field2 and then field1 and field3 will work.  (please ignore any stupid typos/indention errors, quick pseudo-code)


class res_partner(osv.osv):

    _inherit = 'res.partner'

    def _return_values(self, cr, uid, ids, name, args, context=None):

        res={}     

        for partner in self.browse(cr, uid, ids, context=None):

            field1 = #Math

            field2 = #Math

            field3 = #Math

            res[partner.id] = {'field1': field1, 'field2': field2, 'field3: field3}

        return res

    

    def get_partner_ids(self, cr, uid, ids, context=None):

        #Gets ids I care about and is working

        return ids

    _columns = {

        'field1': fields.function(_return_values, type='float', multi='total',

                   store = {'res.company': get_partner_ids, ['company_setting'], 10}

        'field2': fields.function(_return_values, type='float', multi='total',

                    store = {'res.company': get_partner_ids, ['company_setting'], 10}

        'field3': fields.function(_return_values, type='float', multi='total',

                    store = {'res.company': get_partner_ids, ['company_setting'], 10}

        }




    

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: 3/27/15, 1:20 PM
Seen: 782 times
Last updated: 3/15/16, 11:35 AM