OCA / margin-analysis

Odoo Financial Controlling (margin, costs, ...)
https://odoo-community.org/project/9
GNU Affero General Public License v3.0
71 stars 161 forks source link

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

Closed Tisho99 closed 8 months ago

Tisho99 commented 8 months ago

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:

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 commented 8 months ago

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

Tisho99 commented 8 months ago

@ValentinVinagre @HaraldPanten @pedrobaeza

pedrobaeza commented 8 months ago

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

Tisho99 commented 8 months ago

Thank you Pedro!