This question has been flagged
1 Reply
3207 Views

Hi there !

I try to make a v7 module working in v8. The only issue I have for now is the default values.

In model A, I have a one2many field, with a default value set to a function call. The function create records of the linked object B, then return their ids. I checked with psql, the records of B are indeed created, but the id of A is not passed to them. In consequence, when I try to create a record of A, B are created, but I cant see them, nor edit them in the "one2many_list" of A's form view.

And this is weird, since it worked back in v7. I tried the new-style approach, passing the function name to a "default" argument of the one2many field definition, and removing the "_defaults" part, but no luck with that. Not working neither.

Any help ?

EDIT

By the way, what is the proper syntax of a new-style default function ? What decorator should I put ? What should it return ? A list of ids ? A list of tuples (id, name) ? Thanks !

Avatar
Discard
Best Answer

Hi, check this, https://github.com/odoo/odoo/blob/8.0/addons/stock/stock.py#L1796 I think it is working as usual ....

Avatar
Discard
Author

Never mind, in fact, I have came with another approach. Default function was working fine, it's just other things that won't work.