Skip to content

Commit

Permalink
[FIX] fieldservice_portal: Prevent order variable conflict with Purch…
Browse files Browse the repository at this point in the history
…ase module
  • Loading branch information
ppyczko committed Dec 12, 2024
1 parent 567361f commit 12899b1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
12 changes: 6 additions & 6 deletions fieldservice_portal/controllers/fsm_order_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ def _prepare_home_portal_values(self, counters):
return values

def _fsm_order_check_access(self, order_id):
order = request.env["fsm.order"].browse([order_id])
fsm_order = request.env["fsm.order"].browse([order_id])

try:
order.check_access_rights("read")
order.check_access_rule("read")
fsm_order.check_access_rights("read")
fsm_order.check_access_rule("read")
except AccessError:
raise
return order.sudo()
return fsm_order.sudo()

def fsm_order_get_page_view_values(self, order, **kwargs):
def fsm_order_get_page_view_values(self, fsm_order, **kwargs):
values = {
"page_name": "fsm_order",
"order": order,
"fsm_order": fsm_order,
}

if kwargs.get("error"):
Expand Down
46 changes: 23 additions & 23 deletions fieldservice_portal/views/fsm_order_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@
</tr>
</thead>
<tbody>
<t t-foreach="orders" t-as="order">
<t t-foreach="orders" t-as="fsm_order">
<tr>
<td>
<a t-attf-href="/my/fsm_order/#{order.id}">
<t t-out="order.name" />
<a t-attf-href="/my/fsm_order/#{fsm_order.id}">
<t t-out="fsm_order.name" />
</a>
</td>
<td>
<t t-out="order.description" />
<t t-out="fsm_order.description" />
</td>
<td>
<t
t-out="order.sudo().location_id.display_name"
t-out="fsm_order.sudo().location_id.display_name"
/>
</td>
<td>
<t t-out="order.type.name" />
<t t-out="fsm_order.type.name" />
</td>
<td>
<t t-out="order.stage_id.name" />
<t t-out="fsm_order.stage_id.name" />
</td>
</tr>
</t>
Expand All @@ -78,66 +78,66 @@
<t t-set="card_header">
<h1>
<t t-call='portal.record_pager' />
<span t-field="order.name" />
<span t-field="fsm_order.name" />
</h1>
</t>
<t t-set="card_body">
<div class="mb8">
<div class="row">
<div class="col-md-6">
<strong>Location:</strong>
<span t-field="order.location_id" />
<span t-field="fsm_order.location_id" />
<br />
<strong>City:</strong>
<span t-field="order.location_id.city" />
<t t-if="order.location_id.state_id">
<span t-field="fsm_order.location_id.city" />
<t t-if="fsm_order.location_id.state_id">
-
<span t-field="order.location_id.state_id" />
<span t-field="fsm_order.location_id.state_id" />
</t>
<t t-if="order.location_id.zip">
<t t-if="fsm_order.location_id.zip">
(
<span t-field="order.location_id.zip" />
<span t-field="fsm_order.location_id.zip" />
)
</t>
<br />
<strong>Country:</strong>
<span t-field="order.location_id.country_id" />
<span t-field="fsm_order.location_id.country_id" />
<br />
</div>
<div class="col-md-6">
<strong>Stage:</strong>
<t t-out="order.stage_id.name" />
<t t-out="fsm_order.stage_id.name" />
<br />
<strong>Work Type:</strong>
<t t-if="order.type">
<span t-field="order.type.name" />
<t t-if="fsm_order.type">
<span t-field="fsm_order.type.name" />
</t>
<t t-else="">
<span>N/A</span>
</t>
<br />
<strong>Arrival On Site:</strong>
<span
t-if="order.date_start"
t-field="order.date_start"
t-if="fsm_order.date_start"
t-field="fsm_order.date_start"
/>
<span t-else="">Not started yet</span>
<br />
</div>
</div>
<t t-if="order.description">
<t t-if="fsm_order.description">
<div class="row mt8">
<div class="col-md-12">
<h4 class="page-header">Description</h4>
<t t-out="order.description" />
<t t-out="fsm_order.description" />
<br />
</div>
</div>
</t>
</div>
<h4 class="page-header">History</h4>
<t t-call="portal.message_thread">
<t t-set="object" t-value="order" />
<t t-set="object" t-value="fsm_order" />
</t>
</t>
</t>
Expand Down

0 comments on commit 12899b1

Please sign in to comment.