Re: [tryton] Re: remove module

2017-07-17 Thread Marko Randjelovic
On Monday, July 17, 2017 at 9:36:05 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 16/07/17 a les 19:04, Marko Randjelovic ha escrit: 
> > Can't we just upgrade the module with minimal module and then just 
> > remove it from the list? 
> You can mark them as deactivateed from the module form and then perform 
> the deactivation. 
>
What's the module form and where can i find it?

-- 
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/58e195b7-31f2-4f78-81c9-3ac844c5b245%40googlegroups.com.


[tryton] Re: remove module

2017-07-16 Thread Marko Randjelovic
Can't we just upgrade the module with minimal module and then just remove 
it from the list?


-- 
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/5ce03573-4ccb-4dbf-bbad-3557ba8d3ed4%40googlegroups.com.


[tryton] nclone trytond 4.4

2017-07-16 Thread Marko Randjelovic
I am trying to nclone trytond 4.4.

I tried three ways but always get an error sooner or later.
Here's a list of commands i tried with corresponding errors:

hg nclone http://hg.tryton.org/4.4/trytond -b 4.4

[trytond/trytond/modules/web_user/account]
abort: HTTP Error 404: Not Found

hg nclone http://hg.tryton.org/trytond -b 4.4 trytond44-1

[trytond44-1/trytond/modules/notification_email]
abort: unknown branch '4.4'!

hg nclone http://hg.tryton.org/4.4/trytond trytond44-2

[trytond44-2/trytond/modules/web_user/account]
abort: HTTP Error 404: Not Found

Best regards

-- 
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/917ad6cf-ffd1-41ea-8fd3-0e3631b2600a%40googlegroups.com.


[tryton] Why do we have to specify res_model in definition of act_window?

2016-12-06 Thread Marko Randjelovic
When making Tryton module, when we define act_window object, we specity 
res_model. Why, since we already specify model in definition of view which 
is to be displayed in the act window?

For example, in trytond/modules/party/party.xml we have:


party.party
tree
party_tree


party.party
form
party_form


Parties
party.party


First we specify model for party_view_tree with this line:

party.party

Then we do the same for party_view_form.

And finally we specify the same model in definition of act_party_form:
party.party

I am asking this because this looks to me as unnecessary complication. Can 
someone explain to me why we have to do this way?

Regards,
Marko

-- 
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/faa951e6-3cf8-4803-900f-f110d33d007b%40googlegroups.com.


Re: [tryton] Replacement for Transaction.cursor

2016-07-30 Thread Marko Randjelovic


On Saturday, July 30, 2016 at 9:20:03 PM UTC+2, Cédric Krier wrote:
>
> On 2016-07-30 21:03, Cédric Krier wrote: 
> > On 2016-07-30 08:15, Marko Randjelovic wrote: 
> > > The class Transaction as defined in trytond/transaction.py indeed 
> contained 
> > > attribute cursor and in new version this attribute is missing. I need 
> a 
> > > replacement way to execute the query as can be seen from the provided 
> > > excerpt of my code. 
> > 
> > The cursor is accessible from the connection: 
> > 
> http://doc.tryton.org/4.0/trytond/doc/ref/transaction.html?highlight=cursor#trytond.transaction.Transaction.connection
>  
>
> By the way, I just updated the Transaction doc to be correct and 
> complete: https://bugs.tryton.org/issue5759


I'm not sure the documentation is correct. According to documentation, 
there is cursor attribute of Transaction as a method, but if you write in 
code Transaction().cursor(), you will get error that there is not attribute 
cursor.

Regards,
Marko
 

>
>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/0a9e9042-b81c-49fc-8ec5-1e38da08b448%40googlegroups.com.


[tryton] Replacement for Transaction.cursor

2016-07-30 Thread Marko Randjelovic
Hi all,

I have a piece of code that uses cursor, but looks like cursor is removed 
from Trytond 4. When I use this code inside of Tryton 4, I get this error:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 47, in dispatch_request
return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 59, in rpc
request, database_name, *request.params)
  File "/trytond/wsgi.py", line 39, in auth_required
return wrapped(*args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 40, in wrapper
return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 201, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/modelsql.py", line 762, in read
getter_results = field.get(ids, cls, field_list, values=result)
  File "/trytond/model/fields/function.py", line 92, in get
return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 92, in 
return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 84, in call
return method(records, name)
  File "/trytond/modules/training/opportunity.py", line 92, in 
get_description_length
cursor = Transaction().cursor
AttributeError: 'Transaction' object has no attribute 'cursor'


This is the code:

@classmethod
def get_description_length(cls, opportunities, name):
cursor = Transaction().cursor

opportunity = cls.__table__()
query = opportunity.select(
opportunity.id, CharLength(opportunity.description),
where=opportunity.id.in_([o.id for o in opportunities]))
cursor.execute(*query)
return {id: length for id, length in cursor.fetchall()}


We used cursor to execute query, now obviously there should be some 
replacement. I tried to look at the source to find out what that could be, 
but there were too many problems.

The class Transaction as defined in trytond/transaction.py indeed contained 
attribute cursor and in new version this attribute is missing. I need a 
replacement way to execute the query as can be seen from the provided 
excerpt of my code.

Please help.

-- 
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/d37f2ea2-71a7-42eb-9b97-2638e79d85a6%40googlegroups.com.


Re: [tryton] Missing Database submenu

2016-07-28 Thread Marko Randjelovic


On Thursday, July 28, 2016 at 4:12:48 PM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 28/07/16 a les 15:56, Marko Randjelovic ha escrit: 
> > Hi all, 
> > 
> > After solving problem named "Error starting trytond", there is another 
> > problem. When I start Tryton client, there is no "Database" submenu 
> > under "File" menu and for that reason I cannot create database. Another 
> > thing than confuses me is there is no prompt for password in the dialog 
> > that is displayed by default (to connect to database). 
> You are using the development version where those options have changed: 
>
> 1. Databases must be created from server side. 
>

Than how do I create a database?
 

> 2. The password promt will apear after entering a valid username and 
> database. 
>
> Hope it helps! 
>
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
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/a6fa92a8-b01a-4f63-b9b2-dddb10feeca8%40googlegroups.com.


[tryton] Missing Database submenu

2016-07-28 Thread Marko Randjelovic
Hi all,

After solving problem named "Error starting trytond", there is another 
problem. When I start Tryton client, there is no "Database" submenu under 
"File" menu and for that reason I cannot create database. Another thing 
than confuses me is there is no prompt for password in the dialog that is 
displayed by default (to connect to database).

Regards,
Marko

-- 
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/b9b12ec9-d09c-434d-af50-d418583df55c%40googlegroups.com.


Re: [tryton] Error starting trytond

2016-07-28 Thread Marko Randjelovic


On Thursday, July 28, 2016 at 11:17:57 AM UTC+2, Mathias Behrle wrote:
>
> * Marko Randjelovic: " Re: [tryton] Error starting trytond" (Thu, 28 Jul 
> 2016 
>   01:46:31 -0700 (PDT)): 
>
> > On Thursday, July 28, 2016 at 9:20:21 AM UTC+2, Sergi Almacellas 
> Abellana 
> > wrote: 
> > > 
> > > El 27/07/16 a les 21:50, Marko Randjelovic ha escrit:   
> > > > When starting trytond ver 4.1.0, I get this error: 
> > > > 
> > > > (trytond) mr@abc24:~/training/trytond4$ bin/trytond -c 
> ../trytond4p.conf 
> > > > -d test 
> > > > Traceback (most recent call last): 
> > > >   File "bin/trytond", line 24, in  
> > > > from trytond.application import app 
> > > >   File "/home/mr/training/trytond4/trytond/application.py", line 8, 
> in 
> > > >  
> > > > Pool.start() 
> > > >   File "/home/mr/training/trytond4/trytond/pool.py", line 97, in 
> start 
> > > > register_classes() 
> > > >   File "/home/mr/training/trytond4/trytond/modules/__init__.py", 
> line 
> > > > 362, in register_classes 
> > > > mod_file, pathname, description) 
> > > >   File 
> "/home/mr/training/trytond4/trytond/modules/account/__init__.py", 
> > > > line 6, in  
> > > > from .account import * 
> > > >   File 
> "/home/mr/training/trytond4/trytond/modules/account/account.py", 
> > > > line 8, in  
> > > > from sql import Column, Null, Window, Literal 
> > > > ImportError: cannot import name Window   
> > > 
> > > account module at least version 0.7 of python-sql [1] and you seem to 
> > > have and older version. Please upgrade you python-sql to a more recent 
> > > version. 
> > >   
> > 
> > (trytond) mr@abc24:~/training$ pip install python-sql --upgrade 
> > Collecting python-sql 
> > Installing collected packages: python-sql 
> >   Found existing installation: python-sql 0.4 
> > Not uninstalling python-sql at /usr/lib/python2.7/dist-packages, 
> > outside environment /home/mr/training/.venv/trytond 
>
> You seem to have python-sql installed via your package manager and 
> eventually 
> your virtualenv is set up with global-site-packages enabled. What is the 
> OS you 
> are running? 
>
> So either update the first one with a recent version or change your 
> virtualenv 
> to not use site-packages (in which case pip will install python-sql into 
> the 
> virtualenv). 
>

I use Debian Jessie and indeed there was python-sql in global environment. 
After reading your message, I uninstalled it (using Debian package 
manager), but pip (in virtual environment) still didn't want to upgrade 
python-sql (said already at newest version which was obviously wrong). Than 
I uninstalled it and after the command to install it, pip installed 0.8. 
Then Tryton server started without an error.
 

>
> Regards, 
>
> Mathias 
>
> > Successfully installed python-sql-0.4 
> > 
> > For some reason pip installs again the same version. In repo available 
> is 
> > 0.8. 
> > 
> > (trytond) mr@abc24:~/training$ pip search sql | grep "^python-sql" 
> > python-sql-abstraction (0.0.1)   - SQL 
> Abstraction 
> > layer written in Python 3.2 for use in lower level applications, such as 
> > tkinter. 
> > python-sql (0.8) - Library to 
> write 
> > SQL queries 
> > 
> > 
> > 
> > > [1] 
> http://hg.tryton.org/modules/account/file/5d2be5235e04/setup.py#l50 
> > > <
> http://www.google.com/url?q=http%3A%2F%2Fhg.tryton.org%2Fmodules%2Faccount%2Ffile%2F5d2be5235e04%2Fsetup.py%23l50=D=1=AFQjCNGP6z8lHoJAm3DPcs_AvcMccvQHgA>
>  
>
> > > 
> > > -- 
> > > Sergi Almacellas Abellana 
> > > www.koolpi.com 
> > > Twitter: @pokoli_srk 
> > >   
> > 
>
>
>
> -- 
>
> Mathias Behrle 
> MBSolutions 
> Gilgenmatten 10 A 
> D-79114 Freiburg 
>
> Tel: +49(761)471023 
> Fax: +49(761)4770816 
> http://www.m9s.biz 
> UStIdNr: DE 142009020 
> PGP/GnuPG key availabable from any keyserver, ID: 0x8405BBF6 
>

-- 
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/2910101c-6cd8-487b-b3c9-0c7fd29e1253%40googlegroups.com.


Re: [tryton] User interface frozen when creating production request

2016-07-28 Thread Marko Randjelovic


On Thursday, July 28, 2016 at 12:30:05 PM UTC+2, Cédric Krier wrote:
>
> On 2016-07-28 02:50, Marko Randjelovic wrote: 
> >  I have 5 products defined and 3 BOMs. Regarding BOMs, there is 
> recursive 
> > relationship. 
>
> You can not have recursive BOMs. The process is in an infinite loop, 
> that will stop once you will reach the Python stack limit or your 
> machine memory. 
> It is very complex to detect such cases because there are valid cases 
> where you could have loops in the BOMs (like a catalyst but such 
> product should never be configured to be produced by such BOM). But in 
> real life there are no product that needs itself to be produced. 
>

I expressed myself in a wrong way. I wongly used the term "recursive 
relationship". I wanted to say, that the structure is hierarchical with 
depth more than 1, i.e. that there are parts of a product that are 
themselves represented as a list of other products.
 

>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/c50f21ca-3bf5-41cd-b8b7-4906a3269614%40googlegroups.com.


Re: [tryton] User interface frozen when creating production request

2016-07-28 Thread Marko Randjelovic


On Thursday, July 28, 2016 at 10:56:53 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 28/07/16 a les 10:13, Marko Randjelovic ha escrit: 
> > 
> > 
> > On Thursday, July 28, 2016 at 9:55:13 AM UTC+2, Sergi Almacellas 
> > Abellana wrote: 
> > 
> > El 27/07/16 a les 22:12, Marko Randjelovic ha escrit: 
> > > I double clicked "Create Production Request" from the menu and a 
> > wizard 
> > > appeared with question "Create production request?". I clicked on 
> > > "Create" button and after theat user interface froze and remained 
> so 
> > > forever. The only that worked was to click on x to close Tryton 
> > client. 
> > > 
> > 
> > For me you did not wait enougth to the process to finish. 
> > 
> > 
> > And can you tell me how long should be enough? 
>
> It depends on the number of the requests the process have to create, but 
> if you have only 5 products and not so many recursive requests to create 
> it should not spend so much time. 
>

 I have 5 products defined and 3 BOMs. Regarding BOMs, there is recursive 
relationship.


> BTW: Could you explain the steps to reproduce it? 
>
>
I just double click "Production/Productions/Create Production Requests". 
Then wizard appears with the question "Create Production Requests?" At the 
bottom of the window there are two buttons: 'Cancel' and 'Create'. I 
clicked on 'Create' and mouse pointer turned into a clock. I can still 
click on 'Cancel'/'Create' but nothing happens. That was at 10:30. Now is 
past 11:30 and mouse pointer is still clock.

 

> > 
> > 
> > 
> > > I don't know if this is a bug but look so. 
> > > Client version 4.0.3. Server version 4.1.0. 
> > It's not possible to mix client version 4.0 with server version 4.1. 
> So 
> > here there is something wrong. 
> > 
> > 
> > 4.0.3 is the latest version for client and 4.1.0 for server. I did hg 
> > npull for both repos. 
>
> 4.1 is the development series and is not released and 4.0 is the latests 
> stable series. 
>
> Before connecting the client checks [1] if the server version is 
> compatible with the server. So I highly doubt you are conecting on a 4.1 
> server with a 4.0 client. 
>
>
>
Both versions are the latest development versions. I just used

hg nclone http://hg.tryton.org/4.0/trytond
hg nclone http://hg.tryton.org/tryton

to get initial versions and later used 

hg npull

to update. Curretnly they are both fully ahead and version of the client is 
4.0.3 and version of the server is 4.1.0. I don't know why the versions are 
different and they obviously work together.

Regards
 

> [1] 
>
> http://hg.tryton.org/tryton/file/f8a09b793a16/tryton/gui/window/dblogin.py#l299
>  
> <http://www.google.com/url?q=http%3A%2F%2Fhg.tryton.org%2Ftryton%2Ffile%2Ff8a09b793a16%2Ftryton%2Fgui%2Fwindow%2Fdblogin.py%23l299=D=1=AFQjCNEzbpakejASiaQepmGJGEPQBtkIrg>
>  
>
>
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
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/2ee74cb5-f565-452a-986f-1e34826eed67%40googlegroups.com.


Re: [tryton] Error starting trytond

2016-07-28 Thread Marko Randjelovic


On Thursday, July 28, 2016 at 9:20:21 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 27/07/16 a les 21:50, Marko Randjelovic ha escrit: 
> > When starting trytond ver 4.1.0, I get this error: 
> > 
> > (trytond) mr@abc24:~/training/trytond4$ bin/trytond -c ../trytond4p.conf 
> > -d test 
> > Traceback (most recent call last): 
> >   File "bin/trytond", line 24, in  
> > from trytond.application import app 
> >   File "/home/mr/training/trytond4/trytond/application.py", line 8, in 
> >  
> > Pool.start() 
> >   File "/home/mr/training/trytond4/trytond/pool.py", line 97, in start 
> > register_classes() 
> >   File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 
> > 362, in register_classes 
> > mod_file, pathname, description) 
> >   File "/home/mr/training/trytond4/trytond/modules/account/__init__.py", 
> > line 6, in  
> > from .account import * 
> >   File "/home/mr/training/trytond4/trytond/modules/account/account.py", 
> > line 8, in  
> > from sql import Column, Null, Window, Literal 
> > ImportError: cannot import name Window 
>
> account module at least version 0.7 of python-sql [1] and you seem to 
> have and older version. Please upgrade you python-sql to a more recent 
> version. 
>

(trytond) mr@abc24:~/training$ pip install python-sql --upgrade
Collecting python-sql
Installing collected packages: python-sql
  Found existing installation: python-sql 0.4
Not uninstalling python-sql at /usr/lib/python2.7/dist-packages, 
outside environment /home/mr/training/.venv/trytond
Successfully installed python-sql-0.4

For some reason pip installs again the same version. In repo available is 
0.8. 

(trytond) mr@abc24:~/training$ pip search sql | grep "^python-sql"
python-sql-abstraction (0.0.1)   - SQL Abstraction 
layer written in Python 3.2 for use in lower level applications, such as 
tkinter.
python-sql (0.8) - Library to write 
SQL queries



> [1] http://hg.tryton.org/modules/account/file/5d2be5235e04/setup.py#l50 
> <http://www.google.com/url?q=http%3A%2F%2Fhg.tryton.org%2Fmodules%2Faccount%2Ffile%2F5d2be5235e04%2Fsetup.py%23l50=D=1=AFQjCNGP6z8lHoJAm3DPcs_AvcMccvQHgA>
>  
>
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
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/0f62344e-2c9a-4561-879b-3ff6b2266e36%40googlegroups.com.


Re: [tryton] User interface frozen when creating production request

2016-07-28 Thread Marko Randjelovic
On Thursday, July 28, 2016 at 9:55:13 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 27/07/16 a les 22:12, Marko Randjelovic ha escrit: 
> > I double clicked "Create Production Request" from the menu and a wizard 
> > appeared with question "Create production request?". I clicked on 
> > "Create" button and after theat user interface froze and remained so 
> > forever. The only that worked was to click on x to close Tryton client. 
> > 
>
> For me you did not wait enougth to the process to finish. 
>

Just to make note I have only 5 products.
 

>
> > I don't know if this is a bug but look so. 
> > Client version 4.0.3. Server version 4.1.0. 
> It's not possible to mix client version 4.0 with server version 4.1. So 
> here there is something wrong. 
>
>
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
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/92b1c015-0f29-4105-9e40-cd3538151a6a%40googlegroups.com.


[tryton] Error starting trytond

2016-07-27 Thread Marko Randjelovic
When starting trytond ver 4.1.0, I get this error:

(trytond) mr@abc24:~/training/trytond4$ bin/trytond -c ../trytond4p.conf -d 
test 
Traceback (most recent call last):
  File "bin/trytond", line 24, in 
from trytond.application import app
  File "/home/mr/training/trytond4/trytond/application.py", line 8, in 

Pool.start()
  File "/home/mr/training/trytond4/trytond/pool.py", line 97, in start
register_classes()
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 362, 
in register_classes
mod_file, pathname, description)
  File "/home/mr/training/trytond4/trytond/modules/account/__init__.py", 
line 6, in 
from .account import *
  File "/home/mr/training/trytond4/trytond/modules/account/account.py", 
line 8, in 
from sql import Column, Null, Window, Literal
ImportError: cannot import name Window

Contents of trytond4p.conf:

[database]
uri = postgresql://tryton:@localhost:5432/

[session]
super_pwd = x

I created tryton user with this command:

createuser --createdb --username postgres --no-createrole --pwprompt tryton

Regards,
Marko

-- 
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/b2858874-560d-4002-9cd1-e374d532fa4a%40googlegroups.com.


[tryton] User interface frozen when creating production request

2016-07-27 Thread Marko Randjelovic
I double clicked "Create Production Request" from the menu and a wizard 
appeared with question "Create production request?". I clicked on "Create" 
button and after theat user interface froze and remained so forever. The 
only that worked was to click on x to close Tryton client.

I don't know if this is a bug but look so.
Client version 4.0.3. Server version 4.1.0.

Regards,
Marko

-- 
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/c1a6e483-ce6c-4bc0-9757-b704eb7b2155%40googlegroups.com.


Re: [tryton] pyson and '~'

2016-07-23 Thread Marko Randjelovic


On Friday, July 22, 2016 at 9:25:09 AM UTC+2, Cédric Krier wrote:
>
> On 2016-07-21 12:40, Marko Randjelovic wrote: 
> > Of course, but in examples I have neither ~ nor Not is imported from 
> > trytond.pyson. How Python knows about new character of '~'? Also, how is 
> > achieved possible to use ~ as an operator (there are no parenthesis)? 
>
> '~' is a standard python operator so it does not need to be imported. 
> See https://docs.python.org/2/library/operator.html#operator.__invert__


~ is a standard operator but it's purpose is bitwise inversion. How did we 
make it become logical negation?
 

>
>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/73a735e7-89e2-4448-b49c-39752f80d60a%40googlegroups.com.


Re: [tryton] Error when connecting from tryton4 to trytond4

2016-07-23 Thread Marko Randjelovic


On Friday, July 22, 2016 at 9:25:03 AM UTC+2, Cédric Krier wrote:
>
> On 2016-07-21 13:04, Marko Randjelovic wrote: 
> > In meantime I was using tryton 3.8 and imported all modules. When I run 
> > your command I get: 
> > 
> > (venv) mr@debian:~/training/trytond4$ bin/trytond-admin -d test4 --all 
> -c 
> > ../trytond4.conf 
>
> There is a tricky behaviour with the command line parser, the option 
> '--all' should be after the '-u' options otherwise it is wiped off. 
>
>
I swapped the options, but few minutes again got error:

(venv) mr@debian:~/training/trytond4$ bin/trytond-admin -d test4 -c 
../trytond4.conf -u purchase_request --all
Traceback (most recent call last):
  File "bin/trytond-admin", line 21, in 
admin.run(options)
  File "/home/mr/training/trytond4/trytond/admin.py", line 48, in run
Pool(db_name).init(update=options.update, lang=lang)
  File "/home/mr/training/trytond4/trytond/pool.py", line 155, in init
lang=lang)
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 429, 
in load_modules
_load_modules()
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 398, 
in _load_modules
load_module_graph(graph, pool, update, lang)
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 237, 
in load_module_graph
cls.__register__(module)
  File 
"/home/mr/training/trytond4/trytond/modules/sale_opportunity/opportunity.py", 
line 118, in __register__
super(SaleOpportunity, cls).__register__(module_name)
  File "/home/mr/training/trytond4/trytond/model/modelsql.py", line 143, in 
__register__
history_table.index_action('id', action='add')
  File "/home/mr/training/trytond4/trytond/backend/sqlite/table.py", line 
258, in index_action
')')
sqlite3.OperationalError: index sale_opportunity__history_id_index already 
exists

Regards,
Marko
 

> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/adfff306-d4aa-4c50-92ad-fa0ba7043af9%40googlegroups.com.


Re: [tryton] Error when connecting from tryton4 to trytond4

2016-07-21 Thread Marko Randjelovic
On Thursday, July 21, 2016 at 9:59:22 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 20/07/16 a les 13:26, Marko Randjelovic ha escrit: 
> > Hi, 
> > 
> > When I tried to connect from tryton4 client to trytond4, I've got this 
> > two errors. First error is occuring twice (it occurs again after i press 
> > 'Close' and after I press 'Close' again it occurs the second error. 
> > Tryton 3.8 was working fine. 
> > 
> > 
> > 
> > Traceback (most recent call last): 
> >   File "/trytond/wsgi.py", line 47, in dispatch_request 
> > return endpoint(request, **request.view_args) 
> >   File "/trytond/protocols/dispatcher.py", line 59, in rpc 
> > request, database_name, *request.params) 
> >   File "/trytond/wsgi.py", line 39, in auth_required 
> > return wrapped(*args, **kwargs) 
> >   File "/trytond/protocols/dispatcher.py", line 40, in wrapper 
> > return func(request, pool, *args, **kwargs) 
> >   File "/trytond/protocols/dispatcher.py", line 201, in _dispatch 
> > result = rpc.result(meth(*c_args, **c_kwargs)) 
> >   File "/trytond/res/user.py", line 359, in get_preferences 
> > preferences = cls._get_preferences(user, context_only=context_only) 
> >   File "/trytond/modules/company/company.py", line 165, in 
> _get_preferences 
> > context_only=context_only) 
> >   File "/trytond/res/user.py", line 336, in _get_preferences 
> > res[field] = getattr(user, field) 
> >   File "/trytond/model/fields/field.py", line 234, in __get__ 
> > return inst.__getattr__(self.name) 
> >   File "/trytond/model/modelstorage.py", line 1352, in __getattr__ 
> > read_data = self.read(list(ids), ffields.keys()) 
> >   File "/trytond/modules/company/company.py", line 214, in read 
> > result = super(User, cls).read(ids, fields_names=fields_names) 
> >   File "/trytond/model/modelsql.py", line 762, in read 
> > getter_results = field.get(ids, cls, field_list, values=result) 
> >   File "/trytond/model/fields/function.py", line 92, in get 
> > return dict((name, call(name)) for name in names) 
> >   File "/trytond/model/fields/function.py", line 92, in  
> > return dict((name, call(name)) for name in names) 
> >   File "/trytond/model/fields/function.py", line 86, in call 
> > return dict((r.id, method(r, name)) for r in records) 
> >   File "/trytond/model/fields/function.py", line 86, in  
> > return dict((r.id, method(r, name)) for r in records) 
> >   File "/trytond/res/user.py", line 172, in get_pyson_menu 
> > Action.get_action_values(self.menu.type, [self.menu.id])[0]) 
> >   File "/trytond/ir/action.py", line 97, in get_action_values 
> > return Action.read(action_ids, list(columns)) 
> >   File "/trytond/model/modelsql.py", line 692, in read 
> > order_by=history_order, limit=history_limit)) 
> > OperationalError: no such column: a.context_model 
>
> It seems that your database is not sync with the running code, so you 
> must upgrade all the modules in the database using: 
>
> trytond-admin -d  --all -c  
>
> Where  is the name or your database and  the 
> configuration file you are using to run trytond. 
>

In meantime I was using tryton 3.8 and imported all modules. When I run 
your command I get:

(venv) mr@debian:~/training/trytond4$ bin/trytond-admin -d test4 --all -c 
../trytond4.conf
Traceback (most recent call last):
  File "bin/trytond-admin", line 21, in 
admin.run(options)
  File "/home/mr/training/trytond4/trytond/admin.py", line 48, in run
Pool(db_name).init(update=options.update, lang=lang)
  File "/home/mr/training/trytond4/trytond/pool.py", line 155, in init
lang=lang)
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 429, 
in load_modules
_load_modules()
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 396, 
in _load_modules
graph = create_graph(module_list)[0]
  File "/home/mr/training/trytond4/trytond/modules/__init__.py", line 191, 
in create_graph
- set((p[0] for p in packages
Exception: Missing dependencies: [u'purchase_request']



When I try to import purchase_request:

(venv) mr@debian:~/training/trytond4$ bin/trytond-admin -d test4 -c 
../trytond4.conf --all -u purchase_request
5083 3530041120512 [2016-07-21 17:53:37,199] ERROR trytond.convert Error 
while parsing xml file:
In tag record: model ir.action.act_window with id act_purchase_request_form.
Traceback (most recent call la

[tryton] Error when connecting from tryton4 to trytond4

2016-07-21 Thread Marko Randjelovic
Hi,

When I tried to connect from tryton4 client to trytond4, I've got this two 
errors. First error is occuring twice (it occurs again after i press 
'Close' and after I press 'Close' again it occurs the second error. Tryton 
3.8 was working fine.



Traceback (most recent call last):
  File "/trytond/wsgi.py", line 47, in dispatch_request
return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 59, in rpc
request, database_name, *request.params)
  File "/trytond/wsgi.py", line 39, in auth_required
return wrapped(*args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 40, in wrapper
return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 201, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/res/user.py", line 359, in get_preferences
preferences = cls._get_preferences(user, context_only=context_only)
  File "/trytond/modules/company/company.py", line 165, in _get_preferences
context_only=context_only)
  File "/trytond/res/user.py", line 336, in _get_preferences
res[field] = getattr(user, field)
  File "/trytond/model/fields/field.py", line 234, in __get__
return inst.__getattr__(self.name)
  File "/trytond/model/modelstorage.py", line 1352, in __getattr__
read_data = self.read(list(ids), ffields.keys())
  File "/trytond/modules/company/company.py", line 214, in read
result = super(User, cls).read(ids, fields_names=fields_names)
  File "/trytond/model/modelsql.py", line 762, in read
getter_results = field.get(ids, cls, field_list, values=result)
  File "/trytond/model/fields/function.py", line 92, in get
return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 92, in 
return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 86, in call
return dict((r.id, method(r, name)) for r in records)
  File "/trytond/model/fields/function.py", line 86, in 
return dict((r.id, method(r, name)) for r in records)
  File "/trytond/res/user.py", line 172, in get_pyson_menu
Action.get_action_values(self.menu.type, [self.menu.id])[0])
  File "/trytond/ir/action.py", line 97, in get_action_values
return Action.read(action_ids, list(columns))
  File "/trytond/model/modelsql.py", line 692, in read
order_by=history_order, limit=history_limit))
OperationalError: no such column: a.context_model



Traceback (most recent call last):
  File "/home/mr/training/tryton4/tryton/common/common.py", line 1287, in 
process
self.callback(return_)
  File "/home/mr/training/tryton4/tryton/gui/main.py", line 859, in 
_set_preferences
self.global_search_entry.set_placeholder_text(_('Search'))
AttributeError: 'NoneType' object has no attribute 'set_placeholder_text'



Regards,
Marko

-- 
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/55568d28-0d1e-4421-aa9b-eabde53bade5%40googlegroups.com.


[tryton] pyson and '~'

2016-07-21 Thread Marko Randjelovic
Let us look at pyson expresson:

If(~Eval('end_date', None)

What is ~? Experimenting with Python interpreter, ~True is -2 and ~False is 
-1. I thought ~ is for negation, but -1 and -2 are not boolean values even 
in C they are 0 or >0.

-- 
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/b0d6996a-a6da-48c2-8d80-ec1f3f3c8511%40googlegroups.com.


Re: [tryton-dev] KeyError when running config.set_trytond method

2016-07-21 Thread Marko Randjelovic
On Wednesday, July 20, 2016 at 10:28:04 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 20/07/16 a les 10:03, Marko Randjelovic ha escrit: 
> > > No, I have only this: 
> > > 
> > > TRYTOND_CONFIG=/home/mr/.trytond.conf 
> > 
> > And what is the content? 
> > 
> > 
> > What content? 
> The content of the file used as TRYTOND_CONFIG (/home/mr/.trytond.conf) 
>
>
[database]
uri = sqlite://
path = /home/mr/training/databases

[session]
super_pwd = x
 

> -- 
> 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/f8e35c8c-ccf7-4c19-bcc3-871813c21384%40googlegroups.com.


Re: [tryton-dev] KeyError when running config.set_trytond method

2016-07-20 Thread Marko Randjelovic
On Tuesday, July 19, 2016 at 12:15:06 PM UTC+2, Cédric Krier wrote:
>
> On 2016-07-19 02:43, Marko Randjelovic wrote: 
> > On Tuesday, July 19, 2016 at 9:15:06 AM UTC+2, Cédric Krier wrote: 
> > > 
> > > On 2016-07-18 09:48, Marko Randjelovic wrote: 
> > > > And finally, i discovered the problem is solved when inserted this 
> line 
> > > in 
> > > > trytond configuration file, in database section: 
> > > > 
> > > > uri = sqlite:// 
> > > > 
> > > > According to documentation, this is the default, so again something 
> > > > confusing. 
> > > > 
> > > > Please help me understand what is going on. 
> > > 
> > > Maybe you have TRYTOND_DATABASE_URI set in your environment. 
> > > 
> > 
> > No, I have only this: 
> > 
> > TRYTOND_CONFIG=/home/mr/.trytond.conf 
>
> And what is the content? 
>

What content?
 

>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@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/d2e4afc7-904d-49ff-819a-cfa4e1712cdd%40googlegroups.com.


Re: [tryton-dev] KeyError when running config.set_trytond method

2016-07-19 Thread Marko Randjelovic
On Tuesday, July 19, 2016 at 9:15:06 AM UTC+2, Cédric Krier wrote:
>
> On 2016-07-18 09:48, Marko Randjelovic wrote: 
> > And finally, i discovered the problem is solved when inserted this line 
> in 
> > trytond configuration file, in database section: 
> > 
> > uri = sqlite:// 
> > 
> > According to documentation, this is the default, so again something 
> > confusing. 
> > 
> > Please help me understand what is going on. 
>
> Maybe you have TRYTOND_DATABASE_URI set in your environment. 
>

No, I have only this:

TRYTOND_CONFIG=/home/mr/.trytond.conf

 

>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@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/e36b8941-9f37-446b-a237-55eedad8c5ec%40googlegroups.com.


[tryton-dev] KeyError when running config.set_trytond method

2016-07-18 Thread Marko Randjelovic
I decided to post this on dev list because I am dealing with in-depth 
aspects of tryton source code. Please correct me if i am wrong.

I get a strange error when running a simple proteus script:

---
from proteus import config

config.set_trytond(database='test', 
config_file='/home/mr/training/trytond.conf')
---

When I run this script, I get this error:

---
Traceback (most recent call last):
  File "test.py", line 5, in 
config.set_trytond(database='test', 
config_file='/home/mr/training/trytond.conf')
  File 
"/home/mr/training/venv/local/lib/python2.7/site-packages/proteus/config.py", 
line 280, in set_trytond
_CONFIG.current = TrytondConfig(database, user, config_file=config_file)
  File 
"/home/mr/training/venv/local/lib/python2.7/site-packages/proteus/config.py", 
line 232, in __init__
self.pool.init()
  File "/home/mr/training/trytond/trytond/pool.py", line 155, in init
lang=lang)
  File "/home/mr/training/trytond/trytond/modules/__init__.py", line 426, 
in load_modules
with Transaction().start(database_name, 0):
  File "/home/mr/training/trytond/trytond/transaction.py", line 75, in start
Database = backend.get('Database')
  File "/home/mr/training/trytond/trytond/backend/__init__.py", line 35, in 
get
module = sys.modules[modname]
KeyError: 'trytond.backend.'
---

Indeed, in file /home/mr/training/trytond/trytond/backend/__init__.py there 
is a get function with the line 'module = sys.modules[modname]', but there 
is something strange. When I inserted a debugging print command in  get 
method, the text is printed four times when I start trytond, but when I run 
the script, nothing is printed.

On the other hand, when debugging print command is "print modname", output 
(when starting the server) is 'trytond.backend.sqlite', but in traceback 
key is 'trytond.backend.', i.e the third component is and empty string.

Then I modified the code and put in the string literal 
'trytond.backend.sqlite', i.e

old line:
module = sys.modules[modname]

new line:
module = sys.modules['trytond.backend.sqlite']

However, i again get error: KeyError: 'trytond.backend.sqlite'

I thought this is the correct value and don't understand why this key 
doesn't exist in sys.modules dictionary.

And finally, i discovered the problem is solved when inserted this line in 
trytond configuration file, in database section:

uri = sqlite://

According to documentation, this is the default, so again something 
confusing.

Please help me understand what is going on.

Regards,
Marko

-- 
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/4e636520-c2d2-47e0-ac18-33a755bb3e85%40googlegroups.com.


[tryton] Record deletion

2016-07-18 Thread Marko Randjelovic
Hello,

Strange and I didn't notice this till yesterday. When browsing records with 
list view or editing with form view, I tried to find a button to delete one 
or more records for several tables, but not one time I saw this option.

What's the trick?

-- 
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/d269046d-f648-44fe-8a97-c80b2ccb1326%40googlegroups.com.