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
Merge requests
!61
migrate to v17
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
migrate to v17
topic/17.0/RED-318
into
branch/17.0
Overview
1
Commits
10
Pipelines
0
Changes
19
Merged
Axel Prel
requested to merge
topic/17.0/RED-318
into
branch/17.0
6 months ago
Overview
1
Commits
10
Pipelines
0
Changes
5
Expand
0
0
Merge request reports
Compare
version 4
version 6
a1b32ffe
5 months ago
version 5
e2e0ed8f
5 months ago
version 4
c353407e
5 months ago
version 3
254a5a74
5 months ago
version 2
9c5c9748
6 months ago
version 1
9c5c9748
6 months ago
branch/17.0 (base)
and
latest version
latest version
244d816f
10 commits,
5 months ago
version 6
a1b32ffe
9 commits,
5 months ago
version 5
e2e0ed8f
9 commits,
5 months ago
version 4
c353407e
9 commits,
5 months ago
version 3
254a5a74
6 commits,
5 months ago
version 2
9c5c9748
7 commits,
6 months ago
version 1
9c5c9748
25 commits,
6 months ago
Show latest version
5 files
+
41
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
models/redner_template.py
+
14
−
11
Options
@@ -25,6 +25,7 @@
from
odoo.exceptions
import
ValidationError
from
..redner
import
REDNER_API_PATH
,
Redner
from
..utils.mimetype
import
b64_to_extension
logger
=
logging
.
getLogger
(
__name__
)
@@ -163,6 +164,11 @@
compute
=
"
_compute_template_data
"
,
)
template_data_filename
=
fields
.
Char
(
string
=
"
Libreoffice Template Filename
"
,
readonly
=
True
,
)
def
import_from_redner
(
self
):
tl_wizard
=
self
.
env
[
"
template.list.wizard
"
]
templates
=
self
.
list_external_templates
()
@@ -210,7 +216,6 @@
if
f
in
cached_template
:
new_val
=
cached_template
[
f
]
setattr
(
record
,
f
,
new_val
)
print
(
f
"
f
{
f
}
, newvalue
{
new_val
}
"
)
except
Exception
as
e
:
logger
.
error
(
"
Failed to read redner template :%s
"
,
e
)
return
@@ -223,8 +228,6 @@
attr
=
getattr
(
record
,
f
)
if
not
attr
:
new_val
=
cached_template
[
f
]
if
f
==
"
template_data
"
:
new_val
=
base64
.
b64encode
(
new_val
)
setattr
(
record
,
f
,
new_val
)
@api.depends
(
"
template_data
"
)
@@ -240,7 +243,11 @@
cached_template
=
self
.
to_cache
(
record
.
id
,
template
)
if
"
template_data
"
in
cached_template
:
new_val
=
cached_template
[
"
template_data
"
]
print
(
f
"
new val before encoding
{
new_val
[
:
100
]
}
"
)
encoded
=
base64
.
b64encode
(
new_val
).
decode
(
'
utf-8
'
)
print
(
f
"
Setting template_data with:
{
encoded
[
:
100
]
}
...
"
)
encoded
=
base64
.
b64encode
(
new_val
).
decode
(
"
utf-8
"
)
ext
=
"
.odt
"
# default extension
try
:
ext
=
b64_to_extension
(
encoded
)
except
Exception
as
e
:
logger
.
error
(
"
Failed to read extension from file:%s
"
,
e
)
return
record
.
template_data
=
encoded
@@ -246,6 +253,5 @@
record
.
template_data
=
encoded
print
(
f
"
After assignment, template_data is:
{
record
.
template_data
}
"
)
print
(
f
"
template_data type:
{
type
(
record
.
template_data
)
}
"
)
record
.
template_data_filename
=
"
template
"
+
ext
except
Exception
as
e
:
logger
.
error
(
"
Failed to read redner template :%s
"
,
e
)
return
@@ -268,5 +274,4 @@
return
new_templates
def
to_cache
(
self
,
record_id
,
template
):
print
(
f
"
template
{
template
}
"
)
cached_template
=
self
.
to_odoo_template
(
template
)
@@ -272,5 +277,4 @@
cached_template
=
self
.
to_odoo_template
(
template
)
print
(
f
"
cached template
{
cached_template
}
"
)
self
.
cache
[
record_id
]
=
cached_template
return
cached_template
@@ -359,7 +363,6 @@
return
super
().
create
(
vals_list
)
def
write
(
self
,
vals
):
print
(
f
"
writing with vals ..
{
vals
}
"
)
"""
Overwrite write to update redner template
"""
# We depend on the API for consistency here
# So raised error should not result with an updated template
Loading