Odoo Help


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.


Inherit model (cross API versions) field Selection computed

Denis Roussel
on 7/10/15, 9:33 AM 2,343 views


I try to inherit(models.Model) a model defined with osv.osv that contains a field selection which is computed.

I redefined the whole Selection field with the same parameters as I want to override the function called by the compute.

As value of my compute field option, I put my new compute method.

The new compute method call the super one, set the field and then I do my stuff.

Module install is ok, new compute function is well called.

But when I let debugging continue, I got the Exception : 'undefined get method'.

After deep debugging, it appears that my Selection field got the type osv.fields.selection instead of osv.fields.function => the selection type don't have a get method (see the _column object in openerp.osv.fields).

The original model (without my module) has the good type osv.fields.function...

Is it a framework error?

Many thanks for your help

There is no bug for selection field, you might using wrong coding structure in odoo 8, Can you give the sample code what you have tried to set selection?

Anil R. Kesariya
on 7/10/15, 1:37 PM
Denis Roussel
On 7/13/15, 2:36 AM

The code looks like that : 


    @api.depends('move_type','move_lines.state', 'move_lines.partially_available')

    def _state__get(self):

        result = super(stock_picking,self)._state_get(None,None)

        self.state = result[self.id]


        if self.state == 'assigned':



    state=fields.Selection(compute=_state__get, copy=False,



                ('draft', 'Draft'),

                ('cancel', 'Cancelled'),

                ('waiting', 'Waiting Another Operation'),

                ('confirmed', 'Waiting Availability'),

                ('partially_available', 'Partially Available'),

                ('assigned', 'Ready to Transfer'),

                ('done', 'Transferred'),

                ], string='Status', readonly=True, select=True, track_visibility='onchange',


                * Draft: not confirmed yet and will not be scheduled until confirmed\n

                * Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n

                * Waiting Availability: still waiting for the availability of products\n

                * Partially Available: some products are available and reserved\n

                * Ready to Transfer: products reserved, simply waiting for confirmation.\n

                * Transferred: has been processed, can't be modified or cancelled anymore\n

                * Cancelled: has been cancelled, can't be confirmed anymore"""




EDIT : Is it possible that when you change a field that has 'track_visibility' attribute and obviously inherits from 'mail.thread', you have to redeclare inheritance in the new module model you write (error has disappeared)?

Denis Roussel
on 7/13/15, 5:57 AM

@Denis don't you still get an error on install of the module on an empty database? We get Exception: undefined get method ! like here: https://github.com/OCA/carrier-delivery/pull/47

Camptocamp SA, Yannick Vaucher
on 8/11/15, 9:10 AM

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

2 follower(s)


Asked: 7/10/15, 9:33 AM
Seen: 2343 times
Last updated: 8/11/15, 9:29 AM