[IMP] project,sale_timesheet: generic UX improvement for project

Purpose of this commit to improve generic usage of project
app.

So, in this commit done following changes:
  - change the placeholder of the name to 'e.g. Monthly review' in
    project_update_view_form
  - set the 'analytic account' of the project on the tasks by default
  - change the placeholder to 'e.g. Product Launch' in project_milestone_view_form
  - the 'cabinets' milestone should be linked to a milestone service,
    not a manual one so change data to milestone in demo data
  - rename the 'rating' stat button into 'last rating' in view_task_form2
  - set another employee than Mitchell for the 'customer care (prepaid hours)'
    SOL field in sale_service_demo_data
  - display a separator on the right of the stat button so remove unwanted
    properties in project_rightpanel.scss
  - add the 'name' field to the 'fields to export' when 'i want to update data'
    is set to true
  - remove the 'Getting Things Done (GTD)' example from kanban examples wizard
  - add a 'tasks due today' filter that should return tasks whose deadline falls on
    today's date in view_task_search_form

task-2809188

closes odoo/odoo#88271

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Rohitkumar (roku)
2022-05-19 18:06:09 +02:00
parent 0f2bea1e88
commit 4a8f31e25f
6 changed files with 23 additions and 14 deletions
+15 -2
View File
@@ -227,7 +227,7 @@ class Project(models.Model):
def _read_group_stage_ids(self, stages, domain, order):
return self.env['project.project.stage'].search([], order=order)
name = fields.Char("Name", index='trigram', required=True, tracking=True, translate=True)
name = fields.Char("Name", index='trigram', required=True, tracking=True, translate=True, default_export_compatible=True)
description = fields.Html()
active = fields.Boolean(default=True,
help="If the active field is set to False, it will allow you to hide the project without removing it.")
@@ -1187,11 +1187,12 @@ class Task(models.Model):
repeat_show_month = fields.Boolean(compute='_compute_repeat_visibility')
# Account analytic
analytic_account_id = fields.Many2one('account.analytic.account', ondelete='set null',
analytic_account_id = fields.Many2one('account.analytic.account', ondelete='set null', compute='_compute_analytic_account_id', store=True, readonly=False,
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", check_company=True,
help="Analytic account to which this task is linked for financial management. "
"Use an analytic account to record cost and revenue on your task. "
"If empty, the analytic account of the project will be used.")
is_analytic_account_id_changed = fields.Boolean('Is Analytic Account Manually Changed', compute='_compute_is_analytic_account_id_changed', store=True)
project_analytic_account_id = fields.Many2one('account.analytic.account', string='Project Analytic Account', related='project_id.analytic_account_id')
analytic_tag_ids = fields.Many2many('account.analytic.tag', string="Analytic Tags",
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", check_company=True)
@@ -1204,6 +1205,18 @@ class Task(models.Model):
def SELF_WRITABLE_FIELDS(self):
return PROJECT_TASK_WRITABLE_FIELDS
@api.depends('project_id.analytic_account_id')
def _compute_analytic_account_id(self):
self.env.remove_to_compute(self._fields['is_analytic_account_id_changed'], self)
for task in self:
if not task.is_analytic_account_id_changed:
task.analytic_account_id = task.project_id.analytic_account_id
@api.depends('analytic_account_id')
def _compute_is_analytic_account_id_changed(self):
for task in self:
task.is_analytic_account_id_changed = task.project_id and task.analytic_account_id != task.project_id.analytic_account_id
@api.depends('project_id', 'parent_id')
def _compute_is_private(self):
# Modify accordingly, this field is used to display the lock on the task's kanban card
@@ -66,12 +66,6 @@ kanbanExamplesRegistry.add('project', {
'automatically, and you can communicate on the task directly. Your managers decide which ' +
'feedback is accepted %s and which feedback is moved to the %s column. %s'), greenBullet, _lt('"Refused"'), descriptionActivities),
bullets: [greenBullet, redBullet],
}, {
name: _lt('Getting Things Done (GTD)'),
columns: [_lt('Inbox'), _lt('Today'), _lt('This Week'), _lt('This Month'), _lt('Long Term')],
description: escFormat(_lt('Fill your Inbox easily with the email gateway. Periodically review your ' +
'Inbox and schedule tasks by moving them to other columns. Every day, you review the ' +
'%s column to move important tasks %s. Every Monday, you review the %s column. %s'), _lt('"This Week"'), _lt('"Today"'), _lt('"This Month"'), descriptionActivities),
}, {
name: _lt('Consulting'),
columns: [_lt('New Projects'), _lt('Resources Allocation'), _lt('In Progress'), _lt('Done')],
@@ -186,7 +186,7 @@ html .o_web_client > .o_action_manager > .o_action > .o_content > .o_controller_
margin-left: -1px;
height: 57.5px;
&:nth-child(3n){
&:nth-child(3n):not(:last-child){
border-right-width: 0px;
}
@@ -19,7 +19,7 @@
<sheet>
<div class="oe_title">
<h1>
<field name="name" class="o_text_overflow" placeholder="Title of the Update"/>
<field name="name" class="o_text_overflow" placeholder="e.g. Monthly review"/>
</h1>
</div>
<group>
@@ -128,7 +128,7 @@
<group>
<group name="main_details">
<field name="project_id" invisible="1"/>
<field name="name" placeholder="E.g: Product Launch"/>
<field name="name" placeholder="e.g. Product Launch"/>
<field name="deadline"/>
<field name="is_reached"/>
</group>
+3 -1
View File
@@ -34,6 +34,7 @@
<filter string="Open" name="open_tasks" domain="[('is_closed', '=', False)]"/>
<filter string="Closed" name="closed_tasks" domain="[('is_closed', '!=', False)]"/>
<separator/>
<filter string="Tasks Due Today" name="tasks_due_today" domain="[('date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter string="Late Tasks" name="late" domain="[('date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"/>
<separator/>
<filter name="rating_satisfied" string="Satisfied" domain="[('rating_avg', '&gt;=', 3.66)]" groups="project.group_project_rating"/>
@@ -1002,7 +1003,7 @@
<i class="fa fa-fw o_button_icon fa-frown-o text-danger" attrs="{'invisible': [('rating_avg', '&gt;=', 2.33)]}" title="Dissatisfied"/>
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="rating_avg_text" nolabel="1"/></span>
<span class="o_stat_text">Rating</span>
<span class="o_stat_text">Last Rating</span>
</div>
</button>
<!-- Dummy tag used to organize buttons -->
@@ -1159,6 +1160,7 @@
<page name="extra_info" string="Extra Info" groups="base.group_no_one">
<group>
<group>
<field name="is_analytic_account_id_changed" invisible="1"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" context="{'default_partner_id': partner_id}"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
<field name="parent_id" attrs="{'invisible': [('allow_subtasks', '=', False)]}" groups="base.group_no_one"/>
@@ -262,7 +262,7 @@
<field name="name">Cabinets</field>
<field name="project_id" search="[('sale_line_id', '=', ref('sale_line_13'))]"/>
<field name="is_reached">True</field>
<field name="sale_line_id" ref="sale_line_18"/>
<field name="sale_line_id" ref="sale_line_12"/>
<field name="quantity_percentage">0.25</field>
</record>
@@ -433,7 +433,7 @@
<value model="project.project" search="[('sale_line_id', '=', ref('sale_line_13'))]"/>
<value eval="{'sale_line_employee_ids': [
Command.create({
'employee_id': ref('hr.employee_admin'),
'employee_id': ref('hr.employee_mit'),
'sale_line_id': ref('sale_line_11'),
'cost': 220,
}),