Beispiel #1
0
    def index(self):
        context = dict()

        context["main_nav_about_active"] = True
        context["login_redirect"] = "/about"

        return odootask_qweb_render.render("odootask.about", context=context)
Beispiel #2
0
 def new_task(self, **kwargs):
     if request.httprequest.method == 'GET':
         try:
             task_categories = request.env["odootask.task_category"].search(
                 [])
             context = dict()
             context["task_categories"] = task_categories
             return odootask_qweb_render.render("odootask.task_new",
                                                context=context)
         except Exception as ex:
             pass
             # TODO Error handler
     elif request.httprequest.method == 'POST':
         name = kwargs.get("name", "")
         description = kwargs.get("description", "")
         category_id = kwargs.get("category_id", "")
         values = dict()
         values["name"] = name
         values["description"] = description
         if category_id:
             values["category_id"] = int(category_id)
         request.env["odootask.task"].create(values)
         return "create ok"
     else:
         return "only GET POST is available!"
Beispiel #3
0
    def index(self, **kwargs):
        context = dict()

        context["main_nav_team_active"] = True
        context["login_redirect"] = "/teams"

        return odootask_qweb_render.render("odootask.teams", context=context)
Beispiel #4
0
    def index(self, **kwargs):
        para_keyword = kwargs.get("k", "")
        para_category_id = kwargs.get("c", "")
        para_order = kwargs.get("o", "create_date")
        para_page = kwargs.get("p", "0")
        para_qty_per_page = kwargs.get("n", "10")

        domain = list()
        if para_keyword:
            domain.append(("name", "ilike", para_keyword))
        if para_category_id:
            domain.append(("category_id", "=", int(para_category_id)))

        env = request.env

        page_count = int(math.ceil(env["odootask.task"].sudo().search_count(domain) / float(para_qty_per_page)))

        page = int(para_page)
        qty_per_page = int(para_qty_per_page)
        tasks = (
            env["odootask.task"]
            .sudo()
            .search(domain, order="%s desc" % para_order, offset=page * qty_per_page, limit=qty_per_page)
        )

        categories = env["odootask.task_category"].sudo().search([])
        count_for_category = [
            (
                (cat.name, cat.id),
                env["odootask.task"]
                .sudo()
                .search_count([("name", "ilike", para_keyword), ("category_id", "=", cat.id)]),
            )
            for cat in categories
        ]

        if para_keyword:
            count_for_category = filter(lambda cfc: cfc[1] > 0, count_for_category)
        count_for_category = dict(count_for_category)

        context = dict()
        context["tasks"] = tasks
        context["count_for_category"] = count_for_category

        context["category_id"] = para_category_id
        context["keyword"] = para_keyword
        context["page"] = para_page
        context["main_nav_task_active"] = True
        context["login_redirect"] = "/tasks"
        context["page_count"] = page_count

        return odootask_qweb_render.render("odootask.tasks", context=context)
Beispiel #5
0
    def index(self, user_id=None):
        if not user_id:
            user = request.env.user
        else:
            user = request.env["res.users"].sudo().search([("id", "=", user_id)])

        context = dict()
        context["login_redirect"] = "/user"

        context["user"] = user
        context["is_myself"] = not user_id

        return odootask_qweb_render.render("odootask.user", context=context)
Beispiel #6
0
    def index(self, **kwargs):
        para_keyword = kwargs.get("k", "")
        para_category_id = kwargs.get("c", "")
        para_order = kwargs.get("o", "create_date")
        para_page = kwargs.get("p", "0")
        para_qty_per_page = kwargs.get("n", "10")

        domain = list()
        if para_keyword:
            domain.append(("name", "ilike", para_keyword))
        if para_category_id:
            domain.append(("category_id", "=", int(para_category_id)))

        env = request.env

        page_count = int(
            math.ceil(env['odootask.task'].sudo().search_count(domain) /
                      float(para_qty_per_page)))

        page = int(para_page)
        qty_per_page = int(para_qty_per_page)
        tasks = env['odootask.task'].sudo().search(domain,
                                                   order="%s desc" %
                                                   para_order,
                                                   offset=page * qty_per_page,
                                                   limit=qty_per_page)

        categories = env["odootask.task_category"].sudo().search([])
        count_for_category = [((cat.name, cat.id),
                               env['odootask.task'].sudo().search_count([
                                   ("name", "ilike", para_keyword),
                                   ("category_id", "=", cat.id)
                               ])) for cat in categories]

        if para_keyword:
            count_for_category = filter(lambda cfc: cfc[1] > 0,
                                        count_for_category)
        count_for_category = dict(count_for_category)

        context = dict()
        context["tasks"] = tasks
        context["count_for_category"] = count_for_category

        context["category_id"] = para_category_id
        context["keyword"] = para_keyword
        context["page"] = para_page
        context["main_nav_task_active"] = True
        context["login_redirect"] = "/tasks"
        context["page_count"] = page_count

        return odootask_qweb_render.render("odootask.tasks", context=context)
Beispiel #7
0
    def index(self, user_id=None):
        if not user_id:
            user = request.env.user
        else:
            user = request.env["res.users"].sudo().search([("id", "=", user_id)
                                                           ])

        context = dict()
        context["login_redirect"] = "/user"

        context["user"] = user
        context["is_myself"] = not user_id

        return odootask_qweb_render.render("odootask.user", context=context)
Beispiel #8
0
 def task(self, task_id=None, **kwargs):
     try:
         if not task_id:
             # TODO return 404
             pass
         env = request.env
         task = env["odootask.task"].sudo().search([("id", "=", task_id)])
         context = dict()
         context["task"] = task
         context["login_redirect"] = "/task/%d" % task_id
         context["ret_url"] = kwargs.get("ret_url")
         context["user_id"] = env.user.id
         return odootask_qweb_render.render("odootask.task", context=context)
     except Exception as e:
         pass
Beispiel #9
0
 def task(self, task_id=None, **kwargs):
     try:
         if not task_id:
             # TODO return 404
             pass
         env = request.env
         task = env['odootask.task'].sudo().search([("id", "=", task_id)])
         context = dict()
         context["task"] = task
         context["login_redirect"] = "/task/%d" % task_id
         context["ret_url"] = kwargs.get("ret_url")
         context["user_id"] = env.user.id
         return odootask_qweb_render.render("odootask.task",
                                            context=context)
     except Exception as e:
         pass
Beispiel #10
0
 def new_task(self, **kwargs):
     if request.httprequest.method == "GET":
         try:
             task_categories = request.env["odootask.task_category"].search([])
             context = dict()
             context["task_categories"] = task_categories
             return odootask_qweb_render.render("odootask.task_new", context=context)
         except Exception as ex:
             pass
             # TODO Error handler
     elif request.httprequest.method == "POST":
         name = kwargs.get("name", "")
         description = kwargs.get("description", "")
         category_id = kwargs.get("category_id", "")
         values = dict()
         values["name"] = name
         values["description"] = description
         if category_id:
             values["category_id"] = int(category_id)
         request.env["odootask.task"].create(values)
         return "create ok"
     else:
         return "only GET POST is available!"
Beispiel #11
0
 def statistic(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.statistic",
                                        context=context)
Beispiel #12
0
 def index_page(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.index", context=context)
Beispiel #13
0
 def search_page(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.search", context=context)
Beispiel #14
0
 def index(self):
     return odootask_qweb_render.render("odootask.index", context={"login_redirect": "/"})
Beispiel #15
0
 def index(self):
     return odootask_qweb_render.render("odootask.index",
                                        context={"login_redirect": "/"})
Beispiel #16
0
 def upload_page(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.upload", context=context)
Beispiel #17
0
 def detail_page(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.detail", context=context)
Beispiel #18
0
 def donator_page(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.donator", context=context)
Beispiel #19
0
 def category_detail(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.category_detail",
                                        context=context)
Beispiel #20
0
 def more_category(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.more_category",
                                        context=context)
Beispiel #21
0
 def pay_donate(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.pay_donate",
                                        context=context)
Beispiel #22
0
 def donate_search(self, **kwargs):
     context = dict()
     return odootask_qweb_render.render("odootask.donate_search",
                                        context=context)