-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from GlodoUK/sale_stock_force_pdf_download
[FEAT][FIX] Sale Stock Force PDF Download module
- Loading branch information
Showing
9 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Sale Stock Force PDF Download | ||
============================= | ||
|
||
Force PDF download instead of PDF preview when viewing stock picking records via the sales order portal | ||
|
||
This fixes a bug related to certain PDF extensions that run in Chrome whereby the request to "Print" via the portal causes the PDF preview to request the same file repeatedly in a loop, which eventually consumes all available workers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import controllers, models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "Sale Stock Force PDF Download", | ||
"version": "15.0.1.0.0", | ||
"category": "Hidden", | ||
"author": "Glo Networks", | ||
"website": "https://github.com/GlodoUK/sale", | ||
"depends": ["sale_stock"], | ||
"license": "LGPL-3", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import portal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from odoo import exceptions | ||
from odoo.http import request, route | ||
|
||
from odoo.addons.sale_stock.controllers.portal import SaleStockPortal | ||
|
||
|
||
class DriftworksSaleStockPortal(SaleStockPortal): | ||
# Hard Override https://github.com/odoo/odoo/blob/16.0/addons/sale_stock/controllers/portal.py#L24 | ||
@route() | ||
def portal_my_picking_report(self, picking_id, access_token=None, **kw): | ||
try: | ||
picking_sudo = self._stock_picking_check_access( | ||
picking_id, | ||
access_token=access_token, | ||
) | ||
except exceptions.AccessError: | ||
return request.redirect("/my") | ||
|
||
return self._show_report( | ||
model=picking_sudo, | ||
report_type="pdf", | ||
report_ref="stock.action_report_delivery", | ||
download=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_picking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from odoo import models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
def _get_report_base_filename(self): | ||
self.ensure_one() | ||
return "%s" % self.name |
1 change: 1 addition & 0 deletions
1
setup/sale_stock_force_pdf_download/odoo/addons/sale_stock_force_pdf_download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../sale_stock_force_pdf_download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |