[IMP] project,web: generic improvement for project revamp

Purpose of the commit is to do the generic improvement for the
refactoring of project.

So in this commit, done the following changes:
 - move the date_deadline and the tag_ids field to the right column
 - remove the warning 'by saving this change, the customer email and phone
number will also be updated.'
 - track the priority field on task
 - move the deadline field above the fa-star and fa-clock-o icons
 - the name of archived tasks should be crossed out
 - project form add a 'deadline' field below the user_id one
 - project form remove the 'description' notebook
 - remove the 'project' field from the quickcreate of task.

Related Ent PR: odoo/enterprise#16559
TaskID: 2451287
This commit is contained in:
Barad Mahendra
2021-03-22 08:41:04 +00:00
parent 2133b807a8
commit a6ae6d8217
2 changed files with 17 additions and 31 deletions
+1 -17
View File
@@ -571,7 +571,7 @@ class Task(models.Model):
priority = fields.Selection([
('0', 'Normal'),
('1', 'Important'),
], default='0', index=True, string="Starred")
], default='0', index=True, string="Starred", tracking=True)
sequence = fields.Integer(string='Sequence', index=True, default=10,
help="Gives the sequence order when displaying a list of tasks.")
stage_id = fields.Many2one('project.task.type', string='Stage', compute='_compute_stage_id',
@@ -616,7 +616,6 @@ class Task(models.Model):
partner_phone = fields.Char(
compute='_compute_partner_phone', inverse='_inverse_partner_phone',
string="Phone", readonly=False, store=True, copy=False)
ribbon_message = fields.Char('Ribbon Message', compute='_compute_ribbon_message')
partner_city = fields.Char(related='partner_id.city', readonly=False)
manager_id = fields.Many2one('res.users', string='Project Manager', related='project_id.user_id', readonly=True)
company_id = fields.Many2one(
@@ -841,21 +840,6 @@ class Task(models.Model):
if task.partner_id and task.partner_phone != task.partner_id.phone:
task.partner_id.phone = task.partner_phone
@api.depends('partner_email', 'partner_phone', 'partner_id')
def _compute_ribbon_message(self):
for task in self:
will_write_email = task.partner_id and task.partner_email != task.partner_id.email
will_write_phone = task.partner_id and task.partner_phone != task.partner_id.phone
if will_write_email and will_write_phone:
task.ribbon_message = _('By saving this change, the customer email and phone number will also be updated.')
elif will_write_email:
task.ribbon_message = _('By saving this change, the customer email will also be updated.')
elif will_write_phone:
task.ribbon_message = _('By saving this change, the customer phone number will also be updated.')
else:
task.ribbon_message = False
@api.constrains('parent_id')
def _check_parent_id(self):
if not self._check_recursion():
+16 -14
View File
@@ -284,14 +284,12 @@
</group>
</group>
<notebook>
<page name="description_page" string="Description">
<field name="description" nolabel="1" placeholder="Describe your project..." type="html"/>
</page>
<page name="settings" string="Settings">
<group>
<group>
<field name="active" invisible="1"/>
<field name="user_id" string="Project Manager" widget="many2one_avatar_user" attrs="{'readonly':[('active','=',False)]}" domain="[('share', '=', False)]"/>
<field name="date" string="Deadline"/>
<div name="alias_def" colspan="2" attrs="{'invisible': [('alias_domain', '=', False)]}">
<!-- Always display the whole alias in edit mode. It depends in read only -->
<label for="alias_enabled" class="font-weight-bold" string="Create tasks by sending an email"/>
@@ -533,6 +531,7 @@
<field name="rating_status"/>
<field name="rating_active" />
<field name="analytic_account_id"/>
<field name="date"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="#{kanban_color(record.color.raw_value)} oe_kanban_global_click o_has_icon">
@@ -544,11 +543,14 @@
<span class="o_text_overflow" t-if="record.partner_id.value">
<strong><t t-esc="record.partner_id.value"/></strong>
</span>
<div t-if="record.date.raw_value">
<field name="date" widget="remaining_days"/>
</div>
</div>
<div t-if="record.alias_name.value and record.alias_domain.value">
<span><i class="fa fa-envelope" role="img" aria-label="Domain Alias" title="Domain Alias"></i> <a t-att-href="'mailto:' + record.alias_id.value" title="Send an email"><t t-esc="record.alias_id.value"/></a></span>
</div>
<div t-if="record.rating_active.raw_value" class="mt8 text-primary" title="Percentage of happy ratings over the past 30 days." groups="project.group_project_rating">
<div t-if="record.rating_active.raw_value" class="text-primary" title="Percentage of happy ratings over the past 30 days." groups="project.group_project_rating">
<b>
<a name="action_view_all_rating" type="object" context="{'search_default_rating_last_30_days':1}">
<t t-if="record.rating_percentage_satisfaction.value != -1">
@@ -652,9 +654,6 @@
attrs="{'invisible' : [('user_id', '!=', False)]}"/>
<field name="stage_id" widget="statusbar" options="{'clickable': '1', 'fold_field': 'fold'}" attrs="{'invisible': [('project_id', '=', False)]}"/>
</header>
<div class="text-center alert alert-primary" role="alert" attrs="{'invisible': ['|', ('ribbon_message', '=', False), ('ribbon_message', '=', '')]}">
<field name="ribbon_message"/>
</div>
<div class="alert alert-info oe_edit_only" role="status" attrs="{'invisible': ['|', ('recurring_task', '=', False), ('recurrence_id', '=', False)]}">
<p>Edit recurring task</p>
<field name="recurrence_update" widget="radio"/>
@@ -699,14 +698,14 @@
domain="[('parent_id', '=', False)]"
attrs="{'invisible' : [('allow_subtasks', '=', False)]}"
/>
<field name="date_deadline" attrs="{'invisible': [('is_closed', '=', True)]}"/>
<field name="recurring_task" attrs="{'invisible': [('allow_recurring_tasks', '=', False)]}" />
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
</group>
<group>
<field name="active" invisible="1"/>
<field name="partner_id" widget="res_partner_many2one" class="o_task_customer_field"/>
<field name="partner_phone" widget="phone" attrs="{'invisible': True}"/>
<field name="date_deadline" attrs="{'invisible': [('is_closed', '=', True)]}"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
<field name="legend_blocked" invisible="1"/>
<field name="legend_normal" invisible="1"/>
<field name="legend_done" invisible="1"/>
@@ -825,7 +824,6 @@
<group>
<field name="name" string = "Task Title"/>
<field name="user_id" options="{'no_open': True,'no_create': True}" domain="[('share', '=', False)]"/>
<field name="project_id" required="1" invisible="context.get('all_task', 1)"/>
<field name="company_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
</group>
@@ -856,6 +854,7 @@
<field name="activity_state"/>
<field name="rating_last_value"/>
<field name="rating_ids"/>
<field name="active"/>
<progressbar field="kanban_state" colors='{"done": "success", "blocked": "danger", "normal": "muted"}'/>
<templates>
<t t-name="kanban-box">
@@ -863,7 +862,10 @@
<div class="oe_kanban_content">
<div class="o_kanban_record_top">
<div class="o_kanban_record_headings">
<strong class="o_kanban_record_title"><field name="name"/></strong>
<strong class="o_kanban_record_title">
<s t-if="!record.active.raw_value"><field name="name"/></s>
<t t-else=""><field name="name"/></t>
</strong>
<span invisible="context.get('default_project_id', False) or context.get('fsm_mode', False)"><br/><field name="project_id" required="1"/></span>
<br />
<t t-if="record.partner_id.value">
@@ -896,6 +898,9 @@
</div>
<div class="o_kanban_record_body">
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" invisible="context.get('fsm_mode', False)"/>
<div t-if="record.date_deadline.raw_value" name="date_deadline" attrs="{'invisible': [('is_closed', '=', True)]}">
<field name="date_deadline" widget="remaining_days"/>
</div>
<div t-if="record.displayed_image_id.value">
<field name="displayed_image_id" widget="attachment_image"/>
</div>
@@ -909,9 +914,6 @@
<span style="font-weight:bold;" class="fa fa-fw mt4 fa-meh-o text-warning" t-if="record.rating_last_value.value == 3" title="Latest Rating: Not Satisfied" role="img" aria-label="Neutral face"/>
<span style="font-weight:bold;" class="fa fa-fw mt4 fa-frown-o text-danger" t-if="record.rating_last_value.value == 1" title="Latest Rating: Higly Dissatisfied" role="img" aria-label="Sad face"/>
</b>
<div name="date_deadline" attrs="{'invisible': [('is_closed', '=', True)]}">
<field name="date_deadline" widget="remaining_days"/>
</div>
</div>
<div class="oe_kanban_bottom_right" t-if="!selection_mode">
<field name="kanban_state" widget="state_selection" groups="base.group_user" invisible="context.get('fsm_mode', False)"/>