Re: [tryton] openerp2tryton : painfully long in migrate_account_balance

2017-07-18 Thread E. Boer

>
>
> >> when I say long, it is already over 5 hours! 
> > 
> > Yep, proteus is not specially designed for performance. 
> > 
> yikes, guess I'll need to try breaking things down a bit differently, 
> that is instead of putting all move lines in a monster 'migration' move. 
>

We ran into the same problem and created a client script which talks over 
JSON-RPC with the tryton-server. We are now migrating 300.000 
account_move_lines within 1:45 hour. It's a bit more work to get it 
running. Another option is to create a migration_module which does the job.

-- 
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/3f61059d-ba38-49b6-a178-5f2e275d7b83%40googlegroups.com.


Re: [tryton] openerp2tryton : painfully long in migrate_account_balance

2017-07-18 Thread Richard PALO

Le 18/07/2017 à 13:27, Cédric Krier a écrit :

On 2017-07-18 13:01, Richard PALO wrote:

I'm looking for hints as to how to prod move.save()
to complete or at least to give some info as to why it isn't.

It appears to be cpu bound (indeed, the openerp base is quite large).

move.save is at the end of the following, from line 1065..1070 in 
migrate_account_balance

 move.lines.append(new_line)
 new_line.account = get_account(line.code, code2account)
 if new_line.account.party_required:
 new_line.party = code2party[str(line.partner_id)]

 move.save()


How do you know it is the problem?


I added print statements to trace ensuring that the 'for line in cur' loop was 
completed.


...
I do not think it could be a problem, I guess it just show you the last
query run by the session.


yeah, seems probably the case.


when I say long, it is already over 5 hours!


Yep, proteus is not specially designed for performance.


yikes, guess I'll need to try breaking things down a bit differently,
that is instead of putting all move lines in a monster 'migration' move.

cheers,
--

Richard PALO

--
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/e4ac7cf6-ad50-7def-8c43-1f520d28bcb9%40free.fr.


Re: [tryton] openerp2tryton : painfully long in migrate_account_balance

2017-07-18 Thread Cédric Krier
On 2017-07-18 13:27, Cédric Krier wrote:
> On 2017-07-18 13:01, Richard PALO wrote:
> > I'm looking for hints as to how to prod move.save()
> > to complete or at least to give some info as to why it isn't.
> > 
> > It appears to be cpu bound (indeed, the openerp base is quite large).

It will be good to have an estimation of the accounts, partner.
Because the query for the balance could return a huge number of lines
and it may not fit well in the memory of the host. In this case, it may
be good to create the move without lines and create line per small
bunch.

-- 
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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20170718113041.GR30717%40kei.


Re: [tryton] openerp2tryton : painfully long in migrate_account_balance

2017-07-18 Thread Cédric Krier
On 2017-07-18 13:01, Richard PALO wrote:
> I'm looking for hints as to how to prod move.save()
> to complete or at least to give some info as to why it isn't.
> 
> It appears to be cpu bound (indeed, the openerp base is quite large).
> 
> move.save is at the end of the following, from line 1065..1070 in 
> migrate_account_balance
> > move.lines.append(new_line)
> > new_line.account = get_account(line.code, code2account)
> > if new_line.account.party_required:
> > new_line.party = code2party[str(line.partner_id)]
> > 
> > move.save()

How do you know it is the problem?

> phppgadmin seems to believe that the following is cycling:
> > SELECT "a"."rounding" AS "rounding", "a"."active" AS "active", "a"."code" 
> > AS "code", "a"."create_date" AS "create_date", "a"."create_uid" AS 
> > "create_uid", "a"."digits" AS "digits", "a"."id" AS "id", 
> > "a"."mon_decimal_point" AS "mon_decimal_point", "a"."mon_grouping" AS 
> > "mon_grouping", "a"."mon_thousands_sep" AS "mon_thousands_sep", 
> > "a"."n_cs_precedes" AS "n_cs_precedes", "a"."n_sep_by_space" AS 
> > "n_sep_by_space", "a"."n_sign_posn" AS "n_sign_posn", "a"."negative_sign" 
> > AS "negative_sign", "a"."numeric_code" AS "numeric_code", 
> > "a"."p_cs_precedes" AS "p_cs_precedes", "a"."p_sep_by_space" AS 
> > "p_sep_by_space", "a"."p_sign_posn" AS "p_sign_posn", "a"."positive_sign" 
> > AS "positive_sign", "a"."symbol" AS "symbol", "a"."write_date" AS 
> > "write_date", "a"."write_uid" AS "write_uid" FROM "currency_currency" AS 
> > "a" WHERE (("a"."id" IN (44)))

I do not think it could be a problem, I guess it just show you the last
query run by the session.

> when I say long, it is already over 5 hours!

Yep, proteus is not specially designed for performance.
-- 
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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20170718112702.GQ30717%40kei.


[tryton] openerp2tryton : painfully long in migrate_account_balance

2017-07-18 Thread Richard PALO

I'm looking for hints as to how to prod move.save()
to complete or at least to give some info as to why it isn't.

It appears to be cpu bound (indeed, the openerp base is quite large).

move.save is at the end of the following, from line 1065..1070 in 
migrate_account_balance

move.lines.append(new_line)
new_line.account = get_account(line.code, code2account)
if new_line.account.party_required:
new_line.party = code2party[str(line.partner_id)]

move.save()


phppgadmin seems to believe that the following is cycling:

SELECT "a"."rounding" AS "rounding", "a"."active" AS "active", "a"."code" AS "code", "a"."create_date" AS "create_date", "a"."create_uid" AS "create_uid", "a"."digits" AS "digits", "a"."id" AS "id", "a"."mon_decimal_point" AS "mon_decimal_point", "a"."mon_grouping" AS "mon_grouping", "a"."mon_thousands_sep" AS "mon_thousands_sep", "a"."n_cs_precedes" AS "n_cs_precedes", "a"."n_sep_by_space" AS "n_sep_by_space", 
"a"."n_sign_posn" AS "n_sign_posn", "a"."negative_sign" AS "negative_sign", "a"."numeric_code" AS "numeric_code", "a"."p_cs_precedes" AS "p_cs_precedes", "a"."p_sep_by_space" AS "p_sep_by_space", "a"."p_sign_posn" AS "p_sign_posn", "a"."positive_sign" AS "positive_sign", "a"."symbol" AS "symbol", "a"."write_date" AS "write_date", "a"."write_uid" AS "write_uid" FROM "currency_currency" AS "a" WHERE (("a"."id" IN (44)))


when I say long, it is already over 5 hours!
--

Richard PALO

--
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/df654e4b-8312-5929-0123-7939fe5cd06f%40free.fr.


Re: [tryton-es] Problemas con la codificación utf-8 instalado el módulo aeat_347

2017-07-18 Thread Nicolás López Solano
Ya se instala correctamente,

Muchas gracias!!!

El 18 de julio de 2017, 11:58, Raimon Esteve 
escribió:

> Hola,
>
> 2017-07-17 16:47 GMT+02:00 Nicolás López :
> > Buenas tardes,
> >
> > Al instalar el módulo aeat_347 en la rama 4.2 nos salta un error de
> > encoding. Creamos que el problema está en aeat.py, porque se se usan los
> > caracteres "ñ" y "ç" en un comentario. En la versión 4.0 y anteriores se
> > declaraba que la codificación del fichero erá utf-8, pero en la versión
> 4.2
> > se ha eliminado esta declaración al comienzo del fichero.
> >
> > Estamos instando en un CENTOS 7.3 con python 2.7. y la codificación por
> > defecto es ASCII.
> >
> > ¿Ha cambiado algo en este sentido en la versión 4.2 o es algún problema
> de
> > configuración de python en el servidor?.
>
>
> Prueba de nuevo,
>
> Atentamente,
>


Re: [tryton-es] Problemas con la codificación utf-8 instalado el módulo aeat_347

2017-07-18 Thread Raimon Esteve
Hola,

2017-07-17 16:47 GMT+02:00 Nicolás López :
> Buenas tardes,
>
> Al instalar el módulo aeat_347 en la rama 4.2 nos salta un error de
> encoding. Creamos que el problema está en aeat.py, porque se se usan los
> caracteres "ñ" y "ç" en un comentario. En la versión 4.0 y anteriores se
> declaraba que la codificación del fichero erá utf-8, pero en la versión 4.2
> se ha eliminado esta declaración al comienzo del fichero.
>
> Estamos instando en un CENTOS 7.3 con python 2.7. y la codificación por
> defecto es ASCII.
>
> ¿Ha cambiado algo en este sentido en la versión 4.2 o es algún problema de
> configuración de python en el servidor?.


Prueba de nuevo,

Atentamente,


Re: [tryton-es] Problemas con la codificación utf-8 instalado el módulo aeat_347

2017-07-18 Thread Sergi Almacellas Abellana

El 17/07/17 a les 16:47, Nicolás López ha escrit:

Buenas tardes,


Hola Nicolas,


Al instalar el módulo aeat_347 en la rama 4.2 nos salta un error de 
encoding. Creamos que el problema está en aeat.py, porque se se usan los 
caracteres "ñ" y "ç" en un comentario. En la versión 4.0 y anteriores se 
declaraba que la codificación del fichero erá utf-8, pero en la versión 
4.2 se ha eliminado esta declaración al comienzo del fichero.


Estamos instando en un CENTOS 7.3 con python 2.7. y la codificación por 
defecto es ASCII.


¿Ha cambiado algo en este sentido en la versión 4.2 o es algún problema 
de configuración de python en el servidor?.


Vuestra configuración es correcta. Si se usan caracteres que no son 
ASCII  se debe indicar el encoding del fichero. Almenos en python2.


Este es el cambio que eliminio el encoding:

https://bitbucket.org/trytonspain/trytond-aeat_347/commits/6ec05e00588d

Saludos,

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


Re: [tryton] bypass wizard in proteus

2017-07-18 Thread Sergi Almacellas Abellana

El 18/07/17 a les 09:45, lists.jc.mic...@symetrie.com ha escrit:

Hi,


When setting up a new db from proteus, is it mandatory to call the wizards (ie, 
to simulate the actions done from the client) or is it possible/recommended to 
bypass it and populate directly the db?
Below the two ways I tried.

Seems that the company doesn’t become the default company for the next script 
lines with the second method.
With the wizard way, where can I find the form parameters to be filled ?
For creating the company you can have a look at the test tools of 
company module:


http://hg.tryton.org/modules/company/file/5b8a0005ebf9/tests/tools.py#l11

Once the data is created, you can mark the create company wizard as 
done. This data is stored in the ir.config.wizard.item table. We use the 
following code to mark all wizard items as done:


ConfigWizardItem = Model.get('ir.module.config_wizard.item') 

items = [] 

for item in ConfigWizardItem.find([('state', '!=', 'done')]): 

item.state = 'done' 

items.append(item) 


ConfigWizardItem.save(items)

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/f13a80df-a26b-e237-9ed2-893e7cc24601%40koolpi.com.


[tryton] bypass wizard in proteus

2017-07-18 Thread lists.jc.mic...@symetrie.com
Hi,


When setting up a new db from proteus, is it mandatory to call the wizards (ie, 
to simulate the actions done from the client) or is it possible/recommended to 
bypass it and populate directly the db?
Below the two ways I tried.

Seems that the company doesn’t become the default company for the next script 
lines with the second method.
With the wizard way, where can I find the form parameters to be filled ?

# wizard
company_config = Wizard('company.company.config')
company_config.execute('company')
company = company_config.form
company.name = MY_DATA['company']['name']
euro, = Currency.find([('code', '=', MY_DATA['company']['currency'])])
company.currency = euro
company.footer = MY_DATA['company']['footer']
company.party = Party()
company_config.execute('add')
company, = Company.find()

or

# simply create company
party = Party(name=MY_DATA['company']['name'], lang=fr)
party.save()
company = Company(party=party, currency=euro)
company.footer = MY_DATA['company']['footer']
company.timezone = MY_DATA['company']['timezone']
company.vat_country = MY_DATA['company']['country']
company.vat_number = MY_DATA['company']['vat_number']
company.save()

Jean-Christophe Michel

-- 
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/34F69FEB-CCAA-4125-91AD-EA637056C9BB%40symetrie.com.


Re: [tryton] json syntax to populate a model

2017-07-18 Thread lists.jc.mic...@symetrie.com
Hi,


Le 18 juil. 2017 à 09:29, Cédric Krier  a écrit :
> But it is not the way proteus is supposed to be used, you are supposed
> to instantiate Models and call .save()

Thanks for your answers.

Jean-Christophe Michel

-- 
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/9D9A0687-30DF-4DA6-9622-DD2D3E973AE5%40symetrie.com.


Re: [tryton] json syntax to populate a model

2017-07-18 Thread Cédric Krier
On 2017-07-18 08:49, lists.jc.mic...@symetrie.com wrote:
> Hi,
> 
> I found in party/tests/test_party a json syntax to pass data to populate a 
> model with proteus,

This is not json, it is Python dict and it does not use proteus.

> but I see a « keys error » when trying to use it:
> 
> Python 2.7.13 (default, Apr 23 2017, 16:56:24) 
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from proteus import config, Model, Wizard
> >>> def set_config(database, user, config_file=None):
> ... return config.set_trytond(database, user, config_file=config_file)
> ... 
> >>> config = set_config(u't44_4', u'admin', 
> >>> '/Users/jcm/Sites/_tryton/tryton4.4/my_local_trytond.conf')
> >>> Party = Model.get('party.party')
> >>> party1, = Party.create([{
> ... 'name': 'Party 1',
> ... }])
> Traceback (most recent call last):
>   File "", line 2, in 
>   File "/Users/jcm/Sites/_tryton/tryton4.4/proteus/proteus/config.py", line 
> 169, in __call__
> rpc.convert(self._object, *args)
>   File "/Users/jcm/Sites/_tryton/tryton4.4/trytond/trytond/rpc.py", line 36, 
> in convert
> for key in context.keys():
> AttributeError: 'list' object has no attribute ‘keys'

You can call methods using proteus but then you need to pass as last
parameter the context.
But it is not the way proteus is supposed to be used, you are supposed
to instantiate Models and call .save()

-- 
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" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20170718072921.GN30717%40kei.


Re: [tryton] json syntax to populate a model

2017-07-18 Thread Sergi Almacellas Abellana

El 18/07/17 a les 08:49, lists.jc.mic...@symetrie.com ha escrit:

Hi,

I found in party/tests/test_party a json syntax to pass data to populate a 
model with proteus, but I see a « keys error » when trying to use it:

Python 2.7.13 (default, Apr 23 2017, 16:56:24)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from proteus import config, Model, Wizard
def set_config(database, user, config_file=None):

... return config.set_trytond(database, user, config_file=config_file)
...

config = set_config(u't44_4', u'admin', 
'/Users/jcm/Sites/_tryton/tryton4.4/my_local_trytond.conf')
Party = Model.get('party.party')
party1, = Party.create([{

... 'name': 'Party 1',
... }])
Traceback (most recent call last):
   File "", line 2, in 
   File "/Users/jcm/Sites/_tryton/tryton4.4/proteus/proteus/config.py", line 
169, in __call__
 rpc.convert(self._object, *args)
   File "/Users/jcm/Sites/_tryton/tryton4.4/trytond/trytond/rpc.py", line 36, 
in convert
 for key in context.keys():
AttributeError: 'list' object has no attribute ‘keys'
You should pass the proteus config as last argument as you are calling 
and rpc method directly.


If you want to create a list of objects using proteus, i will recomend 
using save with a list of records:


records = []
for x in range(10):
record = Model()
record.xxx = yyy
records.append(record)
Model.save(records)

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/dade3e29-107c-0e77-f30a-9c15784a833b%40koolpi.com.


[tryton] json syntax to populate a model

2017-07-18 Thread lists.jc.mic...@symetrie.com
Hi,

I found in party/tests/test_party a json syntax to pass data to populate a 
model with proteus, but I see a « keys error » when trying to use it:

Python 2.7.13 (default, Apr 23 2017, 16:56:24) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from proteus import config, Model, Wizard
>>> def set_config(database, user, config_file=None):
... return config.set_trytond(database, user, config_file=config_file)
... 
>>> config = set_config(u't44_4', u'admin', 
>>> '/Users/jcm/Sites/_tryton/tryton4.4/my_local_trytond.conf')
>>> Party = Model.get('party.party')
>>> party1, = Party.create([{
... 'name': 'Party 1',
... }])
Traceback (most recent call last):
  File "", line 2, in 
  File "/Users/jcm/Sites/_tryton/tryton4.4/proteus/proteus/config.py", line 
169, in __call__
rpc.convert(self._object, *args)
  File "/Users/jcm/Sites/_tryton/tryton4.4/trytond/trytond/rpc.py", line 36, in 
convert
for key in context.keys():
AttributeError: 'list' object has no attribute ‘keys'


Jean-Christophe Michel

-- 
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/648EA2AD-BE2A-45CF-B361-BA7BC7E7E984%40symetrie.com.