mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 12:32:01 +02:00
20 lines
564 B
Python
20 lines
564 B
Python
# Copyright 2019 Creu Blanca
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import models
|
|
|
|
|
|
class Base(models.AbstractModel):
|
|
_inherit = "base"
|
|
|
|
def get_quick_access_code(self):
|
|
self.ensure_one()
|
|
model_id = (
|
|
self.env["ir.model"].sudo().search([("model", "=", self._name)], limit=1).id
|
|
)
|
|
rule = self.env["document.quick.access.rule"].search(
|
|
[("model_id", "=", model_id)], limit=1
|
|
)
|
|
if not rule:
|
|
return False
|
|
return rule.get_code(self)
|