Empty Party Address created with Proteus and Bypass Error.

68 views
Skip to first unread message

PhiJ

unread,
May 30, 2016, 2:45:04 AM5/30/16
to tryton
Hello everybody!

I would like to make some questions when using Proteus.

The first one is related with its use to create a party with these commands:
>>> Party = Model.get('party.party')
>>> party = Party()
>>> party.name = 'Test'
>>> party.save()

It turns out that always that I execute this, it is created an empty address for that party. Is there any way that this wouldn't happen? I tried creating the address also before saving (see the following code), but anyway it creates that empty entry:
>>> Party = Model.get('party.party')
>>> party = Party()
>>> party.name = 'Test'
>>> address = party.addresses.new(zip='42')
>>> party.save()

Another question that I have is related with the error "Bypass an access rule". I know it is related with the user permissions, but I cannot find how to solve it. For example, I am trying to create with Proteus with the admin user a sequence ("ir.sequence"), I gave to my admin user all the permissions for this module, but anyway it keeps throwing me this error:
You try to bypass an access rule. Document type: ir.sequence
How I should give permissions to my user to avoid this error?

Thanks a lot in advance. Best regards.

Cédric Krier

unread,
May 30, 2016, 3:15:04 AM5/30/16
to tryton
On 2016-05-29 03:45, PhiJ wrote:
> Hello everybody!
>
> I would like to make some questions when using Proteus.
>
> The first one is related with its use to create a party with these commands:
> >>> Party = Model.get('party.party')
> >>> party = Party()
> >>> party.name = 'Test'
> >>> party.save()
>
> It turns out that always that I execute this, it is created an empty
> address for that party. Is there any way that this wouldn't happen? I tried
> creating the address also before saving (see the following code), but
> anyway it creates that empty entry:
> >>> Party = Model.get('party.party')
> >>> party = Party()
> >>> party.name = 'Test'
> >>> address = party.addresses.new(zip='42')
> >>> party.save()

You should just pop the default created address:

>>> party.addresses.pop()

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Sergi Almacellas Abellana

unread,
May 30, 2016, 3:16:22 AM5/30/16
to try...@googlegroups.com
El 29/05/16 a les 12:45, PhiJ ha escrit:
> Hello everybody!
>
> I would like to make some questions when using Proteus.
>
> The first one is related with its use to create a party with these commands:
> >>> Party = Model.get('party.party')
> >>> party = Party()
> >>> party.name = 'Test'
> >>> party.save()
>
> It turns out that always that I execute this, it is created an empty
> address for that party. Is there any way that this wouldn't happen? I
> tried creating the address also before saving (see the following code),
> but anyway it creates that empty entry:
> >>> Party = Model.get('party.party')
> >>> party = Party()
> >>> party.name = 'Test'
> >>> address = party.addresses.new(zip='42')
> >>> party.save()

This is because exists a default value for the addresses field:

http://hg.tryton.org/modules/party/file/tip/party.py#l109

You can remove the default address with:

>>> party.addresses.pop()
>
> Another question that I have is related with the error "Bypass an access
> rule". I know it is related with the user permissions, but I cannot find
> how to solve it. For example, I am trying to create with Proteus with
> the admin user a sequence ("ir.sequence"), I gave to my admin user all
> the permissions for this module, but anyway it keeps throwing me this error:
> *You try to bypass an access rule. Document type: ir.sequence*
> How I should give permissions to my user to avoid this error?

What kind of sequence are creating? Are you sure you are using the
correct sequence type? I normally see this error when there is a typo in
the sequence type name.
>
> Thanks a lot in advance. 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/c81baf57-74ba-4c98-ab58-3eb602abfbc6%40googlegroups.com
> <https://groups.google.com/d/msgid/tryton/c81baf57-74ba-4c98-ab58-3eb602abfbc6%40googlegroups.com?utm_medium=email&utm_source=footer>.


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

Jean Cavallo

unread,
May 30, 2016, 3:19:06 AM5/30/16
to try...@googlegroups.com

2016-05-29 12:45 GMT+02:00 PhiJ <nova...@gmail.com>:
You try to bypass an access rule. Document type: ir.sequence
How I should give permissions to my user to avoid this error?

Also, you must be extra careful on rights management for sequences
since there are special rights on sequence types that do not appear
in group management screens.

Jean Cavallo
Coopengo

PhiJ

unread,
May 30, 2016, 4:35:05 AM5/30/16
to tryton
El lunes, 30 de mayo de 2016, 10:16:22 (UTC+3), Sergi Almacellas Abellana escribió:
What kind of sequence are creating? Are you sure you are using the
correct sequence type? I normally see this error when there is a typo in
the sequence type name.

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

Hello Sergi,

I am trying to create a sequence with Proteus because it is a mandatory field for creating a Fiscal Year, which is my objective. But I tried with different access permissions with no luck, however, the same user is able to create the Sequence on Tryton client, so I am a bit confuse what can it be.

Thank you for your answer! 

PhiJ

unread,
May 30, 2016, 4:35:05 AM5/30/16
to tryton

El lunes, 30 de mayo de 2016, 10:15:04 (UTC+3), Cédric Krier escribió:

You should just pop the default created address:

    >>> party.addresses.pop()

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Excelent! Thank you very much! 

Sergi Almacellas Abellana

unread,
May 30, 2016, 5:08:26 AM5/30/16
to try...@googlegroups.com
El 30/05/16 a les 10:19, PhiJ ha escrit:
> El lunes, 30 de mayo de 2016, 10:16:22 (UTC+3), Sergi Almacellas
> Abellana escribió:
>
> What kind of sequence are creating? Are you sure you are using the
> correct sequence type? I normally see this error when there is a
> typo in
> the sequence type name.
>
> --
> Sergi Almacellas Abellana
> www.koolpi.com <http://www.koolpi.com>
> Twitter: @pokoli_srk
>
>
> Hello Sergi,
>
> I am trying to create a sequence with Proteus because it is a mandatory
> field for creating a Fiscal Year, which is my objective. But I tried
> with different access permissions with no luck, however, the same user
> is able to create the Sequence on Tryton client, so I am a bit confuse
> what can it be.

In this case you can use the helpers defined on the account and
account_invoice modules. See:

https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l13
https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l37

PhiJ

unread,
May 30, 2016, 1:05:04 PM5/30/16
to tryton
Thank you for the test scenarios data! Now that I came back to work, I tested what you said me before about sequence type and that was right! I didn't wrote a correct sequence code. Thanks a lot!

Best regards!

PhiJ

unread,
May 30, 2016, 1:05:04 PM5/30/16
to tryton
Thank you for your help and information Jean! It helped me to know more in detail about the system.  
Reply all
Reply to author
Forward
0 new messages