health-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Health-dev] List on a wizard stateview


From: Francisco Maria Moyano Casco
Subject: Re: [Health-dev] List on a wizard stateview
Date: Thu, 30 Apr 2020 09:47:37 -0300

Hi Luis,
  Thanks for the answer.

  I already find the solution. It was fields.Selection wrong defined. I defined wrongly one of the tuples on selection as ('',None ) instead of (None, '').

  It works fine on the previous gnuhealth version, because the client was on python2, and compairing a string to a None value returns false. But on the currently client version, on python3, it returns an error.

  Regards.

El mar., 21 abr. 2020 a las 7:46, Luis Falcon (<address@hidden>) escribió:
Hi Francisco!
On Sun, 19 Apr 2020 19:50:43 -0300
Francisco Maria Moyano Casco <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]