Browse Source

May 23 : [UPDT] Bug Fixed 'website_product_attachments'

pull/257/head
AjmalCybro 2 years ago
parent
commit
7b10404948
  1. 4
      website_product_attachments/controllers/website_product_attachment.py
  2. 2
      website_product_attachments/views/template.xml

4
website_product_attachments/controllers/website_product_attachment.py

@ -26,12 +26,10 @@ from werkzeug.utils import redirect
import io import io
from odoo import http from odoo import http
from odoo.http import request from odoo.http import request
from odoo.addons.website.controllers.main import QueryURL
from odoo.addons.website_sale.controllers.main import WebsiteSale from odoo.addons.website_sale.controllers.main import WebsiteSale
class WebsiteSale(WebsiteSale): class WebsiteSale(WebsiteSale):
@http.route(['/shop/<model("product.template"):product>'], type='http', @http.route(['/shop/<model("product.template"):product>'], type='http',
auth="public", website=True) auth="public", website=True)
def product(self, product, category='', search='', **kwargs): def product(self, product, category='', search='', **kwargs):
@ -39,7 +37,7 @@ class WebsiteSale(WebsiteSale):
**kwargs) **kwargs)
attachments = request.env['ir.attachment'].sudo().search( attachments = request.env['ir.attachment'].sudo().search(
[('res_model', '=', 'product.template'), [('res_model', '=', 'product.template'),
('res_id', '=', product.id)], order='id') ('res_id', '=', product.id)], order='id').filtered(lambda att: not att.access_token)
res.qcontext['attachments'] = attachments res.qcontext['attachments'] = attachments
return res return res

2
website_product_attachments/views/template.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- Adds new field to show product attachments in website -->
<template id="product_attachments" inherit_id="website_sale.product" name="product attachments"> <template id="product_attachments" inherit_id="website_sale.product" name="product attachments">
<!-- <xpath expr="//a[@id='add_to_cart']" position="after">-->
<xpath expr="//div[@id='o_product_terms_and_share']" position="before"> <xpath expr="//div[@id='o_product_terms_and_share']" position="before">
<t t-if="attachments"> <t t-if="attachments">
<span><strong>Related Documents:</strong></span> <span><strong>Related Documents:</strong></span>

Loading…
Cancel
Save