[18.0][FIX] account_payment_order: Manager can create partner bank accounts#1500
[18.0][FIX] account_payment_order: Manager can create partner bank accounts#1500
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
This was done on purpose for security, removing the permissions and putting them in a special group called "Accounting / Payments". |
fccaf24 to
a267d1c
Compare
Thanks for having a look! This issue affects any test class inheriting from |
Hi, to clarify what's happening here. Module A changes the behaviour of a standard model by requiring membership to a module specific group for users to create an instance. Module B - that does NOT depend on A - creates instances of such model in its test. A new module C that depends on both A and B is created (or migrated). Now tests on C fail in module B, because B does not use the group defined in A when creating instances of the model. This creates a situation that cannot be solved in C unless it actively undoes what module A does permission-wise, which is not the desired outcome. Plus B is just one of many other modules that potentially may access the base model in their tests, not to mention it's completely unrelated to module A, so changing it to depend on A and modifing its tests is also a non solution. |
|
we need to sblok the situation, @pedrobaeza what do you suggest? |
|
@pedrobaeza ping |
|
I'm OK with removing this restriction instead of adding a new permission if #1340 is finished and bring to 18.0. The question is that an invoicing manager shouldn't be able to send money without more supervision. That's a very critical security hole. But having the other flag with its isolated permission makes the same effect. |
0da5364 to
70be430
Compare
Thanks @pedrobaeza for the explanation and the proposed solution, now I can better understand what this module is doing and why. Since the problem only happens during tests execution, I have changed approach and tried to only change what is happening in the affected accounting tests. |
70be430 to
8627284
Compare
|
@monen17 meanwhile, Odoo has made a move even in 16, forcing in certain flows to have the flag activated: odoo/odoo@7763099, so maybe is already covered or almost to get to that functional requirement. |
|
I will review the upstream Odoo changes and make the corresponding changes here for not requiring this extra group. |
Thanks for the update! |
|
Yes, I would say that is already in 18. I'll let you know. |
I have seen #1557 just now; do you still plan to remove this security group? I don't want to rush you, just trying to keep track with what is happening. |
I have found the following unexpected behavior while writing the tests of OCA/l10n-italy#4920:
AccountTestInvoicingCommon, note that theself.env.useris an account manager.res.partner.bankrecordExpected:
The record is created
Actual:
Additional context
The root cause is that in
bank-payment/account_payment_order/security/ir.model.access.csv
Line 7 in 311be5c
In the tests of
16.0this was not a problem because the account manager created byAccountTestInvoicingCommonwas inheriting the groups of OdooBot in https://github.com/odoo/odoo/blob/5de47fb3bd4619dab2c84fff8f08d69dfee7b308/addons/account/tests/common.py#L49.This is no more the case in
18.0, where the account manager only has the account manager groups (see https://github.com/odoo/odoo/blob/0745730d44ad2a0e198a6f37b4ee7cb8e88f30ea/addons/account/tests/common.py#L248).I understand there are security implications for this change, but I think it makes sense that an account manager can create bank accounts of the partners.
Please let me know if I'm wrong or if there are better solutions! Thanks