[IMP] sale_(project,timesheet): improve generic UX
Purpose of this commit is to improve the generic UX of the project and
timesheet app.
So, in this commit improve the following:
- set allocated_hous 0 of task when task is created from SO and SOL product
invoice policy in either based on manual or based on milestone
- in project.update description improve the following points,
- hide the 'activities' heading if there is no activity to display.
- hide the 'profitability' sentence if there in no AAL in project's AA.
- rename the 'service on timesheet' product into 'service on timesheets'.
task-2924215
closes odoo/odoo#96298
Related: odoo/enterprise#29632
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
@@ -194,7 +194,9 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
def _timesheet_create_task_prepare_values(self, project):
|
||||
self.ensure_one()
|
||||
planned_hours = self._convert_qty_company_hours(self.company_id)
|
||||
planned_hours = 0.0
|
||||
if self.product_id.service_type not in ['milestones', 'manual']:
|
||||
planned_hours = self._convert_qty_company_hours(self.company_id)
|
||||
sale_line_name_parts = self.name.split('\n')
|
||||
title = sale_line_name_parts[0] or self.product_id.name
|
||||
description = '<br/>'.join(sale_line_name_parts[1:])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="time_product" model="product.product">
|
||||
<field name="name">Service on Timesheet</field>
|
||||
<field name="name">Service on Timesheets</field>
|
||||
<field name="type">service</field>
|
||||
<field name="list_price">40</field>
|
||||
<field name="uom_id" ref="uom.product_uom_hour"/>
|
||||
|
||||
@@ -14,12 +14,13 @@ class ProjectUpdate(models.Model):
|
||||
template_values = super(ProjectUpdate, self)._get_template_values(project)
|
||||
services = self._get_services_values(project)
|
||||
profitability = self._get_profitability_values(project)
|
||||
show_profitability = bool(profitability and profitability.get('analytic_account_id') and (profitability.get('costs') or profitability.get('revenues')))
|
||||
show_sold = template_values['project'].allow_billable and len(services.get('data', [])) > 0
|
||||
return {
|
||||
**template_values,
|
||||
'show_sold': show_sold,
|
||||
'show_profitability': bool(profitability),
|
||||
'show_activities': template_values['show_activities'] or show_sold or bool(profitability),
|
||||
'show_profitability': show_profitability,
|
||||
'show_activities': template_values['show_activities'] or show_profitability or show_sold,
|
||||
'services': services,
|
||||
'profitability': profitability,
|
||||
'format_value': lambda value, is_hour: str(round(value, 2)) if not is_hour else format_duration(value),
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<div name="profitability" t-if="show_profitability">
|
||||
<t t-if="project.analytic_account_id and project.allow_billable and user.has_group('project.group_project_manager')" name="costs">
|
||||
<h3 style="font-weight: bolder"><u>Profitability</u></h3>
|
||||
The cost of the project is now at <t t-esc="profitability['costs_formatted']"/>, for a revenue of <t t-esc="profitability['revenues_formatted']"/>, leading to a
|
||||
<t t-if="project.analytic_account_id.line_ids"> The cost of the project is now at <t t-esc="profitability['costs_formatted']"/>, for a revenue of <t t-esc="profitability['revenues_formatted']"/>, leading to a
|
||||
<span>
|
||||
<font t-if="profitability['margin'] > 0" style="color: rgb(0, 128, 0)">
|
||||
<b><t t-esc="profitability['margin_formatted']"/></b>
|
||||
@@ -46,6 +46,7 @@ The cost of the project is now at <t t-esc="profitability['costs_formatted']"/>,
|
||||
<t t-else="" t-esc="profitability['margin_formatted']"/>
|
||||
</span> margin (<t t-esc="profitability['margin_percentage']"/>%).
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user