Skip to content
Snippets Groups Projects
Commit 675d6b46fd69 authored by Axel Prel's avatar Axel Prel
Browse files

add 'view in redner' button in form

parent 17eaa0a5ce23
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from ..redner import Redner
from ..redner import REDNER_API_PATH, Redner
logger = logging.getLogger(__name__)
......@@ -271,3 +271,22 @@
body_format=body_format,
version=fields.Datetime.to_string(fields.Datetime.now()),
)
def redner_url(self):
if self.redner_id is None:
return ""
return (
self.redner.server_url.removesuffix(REDNER_API_PATH)
+ "template/"
+ self.redner.account
+ "/"
+ self.redner_id
)
def view_in_redner(self):
return {
"type": "ir.actions.act_url",
"url": self.redner_url(),
"target": "new",
}
......@@ -32,6 +32,16 @@
<field name="model">redner.template</field>
<field name="arch" type="xml">
<form>
<header>
<field name="redner_id" invisible="1" />
<button
name="view_in_redner"
type="object"
string="View in Redner"
class="oe_highlight"
invisible="redner_id == False"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment