Skip to Content
Menu
This question has been flagged
1 Reply
2596 Views

Hi, I want to move fieldservice link from project in the portal as show below for users who cannot access backend. 

To get here you go to Portal -> Project



I want to get the field service link above and place it on the same level as project -> (Portal -> Field Service).

My code is giving me a page not found error.

Here is the code:


@http.route("/my/projecting/project_sharing", type="http", auth="user", methods=['GET']) def render_project_backend_view(self, project_task_id): project = request.env
[
' project.project'].sudo().browse(project_task_id)
print('project_task_id', project)
if not project.exists() or not project.with_user( request.env.user)._check_project_sharing_access() :
return request.not_found ()

return request.render(
'portal_project_customizations.project_sharing_embed',
{'session_info': self._prepare_project_sharing_session_info(project)},
)

  
FieldService t>



Any assistance will be highly appreciated.


Avatar
Discard
Author

<xpath><t t-call="portal.portal_docs_entry">
<t t-set="title">FieldService </t>
<t t-set="url" t-value="'/my/projecting/{{ project_task_id }}/project_sharing'"/>
<t t-set="placeholder_count" t-value="'task_count'"/>
</ t>
</xpath>

Best Answer

Hello Jay,

As per your requirement, you need to inherit the "portal_my_home" template in your custom module

You didn't need to create a new controller for this, in odoo bases already created a controller for sharing projects, and you need to set a dynamic URL, as per I shared code below 

First, you need to get the field_service project id using the request.env.ref method then pass it into the URL. 

Please find code in comment. 

I hope this can help you.

Thanks & Regards,
Email:    odoo@aktivsoftware.com 

Skype: kalpeshmaheshwari

Avatar
Discard

Please find code here :-

Make sure that you have added the "industry_fsm" module dependency in your custom module

<template id="portal_my_home" name="Show Field Service" inherit_id="portal.portal_my_home">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Field Service</t>
<t t-set="url" t-value="'/my/projects/%s/project_sharing' % (request.env.ref('industry_fsm.fsm_project').id) " />
<t t-set="placeholder_count" t-value="'task_count'" />
</t>
</xpath>
</template>

Related Posts Replies Views Activity
1
Nov 20
5863
2
Dec 19
3448
1
Mar 18
6205
0
Mar 15
4234
1
Jun 25
512