Re: [tryton-es] Ayuda para integración de nuevos campos en los formularios en GNU Health

2017-06-20 Thread Marco Vinicio Guapi Guapi
Existe algún módulo que permita hacer esa tarea o alguna manera simple de
hacerlo?

El 12 de junio de 2017, 03:06, Sergi Almacellas Abellana
escribió:

> HOla,
>
> El 12/06/17 a les 05:06, Marco Vinicio Guapi Guapi ha escrit:
>
>>
>> Necesitamos implementar el sistema GNU health en un centro medico en
>> dicho centro se realizan el ingreso de los pacientes con algunos campos que
>> no se encuentran en el sistema GNU Health para ello necesitamos anadir los
>> campos extras.
>>
>
> Debes crear un nuevo módulo de tryton que añada nuevos campos a los
> modelos existentes. Puedes encontrar un pequeño taller/tutorial en:
>
> https://bitbucket.org/pokoli/tryton_workshop
>
> Simplemente tienes que clonar el Repositorio via mercurial, y ir siguiendo
> los passos que se explican en el README.
>
> Un saludo,
>
> --
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk
>


Re: [tryton] updating party_sequence with proteus

2017-06-20 Thread Richard PALO

Le 20/06/2017 à 17:09, Richard PALO a écrit :

The following code, for example, works as expected if I manually install party 
and select
the party sequence with the tryton client.

 # Reset the sequence
 Sequence = Model.get('ir.sequence')
 configuration = Configuration(1)
 if not configuration.party_sequence:
 configuration.party_sequence = Sequence.find([('code', '=', 
'party.party')])
 configuration.party_sequence.number_next = max(
 list(map(int, iter(code2party.keys() + 1
 configuration.party_sequence.save()





I believe I just realised that Sequence.find() is a multivalued function, so 
after changing thus:


 configuration.party_sequence, = Sequence.find([('code', '=', 
'party.party')])

the workaround does seem to be okay in the end.

--

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/de68c09c-188e-0f78-e2a0-b3a4a16a8c51%40free.fr.


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Sergi Almacellas Abellana


On 20 de juny de 2017 17.01.24 CEST, Maxime Richez  
wrote:
>
>
>>
>> I agree with Cedric here. Specially if you want to use it on a
>domain. Let 
>> me explain: 
>>
>> If you store it on the configuration, changing the value on the 
>> configuration may invalidate all the existing records domain.
>Creating a 
>> static category with xml records will prevent it. 
>>
>>
>But if i change the xml category on the product, problem will also be
>the 
>same  (but with less impact, or i can prevent to change product
>category )?

If you have a domain it can not be changed as the domain will ensure it.

-- 
Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi 
brevedad.

-- 
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/B0F425C5-72A7-4EFF-A80D-7927166D6340%40koolpi.com.


Re: [tryton] updating party_sequence with proteus

2017-06-20 Thread Richard PALO

Le 20/06/2017 à 15:19, Cédric Krier a écrit :

On 2017-06-20 15:10, Richard PALO wrote:

Le 20/06/2017 à 14:27, Cédric Krier a écrit :

On 2017-06-20 09:08, Richard PALO wrote:

Not very fluent in proteus nor the recent ir.sequence usage changes, I'm having 
difficulty
getting a critical portion of the openerp2tryton to work on 4.4...

In migrate_party, there is the following code around line 254 (nb:this has been 
2to3'd):

  # Reset the sequence
  configuration = Configuration(1)
  configuration.party_sequence.number_next = max(
  list(map(int, iter(code2party.keys() + 1
  configuration.party_sequence.save()



Unfortunately party_sequence is null and I can't seem to determine the 
incantation
that will fill it in correctly...


Is it also null when using the client?
Did you do a proper installation?



It appears so.  I checked my existing bases, plus a base created under 4.4

Under party->configuration->party configuration the sequence field is blank for 
all.


So it seems you have decided to not have automatic code on party.
We could improve the script for this case because obviously it does not
need to be updated.



Hmm, I've haven't [consciously] decided this at all... how would one do this, 
and why?
Moreso, has always worked as intended (automatically, that is). I've never 
fiddled with
this form prior to you just now asking me to check there in the client.

Therefore I believe at run-time the party.party sequence seems to be 
effectively used,
but the script (at least as is) is not able to update the number_next value, 
therefore dies
when trying to create the first employee because code '1' is already used (the 
company).


That is, I need to explicitly select 'party' to load it.


I do not understand what this means.
Do you mean, you have to fill the code field explicitly when creating a
party?


No. In the party configuration form for the sequence, if I select 'party' then 
it seems
selected in a persistent manner.

The problem is that all the modules are typically loaded by the script...

The following code, for example, works as expected if I manually install party 
and select
the party sequence with the tryton client.

# Reset the sequence
Sequence = Model.get('ir.sequence')
configuration = Configuration(1)
if not configuration.party_sequence:
configuration.party_sequence = Sequence.find([('code', '=', 
'party.party')])
configuration.party_sequence.number_next = max(
list(map(int, iter(code2party.keys() + 1
configuration.party_sequence.save()



But if I don't, the assignment fails after the find as follows:

/opt/trytond/trytond/modules/__init__.py:143: DeprecationWarning: This method 
will be removed in future versions.  Use 'parser.read_file()' instead.
  module_config.readfp(fp)
/opt/trytond/trytond/modules/__init__.py:143: DeprecationWarning: This method 
will be removed in future versions.  Use 'parser.read_file()' instead.
  module_config.readfp(fp)
/opt/trytond/trytond/model/fields/function.py:100: DeprecationWarning: 
inspect.getargspec() is deprecated, use inspect.signature() or 
inspect.getfullargspec()
  if 'names' in inspect.getargspec(method)[0]:
Traceback (most recent call last):
  File "migration.py", line 1141, in 
'account': args.load_account,
  File "migration.py", line 30, in main
migrate_party(installed, cur)
  File "migration.py", line 258, in migrate_party
configuration.party_sequence = Sequence.find([('code', '=', 'party.party')])
  File 
"/usr/lib/python3.6/site-packages/proteus-4.4.1-py3.6.egg/proteus/__init__.py", 
line 256, in __set__
AssertionError


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/ee4dd7f5-cf04-6b4e-9612-b35750aac94e%40free.fr.


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Maxime Richez

>
>
> No, any field can be stored on configuration but usually it is a 
> Property/MultiValue because it depends on the company. 
>
> Ok, i didn't know , as you said, in the code, it's usually 
Property/Multivalue...  

-- 
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/8fbba03a-6866-478f-9c3e-f0e0dbfd00f0%40googlegroups.com.


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Maxime Richez


>
> I agree with Cedric here. Specially if you want to use it on a domain. Let 
> me explain: 
>
> If you store it on the configuration, changing the value on the 
> configuration may invalidate all the existing records domain. Creating a 
> static category with xml records will prevent it. 
>
>
But if i change the xml category on the product, problem will also be the 
same  (but with less impact, or i can prevent to change product category )?

-- 
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/8356b69b-978d-4f68-83f0-9a09110399eb%40googlegroups.com.


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Cédric Krier
On 2017-06-20 07:47, Maxime Richez wrote:
> 
> 
> >
> > Why using a Property field? 
> >
> > The only way to store a value in configuration, no ? And it allows to 
> choose an existing product category.

No, any field can be stored on configuration but usually it is a
Property/MultiValue because it depends on the company.

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


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Sergi Almacellas Abellana


On 20 de juny de 2017 16.23.57 CEST, "Cédric Krier"  
wrote:
>On 2017-06-20 06:20, Maxime Richez wrote:
>> Hi,
>> 
>> Here's my small problem in Tryton 4.2, i want to filter products on a
>
>> specific product category. I define those category as a property in a
>
>> configuration.
>
>Why using a Property field?
>
>> My code is here: https://pastebin.com/wDF8qGtX
>> 
>> So in my main class (PrinterModel), i define a function field on
>product 
>> category to get the default category stored in configuration... 
>> (printer_category).
>> 
>> This function field is used in my domain for the product to get only 
>> products from a specific category (and children too)  (printer_model
>field)
>> 
>> My code wasn't working until i define a default_printer_category...
>code is 
>> redundant but it's working.
>> 
>> My question: is it necessary to use a function field for the domain
>or can 
>> i evaluate a function in domain ?
>
>Only field of a model can be evaluated by PYSON.
>There is the PYSON.Id but it will require that you create the category
>in XML.
>
>> If not, how to avoid code redundancy for 
>> default_ method and get_ method for the function field ? 
>
>You can call the default_ method from the getter method.
>But you need to have both because the getter will be called only once
>the record is saved/created.
>
>> Is there a better way to implement this "filter" ? i'm looking for
>examples 
>> in code but unsuccessfully.
>
>I think the creation of categories from XML could be a good option.

I agree with Cedric here. Specially if you want to use it on a domain. Let me 
explain:

If you store it on the configuration, changing the value on the configuration 
may invalidate all the existing records domain. Creating a static category with 
xml records will prevent it.

-- 
Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi 
brevedad.

-- 
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/395E6C43-660B-4D6C-84F1-6F8F4A73D2C8%40koolpi.com.


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Maxime Richez


>
> Why using a Property field? 
>
> The only way to store a value in configuration, no ? And it allows to 
choose an existing product category.
 

> Only field of a model can be evaluated by PYSON. 
> There is the PYSON.Id but it will require that you create the category 
> in XML. 
>
 
I'll try this. It seems easier and without property :-)
 

>
> You can call the default_ method from the getter method. 
> But you need to have both because the getter will be called only once 
> the record is saved/created. 
>

I didn't thought this way :-)

>
>
> I think the creation of categories from XML could be a good option.
>

Indeed. Thanks for your help ! 

-- 
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/9d36c8dc-25f4-4a96-b6cc-f29356f626b7%40googlegroups.com.


Re: [tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Cédric Krier
On 2017-06-20 06:20, Maxime Richez wrote:
> Hi,
> 
> Here's my small problem in Tryton 4.2, i want to filter products on a 
> specific product category. I define those category as a property in a 
> configuration.

Why using a Property field?

> My code is here: https://pastebin.com/wDF8qGtX
> 
> So in my main class (PrinterModel), i define a function field on product 
> category to get the default category stored in configuration... 
> (printer_category).
> 
> This function field is used in my domain for the product to get only 
> products from a specific category (and children too)  (printer_model field)
> 
> My code wasn't working until i define a default_printer_category... code is 
> redundant but it's working.
> 
> My question: is it necessary to use a function field for the domain or can 
> i evaluate a function in domain ?

Only field of a model can be evaluated by PYSON.
There is the PYSON.Id but it will require that you create the category
in XML.

> If not, how to avoid code redundancy for 
> default_ method and get_ method for the function field ? 

You can call the default_ method from the getter method.
But you need to have both because the getter will be called only once
the record is saved/created.

> Is there a better way to implement this "filter" ? i'm looking for examples 
> in code but unsuccessfully.

I think the creation of categories from XML could be a good option.

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


[tryton-dev] Using property (tryton 4.2) on domain field

2017-06-20 Thread Maxime Richez
Hi,

Here's my small problem in Tryton 4.2, i want to filter products on a 
specific product category. I define those category as a property in a 
configuration.

My code is here: https://pastebin.com/wDF8qGtX

So in my main class (PrinterModel), i define a function field on product 
category to get the default category stored in configuration... 
(printer_category).

This function field is used in my domain for the product to get only 
products from a specific category (and children too)  (printer_model field)

My code wasn't working until i define a default_printer_category... code is 
redundant but it's working.

My question: is it necessary to use a function field for the domain or can 
i evaluate a function in domain ? If not, how to avoid code redundancy for 
default_ method and get_ method for the function field ? 
Is there a better way to implement this "filter" ? i'm looking for examples 
in code but unsuccessfully.

Thanks for help!


-- 
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/04e9f629-df6f-4e0d-b4b9-77f0f88aad19%40googlegroups.com.


Re: [tryton] updating party_sequence with proteus

2017-06-20 Thread Cédric Krier
On 2017-06-20 15:10, Richard PALO wrote:
> Le 20/06/2017 à 14:27, Cédric Krier a écrit :
> > On 2017-06-20 09:08, Richard PALO wrote:
> >> Not very fluent in proteus nor the recent ir.sequence usage changes, I'm 
> >> having difficulty
> >> getting a critical portion of the openerp2tryton to work on 4.4...
> >>
> >> In migrate_party, there is the following code around line 254 (nb:this has 
> >> been 2to3'd):
> >>>  # Reset the sequence
> >>>  configuration = Configuration(1)
> >>>  configuration.party_sequence.number_next = max(
> >>>  list(map(int, iter(code2party.keys() + 1
> >>>  configuration.party_sequence.save()
> >>>
> >>
> >> Unfortunately party_sequence is null and I can't seem to determine the 
> >> incantation
> >> that will fill it in correctly...
> > 
> > Is it also null when using the client?
> > Did you do a proper installation?
> > 
> 
> It appears so.  I checked my existing bases, plus a base created under 4.4
> 
> Under party->configuration->party configuration the sequence field is blank 
> for all.

So it seems you have decided to not have automatic code on party.
We could improve the script for this case because obviously it does not
need to be updated.

> That is, I need to explicitly select 'party' to load it.

I do not understand what this means.
Do you mean, you have to fill the code field explicitly when creating a
party?

-- 
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/20170620131931.GD18592%40kei.


Re: [tryton] updating party_sequence with proteus

2017-06-20 Thread Richard PALO

Le 20/06/2017 à 14:27, Cédric Krier a écrit :

On 2017-06-20 09:08, Richard PALO wrote:

Not very fluent in proteus nor the recent ir.sequence usage changes, I'm having 
difficulty
getting a critical portion of the openerp2tryton to work on 4.4...

In migrate_party, there is the following code around line 254 (nb:this has been 
2to3'd):

 # Reset the sequence
 configuration = Configuration(1)
 configuration.party_sequence.number_next = max(
 list(map(int, iter(code2party.keys() + 1
 configuration.party_sequence.save()



Unfortunately party_sequence is null and I can't seem to determine the 
incantation
that will fill it in correctly...


Is it also null when using the client?
Did you do a proper installation?



It appears so.  I checked my existing bases, plus a base created under 4.4

Under party->configuration->party configuration the sequence field is blank for 
all.

That is, I need to explicitly select 'party' to load it.

Which would seem to corroborate with what I'm experiencing.

I'm current on the 4.4 branch under Python 3.6.1

--

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/83234c80-d04c-080a-93dc-d3e7f058037e%40free.fr.


Re: [tryton] updating party_sequence with proteus

2017-06-20 Thread Cédric Krier
On 2017-06-20 09:08, Richard PALO wrote:
> Not very fluent in proteus nor the recent ir.sequence usage changes, I'm 
> having difficulty
> getting a critical portion of the openerp2tryton to work on 4.4...
> 
> In migrate_party, there is the following code around line 254 (nb:this has 
> been 2to3'd):
> > # Reset the sequence
> > configuration = Configuration(1)
> > configuration.party_sequence.number_next = max(
> > list(map(int, iter(code2party.keys() + 1
> > configuration.party_sequence.save()
> > 
> 
> Unfortunately party_sequence is null and I can't seem to determine the 
> incantation
> that will fill it in correctly...

Is it also null when using the client?
Did you do a proper installation?

> I tried to use get_multivalue() using somewhat as model a snippet from 
> account/party.py but I
> get the error that get_multivalue() isn't available (where it is in vanilla 
> tryton code).

multivalue is for the server side. It must be transparent on client
side.

> I tried accessing directly 'ir.sequence' for 'party.party' and I can set 
> number_next but cannot 'save()' the record as the method isn't available.

This is very strange, proteus as 'save' method for all Models.

> Using update_sql_sequence()
> doesn't seem to work in this context either. So I presume this is probably a 
> false route.

It should neither be called directly.

> Any hints on how to actualise the reference party_sequence under 
> Configuration?
> Where does ConfigurationSequence play into things, if it does?

It is the hidden model that actually store the value of the multivalue
field.

-- 
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/20170620122722.GC18592%40kei.


Re: [tryton-es] Ocultar menu en SAO

2017-06-20 Thread Raimon Esteve
hola Elmer,

Se creo un issue al respeto:

https://bugs.tryton.org/issue5554

Finalmente viendo que no interesa entrar a core, me hice mi propio
patch para implementar que el usuario pueda ocultar el menú y no según
el dispositivo.

Saludos,


[tryton] updating party_sequence with proteus

2017-06-20 Thread Richard PALO

Not very fluent in proteus nor the recent ir.sequence usage changes, I'm having 
difficulty
getting a critical portion of the openerp2tryton to work on 4.4...

In migrate_party, there is the following code around line 254 (nb:this has been 
2to3'd):

# Reset the sequence
configuration = Configuration(1)
configuration.party_sequence.number_next = max(
list(map(int, iter(code2party.keys() + 1
configuration.party_sequence.save()



Unfortunately party_sequence is null and I can't seem to determine the 
incantation
that will fill it in correctly...

I tried to use get_multivalue() using somewhat as model a snippet from 
account/party.py but I
get the error that get_multivalue() isn't available (where it is in vanilla 
tryton code).

I tried accessing directly 'ir.sequence' for 'party.party' and I can set 
number_next but cannot 'save()' the record as the method isn't available. Using 
update_sql_sequence()
doesn't seem to work in this context either. So I presume this is probably a 
false route.

Any hints on how to actualise the reference party_sequence under Configuration?
Where does ConfigurationSequence play into things, if it does?

--

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/4b64077d-b84c-031c-2e8c-04ffcf1641e9%40free.fr.