projectal.entities.project

 1from projectal.entity import Entity
 2from projectal.linkers import *
 3from projectal import api
 4
 5
 6class Project(Entity,  LocationLinker, CustomerLinker, FileLinker, StageLinker,
 7              RebateLinker, StageListLinker, CompanyLinker, NoteLinker, TagLinker,
 8              TaskInProjectLinker):
 9    """
10    Implementation of the [Project](https://projectal.com/docs/latest/#tag/Project) API.
11    """
12    _path = 'project'
13    _name = 'project'
14    _links = [LocationLinker, CustomerLinker, FileLinker, StageLinker,
15              RebateLinker, StageListLinker, NoteLinker, TagLinker,
16              TaskInProjectLinker]
17    _links_reverse = [CompanyLinker]
18
19    @classmethod
20    def stage_order(cls, uuId, stages):
21        """Reorder the Project's Stage links in a customer order."""
22        url = '/api/project/stage_list/order?holder={}'.format(uuId)
23        api.post(url, stages)
24        return True
25
26    @classmethod
27    def autoschedule(cls, project, mode='ASAP'):
28        """
29        Autoschedule the project.
30
31        `project`: A Project entity
32
33        `mode`: `ASAP` or `ALAP`
34        """
35        url = '/api/project/schedule?mode={}'.format(mode)
36        api.post(url, [project])
37        return True
38
39    def tasks(self):
40        """Get a list of uuIds of all tasks in this Project."""
41        payload = {
42            "name": "Task in project",
43            "type": "msql",
44            "start": 0,
45            "limit": -1,
46            "holder": "{}".format(self['uuId']),
47            "select": [
48                [
49                    "PROJECT.TASK.uuId"
50                ]
51            ],
52        }
53        return [t[0] for t in api.query(payload)]
 7class Project(Entity,  LocationLinker, CustomerLinker, FileLinker, StageLinker,
 8              RebateLinker, StageListLinker, CompanyLinker, NoteLinker, TagLinker,
 9              TaskInProjectLinker):
10    """
11    Implementation of the [Project](https://projectal.com/docs/latest/#tag/Project) API.
12    """
13    _path = 'project'
14    _name = 'project'
15    _links = [LocationLinker, CustomerLinker, FileLinker, StageLinker,
16              RebateLinker, StageListLinker, NoteLinker, TagLinker,
17              TaskInProjectLinker]
18    _links_reverse = [CompanyLinker]
19
20    @classmethod
21    def stage_order(cls, uuId, stages):
22        """Reorder the Project's Stage links in a customer order."""
23        url = '/api/project/stage_list/order?holder={}'.format(uuId)
24        api.post(url, stages)
25        return True
26
27    @classmethod
28    def autoschedule(cls, project, mode='ASAP'):
29        """
30        Autoschedule the project.
31
32        `project`: A Project entity
33
34        `mode`: `ASAP` or `ALAP`
35        """
36        url = '/api/project/schedule?mode={}'.format(mode)
37        api.post(url, [project])
38        return True
39
40    def tasks(self):
41        """Get a list of uuIds of all tasks in this Project."""
42        payload = {
43            "name": "Task in project",
44            "type": "msql",
45            "start": 0,
46            "limit": -1,
47            "holder": "{}".format(self['uuId']),
48            "select": [
49                [
50                    "PROJECT.TASK.uuId"
51                ]
52            ],
53        }
54        return [t[0] for t in api.query(payload)]

Implementation of the Project API.

@classmethod
def stage_order(cls, uuId, stages):
20    @classmethod
21    def stage_order(cls, uuId, stages):
22        """Reorder the Project's Stage links in a customer order."""
23        url = '/api/project/stage_list/order?holder={}'.format(uuId)
24        api.post(url, stages)
25        return True

Reorder the Project's Stage links in a customer order.

@classmethod
def autoschedule(cls, project, mode='ASAP'):
27    @classmethod
28    def autoschedule(cls, project, mode='ASAP'):
29        """
30        Autoschedule the project.
31
32        `project`: A Project entity
33
34        `mode`: `ASAP` or `ALAP`
35        """
36        url = '/api/project/schedule?mode={}'.format(mode)
37        api.post(url, [project])
38        return True

Autoschedule the project.

project: A Project entity

mode: ASAP or ALAP

def tasks(self):
40    def tasks(self):
41        """Get a list of uuIds of all tasks in this Project."""
42        payload = {
43            "name": "Task in project",
44            "type": "msql",
45            "start": 0,
46            "limit": -1,
47            "holder": "{}".format(self['uuId']),
48            "select": [
49                [
50                    "PROJECT.TASK.uuId"
51                ]
52            ],
53        }
54        return [t[0] for t in api.query(payload)]

Get a list of uuIds of all tasks in this Project.