MultiSelection failing on storing value

Hello,

Recently I’ve started a main module, its depends from the tryton.cfg are the following:

[tryton]
version=5.8.0
depends:
    ir
    blog
xml:

blog is a module which doesn’t have any depends except the ir.

In blog I’ve created a MultiSelection field, pretty straight forward, just with the required selection and string requirements for the constructor.

The problem is the following:

When no selection is made, the column is storing an empty array, which is the expected behavior I guess.

When a selection is made, that being one or multiple, the value returned to the modelstorage.py as I’ve seen is returning None. Now, since the selection defined on the constructor has no None value, the store is failing.

I was certain that the field definition was correct, so I tried to create a MultiSelection field on a clients module* that has more dependencies, and everything went smoothly, the field was created and the value(s) stored is/are the expected.

*This client is running version 5.8.0.

I assume something is missing either by my end (a dependency required for this field to work?) or there is a bug somewhere.

Here the packages installed from both the “wrong” environment and “working” environment. Note that some packages are not installed just from Tryton but I install them from a script since I use them often and have separate environments for each client.

WRONG:

Babel==2.9.1
bcrypt==3.2.0
cffi==1.14.5
click==7.1.2
et-xmlfile==1.1.0
Flask==1.1.2
Flask-Babel==2.0.0
Flask-WTF==0.14.3
Genshi==0.7.5
html2text==2020.1.16
git@gitlab.com: ... blog
git@gitlab.com: ... main module
itsdangerous==1.1.0
Jinja2==2.11.3
lxml==4.6.3
MarkupSafe==1.1.1
mercurial==5.7.1
openpyxl==3.0.7
passlib==1.7.4
polib==1.1.1
proteus==5.8.1
psycopg2-binary==2.8.6
pycparser==2.20
python-dateutil==2.8.1
python-magic==0.4.22
python-sql==1.2.1
pytz==2021.1
relatorio==0.9.2
six==1.15.0
trytond==5.8.7
Werkzeug==1.0.1
wrapt==1.12.1
WTForms==2.3.3

WORKING:

Babel==2.9.0
bcrypt==3.2.0
cffi==1.14.5
click==7.1.2
et-xmlfile==1.0.1
Flask==1.1.2
Flask-Babel==2.0.0
flask-paginate==0.8.1
flask-tryton==0.10.0
Flask-WTF==0.14.3
Genshi==0.7.5
( ... multiple custom modules ... )
itsdangerous==1.1.0
Jinja2==2.11.3
lxml==4.6.3
MarkupSafe==1.1.1
mercurial==5.7.1
openpyxl==3.0.7
passlib==1.7.4
Pillow==8.2.0
polib==1.1.1
proteus==5.8.1
psycopg2-binary==2.8.6
pycparser==2.20
pyodbc==4.0.30
python-barcode==0.13.1
python-dateutil==2.8.1
python-magic==0.4.22
python-sql==1.2.1
python-stdnum==1.16
pytz==2021.1
relatorio==0.9.2
simpleeval==0.9.10
six==1.15.0
trytond==5.8.6
trytond-account==5.8.2
trytond-account-es==5.8.3
trytond-account-eu==5.8.1
trytond-account-invoice==5.8.3
trytond-account-invoice-secondary-unit==5.8.1
trytond-account-invoice-stock==5.8.1
trytond-account-payment==5.8.2
trytond-account-payment-sepa==5.8.1
-e git+git@github.com:tryton/account_payment_sepa_cfonb@70428bd205300990370a4e4844e90e4caaee496b#egg=trytond_account_payment_sepa_cfonb
trytond-account-product==5.8.1
trytond-bank==5.8.1
trytond-commission==5.8.2
trytond-company==5.8.1
-e git+git@github.com:tryton/company_work_time@505665a017bec47e5f3d7bd1aebfbacf9ba06a98#egg=trytond_company_work_time
trytond-country==5.8.1
trytond-currency==5.8.1
trytond-party==5.8.1
trytond-product==5.8.1
-e git+git@github.com:tryton/product_attribute@1ee083ce9c4b18f9158ba71f6c637464d9607e8e#egg=trytond_product_attribute
-e git+git@github.com:tryton/product_measurements@cac640d2f168f48f4eef038452b9a5645e8c1949#egg=trytond_product_measurements
trytond-product-price-list==5.8.1
-e git+git@github.com:tryton/product_price_list_dates@32fa5ff1e61b11a7fdaa95be62540fbfa0cb6fc2#egg=trytond_product_price_list_dates
-e git+git@github.com:tryton/product_price_list_parent@e471f7fe0cf169d292f521f00aa75f2e0d4edaa6#egg=trytond_product_price_list_parent
trytond-production==5.8.1
trytond-production-routing==5.8.1
trytond-production-work==5.8.1
-e git+git@github.com:tryton/production_work_timesheet@7d8b3f1634de4dde8f9ba59e6981b3a1d4e639fa#egg=trytond_production_work_timesheet
trytond-purchase==5.8.3
trytond-purchase-request==5.8.2
trytond-purchase-secondary-unit==5.8.1
trytond-sale==5.8.2
trytond-sale-amendment==5.8.1
trytond-sale-discount==5.8.2
trytond-sale-history==5.8.1
trytond-sale-opportunity==5.8.1
trytond-sale-price-list==5.8.1
trytond-sale-promotion==5.8.1
trytond-sale-secondary-unit==5.8.1
trytond-stock==5.8.3
trytond-stock-forecast==5.8.1
trytond-stock-lot==5.8.2
trytond-stock-lot-sled==5.8.1
trytond-stock-package==5.8.2
trytond-stock-secondary-unit==5.8.1
trytond-stock-supply==5.8.1
trytond-timesheet==5.8.2
trytond-web-user==5.8.2
Werkzeug==1.0.1
wrapt==1.12.1
WTForms==2.3.3

Any ideas about whats failing or what am I missing?

Thank you beforehand.

No, there is no external dependency for MultiSelection fields.

Could you please share code where this field is defined to see if there is a bug there?

    from trytond.model import ModelSQL, ModelView, fields

    class Entrada(ModelSQL, ModelView):
        """Entrada"""
        __name__ = 'blog.entrada'
        titulo = fields.Char('Titulo')
        subtitulo = fields.Char('Subtitulo')
        contenido = fields.Text('Contenido')
        imagen_cabecera = fields.Binary('Imagen de cabecera')
        categoria = fields.MultiSelection([
            ('webinar', 'Webinar'),
            ('interes', 'Articulo de interes')
        ], 'Categoria')

This code stores a [None] if any option is selected, doesn’t matter one or multiple.

If a (None, ‘’) selection is added, then it stores [‘’].

I’ve started the database and the modules from 0 again and everything works as intended, I don’t know what could be wrong with the previous ones.

Thanks anyway.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.