Browse Source

Feb 29 : [UPDT] Module Updated 'website_quotation_template'

pull/267/merge
RisvanaCybro 1 year ago
parent
commit
a55598e6f7
  1. 2
      website_quotation_template/__init__.py
  2. 3
      website_quotation_template/__manifest__.py
  3. 6
      website_quotation_template/controllers/__init__.py
  4. 12
      website_quotation_template/controllers/website_quotation_template.py
  5. 8
      website_quotation_template/controllers/website_sale.py
  6. 2
      website_quotation_template/doc/RELEASE_NOTES.md
  7. 2
      website_quotation_template/models/__init__.py
  8. 9
      website_quotation_template/models/sale_order_template.py
  9. BIN
      website_quotation_template/static/description/assets/screenshots/9.png
  10. BIN
      website_quotation_template/static/description/assets/screenshots/hero.gif
  11. 6
      website_quotation_template/static/description/index.html
  12. 13
      website_quotation_template/static/src/css/snippet.css
  13. 7
      website_quotation_template/static/src/js/snippet.js
  14. 9
      website_quotation_template/static/src/xml/snippet_template.xml
  15. 55
      website_quotation_template/views/product_details_templates.xml

2
website_quotation_template/__init__.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Athira PS (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO

3
website_quotation_template/__manifest__.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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': [

6
website_quotation_template/controllers/__init__.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import add_to_cart_temp
from . import snippet
from . import website_sale
from . import website_quotation_template

12
website_quotation_template/controllers/snippet.py → website_quotation_template/controllers/website_quotation_template.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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/<int:product_id>', 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})

8
website_quotation_template/controllers/add_to_cart_temp.py → website_quotation_template/controllers/website_sale.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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([]))

2
website_quotation_template/doc/RELEASE_NOTES.md

@ -1,6 +1,6 @@
## Module <website_quotation_template>
#### 18.11.2023
#### 01.02.2024
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Website Quotation Template Snippet

2
website_quotation_template/models/__init__.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Athira PS (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO

9
website_quotation_template/models/sale_order_template.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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.")

BIN
website_quotation_template/static/description/assets/screenshots/9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
website_quotation_template/static/description/assets/screenshots/hero.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 180 KiB

6
website_quotation_template/static/description/index.html

@ -28,7 +28,7 @@
<!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Website Quotation Template Snippet</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">Quotation Template Snippet inside Website.New Snippet for Directly Adding Products inside the Quotation Templates into the Cart.</p>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">New Snippet for Directly Adding Products inside the Quotation Templates into the Cart.</p>
<!-- END OF APP HERO -->
<img src="assets/screenshots/hero.gif" class="img-responsive"
style="width: 100%; margin-left: auto; margin-right: auto;" />
@ -175,6 +175,10 @@
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">Here we can see the quotation template that we are created in backend.</p>
<img src="assets/screenshots/w4.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">When we click on the image or name of the quotation template, We can see the products inside the quotation template.</p>
<img src="assets/screenshots/9.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">When we click "Add To Cart" button , all products inside the selected quotation templates are directly added into cart.
</h3>

13
website_quotation_template/static/src/css/snippet.css

@ -38,3 +38,16 @@ width:250px important;
height:250px important;
object-fit:contain;
}
.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;
}

7
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

9
website_quotation_template/static/src/xml/snippet_template.xml

@ -8,12 +8,17 @@
<div class="card prodcard"
t-if="tem.is_available_in_website">
<div class="img_card" style="overflow: hidden;">
<img class="temp_img" t-att-src="tem.image" style="width:250px !important; height:250px !important;"
alt="Card image cap"/>
<a t-attf-href="/product/details/#{tem.id}">
<img class="temp_img" t-att-src="tem.image"
style="width:250px !important; height:250px !important;"
alt="Card image cap"/>
</a>
</div>
<div class="card-body">
<a t-attf-href="/product/details/#{tem.id}">
<h5 t-esc="tem.name"
class="card-title">Card title</h5>
</a>
<form action="/product/add_cart" method="POST">
<input name="prod_id"
t-att-value="tem.id"

55
website_quotation_template/views/product_details_templates.xml

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- This template is used to display detailed information about each product
in a sale order template. -->
<template id="product_details_template" name="Product Details Template">
<t t-call="website.layout">
<t t-name="website_quotation_template.product_details_template">
<div class="container">
<div class="row">
<div class="col-md-12">
<table class="table">
<thead>
<tr>
<th>Image</th>
<th>Name</th>
<th>Description</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<t t-foreach="template.sale_order_template_line_ids"
t-as="line">
<tr>
<td>
<t t-if="line.product_id.image_1920">
<img class="product-image"
t-att-src="image_data_uri(line.product_id.image_1920)"
alt="Product Image"
style="height:50px;"/>
</t>
</td>
<td t-esc="line.product_id.name"/>
<td t-esc="line.product_id.display_name"/>
<td t-esc="line.product_uom_qty"/>
</tr>
</t>
</tbody>
</table>
</div>
</div>
<div class="text-center mt-4">
<form action="/product/add_cart" method="POST">
<input name="prod_id" t-att-value="template.id"
type="hidden"/>
<button type="submit"
class="btn btn-primary buy_template">
<span>Add To Cart</span>
</button>
</form>
</div>
</div>
</t>
</t>
</template>
</odoo>
Loading…
Cancel
Save