(),'
"}) + values = { + 'string': string, + 'id': product['id'] + } + pro = self.env['product.template'].browse(values['id']) + pro.write({ + 'website_meta_title': values['string'], + 'website_meta_keywords': pro.name + }) + meta_title.append(values) + if self.meta_description_ids: + products = self.env['product.template'].search_read( + [], fields=self.meta_description_ids.mapped('product')) + meta_description = [] + for product in products: + sep = self.attribute_separator + string = str(sep).join( + str(product[x]) for x in product.keys() if x != 'id') + string = string.translate( + {ord(i): None for i in "(),'
"}) + values = { + 'string': string, + 'id': product['id'] + } + pro = self.env['product.template'].browse(values['id']) + pro.write({ + 'website_meta_description': values['string'], + }) + meta_description.append(values) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'target': 'new', + 'params': { + 'message': ("Successfully " + "generated the seo for all products"), + 'type': 'success', + 'sticky': False, + 'next': {'type': 'ir.actions.act_window_close'}, + } + } + elif self.model_name == 'product_category': + if self.meta_title_ids: + products = self.env['product.public.category'].search_read( + [('is_auto_seo', '=', True)], + fields=self.meta_title_ids.mapped('category')) + meta_categ_title = [] + for product in products: + sep = self.attribute_separator + string = str(sep).join( + str(product[x]) for x in product.keys() if x != 'id') + string = string.translate( + {ord(i): None for i in "(),'
"}) + values = { + 'string': string, + 'id': product['id'] + } + pro = self.env['product.public.category'].browse( + values['id']) + for rec in pro: + rec.write({ + 'website_meta_title': values['string'], + 'website_meta_keywords': pro.name + }) + meta_categ_title.append(values) + if self.meta_description_ids: + products = self.env['product.public.category'].search_read( + [('is_auto_seo', '=', True)], + fields=self.meta_description_ids.mapped('category')) + meta_categ_description = [] + for product in products: + sep = self.attribute_separator + string = str(sep).join( + str(product[x]) for x in product.keys() if x != 'id') + string = string.translate( + {ord(i): None for i in "(),'
"}) + values = { + 'string': string, + 'id': product['id'] + } + pro = self.env[ + 'product.public.category'].browse(values['id']) + pro.write({ + 'website_meta_description': values['string'], + }) + meta_categ_description.append(values) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'target': 'new', + 'params': { + 'message': + ("Successfully created the SEO only for product" + " groups with auto SEO enabled."), + 'type': 'success', + 'sticky': False, + 'next': {'type': 'ir.actions.act_window_close'}, + } + } diff --git a/website_seo_kit/models/website_seo_attributes.py b/website_seo_kit/models/website_seo_attributes.py new file mode 100644 index 000000000..120a3ab0f --- /dev/null +++ b/website_seo_kit/models/website_seo_attributes.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(+ Using the module, you may automatically generate meta titles, + descriptions, and keywords for each product and product group. +
++ This module assists you in automatically generating meta titles, + descriptions, and keywords for each product and product group. + For instance, with odoo you have to specify each meta title, + meta description, and meta keyword individually. However, with + this software you can create meta contents with only one click. +
+Go to Website -> Site -> SEO Attribute + -> Here you can Create SEO attribute.
+Go to Website -> Site -> Generate SEO + -> Here you can generate seo content.
+ ++ Easily procure + and + sell your products
++ Easy + configuration + and convivial experience
++ A platform for + educational management
++ Plan, track and + schedule your operations
++ Mobile + friendly, + awe-inspiring product pages
++ Keep track of + services and invoice
++ Run your bar or + restaurant methodically
++ An + all-inclusive + hotel management application
+