[IMP] {sale_}project{_mrp}: improve some generic UX of project app.
Purpose: - Improve some generic UX of project app. Specification: - make milestone field option hide in task tree view. - set default 'Tasks' to label_tasks field on creation when label_tasks field is empty. - order stat buttons of project update right side panel according to user usage. - hide project field for list, calendar, graph and activity view of act_project_project_2_project_task_all action. - archive task ratings template when ratings is disabled and unarchive that template when its not. task-3083855 closes odoo/odoo#107467 Related: odoo/enterprise#34778 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
committed by
Xavier Bol (xbo)
parent
d689f6083f
commit
6e03d2bd26
@@ -29,6 +29,7 @@
|
||||
<record id="rating_project_request_email_template" model="mail.template">
|
||||
<field name="name">Project: Task Rating Request</field>
|
||||
<field name="model_id" ref="project.model_project_task"/>
|
||||
<field name="active" eval="False"/>
|
||||
<field name="subject">{{ object.project_id.company_id.name }}: Satisfaction Survey</field>
|
||||
<field name="email_from">{{ (object._rating_get_operator().email_formatted if object._rating_get_operator() else user.email_formatted) }}</field>
|
||||
<field name="partner_to" >{{ object._rating_get_partner().id }}</field>
|
||||
|
||||
@@ -405,6 +405,11 @@ class Project(models.Model):
|
||||
def create(self, vals_list):
|
||||
# Prevent double project creation
|
||||
self = self.with_context(mail_create_nosubscribe=True)
|
||||
if any('label_tasks' in vals and not vals['label_tasks'] for vals in vals_list):
|
||||
task_label = _("Tasks")
|
||||
for vals in vals_list:
|
||||
if 'label_tasks' in vals and not vals['label_tasks']:
|
||||
vals['label_tasks'] = task_label
|
||||
projects = super().create(vals_list)
|
||||
return projects
|
||||
|
||||
@@ -731,7 +736,7 @@ class Project(models.Model):
|
||||
'active_id': self.id,
|
||||
}),
|
||||
'show': True,
|
||||
'sequence': 3,
|
||||
'sequence': 1,
|
||||
}]
|
||||
if self.rating_count != 0 and self.user_has_groups('project.group_project_rating'):
|
||||
if self.rating_avg >= rating_data.RATING_AVG_TOP:
|
||||
|
||||
@@ -66,5 +66,9 @@ class ResConfigSettings(models.TransientModel):
|
||||
project_stage_change_mail_type = self.env.ref('project.mt_project_stage_change')
|
||||
if project_stage_change_mail_type.hidden == self['group_project_stages']:
|
||||
project_stage_change_mail_type.hidden = not self['group_project_stages']
|
||||
# Hide task rating tempalate when customer rating is disbled
|
||||
rating_project_request_email_template = self.env.ref('project.rating_project_request_email_template')
|
||||
if rating_project_request_email_template.active != self['group_project_rating']:
|
||||
rating_project_request_email_template.active = self['group_project_rating']
|
||||
|
||||
super().set_values()
|
||||
|
||||
@@ -689,7 +689,7 @@
|
||||
js_class="project_calendar"
|
||||
scales="month,year">
|
||||
<field name="allow_milestones" invisible="1" />
|
||||
<field name="project_id" widget="project_private_task"/>
|
||||
<field name="project_id" widget="project_private_task" invisible="context.get('default_project_id', False)"/>
|
||||
<field name="milestone_id" attrs="{'invisible': ['|', ('allow_milestones', '=', False), ('milestone_id', '=', False)]}"/>
|
||||
<field name="user_ids" widget="many2many_avatar_user" attrs="{'invisible': [('user_ids', '=', [])]}"/>
|
||||
<field name="partner_id" attrs="{'invisible': [('partner_id', '=', False)]}"/>
|
||||
@@ -722,7 +722,7 @@
|
||||
<field name="model">project.task</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Tasks" sample="1" js_class="project_graph">
|
||||
<field name="project_id"/>
|
||||
<field name="project_id" invisible="context.get('default_project_id', False)"/>
|
||||
<field name="stage_id"/>
|
||||
<field name="color" invisible="1"/>
|
||||
<field name="sequence" invisible="1"/>
|
||||
@@ -745,7 +745,7 @@
|
||||
<span t-att-title="record.name.value">
|
||||
<field name="name" display="full" class="text-truncate"/>
|
||||
</span>
|
||||
<span t-att-title="record.project_id.value">
|
||||
<span t-att-title="record.project_id.value" invisible="context.get('default_project_id', False)">
|
||||
<field t-if="record.project_id.value" name="project_id" muted="1" display="full"/>
|
||||
<span t-elif="record.is_private.value" class="fst-italic text-muted"><i class="fa fa-lock"></i> Private</span>
|
||||
</span>
|
||||
|
||||
@@ -95,6 +95,6 @@ class Project(models.Model):
|
||||
'action_type': 'object',
|
||||
'action': 'action_view_mrp_bom',
|
||||
'show': self.bom_count > 0,
|
||||
'sequence': 45,
|
||||
'sequence': 35,
|
||||
}])
|
||||
return buttons
|
||||
|
||||
@@ -513,7 +513,7 @@ class Project(models.Model):
|
||||
'action_type': 'object',
|
||||
'action': 'action_view_sos',
|
||||
'show': self.sale_order_count > 0,
|
||||
'sequence': 1,
|
||||
'sequence': 27,
|
||||
})
|
||||
if self.user_has_groups('account.group_account_readonly'):
|
||||
buttons.append({
|
||||
@@ -533,7 +533,7 @@ class Project(models.Model):
|
||||
'action_type': 'object',
|
||||
'action': 'action_open_project_vendor_bills',
|
||||
'show': self.vendor_bill_count > 0,
|
||||
'sequence': 48,
|
||||
'sequence': 38,
|
||||
})
|
||||
return buttons
|
||||
|
||||
|
||||
Reference in New Issue
Block a user