Hi Francisco!
On Sun, 19 Apr 2020 19:50:43 -0300
Francisco Maria Moyano Casco <[email protected]> wrote:

> Hi,
> I am having some issues using tryton 4.6 module on tryton 5.0
> The issue is with a One2Many list based on a ModelView class.
> I tried to scrap an example of the code, so I don’t have to copy all
> the original.
> The idea behind is to fullfill a list (the one2many) with something.
> 
> class Element(ModelView):
>    'Element'
>     __name__ = 'list.element'
> 
>     foo = fields.Char("Foo")
> 
> class ListElement(ModelView):
>     'List Element'
>     __name__ = 'list.list'
> 
>     elements = fields.One2Many('list.element',None,'Cobertura',
>         readonly=True)
> 
> 
> TypeError: '<' not supported between instances of 'str' and 'NoneType'
> 
> Could it be possible due to the one2many refers to ModelView and not
> to a ModelSQL? If I change the one2many target to party.party, it
> gives me no error.
> 
> Thanks in advance
I haven't looked much into the details, but a O2M field needs a M2O
counterpart to establish the relationship.

On your example, you're referring to None, instead you
should be referring to a M2O field on the Element class that refers to
ListElement.

Hope this helps.

Luis




Reply via email to