Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
vauxoo-dev
addons-vauxoo
Commits
de271cbe
Commit
de271cbe
authored
May 27, 2016
by
oalca
Browse files
[ADD] Controller to be able to print reports with public URL.
parent
cd16ee93
Changes
3
Hide whitespace changes
Inline
Side-by-side
website_variants_extra/controllers/__init__.py
View file @
de271cbe
# coding: utf-8
from
.
import
main
from
.
import
async_controllers
website_variants_extra/controllers/main.py
0 → 100644
View file @
de271cbe
# coding: utf-8
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from
openerp.addons.web.http
import
Controller
,
route
,
request
,
SUPERUSER_ID
class
DownloadableBrochure
(
Controller
):
@
route
([
'/downloadable/productbrochure/<docids>'
,
],
type
=
'http'
,
auth
=
'public'
,
website
=
True
)
def
report_routes
(
self
,
docids
=
None
,
**
data
):
report_obj
=
request
.
registry
[
'report'
]
cr
,
context
=
request
.
cr
,
request
.
context
if
docids
:
docids
=
[
int
(
i
)
for
i
in
docids
.
split
(
','
)]
reportname
=
'website_variants_extra.pprintable'
pdf
=
report_obj
.
get_pdf
(
cr
,
SUPERUSER_ID
,
docids
,
reportname
,
context
=
context
)
pdfhttpheaders
=
[
(
'Content-Type'
,
'application/pdf'
),
(
'Content-Length'
,
len
(
pdf
))]
return
request
.
make_response
(
pdf
,
headers
=
pdfhttpheaders
)
website_variants_extra/static/src/js/website_sale.js
View file @
de271cbe
...
...
@@ -25,7 +25,7 @@
$
(
'
#add_to_cart
'
).
addClass
(
'
product_price
'
);
$
(
'
.pepdf
'
).
click
(
function
(){
var
product_id
=
$
(
'
.product_id
'
).
val
();
var
url
=
'
/
report/pdf/website_variants_extra.pprintabl
e/
'
+
product_id
;
var
url
=
'
/
downloadable/productbrochur
e/
'
+
product_id
;
var
win
=
window
.
open
(
url
,
'
_blank
'
);
win
.
focus
();
});
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment