Skip to content

Commit

Permalink
[FIX] sale_project: e-commerce delivered_milestones
Browse files Browse the repository at this point in the history
Steps to reproduce:

Create a Service Product with the Invoicing Policy "Based on Milestones"
publish its eCommerce page.
When logged out, click on "Add to Cart" on the product's eCommerce page.
an error message occurs

Bug:
since this commit[1] "delivered_milestones" is only a valid selection
for users with the group "group_project_milestone"

Fix:
compute the field as sudo to avoid acces error but still only allow
the correct group to manually set that value

opw-3892462

[1]:50ffc33

closes #165123

X-original-commit: c528097
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
  • Loading branch information
HANNICHE-Walid committed May 12, 2024
1 parent 1703464 commit 1be5dfc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/sale_project/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _selection_service_policy(self):
project_template_id = fields.Many2one(
'project.project', 'Project Template', company_dependent=True, copy=True,
domain="[('company_id', '=', current_company_id)]")
service_policy = fields.Selection('_selection_service_policy', string="Service Invoicing Policy", compute='_compute_service_policy', inverse='_inverse_service_policy')
service_policy = fields.Selection('_selection_service_policy', string="Service Invoicing Policy", compute_sudo=True, compute='_compute_service_policy', inverse='_inverse_service_policy')
service_type = fields.Selection(selection_add=[
('milestones', 'Project Milestones'),
])
Expand Down

0 comments on commit 1be5dfc

Please sign in to comment.