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

AccessError: ('AccessError', "No value found for foo.bar('1',).baz")

By
PY
on 2/23/15, 12:52 PM 984 views

Hi ! I'm on Odoo (v8).

I have two models, declared like this:

class bar(models.Model):
    _name = 'foo.bar'
    _order = 'name'

    name = fields.Char()
    quz = fields.Many2many(comodel_name='foo.quz')

    @api.model
    def get_records(self, bar_id):

        bar_record = self.browse(bar_id)
        return bar_record.quz

class quz(models.Model):
    _name = 'foo.quz'
    _order = 'name'

    name = fields.Char(

Whenever I call the function foo.bar.get_records(1), I get the error I wrote in the title.

Any idea how to solve this ?

Obviously, this is a simplified code, but the real code is not bigger.

I tried self.browse(1).quz, self.env['foo.bar'].browse(1).quz, with no more luck.

The records are in the database, I checked using psql. I really don't know how to access to these records.

I also tried change the name of the relational field. But that doesn't work neither.

Another idea, explanation ?

1
PY
On 2/24/15, 4:07 AM

You know what, I thing I'm tired. The answer was in the title.

I tried to access a browse record by passing a damned string to it.

The ID was right, but in the wrong format. That helps if you call int(bar_id) first...

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: 2/23/15, 12:52 PM
Seen: 984 times
Last updated: 3/20/15, 8:07 AM