Compare commits
2 Commits
18.0-dev-p
...
18.0-proje
| Author | SHA1 | Date | |
|---|---|---|---|
| c77500bfab | |||
| d63a269de2 |
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "project_average_acceptable_time",
|
||||
"version": "18.0.1.1.0",
|
||||
"version": "18.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://git.elabore.coop/elabore/project-tools",
|
||||
"maintainer": "Clément Thomas",
|
||||
|
||||
@@ -17,12 +17,9 @@ class CustomCustomerPortal(CustomerPortal):
|
||||
if post and request.httprequest.method == "POST":
|
||||
error, error_message = self.details_form_validate(post)
|
||||
if not error:
|
||||
# sudo: a portal user has no write access at all on
|
||||
# project.project, and no read access on its default project
|
||||
# unless it follows it
|
||||
project_sudo = request.env.user.sudo().default_project_id
|
||||
if project_sudo and post.get("average_acceptable_time"):
|
||||
project_sudo.average_acceptable_time = post[
|
||||
user = request.env.user
|
||||
if user.default_project_id and post["average_acceptable_time"]:
|
||||
user.default_project_id.average_acceptable_time = post[
|
||||
"average_acceptable_time"
|
||||
]
|
||||
|
||||
|
||||
@@ -8,19 +8,11 @@
|
||||
priority="40"
|
||||
>
|
||||
<xpath expr="//div[@class='o_portal_my_details']" position="inside">
|
||||
<!-- sudo: a portal user cannot read its own default project
|
||||
unless it follows it (project.project_project_rule_portal) -->
|
||||
<t
|
||||
t-set="default_project_sudo"
|
||||
t-value="user_id.sudo().default_project_id"
|
||||
<hr class="mt-1 mb-0" />
|
||||
<b>Average acceptable time</b>: <t
|
||||
t-esc="user_id.default_project_id.average_acceptable_time"
|
||||
t-options="{'widget': 'float_time'}"
|
||||
/>
|
||||
<t t-if="default_project_sudo">
|
||||
<hr class="mt-1 mb-0" />
|
||||
<b>Average acceptable time</b>: <t
|
||||
t-esc="default_project_sudo.average_acceptable_time"
|
||||
t-options="{'widget': 'float_time'}"
|
||||
/>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
@@ -42,7 +34,7 @@
|
||||
type="text"
|
||||
name="average_acceptable_time"
|
||||
t-attf-class="form-control #{error.get('average_acceptable_time') and 'is-invalid' or ''}"
|
||||
t-att-value="average_acceptable_time or user_id.sudo().default_project_id.average_acceptable_time"
|
||||
t-att-value="average_acceptable_time or user_id.default_project_id.average_acceptable_time"
|
||||
t-options="{'widget': 'float_time'}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
# views/hr_timesheet_portal.xml",
|
||||
"views/hr_timesheet_view_task_form2.xml",
|
||||
"views/portal_tasks_list.xml",
|
||||
"views/portal_my_task_with_subtasks.xml"
|
||||
],
|
||||
"assets": {
|
||||
"web.assets_frontend": [
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="hr_timesheet_portal_timesheet_table_inherit"
|
||||
inherit_id="hr_timesheet.portal_timesheet_table">
|
||||
<xpath expr="//table[hasclass('o_portal_my_doc_table')]" position="after">
|
||||
<t t-foreach="task.child_ids" t-as="subtask">
|
||||
<t t-if="subtask.billable_effective_hours > 0">
|
||||
<a t-attf-href="/my/tasks/#{subtask.id}">
|
||||
<span t-att-title="subtask.name" t-field="subtask.name" />
|
||||
</a>
|
||||
|
||||
<t t-set="timesheets" t-value="subtask.timesheet_ids" />
|
||||
|
||||
<table class="o_portal_my_doc_table table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Employee</th>
|
||||
<th>Description</th>
|
||||
<th class="text-end" name="t_label">Time Spent</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr t-foreach="timesheets" t-as="timesheet" valign="middle">
|
||||
<td>
|
||||
<t t-esc="timesheet.date" t-options='{"widget": "date"}' />
|
||||
</td>
|
||||
<td t-attf-title="#{timesheet.employee_id.name}">
|
||||
<t t-esc="timesheet.employee_id.name" />
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="timesheet.name" />
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<span t-if="is_uom_day" t-esc="timesheet._get_timesheet_time_day()"
|
||||
t-options='{"widget": "timesheet_uom"}' />
|
||||
<span t-else="" t-field="timesheet.unit_amount"
|
||||
t-options='{"widget": "float_time"}' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user