On 2018-01-31 05:51, Maxime Richez wrote:
> So, what's the best way to finish my custom module?
> 
> - Changing my original test "if values.get('number') is None:" by "if 
> values.get('number') == "":" (and keeping the database unchanged) ?

Use a test like this:

    if not values.get('number'):
        …

In Tryton required means not False for Python so it includes None,
empty string, empty list, empty dictionary etc.

> - Using some sql in the __register__ method to remove the "NOT NULL" on the 
> "number" column ?

The constraint on removing "NOT NULL" only by the original module is
there on purpose because once a field is required all depending code
will not manage the case if it is empty. So we must ensure that there
will be always a value.
Also it is the reason why we must be careful when setting a field
required.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20180131141825.GD23162%40kei.

Reply via email to