projectal.entities.project

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

Implementation of the Project API.

@classmethod
def stage_order(cls, uuId, stages):
39    @classmethod
40    def stage_order(cls, uuId, stages):
41        """Reorder the Project's Stage links in a customer order."""
42        url = "/api/project/stage_list/order?holder={}".format(uuId)
43        api.post(url, stages)
44        return True

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

@classmethod
def autoschedule(cls, project, mode='ASAP'):
46    @classmethod
47    def autoschedule(cls, project, mode="ASAP"):
48        """
49        Autoschedule the project.
50
51        `project`: A Project entity
52
53        `mode`: `ASAP` or `ALAP`
54        """
55        url = "/api/project/schedule?mode={}".format(mode)
56        api.post(url, [project])
57        return True

Autoschedule the project.

project: A Project entity

mode: ASAP or ALAP

def tasks(self):
59    def tasks(self):
60        """Get a list of uuIds of all tasks in this Project."""
61        payload = {
62            "name": "Task in project",
63            "type": "msql",
64            "start": 0,
65            "limit": -1,
66            "holder": "{}".format(self["uuId"]),
67            "select": [["PROJECT.TASK.uuId"]],
68        }
69        return [t[0] for t in api.query(payload)]

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