File: test_todo_ui.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (61 lines) | stat: -rw-r--r-- 2,684 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import Command
from odoo.tests import HttpCase, tagged, users


@tagged('post_install', '-at_install')
class TestTodoUi(HttpCase):

    @users('admin')
    def test_tour_project_task_activities_split(self):
        """ Activities linked to project.task records can appear either in the
            'Task', either in the 'To-Do' category, depending on wether they are
            linked to a project or not. This test ensures that:
                - activities linked to records with no project_id set and no
                  parent are listed in the 'To-Do' category
                - activities linked to records with either project_id set or
                  linked to a parent task are listed in the 'Task' category
        """
        self.env.user.tz = "UTC"
        project = self.env['project.project'].create([{'name': 'Test project'}])
        stage = self.env['project.task.type'].create([{
            'name': 'Test Stage',
            'project_ids': project.ids,
        }])
        private_task, task = self.env['project.task'].create([{
            'name': 'New To-Do!',
            'project_id': False,
        }, {
            'name': 'New Task!',
            'project_id': project.id,
            'stage_id': stage.id,
            'child_ids': [
                Command.create({
                    'name': 'New Sub-Task!',
                    'project_id': project.id,
                    'display_in_project': False,
                }),
            ]
        }])

        subtask = task.child_ids
        task.activity_schedule(act_type_xmlid='mail.mail_activity_data_todo')
        subtask.activity_schedule(act_type_xmlid='mail.mail_activity_data_todo')
        private_task.activity_schedule(act_type_xmlid='mail.mail_activity_data_todo')

        # Ensure that all activities appear in the systray under the good category
        # name and that clicking on this category opens the correct view where only
        # records of this category are listed.
        self.start_tour("/odoo", 'project_task_activities_split', login="admin")

    def test_tour_todo_main_ui_functions(self):
        """ This test ensure that the main ui functionalities are working including:
        - Create a personal stage from the kanban view
        - Moving a personal stage in the kanban view
        - Create a personal task from the kanban view
        - Opening the form view of a task from the kanban view
        - Mark a task as done from the todo form view
        - Convert a todo to a task
        """
        self.start_tour("/odoo", 'project_todo_main_functions', login='admin')