Il giorno lunedì 22 gennaio 2018 09:32:40 UTC+1, Sergi Almacellas Abellana ha 
scritto:
> El 22/01/18 a les 05:11, Cato Nano ha escrit:
> > In testing my module for the first time, this error is reported
> > 
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >   File 
> > "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/tests/test_tryton.py",
> >  line 198, in wrapper
> >     result = func(*args, **kwargs)
> >   File 
> > "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/tests/test_tryton.py",
> >  line 361, in test_field_methods
> >     getattr(record, attr)()
> >   File 
> > "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/model/fields/field.py",
> >  line 106, in wrapper
> >     return func(self, *args, **kwargs)
> >   File 
> > "/home/catonano/tributi/build/lib/trytond/modules/tributi/affissione.py", 
> > line 38, in on_change_with_fattoreGiorni
> >     ng = abs((self.on_change_with_bollettaDataFine() - 
> > self.on_change_with_bollettaDataInizio()).days)
> > TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
> > 
> > ----------------------------------------------------------------------
> 
> The problem is that both on_change functions return a None value and
> python does not know how too substract None from None. That's because
> the test suite call all on_change functions with an empty object to
> ensure that they correctly work when there is no value on the form.
> 
> You should take in account None values on your function.
> > 
> > 
> > but when I run it in the GUI, fattoreGiorni DOES WORK
> > 
> > I swear !
> > 
> > You can see a picture here
> > https://imgur.com/a/kUUjs
> > 
> 
> 
> -- 
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk

Thank you Sergi

I managed to give my date fiuelds default values AND make my methods return a 
date _anyway_.

That allowed the tests to pass

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/aad1211a-f04c-4614-810e-0f55f0e28df5%40googlegroups.com.

Reply via email to