Initial commit: OCA Workflow Process packages (456 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:00 +02:00
commit d366e42934
18799 changed files with 1284507 additions and 0 deletions

View file

@ -0,0 +1,41 @@
# Copyright 2017 - 2018 Modoolar <info@modoolar.com>
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
import werkzeug
from odoo import http
# from odoo.http import request
class ProjectBrowser(http.Controller):
def get_record_url(self, model, domain, action_xml_id):
env = http.request.env()
records = env[model].search(domain)
record_id = records and records.id or -1
action_id = env.ref(action_xml_id).id
return "/web#id={}&view_type=form&model={}&action={}".format(
record_id, model, action_id
)
def get_task_url(self, key):
return self.get_record_url(
"project.task", [("key", "=ilike", key)], "project.action_view_task"
)
def get_project_url(self, key):
return self.get_record_url(
"project.project",
[("key", "=ilike", key)],
"project.open_view_project_all_config",
)
@http.route(["/projects/<string:key>"], type="http", auth="user")
def open_project(self, key, **kwargs):
return werkzeug.utils.redirect(self.get_project_url(key), 301)
@http.route(["/tasks/<string:key>"], type="http", auth="user")
def open_task(self, key, **kwargs):
return werkzeug.utils.redirect(self.get_task_url(key), 301)