Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account: Migrate security groups #2260

Merged
merged 1 commit into from
Apr 13, 2020

Conversation

yajo
Copy link
Member

@yajo yajo commented Mar 30, 2020

In v10:

  • group_account_user implied group_account_invoice
  • group_account_manager implied group_account_user

In v11:

  • group_account_user implied no other groups
  • group_account_manager implied group_account_invoice

These one2many changes are not automigrated, so here's the script.

@Tecnativa TT23168

[In v10][10]:

- group_account_user implied group_account_invoice
- group_account_manager implied group_account_user

[In v11][11]:

- group_account_user implied no other groups
- group_account_manager implied group_account_invoice

These one2many changes are not automigrated, so here's the script.

@Tecnativa TT23168

[10]: https://github.com/odoo/odoo/blob/91807404e7d5c314ea30926b44bd16e878417ec1/addons/account/security/account_security.xml#L16-L26
[11]: https://github.com/odoo/odoo/blob/45eaa164e24ffec79f7b2be4093630f595e80565/addons/account/security/account_security.xml#L11-L20
@pedrobaeza
Copy link
Member

Aren't this noupdate data?

@pedrobaeza pedrobaeza added this to the 11.0 milestone Mar 30, 2020
@pedrobaeza
Copy link
Member

If so, please use the usual method through noupdate_records.xml file.

@yajo
Copy link
Member Author

yajo commented Mar 30, 2020

No, it is updatable, just check the links.

@yajo
Copy link
Member Author

yajo commented Mar 30, 2020

This affects also stock_account, should I make a separate PR or can I push that here too?

@pedrobaeza
Copy link
Member

OK, then the problem seems to be that no field means no deletion of previous one. That is getting into a common problem. @MiquelRForgeFlow how did you solve this previously? I think your solution was to make a PR to Odoo, isn't it? Maybe we can perform this check also on the noupdate script.

@yajo put it here if related.

@yajo
Copy link
Member Author

yajo commented Mar 30, 2020

Oh it seems the stock_account problem is in v8: #2261

@MiquelRForgeFlow
Copy link
Contributor

MiquelRForgeFlow commented Mar 30, 2020

how did you solve this previously?

where? which previous case are you thinking?

perform this check also on the noupdate script.

but this case is unrelated to noupdate script because that is updatable data

@pedrobaeza
Copy link
Member

@MiquelRForgeFlow I remember some missing context lines in XML data leads to incorrect action windows or similar in 11.0/12.0. Don't you remember?

I know that is not noupdate cases, but we can use the same engine to detect them and prepare noupdate_records.xml files that handle these cases (maybe we can rename then to data_to_update.xml).

yajo pushed a commit to Tecnativa/OpenUpgrade that referenced this pull request Mar 30, 2020
@MiquelRForgeFlow
Copy link
Contributor

so, you mean, doing a PR to Odoo like:

    <record id="group_account_user" model="res.groups">
        <...>
+        <field name="implied_ids" eval="[(3, ref('group_account_invoice'))]"/>
    </record>

    <record id="group_account_manager" model="res.groups">
        <...>
-        <field name="implied_ids" eval="[(4, ref('group_account_invoice'))]"/>
+        <field name="implied_ids" eval="[(3, ref('group_account_user')),(4, ref('group_account_invoice'))]"/>
    </record>

then, yeah, it's doable, but I don't know if they will accept.

@yajo
Copy link
Member Author

yajo commented Mar 30, 2020

For v11 maybe... But that wouldn't fix it here because OU is out of sync with Odoo, right?

@MiquelRForgeFlow
Copy link
Contributor

@yajo your fix here makes sense. If done PR to Odoo, then when odoo accepts it, then we can update upstream again and delete your patch here. Don't worry.

@MiquelRForgeFlow
Copy link
Contributor

I think odoo won't accept that kind of PR because they can say "that's updatable data, so if somebody customize those two groups (i.e., by adding group_account_invoice to group_account_user and group_account_user to group_account_manager) and then they do an update of account module (with the PR), then this two groups modifications will be reseted"

@pedrobaeza
Copy link
Member

Although I agree with the change, I think we should provide continuity with the expected permissions: if a user in v10 with one permission have access to certain parts, on v11 it should be the same without changing anything. What this means? That you have to complement this with a direct assignation of the previous group to all the users that were in the other. Do you understand me?

@pedrobaeza
Copy link
Member

@yajo please check my last comment

@yajo
Copy link
Member Author

yajo commented Apr 13, 2020

I understand, but it's not going to be fast or easy to find out that. I think we should merge this now, as it doesn't conflict with that and it's fixing a bug experienced in a real world scenario, and improve that later when we face it.

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just checked and groups in users are preserved although you change the groups inheritance, so it's good to go

@pedrobaeza pedrobaeza merged commit 9ad6c75 into OCA:11.0 Apr 13, 2020
@yajo yajo deleted the 11.0-account-fix_implied_groups branch April 13, 2020 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants