mirror of
https://github.com/bringout/oca-workflow-process.git
synced 2026-04-19 12:32:03 +02:00
Initial commit: OCA Workflow Process packages (456 packages)
This commit is contained in:
commit
d366e42934
18799 changed files with 1284507 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
|
||||
|
||||
from . import main
|
||||
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue