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

[15.0][IMP] sale_report_delivered: Allow salesman to have access to the sale delivery report in the same way as they have access to the sales report. #297

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from

Conversation

pilarvargas-tecnativa
Copy link

cc @Tecnativa TT51606

@sergio-teruel @carlosdauden please review

@OCA-git-bot
Copy link
Contributor

Hi @sergio-teruel,
some modules you are maintaining are being modified, check this out!

@pilarvargas-tecnativa pilarvargas-tecnativa changed the title [IMP] sale_report_delivered: Allow salesman to have access to the sale delivery report in the same way as they have access to the sales report. [15.0][IMP] sale_report_delivered: Allow salesman to have access to the sale delivery report in the same way as they have access to the sales report. Dec 4, 2024
@pedrobaeza pedrobaeza added this to the 15.0 milestone Dec 4, 2024
@pedrobaeza
Copy link
Member

Didn't you need specific record rules?

@pilarvargas-tecnativa pilarvargas-tecnativa force-pushed the 15.0-imp-sale_report_delivered-salesman_security branch from bf93745 to 877a423 Compare December 4, 2024 07:39
@pilarvargas-tecnativa
Copy link
Author

Didn't you need specific record rules?

Yes, I was already forgetting... Thanks

@pedrobaeza
Copy link
Member

The 1 = 1 rule for managers is still missing.

@pilarvargas-tecnativa pilarvargas-tecnativa force-pushed the 15.0-imp-sale_report_delivered-salesman_security branch 2 times, most recently from f2bb2cb to 472aaed Compare December 4, 2024 07:53
@pilarvargas-tecnativa
Copy link
Author

The 1 = 1 rule for managers is still missing.

Done! The tests were already saying that this rule was missing.

@@ -1,2 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sale_report_delivered_manager,sale.report.delivered,model_sale_report_delivered,sales_team.group_sale_manager,1,1,1,1
Copy link
Member

@pedrobaeza pedrobaeza Dec 4, 2024

Choose a reason for hiding this comment

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

I'm thinking that you don't need this ACL line, and in fact, you should never grant delete permissions to _auto = False models.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@pedrobaeza pedrobaeza Dec 4, 2024

Choose a reason for hiding this comment

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

Look at this:

https://github.com/odoo/odoo/blob/5a6095cf332bf385092f16b2a11c553cd48767b4/addons/account/security/ir.model.access.csv#L7-L9

Seeing this one, you don't need as well modify not create permissions, just reading ones.

Copy link
Member

Choose a reason for hiding this comment

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

That's 18.0 though. On 15.0, it' similar to yours (but only with reading):

https://github.com/odoo/odoo/blob/3a28e5b0adbb36bdb1155a6854cdfbe4e7f9b187/addons/account/security/ir.model.access.csv#L18-L20

I would bet that this is not a change in the framework, but a cleaning...

Is it worth trying? You tell me. I don't want to block this.

Copy link
Contributor

Choose a reason for hiding this comment

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

In 18.0, we should look at this:
https://github.com/odoo/odoo/blob/18.0/addons/sale/security/ir.model.access.csv#L49

We normally recommend developers to do the following:

  • If this is the case in 15.0, it is always advisable to ‘mimic’ the version.
  • If it is wrong or can be improved, we can always do a PR to Odoo to change it and then adapt our modules.

If set as is in 18.0 with only this record:
access_sale_report_salesman,sale.report,model_sale_report,sales_team.group_sale_sale_salesman,1,0,0,0,0,0
should work without problems and with one less line, but I understand that we should not make people too confused so that they don't lose the spirit of contribution.

@pilarvargas-tecnativa , if you consider it appropriate, make the change, otherwise it's fine.

Choose a reason for hiding this comment

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

I think it's good to follow the Odoo line but leave the read-only permission for the salesman group. Pushed change

Copy link
Member

Choose a reason for hiding this comment

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

If it is wrong or can be improved, we can always do a PR to Odoo to change it and then adapt our modules.

That's the question. It's not wrong. It's just that it seems not needed. Odoo is not going to accept that "improvement"/cleaning on stable versions, so if we detect that something can be done, the sooner, the better. If not, when migrating this module to 18, any contributor (being us or any other) won't probably do the change.

but I understand that we should not make people too confused so that they don't lose the spirit of contribution.

This is not a random contributor. This is our team, and thus, we can set higher quality standards between us.

…e delivery report in the same way as they have access to the sales report.

TT51606
@pilarvargas-tecnativa pilarvargas-tecnativa force-pushed the 15.0-imp-sale_report_delivered-salesman_security branch from 472aaed to 3d1fbf0 Compare December 5, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants