On Dec 18, 2017 04:08, "Cato Nano" <[email protected]> wrote:

Now that a list of entities represented by my model get correctly shown, I
want to add a selection field to my model. Like this


    tipo = fields.Selection('tipo', [
        ('M', 'Male')
        ('F', 'Female')
    ],
    )

You need to separate your tuples with commas in the selection list like
this:
    ('M', 'Male),
    ('F', 'Female')

without the comma it looks to the Python interpreter like the second tuple
is parameters and the first tuple is a function hence the error.


I copied this from the manual, here
http://doc.tryton.org/4.6/trytond/doc/ref/models/fields.
html#ref-models-fields

when updating the module like this

:~/tributi$ sudo python3 setup.py develop
:~/tributi$ sudo trytond-admin -c /etc/tryton/trytond.conf -d tryton -u
tributi



i get this error




Traceback (most recent call last):
  File "/usr/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/usr/lib/python3/dist-packages/trytond/admin.py", line 54, in run
    installdeps=options.installdeps)
  File "/usr/lib/python3/dist-packages/trytond/pool.py", line 142, in init
    self.start()
  File "/usr/lib/python3/dist-packages/trytond/pool.py", line 95, in start
    register_classes()
  File "/usr/lib/python3/dist-packages/trytond/modules/__init__.py", line
373, in register_classes
    mod_file, pathname, description)
  File "/usr/lib/python3.6/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/usr/lib/python3.6/imp.py", line 217, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
  File "/home/admin/tributi/build/lib/trytond/modules/tributi/__init__.py",
line 2, in <module>
    from .bolletta import Bolletta
  File "/home/admin/tributi/build/lib/trytond/modules/tributi/bolletta.py",
line 6, in <module>
    class Bolletta(ModelSQL, ModelView):
  File "/home/admin/tributi/build/lib/trytond/modules/tributi/bolletta.py",
line 13, in Bolletta
    ('F', 'Female')
TypeError: 'tuple' object is not callable


Thanks in advance !

--
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/8ddc439a-f4cb-49bc-a5aa-09d7e4201e58%40googlegroups.com.

-- 
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/CAJ0%2BmOr%2BtLKV8_d47iPZA5YVMyPKTfBaequtSZWOGq4k8-FFVg%40mail.gmail.com.

Reply via email to