@ -0,0 +1,44 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg |
||||
|
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Website Index and Follow |
||||
|
======================= |
||||
|
This module lets you specify whether or not a particular page should be indexed. |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
Developer: Ayisha Sumayya K @cybrosys, Contact: odoo@cybrosys.com |
||||
|
|
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.odoo.com/documentation/user/13.0/legal/licenses/licenses.html) |
||||
|
|
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ayisha Sumayya K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
||||
|
from . import controllers |
@ -0,0 +1,47 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ayisha Sumayya K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'Website Index and Follow', |
||||
|
'version': '16.0.1.0.0', |
||||
|
'category': 'Website/Website', |
||||
|
'summary': """Website Index and Follow Application for Odoo 16""", |
||||
|
'description': """The module helps you to specify product-level |
||||
|
indexing.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['website_sale'], |
||||
|
'data': [ |
||||
|
'views/source_views.xml', |
||||
|
'views/website_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_frontend': [ |
||||
|
'index_and_follow/static/src/js/website.js', ], |
||||
|
}, |
||||
|
'images': ['static/description/banner.png', ], |
||||
|
'license': 'LGPL-3', |
||||
|
'auto_install': False, |
||||
|
'installable': True, |
||||
|
'application': False |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ayisha Sumayya K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import website |
@ -0,0 +1,54 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ayisha Sumayya K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import http |
||||
|
from odoo.http import request |
||||
|
from odoo.addons.website_sale.controllers.main import WebsiteSale |
||||
|
|
||||
|
|
||||
|
class WebIndexJson(http.Controller): |
||||
|
""" controller for website index and follow """ |
||||
|
|
||||
|
@http.route('/web_index', type='json', auth='user') |
||||
|
def web_index(self, index, product): |
||||
|
""" route for index """ |
||||
|
|
||||
|
product_rec = request.env['product.template'].browse(int(product)) |
||||
|
if index: |
||||
|
product_rec.is_index = True |
||||
|
else: |
||||
|
product_rec.is_index = False |
||||
|
|
||||
|
|
||||
|
class WebIndex(WebsiteSale): |
||||
|
""" class for website_sale """ |
||||
|
|
||||
|
def _prepare_product_values(self, product, category, search, **kwargs): |
||||
|
""" function for access user along with product """ |
||||
|
|
||||
|
res = super(WebIndex, self)._prepare_product_values(product, category, |
||||
|
search) |
||||
|
res.update({ |
||||
|
'page_index': product.is_index, |
||||
|
'product_rec': product, |
||||
|
'user': request.env.user.has_group('base.group_user') |
||||
|
}) |
||||
|
return res |
@ -0,0 +1,7 @@ |
|||||
|
## Module <index_and_follow> |
||||
|
|
||||
|
#### 18.02.2023 |
||||
|
#### Version 16.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial commit for Website Index and Follow |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ayisha Sumayya K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import product_template |
@ -0,0 +1,30 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ayisha Sumayya K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ProductTemplate(models.Model): |
||||
|
""" class for adding a field in product """ |
||||
|
|
||||
|
_inherit = "product.template" |
||||
|
|
||||
|
is_index = fields.Boolean(default=True) |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 556 KiB |
After Width: | Height: | Size: 520 KiB |
After Width: | Height: | Size: 886 KiB |
After Width: | Height: | Size: 429 KiB |
After Width: | Height: | Size: 491 KiB |
After Width: | Height: | Size: 876 KiB |
After Width: | Height: | Size: 443 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,41 @@ |
|||||
|
odoo.define('index_and_follow.index', function (require) { |
||||
|
'use strict'; |
||||
|
|
||||
|
var ajax = require('web.ajax'); |
||||
|
var publicWidget = require('web.public.widget'); |
||||
|
|
||||
|
publicWidget.registry.IndexAndFollow = publicWidget.Widget.extend({ |
||||
|
selector: '#product_detail_main', |
||||
|
events: { |
||||
|
'change .is_index': '_setProductIndex', |
||||
|
}, |
||||
|
_setProductIndex: function(event){ |
||||
|
//function to set product index
|
||||
|
var product = this.el.querySelector('.product').value; |
||||
|
if (event.target.checked == true){ |
||||
|
/*check index input is checked, if input is checked, it sends an AJAX request |
||||
|
to the server to set the product's indexing status to true.*/ |
||||
|
this.el.querySelector('.is_index').checked = true; |
||||
|
ajax.jsonRpc('/web_index', 'call',{ |
||||
|
'index': true, |
||||
|
'product': product, |
||||
|
}).then(function(){ |
||||
|
location.reload(); |
||||
|
}); |
||||
|
} |
||||
|
else{ |
||||
|
//input is unchecked, it sends an AJAX request to set the status to false.
|
||||
|
ajax.jsonRpc('/web_index', 'call',{ |
||||
|
'index': false, |
||||
|
'product': product, |
||||
|
}).then(function(){ |
||||
|
location.reload(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
return publicWidget.registry.IndexAndFollow; |
||||
|
|
||||
|
}); |
@ -0,0 +1,12 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Inherited the portal front layout for meta-tag --> |
||||
|
<template id="index_follow" inherit_id="portal.frontend_layout" name="Index and Follow"> |
||||
|
<xpath expr="//head/meta[last()]" position="after"> |
||||
|
|
||||
|
<meta t-if="page_index" name='robots' content='index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'/> |
||||
|
<meta t-if="not page_index" name='robots' content="noindex, nofollow"/> |
||||
|
|
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,14 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!--Inherited website_sales product template for adding the is_index check box --> |
||||
|
<template id="website_index" inherit_id="website_sale.product" name="Web Index" customize_show="True"> |
||||
|
<xpath expr="//div[@id='o_wsale_cta_wrapper']" position="before"> |
||||
|
<t t-if="user"> |
||||
|
<input type="checkbox" t-att-checked="product.is_index" id="is_index" class="is_index"/> |
||||
|
<span><b>Is Indexed</b></span><br/> |
||||
|
<input type="hidden" class="product" t-att-value="product.id"/> |
||||
|
</t> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |
||||
|
|