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

[16.0][FIX]sale_margin_security: allow sale.order duplication #192

Closed

Conversation

Tisho99
Copy link

@Tisho99 Tisho99 commented Dec 27, 2023

Users without the "sale_margin_security.group_sale_margin_security" permission group can not duplicate sale.order records due to a permission error. This PR avoids that error setting Copy=False in that inherited field's inheritance.

image

Extended explanation:

The purchase_price field has:

  • A default value of Copy=True (because it is defined on the Odoo sale_margin module with readonly=False). When a user
  • A groups parameter = 'sale_margin_security.group_sale_margin_security'

When a user without the 'sale_margin_security.group_sale_margin_security' tries to copy a record of the model, an error is shown because Odoo tries to access to the field with the salesman user but it does not have the permission

The purchase_price has a computed default value, and the case of manually editing it is not common; so setting copy=False on the field and priorizing the compute over the manual changes should not be a problem

@OCA-git-bot
Copy link
Contributor

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

@Tisho99
Copy link
Author

Tisho99 commented Dec 27, 2023

Copy link
Contributor

@HaraldPanten HaraldPanten left a comment

Choose a reason for hiding this comment

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

It's functionally working fine. Waiting for technical reviews in order to decide that this is the best way for fixing this issue.

@pedrobaeza
Copy link
Member

Although it's correct, the proper place to do this is in Odoo. In fact, we have done it already for 15.0: odoo/odoo#147137, and you should just wait for the patch to be forward-ported to 16.0.

@Tisho99
Copy link
Author

Tisho99 commented Dec 28, 2023

Thank you Pedro!

@Tisho99 Tisho99 closed this Dec 28, 2023
@HaraldPanten HaraldPanten deleted the 16.0-fix-sale_margin_security-copy branch December 28, 2023 08:55
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.

4 participants