[IMP] sale_order: name and description of generated task
We want to split the sale order line description as follow: - first line will be the title of the task, prefixed by SO reference - the rest of SO line description should be the task description The purpose is to avoid duplicating the first SO line description in task title and description. Task #1831934
This commit is contained in:
@@ -236,13 +236,16 @@ class SaleOrderLine(models.Model):
|
||||
def _timesheet_create_task_prepare_values(self, project):
|
||||
self.ensure_one()
|
||||
planned_hours = self._convert_qty_company_hours()
|
||||
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:])
|
||||
return {
|
||||
'name': '%s:%s' % (self.order_id.name or '', self.name.split('\n')[0] or self.product_id.name),
|
||||
'name': title if project.sale_line_id else '%s: %s' % (self.order_id.name or '', title),
|
||||
'planned_hours': planned_hours,
|
||||
'remaining_hours': planned_hours,
|
||||
'partner_id': self.order_id.partner_id.id,
|
||||
'email_from': self.order_id.partner_id.email,
|
||||
'description': self.name + '<br/>',
|
||||
'description': description,
|
||||
'project_id': project.id,
|
||||
'sale_line_id': self.id,
|
||||
'company_id': self.company_id.id,
|
||||
|
||||
@@ -44,8 +44,8 @@ class TestSaleService(TestCommonSaleTimesheetNoChart):
|
||||
|
||||
# check task creation
|
||||
project = self.project_global
|
||||
task = project.task_ids.filtered(lambda t: t.name == '%s:%s' % (self.sale_order.name, self.product_delivery_timesheet2.name))
|
||||
self.assertTrue(task, 'Sale Service: task is not created')
|
||||
task = project.task_ids.filtered(lambda t: t.name == '%s: %s' % (self.sale_order.name, self.product_delivery_timesheet2.name))
|
||||
self.assertTrue(task, 'Sale Service: task is not created, or it badly named')
|
||||
self.assertEqual(task.partner_id, self.sale_order.partner_id, 'Sale Service: customer should be the same on task and on SO')
|
||||
self.assertEqual(task.email_from, self.sale_order.partner_id.email, 'Sale Service: Task Email should be the same as the SO customer Email')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user