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
3d7d44c259bd
Commit
3d7d44c259bd
authored
2 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Server URL rework: Expect an URL without path
add /api/v1 in the code.
parent
ebebb6493126
No related branches found
Branches containing commit
Tags
13.0.3.3.0
Tags containing commit
1 merge request
!25
Server URL rework: Expect an URL without path
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS.rst
+7
-0
7 additions, 0 deletions
NEWS.rst
__manifest__.py
+1
-1
1 addition, 1 deletion
__manifest__.py
redner.py
+13
-7
13 additions, 7 deletions
redner.py
with
21 additions
and
8 deletions
NEWS.rst
+
7
−
0
View file @
3d7d44c2
...
...
@@ -2,6 +2,13 @@
NEWS
====
13.0.3.3.0
==========
(port from 11.0.2.8.0)
* Server URL rework: Expect an URL without path, add /api/v1 in the code.
13.0.3.2.0
==========
...
...
This diff is collapsed.
Click to expand it.
__manifest__.py
+
1
−
1
View file @
3d7d44c2
...
...
@@ -21,7 +21,7 @@
"
name
"
:
"
Redner
"
,
"
summary
"
:
"""
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
"
version
"
:
"
13.0.3.
2
.0
"
,
"
version
"
:
"
13.0.3.
3
.0
"
,
"
category
"
:
"
Technical
"
,
"
author
"
:
"
XCG Consulting
"
,
"
website
"
:
"
http://odoo.consulting/
"
,
...
...
This diff is collapsed.
Click to expand it.
redner.py
+
13
−
7
View file @
3d7d44c2
...
...
@@ -11,6 +11,8 @@
_logger
=
logging
.
getLogger
(
__name__
)
REDNER_API_PATH
=
"
api/v1/
"
class
Redner
:
def
__init__
(
self
,
api_key
,
server_url
,
account
,
timeout
):
...
...
@@ -19,6 +21,7 @@
Args:
api_key(str): provide your Redner API key.
server_url(str): Redner server URL or socket path.
For example: http://localhost:30001/
timeout(float): Timeout per Redner call, in seconds.
"""
...
...
@@ -28,9 +31,9 @@
if
server_url
.
startswith
(
"
/
"
):
self
.
session
=
requests_unixsocket
.
Session
()
self
.
server_url
=
"
http+unix://{}/
api/
"
.
format
(
self
.
server_url
=
"
http+unix://{}/
"
.
format
(
quote
(
server_url
,
safe
=
""
)
)
else
:
self
.
session
=
requests
.
sessions
.
Session
()
self
.
server_url
=
server_url
...
...
@@ -32,8 +35,12 @@
quote
(
server_url
,
safe
=
""
)
)
else
:
self
.
session
=
requests
.
sessions
.
Session
()
self
.
server_url
=
server_url
if
not
self
.
server_url
.
endswith
(
"
/
"
):
self
.
server_url
+=
"
/
"
self
.
server_url
+=
REDNER_API_PATH
self
.
templates
=
Templates
(
self
)
def
call
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
...
...
@@ -154,7 +161,7 @@
"
body-format
"
:
body_format
,
"
metadata
"
:
metadata
or
{},
}
return
self
.
master
.
call
(
"
v1/
render
"
,
http_verb
=
"
post
"
,
**
params
)
return
self
.
master
.
call
(
"
render
"
,
http_verb
=
"
post
"
,
**
params
)
def
account_template_add
(
self
,
...
...
@@ -198,7 +205,7 @@
"
version
"
:
version
,
}
res
=
self
.
master
.
call
(
"
v1/
template/%s
"
%
self
.
master
.
account
,
http_verb
=
"
post
"
,
**
params
"
template/%s
"
%
self
.
master
.
account
,
http_verb
=
"
post
"
,
**
params
)
return
res
[
"
name
"
]
...
...
@@ -246,7 +253,7 @@
"
version
"
:
version
,
}
res
=
self
.
master
.
call
(
"
v1/
template/%s/%s
"
%
(
self
.
master
.
account
,
template_id
),
"
template/%s/%s
"
%
(
self
.
master
.
account
,
template_id
),
http_verb
=
"
put
"
,
**
params
,
)
...
...
@@ -262,8 +269,7 @@
dict: API response.
"""
return
self
.
master
.
call
(
"
v1/template/%s/%s
"
%
(
self
.
master
.
account
,
name
),
http_verb
=
"
delete
"
,
"
template/%s/%s
"
%
(
self
.
master
.
account
,
name
),
http_verb
=
"
delete
"
)
def
account_template_varlist
(
self
,
name
):
...
...
@@ -280,4 +286,4 @@
params
=
{
"
account
"
:
self
.
master
.
account
,
"
name
"
:
name
}
return
self
.
master
.
call
(
"
v1/
varlist
"
,
**
params
)
return
self
.
master
.
call
(
"
varlist
"
,
**
params
)
This diff is collapsed.
Click to expand it.
Vincent Hatakeyama
@vincent.hatakeyama
mentioned in commit
02327f5990a7
·
2 years ago
mentioned in commit
02327f5990a7
mentioned in commit 02327f5990a7a4fbbda548caf965694e6bdab195
Toggle commit list
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