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] joint_buying_sale : compute fields with sudo, to avoid access e… #85

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions joint_buying_sale/models/joint_buying_transport_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def _get_depends_can_change(self):
def _compute_origin(self):
super(
JointBuyingTransportRequest, self.filtered(lambda x: not x.sale_order_id)
)._compute_request_type()
)._compute_origin()

for request in self.filtered(lambda x: x.sale_order_id):
request.origin = request.sale_order_id.name
request.origin = request.sale_order_id.sudo().name

def _compute_request_type(self):
super(
Expand All @@ -74,15 +74,15 @@ def _compute_amount_untaxed(self):
)._compute_amount_untaxed()

for request in self.filtered(lambda x: x.sale_order_id):
request.amount_untaxed = request.sale_order_id.amount_untaxed
request.amount_untaxed = request.sale_order_id.sudo().amount_untaxed

def _compute_total_weight(self):
super(
JointBuyingTransportRequest, self.filtered(lambda x: not x.sale_order_id)
)._compute_total_weight()

for request in self.filtered(lambda x: x.sale_order_id):
request.total_weight = request.sale_order_id.total_ordered_weight
request.total_weight = request.sale_order_id.sudo().total_ordered_weight

def _compute_description(self):
super(
Expand All @@ -91,7 +91,7 @@ def _compute_description(self):

for request in self.filtered(lambda x: x.sale_order_id):
description = ""
for line in request.sale_order_id.order_line.filtered(
for line in request.sale_order_id.sudo().order_line.filtered(
lambda x: x.display_type not in ["line_note", "line_section"]
):
description += (
Expand All @@ -115,7 +115,7 @@ def _compute_can_change(self):
def _get_report_tour_data_sale(self):
self.ensure_one()
res = []
for line in self.sudo().sale_order_id.order_line.filtered(
for line in self.sale_order_id.sudo().order_line.filtered(
lambda x: x.display_type not in ["line_note", "line_section"]
):
res.append(line._get_report_tour_data())
Expand Down
Loading