Re: [tryton-dev] GTK client - PyGObjectParamFlags has not attribute READWRITE

2018-02-01 Thread Sergi Almacellas Abellana
El 01/02/18 a les 16:24, Raimon Esteve ha escrit:
> Hie,
> 
> Since "Replace deprecated usage of params and signals in GTK+3" [1],
> after login popup I receive an error that has not attribute READWRITE
> 
>      13             "text": (gobject.TYPE_STRING, None, "Text",
>      14                 "Displayed text", gobject.ParamFlags.READWRITE),
> 
> Which version gobject is required?
> 

Which gtk version do you have? Take in account that tryton requires at
least gtk3.20 or later [1], which IIRC is not avaiable on ubuntu 16.04
(should be installed via ppa)

Indeed you should be using python-object 3.20.0. Which is the output the
following command:

apt list python-gobject

You should see something like:

Listing… Fet
python-gobject/xenial,xenial,now 3.20.0-0ubuntu1 all [installed]


Hope it helps.


[1] http://hg.tryton.org/tryton/file/292a067fe066/doc/installation.rst#l8


-- 
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

-- 
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/1c999d58-96e3-d264-0239-0ba1d14df6b3%40koolpi.com.


[tryton-dev] GTK client - PyGObjectParamFlags has not attribute READWRITE

2018-02-01 Thread Raimon Esteve
Hie,

Since "Replace deprecated usage of params and signals in GTK+3" [1], after
login popup I receive an error that has not attribute READWRITE

 13 "text": (gobject.TYPE_STRING, None, "Text",
 14 "Displayed text", gobject.ParamFlags.READWRITE),

Which version gobject is required?

Last version python-gobject-2 in Ubuntu is 2.28.6 [2]

Here the traceback:

Traceback (most recent call last):
  File "/home/resteve/virtualenv/trydev/tryton/tryton/common/common.py",
line 1260, in process
self.callback(return_)
  File "/home/resteve/virtualenv/trydev/tryton/tryton/gui/main.py", line
858, in _set_preferences
self.sig_win_menu(prefs=prefs)
  File "/home/resteve/virtualenv/trydev/tryton/tryton/gui/main.py", line
1041, in sig_win_menu
row_activate=self.menu_row_activate)
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/screen/screen.py",
line 142, in __init__
self.switch_view()
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/screen/screen.py",
line 486, in switch_view
self.load_view_to_load()
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/screen/screen.py",
line 507, in load_view_to_load
self.add_view_id(view_id, view_type)
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/screen/screen.py",
line 520, in add_view_id
return self.add_view(view)
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/screen/screen.py",
line 545, in add_view
view = View.parse(self, xml_dom, view.get('field_childs'))
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/view/__init__.py",
line 36, in parse
from .list import ViewTree
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/gui/window/view_form/view/list.py",
line 13, in 
from tryton.common.cellrendererbutton import CellRendererButton
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/common/cellrendererbutton.py",
line 10, in 
class CellRendererButton(gtk.GenericCellRenderer):
  File
"/home/resteve/virtualenv/trydev/tryton/tryton/common/cellrendererbutton.py",
line 14, in CellRendererButton
"Displayed text", gobject.ParamFlags.READWRITE),
AttributeError: type object 'PyGObjectParamFlags' has no attribute
'READWRITE'

Thanks

[1]
https://bitbucket.org/tryton/tryton/commits/4b07964676a33abf72efccf91bbcc22e36e86072
[2] https://packages.ubuntu.com/search?keywords=python-gobject-2

-- 
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/CAN2HbXVPdZKZwg30%2B%2B%3D-4C0_NXm%2BCOkC76vtEoe-s%2BXawnXXmQ%40mail.gmail.com.


Re: [tryton-dev] How to update to null a table column with python-sql

2018-02-01 Thread Raimon Esteve
Hie,

2018-01-31 15:40 GMT+01:00 Raimon Esteve :

>
>
> 2018-01-31 15:19 GMT+01:00 Cédric Krier :
>
>> On 2018-01-31 13:50, Raimon Esteve wrote:
>> > I try with python-sql to update a column to "null".
>> >
>> > Somebody know how to update to null a column?
>> >
>> > Example:
>> >
>> > query = user.update(
>> > columns=[user.main_company],
>> > values=[None], <- I like here to update with null
>> > where=user.main_company != Null)
>>
>> As you do not explain what is not working, we can not help you.
>>
>
> Examples and errors with python-sql 0.9:
>
> *1- values is [None]*
>
> query = user.update(
> columns=[user.main_company],
> values=[None],
> where=user.main_company != Null)
>
> Query is:
>
> ('UPDATE "res_user" SET "main_company" = %s WHERE
> ("res_user"."main_company" IS NOT NULL)', (None,))
>

I'ts correct and working me.

Get error:
>
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 193, in __iter__
> yield str(self)
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 766, in __str__
> where = ' WHERE ' + str(self.where)
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/operators.py", line 224, in __str__
> return '(%s IS NOT NULL)' % self.left
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 1300, in __str__
> alias = self._from.alias
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 250, in alias
> return AliasManager.get(self)
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 155, in get
> if getattr(cls.local, 'alias', None) is None:
> RuntimeError: maximum recursion depth exceeded in cmp
>

The problem was that I was __register__ in another class :/ Change
__register__() in other class work for me.

*2- values is [Null]*
>
> query = user.update(
> columns=[user.main_company],
> values=[Null],
> where=user.main_company != Null)
>
> Query is:
>
> ('UPDATE "res_user" SET "main_company" = %s WHERE
> ("res_user"."main_company" IS NOT NULL)', (None,))
>
> Get error:
>
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 193, in __iter__
> yield str(self)
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 766, in __str__
> where = ' WHERE ' + str(self.where)
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/operators.py", line 224, in __str__
> return '(%s IS NOT NULL)' % self.left
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 1300, in __str__
> alias = self._from.alias
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 250, in alias
> return AliasManager.get(self)
>   File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/
> site-packages/sql/__init__.py", line 155, in get
> if getattr(cls.local, 'alias', None) is None:
> RuntimeError: maximum recursion depth exceeded in cmp
>
> *3- values is an empty list: []*
>
> query = user.update(
> columns=[user.main_company],
> values=[],
> where=user.main_company != Null)
>
> Query is:
>
> ('UPDATE "res_user" SET  WHERE ("res_user"."main_company" IS NOT NULL)',
> ())
>
> Get error:
>
> Traceback (most recent call last):
>   File "./trytond/bin/trytond-admin", line 21, in 
> admin.run(options)
>   File "/home/resteve/virtualenv/nan40/trytond/trytond/admin.py", line
> 48, in run
> Pool(db_name).init(update=options.update, lang=lang)
>   File "/home/resteve/virtualenv/nan40/trytond/trytond/pool.py", line
> 155, in init
> lang=lang)
>   File "/home/resteve/virtualenv/nan40/trytond/trytond/modules/__init__.py",
> line 429, in load_modules
> _load_modules()
>   File "/home/resteve/virtualenv/nan40/trytond/trytond/modules/__init__.py",
> line 398, in _load_modules
> load_module_graph(graph, pool, update, lang)
>   File "/home/resteve/virtualenv/nan40/trytond/trytond/modules/__init__.py",
> line 237, in load_module_graph
> cls.__register__(module)
>   File 
> "/home/resteve/virtualenv/nan40/trytond/trytond/modules/party_company/user.py",
> line 51, in __register__
> cursor.execute(*query)
> psycopg2.ProgrammingError: syntax error at or near "WHERE"
> LINE 1: UPDATE "res_user" SET  WHERE ("res_user"."main_company" IS N...
>
> *Annex:*
>
> - I don't found an example a tryton modules or at  tests in python-sql to
> set null a