Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Redner Odoo Module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Redner Odoo Module
Commits
208dd1f192c5
Commit
208dd1f192c5
authored
3 months ago
by
Axel Prel
Browse files
Options
Downloads
Patches
Plain Diff
fix crashing previews
parent
7e4a9e871c6f
No related branches found
Branches containing commit
No related tags found
1 merge request
!69
Topic/18.0/preview
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/redner_template.py
+10
-2
10 additions, 2 deletions
models/redner_template.py
with
10 additions
and
2 deletions
models/redner_template.py
+
10
−
2
View file @
208dd1f1
...
...
@@ -78,7 +78,6 @@
preview
=
fields
.
Binary
(
string
=
"
Preview
"
,
default
=
"
New
"
,
compute
=
"
_compute_preview
"
,
help
=
"
This is a preview of the template
"
,
)
...
...
@@ -92,6 +91,7 @@
description
=
fields
.
Char
(
string
=
"
Description
"
,
default
=
"
New
"
,
help
=
"
Description of the template
"
,
readonly
=
False
,
compute
=
"
_compute_template
"
,
...
...
@@ -187,4 +187,8 @@
@api.depends
(
"
body
"
,
"
template_data
"
)
def
_compute_preview
(
self
):
for
record
in
self
:
if
not
record
.
redner_id
:
record
.
preview
=
False
continue
response
=
self
.
get_preview
(
record
.
redner_id
)
...
...
@@ -190,4 +194,8 @@
response
=
self
.
get_preview
(
record
.
redner_id
)
if
not
response
:
record
.
preview
=
False
continue
b64
=
base64
.
b64encode
(
response
.
content
)
record
.
preview
=
b64
...
...
@@ -197,7 +205,7 @@
return
preview
except
Exception
as
e
:
logger
.
error
(
"
Failed to get preview of redner template :%s
"
,
e
)
return
return
False
def
_to_odoo_template
(
self
,
template
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment