diff --git a/website_quotation_template/__init__.py b/website_quotation_template/__init__.py index e5cd0f7ee..bc342e8f0 100644 --- a/website_quotation_template/__init__.py +++ b/website_quotation_template/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira PS (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO diff --git a/website_quotation_template/__manifest__.py b/website_quotation_template/__manifest__.py index 8155ace45..5b5d37c33 100644 --- a/website_quotation_template/__manifest__.py +++ b/website_quotation_template/__manifest__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira PS (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -36,6 +36,7 @@ [ 'views/sale_order_template_views.xml', 'views/website_quotation_snippet_templates.xml', + 'views/product_details_templates.xml', ], 'assets': { 'web.assets_frontend': [ diff --git a/website_quotation_template/controllers/__init__.py b/website_quotation_template/controllers/__init__.py index 6a74ac713..62f0d0dbd 100644 --- a/website_quotation_template/controllers/__init__.py +++ b/website_quotation_template/controllers/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira P S (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -19,5 +19,5 @@ # If not, see . # ############################################################################### -from . import add_to_cart_temp -from . import snippet +from . import website_sale +from . import website_quotation_template diff --git a/website_quotation_template/controllers/snippet.py b/website_quotation_template/controllers/website_quotation_template.py similarity index 75% rename from website_quotation_template/controllers/snippet.py rename to website_quotation_template/controllers/website_quotation_template.py index 85b1c6f89..cba428517 100644 --- a/website_quotation_template/controllers/snippet.py +++ b/website_quotation_template/controllers/website_quotation_template.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira PS (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -41,3 +41,13 @@ class TemplateSnippet(http.Controller): for temp in request.env['sale.order.template'].sudo().search([]) ] return templates + + @http.route('/product/details/', type='http', + auth="public", website=True) + def product_details(self, product_id, **kwargs): + """Render the product details template for a specific sale order + template.""" + template = request.env['sale.order.template'].sudo().browse(product_id) + return http.request.render( + 'website_quotation_template.product_details_template', + {'template': template}) diff --git a/website_quotation_template/controllers/add_to_cart_temp.py b/website_quotation_template/controllers/website_sale.py similarity index 94% rename from website_quotation_template/controllers/add_to_cart_temp.py rename to website_quotation_template/controllers/website_sale.py index f4335bcc0..4130abb65 100644 --- a/website_quotation_template/controllers/add_to_cart_temp.py +++ b/website_quotation_template/controllers/website_sale.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira PS (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -45,10 +45,10 @@ class ProductAddToCart(WebsiteSale): ppg (bool): Whether to paginate the results. **post: Additional keyword arguments. Returns: - A response object with updated context. - """ + A response object with updated context.""" response = super(ProductAddToCart, self).shop(page, category, search, - min_price, max_price, ppg, + min_price, max_price, + ppg, **post) response.qcontext.update( val=request.env['sale.order.template'].sudo().search([])) diff --git a/website_quotation_template/doc/RELEASE_NOTES.md b/website_quotation_template/doc/RELEASE_NOTES.md index e5f43e9c6..c8c401d21 100644 --- a/website_quotation_template/doc/RELEASE_NOTES.md +++ b/website_quotation_template/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 18.11.2023 +#### 01.02.2024 #### Version 16.0.1.0.0 #### ADD - Initial commit for Website Quotation Template Snippet diff --git a/website_quotation_template/models/__init__.py b/website_quotation_template/models/__init__.py index 5559d962a..bc073da62 100644 --- a/website_quotation_template/models/__init__.py +++ b/website_quotation_template/models/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira PS (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO diff --git a/website_quotation_template/models/sale_order_template.py b/website_quotation_template/models/sale_order_template.py index d677ff5e5..6afa48a5f 100644 --- a/website_quotation_template/models/sale_order_template.py +++ b/website_quotation_template/models/sale_order_template.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2024-TODAY Cybrosys Technologies() # Author: Athira PS (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -29,9 +29,8 @@ class SaleOrderTemplate(models.Model): is_available_in_website = fields.Boolean(string="Is available in website", help="Specifies whether this sale" "order template is available" - "for purchase on the website." - ) + "for purchase on the " + "website.") temp_img = fields.Image(string="Template Image", help="An image representing the sale order " - "template." - ) + "template.") diff --git a/website_quotation_template/static/description/assets/screenshots/9.png b/website_quotation_template/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..28cb288a0 Binary files /dev/null and b/website_quotation_template/static/description/assets/screenshots/9.png differ diff --git a/website_quotation_template/static/description/assets/screenshots/hero.gif b/website_quotation_template/static/description/assets/screenshots/hero.gif index 615775c99..36dbe7ba9 100644 Binary files a/website_quotation_template/static/description/assets/screenshots/hero.gif and b/website_quotation_template/static/description/assets/screenshots/hero.gif differ diff --git a/website_quotation_template/static/description/index.html b/website_quotation_template/static/description/index.html index 704cc3e6b..56b441502 100644 --- a/website_quotation_template/static/description/index.html +++ b/website_quotation_template/static/description/index.html @@ -28,7 +28,7 @@

Website Quotation Template Snippet

-

Quotation Template Snippet inside Website.New Snippet for Directly Adding Products inside the Quotation Templates into the Cart.

+

New Snippet for Directly Adding Products inside the Quotation Templates into the Cart.

@@ -175,6 +175,10 @@

Here we can see the quotation template that we are created in backend.

+
+

When we click on the image or name of the quotation template, We can see the products inside the quotation template.

+ +

When we click "Add To Cart" button , all products inside the selected quotation templates are directly added into cart.

diff --git a/website_quotation_template/static/src/css/snippet.css b/website_quotation_template/static/src/css/snippet.css index 821885d6a..9510272bb 100644 --- a/website_quotation_template/static/src/css/snippet.css +++ b/website_quotation_template/static/src/css/snippet.css @@ -37,4 +37,17 @@ width:250px important; height:250px important; object-fit:contain; -} \ No newline at end of file +} +.small-list-item { + padding: 5px; + margin-bottom: 5px; +} + +.small-list-item .product-image { + max-width: 100px; + max-height: 100px; +} + +.small-list-item .product-details { + margin-left: 10px; +} diff --git a/website_quotation_template/static/src/js/snippet.js b/website_quotation_template/static/src/js/snippet.js index 786821b6a..fc0e37ea6 100644 --- a/website_quotation_template/static/src/js/snippet.js +++ b/website_quotation_template/static/src/js/snippet.js @@ -22,6 +22,13 @@ var Dynamic = PublicWidget.Widget.extend({ template:data })); }); + self.$el.find('.img_card, .card-title').on('click', function () { + var templateId = $(this).closest('.prodcard').data('template-id'); + ajax.jsonRpc("/product/details/" + templateId, 'call', {}) + .then(function (data) { + self.$el.find('.product-details-container').html(QWeb.render('ProductDetailsTemplate', { template: data.template })); + }); + }); }, }); // Register the widget with the PublicWidget registry diff --git a/website_quotation_template/static/src/xml/snippet_template.xml b/website_quotation_template/static/src/xml/snippet_template.xml index c07765414..3bfc3055c 100644 --- a/website_quotation_template/static/src/xml/snippet_template.xml +++ b/website_quotation_template/static/src/xml/snippet_template.xml @@ -8,12 +8,17 @@
- Card image cap + + Card image cap +
+
Card title
+
+ + + +