1
votes

When I want show a one2many computed field in a tree view,I got these message

ValueError: Wrong value for facturation.lot.id_articleouvrage: facturation.articleouvrage(1, 2)

@api.one
def get_article_list(self):
    art = self.env["facturation.articleouvrage"].search([])
    self.id_articleouvrage = art
    print self.id_articleouvrageer`

id_articleouvrage   =   fields.One2many(compute="get_article_list",relation='facturation.articleouvrage')

xml file:

<field name="id_articleouvrage">
    <tree editable="true">
    </tree>
</field> 
2

2 Answers

1
votes

To solve your problem, you need to set ids in the One2Many like this .

@api.one
def get_article_list(self):
    art = self.env["facturation.articleouvrage"].search([]).ids
    self.id_articleouvrage = art
    print self.id_articleouvrageer`

In your field One2many you specify an attribute relation. But it's only for Many2mnay field.

Doc from odoo https://www.odoo.com/documentation/10.0/reference/orm.html

0
votes

One2many only works if reverse field Many2one set in facturation.articleouvrage this model.