diff --git a/event_management/README.rst b/event_management/README.rst new file mode 100644 index 000000000..820b8931b --- /dev/null +++ b/event_management/README.rst @@ -0,0 +1,64 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Event Management +================ +Event management is a core module which can manage any type of events. +The user can selectively download and install different service modules to extend the scope of this module. +The new service will be automatically get attached to this core Event management module. +It is different from Odoo's event module. +Here you can manage different types of events and allocate services to different users. +Note: Presently we have released the service “Event Catering” under this module. New services are being developed by our team. + +Configuration +============= +* No additional configuration required + +Features +======== +* Event order creation. +* Automatically creates service orders. +* Allocate the services to different users. +* Integrated with Accounting module. +* Simple Workflow. +* Attractive Design. + +Installation +============ + - www.odoo.com/documentation/15.0/setup/install.html + - Install our custom addon + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +`Cybrosys Techno Solutions `__ + +Credits +============ +* Developer: (V15) Mohammed Dilshad Tk , Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@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 https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/event_management/__init__.py b/event_management/__init__.py new file mode 100644 index 000000000..3f04be586 --- /dev/null +++ b/event_management/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import controllers +from . import models +from . import reports +from . import wizards diff --git a/event_management/__manifest__.py b/event_management/__manifest__.py new file mode 100644 index 000000000..cfd90d975 --- /dev/null +++ b/event_management/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +{ + 'name': 'Event Management', + 'version': '15.0.1.0.0', + "category": "Industries", + 'summary': """Event Management module for manage events.""", + 'description': """Event management module is a core module for managing + different types of events""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['product', 'account'], + 'data': ['security/event_management_security.xml', + 'security/ir.model.access.csv', + 'data/event_management_type_data.xml', + 'reports/pdf_report_templates.xml', + 'reports/event_management_reports.xml', + 'views/event_management_views.xml', + 'views/event_management_type_views.xml', + 'wizards/event_management_report_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + "event_management/static/src/css/event_dashboard.css", + "event_management/static/src/js/action_manager.js" + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/event_management/controllers/__init__.py b/event_management/controllers/__init__.py new file mode 100644 index 000000000..b080a62e1 --- /dev/null +++ b/event_management/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import event_management diff --git a/event_management/controllers/event_management.py b/event_management/controllers/event_management.py new file mode 100644 index 000000000..9f23ad1bc --- /dev/null +++ b/event_management/controllers/event_management.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.http import serialize_exception as _serialize_exception +from odoo.tools import html_escape + + +class XlsxReportController(http.Controller): + """Controller Class for xlsx report""" + @http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], + csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name): + """Method for passing data to xlsx report""" + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + options = json.loads(options) + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[('Content-Type', 'application/vnd.ms-excel'), ( + 'Content-Disposition', + content_disposition(report_name + '.xlsx'))]) + report_obj.get_xlsx_report(options, response) + return response + except Exception as err: + exception = _serialize_exception(err) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': exception + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/event_management/data/event_management_type_data.xml b/event_management/data/event_management_type_data.xml new file mode 100644 index 000000000..bf99ca0c9 --- /dev/null +++ b/event_management/data/event_management_type_data.xml @@ -0,0 +1,50 @@ + + + + + + Wedding + + + + + Birthday + + + + + Family Events + + + + + Press Conference + + + + + Seminars + + + + + Conferences + + + + + Event Order + event.order.sequence + %(day)s/%(month)s/%(year)s + EVE- + 1 + 2 + + + diff --git a/event_management/doc/RELEASE_NOTES.md b/event_management/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..178ee8020 --- /dev/null +++ b/event_management/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module +#### 19.09.2023 +#### Version 15.0.1.0.0 +#### Add +- Initial commit for Event Management diff --git a/event_management/models/__init__.py b/event_management/models/__init__.py new file mode 100644 index 000000000..e0f5142b9 --- /dev/null +++ b/event_management/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import event_management +from . import event_management_type +from . import event_service_line diff --git a/event_management/models/event_management.py b/event_management/models/event_management.py new file mode 100644 index 000000000..de6d98fd1 --- /dev/null +++ b/event_management/models/event_management.py @@ -0,0 +1,205 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import api, fields, models, _ +from odoo.exceptions import UserError, ValidationError + + +class EventManagement(models.Model): + """Model for managing different event kind of events""" + _name = 'event.management' + _description = "Event Management" + + name = fields.Char(string='Name', readonly=True, copy=False, + help="Show combined name of the event") + reference = fields.Char(string='Reference', readonly=True, + help="Reference of the event") + type_of_event_id = fields.Many2one('event.management.type', + string="Type", + required=True, + help="Different types of events") + partner_id = fields.Many2one('res.partner', string="Customer", + required=True, + help="Select customers for the event.") + date = fields.Date(string="Date", default=fields.Date.today, required=True, + help="Date of event creating") + start_date = fields.Datetime(string="Start Date", + default=lambda self: fields.datetime.now(), + required=True, help="Start date of event") + end_date = fields.Datetime(string="End Date", required=True, + help="End date of the event") + service_line_ids = fields.One2many('event.service.line', + 'event_id', + string="Services", help="Event services") + state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirmed'), + ('invoice', 'Invoiced'), + ('close', 'Close'), ('cancel', 'Canceled')], + string="State", default="draft", + help="States of the Event management record") + note = fields.Text(string='Terms and Conditions', help="Notes") + price_subtotal = fields.Float(string='Total', + compute='_compute_price_subtotal', + readonly=True, store=True, + help="Total price of services in service" + " lines") + image = fields.Binary(string="Image", attachment=True, + help="This field holds the image used as image for " + "the event, limited to 1080x720px.") + currency_id = fields.Many2one('res.currency', string='Currency', + readonly=True, + default=lambda self: + self.env.user.company_id.currency_id, + help="Default currency of company") + invoice_count = fields.Integer(string='Count of Invoices', + help="Count of total invoices for the event") + invoice_ids = fields.Many2many("account.move", + string='Invoices', copy=False, + help="Invoices created for each event") + pending_invoice = fields.Boolean(string="In Voice Pending", + compute='_compute_pending_invoice', + help="Does any pending invoice.") + + @api.depends('service_line_ids', 'service_line_ids.state') + def _compute_pending_invoice(self): + """ Computes pending invoices """ + pending = 0 + for lines in self.service_line_ids: + if lines.invoiced is False and lines.state == "done": + pending = 1 + self.pending_invoice = True if pending == 1 else False + + @api.depends('service_line_ids', 'service_line_ids.amount') + def _compute_price_subtotal(self): + """ Computes price total """ + total = 0 + for items in self.service_line_ids: + total += items.amount + self.price_subtotal = total + + @api.model + def create(self, values): + """Create method for sequencing and checking dates while creating""" + if values['start_date'] >= values['end_date']: + raise UserError(_('Start date must be less than End date')) + name = '%s-%s-%s' % (self.env['res.partner'].browse(values['partner_id'] + ).name, + self.env['event.management.type'].browse( + values['type_of_event_id']).name, + values['date']) + values['name'] = name + sequence_number = self.env['ir.sequence'].next_by_code( + 'event.order.sequence') + values['reference'] = sequence_number + res = super(EventManagement, self).create(values) + return res + + def action_event_confirm(self): + """Button action to confirm""" + self.state = "confirm" + + def action_event_cancel(self): + """Button action to cancel""" + self.state = "cancel" + + def action_event_close(self): + """Button action to close""" + pending = 0 + for lines in self.service_line_ids: + if lines.invoiced is False: + pending = 1 + if pending == 1: + raise ValidationError(_('You can close an event only when all ' + 'services is Done and Invoiced')) + else: + self.state = "close" + + def action_view_invoice_event(self): + """Button action to View the related invoice""" + invoices = self.mapped('invoice_ids') + action = self.env.ref( + 'account.action_move_out_invoice_type').sudo().read()[0] + if len(invoices) > 1: + action['domain'] = [('id', 'in', invoices.ids)] + elif len(invoices) == 1: + action['views'] = [ + (self.env.ref('account.view_move_form').id, 'form')] + action['res_id'] = invoices.ids[0] + else: + action = {'type': 'ir.actions.act_window_close'} + return action + + def action_event_invoice_create(self): + """Button action to create related invoice""" + product_line = [] + payment_list = [] + for line in self.service_line_ids: + if line.invoiced is False and line.state == "done": + product_line.append({'product_id': line.related_product_id, + 'price_unit': line.amount}) + line.invoiced = True + if len(product_line) > 0: + partner = self.partner_id + for records in product_line: + product_id = records['product_id'] + if product_id.property_account_income_id.id: + income_account = product_id.property_account_income_id.id + elif product_id.categ_id.property_account_income_categ_id.id: + income_account = product_id.categ_id. \ + property_account_income_categ_id.id + else: + raise UserError( + _('Please define income account for' + ' this product: "%s" (id:%d).') % ( + product_id.name, product_id.id)) + + inv_line_data = { + 'name': self.name, + 'account_id': income_account, + 'price_unit': records['price_unit'], + 'quantity': 1, + 'product_id': product_id.id, + 'product_uom_id': product_id.uom_id.id, + } + payment_list.append((0, 0, inv_line_data)) + inv_data = { + 'move_type': 'out_invoice', + 'ref': self.name, + 'bank_partner_id': partner.property_account_payable_id.id, + 'partner_id': partner.id, + 'payment_reference': self.name, + 'company_id': self.env.user.company_id.id, + 'invoice_line_ids': payment_list, + } + inv_id = self.env['account.move'].create(inv_data) + result = { + 'view_type': 'form', + 'res_model': 'account.move', + 'res_id': inv_id.id, + 'view_id': False, + 'view_mode': 'form', + 'type': 'ir.actions.act_window' + } + self.state = "invoice" + all_invoice_ids = self.invoice_ids.ids + all_invoice_ids.append(inv_id.id) + self.update({'invoice_ids': all_invoice_ids, + 'invoice_count': self.invoice_count + 1}) + return result diff --git a/event_management/models/event_management_type.py b/event_management/models/event_management_type.py new file mode 100644 index 000000000..c860a86e1 --- /dev/null +++ b/event_management/models/event_management_type.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from ast import literal_eval +from odoo import fields, models + + +class EventManagementType(models.Model): + """Model for managing the Event types""" + _name = 'event.management.type' + _description = "Event Management Type" + + name = fields.Char(string="Name", help="Name of the event type") + image = fields.Binary(string="Image", attachment=True, + help="This field holds the image used as " + "image for the event, limited to 1080x720px.") + event_count = fields.Integer(string="Count of Events", + compute='_compute_event_count', + help="Count of total events") + + def _compute_event_count(self): + """ Compute event count """ + for records in self: + events = self.env['event.management'].search_count([ + ('type_of_event_id', '=', records.id)]) + records.event_count = events + + def _get_action(self, action_xml_id): + """ Pass values to Event management kanban """ + action = self.env['ir.actions.actions']._for_xml_id(action_xml_id) + if self: + action['display_name'] = self.display_name + context = { + 'search_default_type_of_event_id': [self.id], + 'default_type_of_event_id': self.id, + } + action_context = literal_eval(action['context']) + context = {**action_context, **context} + action['context'] = context + return action + + def get_event_type_action_event(self): + """Event management action """ + return self._get_action( + 'event_management.event_management_action') diff --git a/event_management/models/event_service_line.py b/event_management/models/event_service_line.py new file mode 100644 index 000000000..d3356486b --- /dev/null +++ b/event_management/models/event_service_line.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class EventServiceLine(models.Model): + """Model to manage the service lines of the event management""" + _name = 'event.service.line' + _description = "Event Management Line" + + service = fields.Selection( + [('', '')], string="Services", required=True, + help="List of the service that automatically adds to selection while" + " install service modules") + event_id = fields.Many2one('event.management', string="Event", + help="Name of the event") + date_from = fields.Datetime(string="Start Date", required=True, + help="Start date of service") + date_to = fields.Datetime(string="Date to", required=True, help="End date" + " of service") + amount = fields.Float(string="Amount", readonly=True, help="Amount") + state = fields.Selection([('done', 'Done'), ('pending', 'Pending')], + string="State", default="pending", + readonly=True, help="States of the each" + " service in service line") + currency_id = fields.Many2one('res.currency', string='Currency', + readonly=True, default=lambda self: + self.env.user.company_id.currency_id, + help="Default currency of the company") + invoiced = fields.Boolean(string="Invoiced", readonly=True, + help="Is this service invoiced") + related_product_id = fields.Many2one('product.product', + string="Related Product", + help="Select the related service " + "product") + _sql_constraints = [('event_supplier_unique', 'unique(event_id, service)', + 'Duplication Of Service In The Service Lines ' + 'Is not Allowed')] + + @api.constrains('date_from', 'date_to') + def _check_date_to_date_from(self): + """ Checking if end date less than start date + if yes: Show a validation error""" + for rec in self: + if rec.date_to < rec.date_from: + raise ValidationError(_('"Date to" cannot be set before ' + '"Date from".\n\n' + 'Check the "Date from" and "Date to" ' + 'of the "%s" service' % rec.service)) diff --git a/event_management/reports/__init__.py b/event_management/reports/__init__.py new file mode 100644 index 000000000..683e3f851 --- /dev/null +++ b/event_management/reports/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import event_management_reports diff --git a/event_management/reports/event_management_reports.py b/event_management/reports/event_management_reports.py new file mode 100644 index 000000000..390603123 --- /dev/null +++ b/event_management/reports/event_management_reports.py @@ -0,0 +1,73 @@ +"""Module for pdf data fetching and carry off pdf report data""" +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +import pytz +from odoo import api, fields, models +from odoo.exceptions import ValidationError + + +class ReportHotelManagement(models.AbstractModel): + """Class for fetch and carry off pdf data to template""" + _name = "report.event_management.report_event_management" + _description = "Event Management Report" + + @api.model + def _get_report_values(self, docids, data=None): + """ Get values for the report""" + form_data = data['form'] + where = '1=1' + if form_data['date_from'] and form_data['date_to'] \ + and form_data['date_from'] > form_data['date_to']: + raise ValidationError('From Date must be less than To Date') + if form_data["partner_id"]: + where += """AND e.partner_id = '%s'""" % \ + (form_data['partner_id'][0]) + if form_data['date_from']: + where += """AND e.date>='%s'""" % (form_data['date_from']) + if form_data['date_to']: + where += """AND e.date <= '%s'""" % (form_data['date_to']) + if form_data['type_event_ids']: + event_list = data['event_types'] + event_ids = f"({event_list[0]})" if len(event_list) == 1 else tuple( + event_list) + where += """AND e.type_of_event_id IN {}""".format(event_ids) + if form_data['event_state']: + where += """AND e.state = '%s'""" % (form_data['event_state']) + self.env.cr.execute(""" + SELECT e.name as event, t.name as type, r.name as partner, + e.state, e.date, + e.start_date, e.end_date + from event_management e inner join + res_partner r on e.partner_id = r.id + inner join event_management_type t on + e.type_of_event_id = t.id + where %s order by e.date""" % where) + rec = self.env.cr.dictfetchall() + return { + 'docs': rec, + 'docs2': form_data, + 'today_date': fields.datetime.strftime( + pytz.UTC.localize(fields.datetime. + now()).astimezone(pytz.timezone(self.env. + user.tz)), + "%d-%m-%Y %H:%M:%S") + } diff --git a/event_management/reports/event_management_reports.xml b/event_management/reports/event_management_reports.xml new file mode 100644 index 000000000..c8624e7c1 --- /dev/null +++ b/event_management/reports/event_management_reports.xml @@ -0,0 +1,11 @@ + + + + + Event Management Report + event.management + qweb-pdf + event_management.report_event_management + event_management.report_event_management + + diff --git a/event_management/reports/pdf_report_templates.xml b/event_management/reports/pdf_report_templates.xml new file mode 100644 index 000000000..d8096474e --- /dev/null +++ b/event_management/reports/pdf_report_templates.xml @@ -0,0 +1,97 @@ + + + + + diff --git a/event_management/security/event_management_security.xml b/event_management/security/event_management_security.xml new file mode 100644 index 000000000..2ecc87819 --- /dev/null +++ b/event_management/security/event_management_security.xml @@ -0,0 +1,26 @@ + + + + + Event Management + 19 + + + + Event Manager + + + + + + Event Manager see all Events + + [] + + + diff --git a/event_management/security/ir.model.access.csv b/event_management/security/ir.model.access.csv new file mode 100644 index 000000000..7f3a12f18 --- /dev/null +++ b/event_management/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_event_management_event_manager,access.event.management.event.manager,event_management.model_event_management,event_management.group_event_manager,1,1,1,1 +access_event_service_line_event_manager,access.event.service.line.event.manager,event_management.model_event_service_line,event_management.group_event_manager,1,1,1,1 +access_event_management_type_event_manager,access.event.management.type.event.manager,event_management.model_event_management_type,event_management.group_event_manager,1,1,1,1 +access_event_management_report_event_manager,access.event.management.report.event.manager,event_management.model_event_management_report,event_management.group_event_manager,1,1,1,1 diff --git a/event_management/static/description/assets/icons/check.png b/event_management/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/event_management/static/description/assets/icons/check.png differ diff --git a/event_management/static/description/assets/icons/chevron.png b/event_management/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/event_management/static/description/assets/icons/chevron.png differ diff --git a/event_management/static/description/assets/icons/cogs.png b/event_management/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/event_management/static/description/assets/icons/cogs.png differ diff --git a/event_management/static/description/assets/icons/consultation.png b/event_management/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/event_management/static/description/assets/icons/consultation.png differ diff --git a/event_management/static/description/assets/icons/ecom-black.png b/event_management/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/event_management/static/description/assets/icons/ecom-black.png differ diff --git a/event_management/static/description/assets/icons/education-black.png b/event_management/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/event_management/static/description/assets/icons/education-black.png differ diff --git a/event_management/static/description/assets/icons/hotel-black.png b/event_management/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/event_management/static/description/assets/icons/hotel-black.png differ diff --git a/event_management/static/description/assets/icons/license.png b/event_management/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/event_management/static/description/assets/icons/license.png differ diff --git a/event_management/static/description/assets/icons/lifebuoy.png b/event_management/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/event_management/static/description/assets/icons/lifebuoy.png differ diff --git a/event_management/static/description/assets/icons/logo.png b/event_management/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/event_management/static/description/assets/icons/logo.png differ diff --git a/event_management/static/description/assets/icons/manufacturing-black.png b/event_management/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/event_management/static/description/assets/icons/manufacturing-black.png differ diff --git a/event_management/static/description/assets/icons/pos-black.png b/event_management/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/event_management/static/description/assets/icons/pos-black.png differ diff --git a/event_management/static/description/assets/icons/puzzle.png b/event_management/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/event_management/static/description/assets/icons/puzzle.png differ diff --git a/event_management/static/description/assets/icons/restaurant-black.png b/event_management/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/event_management/static/description/assets/icons/restaurant-black.png differ diff --git a/event_management/static/description/assets/icons/service-black.png b/event_management/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/event_management/static/description/assets/icons/service-black.png differ diff --git a/event_management/static/description/assets/icons/trading-black.png b/event_management/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/event_management/static/description/assets/icons/trading-black.png differ diff --git a/event_management/static/description/assets/icons/training.png b/event_management/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/event_management/static/description/assets/icons/training.png differ diff --git a/event_management/static/description/assets/icons/update.png b/event_management/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/event_management/static/description/assets/icons/update.png differ diff --git a/event_management/static/description/assets/icons/user.png b/event_management/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/event_management/static/description/assets/icons/user.png differ diff --git a/event_management/static/description/assets/icons/wrench.png b/event_management/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/event_management/static/description/assets/icons/wrench.png differ diff --git a/event_management/static/description/assets/misc/categories.png b/event_management/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/event_management/static/description/assets/misc/categories.png differ diff --git a/event_management/static/description/assets/misc/check-box.png b/event_management/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/event_management/static/description/assets/misc/check-box.png differ diff --git a/event_management/static/description/assets/misc/compass.png b/event_management/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/event_management/static/description/assets/misc/compass.png differ diff --git a/event_management/static/description/assets/misc/corporate.png b/event_management/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/event_management/static/description/assets/misc/corporate.png differ diff --git a/event_management/static/description/assets/misc/customer-support.png b/event_management/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/event_management/static/description/assets/misc/customer-support.png differ diff --git a/event_management/static/description/assets/misc/cybrosys-logo.png b/event_management/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/event_management/static/description/assets/misc/cybrosys-logo.png differ diff --git a/event_management/static/description/assets/misc/features.png b/event_management/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/event_management/static/description/assets/misc/features.png differ diff --git a/event_management/static/description/assets/misc/logo.png b/event_management/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/event_management/static/description/assets/misc/logo.png differ diff --git a/event_management/static/description/assets/misc/pictures.png b/event_management/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/event_management/static/description/assets/misc/pictures.png differ diff --git a/event_management/static/description/assets/misc/pie-chart.png b/event_management/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/event_management/static/description/assets/misc/pie-chart.png differ diff --git a/event_management/static/description/assets/misc/right-arrow.png b/event_management/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/event_management/static/description/assets/misc/right-arrow.png differ diff --git a/event_management/static/description/assets/misc/star.png b/event_management/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/event_management/static/description/assets/misc/star.png differ diff --git a/event_management/static/description/assets/misc/support.png b/event_management/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/event_management/static/description/assets/misc/support.png differ diff --git a/event_management/static/description/assets/misc/whatsapp.png b/event_management/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/event_management/static/description/assets/misc/whatsapp.png differ diff --git a/event_management/static/description/assets/modules/fleet_car_workshop.jpg b/event_management/static/description/assets/modules/fleet_car_workshop.jpg new file mode 100644 index 000000000..f5c548538 Binary files /dev/null and b/event_management/static/description/assets/modules/fleet_car_workshop.jpg differ diff --git a/event_management/static/description/assets/modules/fleet_rental.png b/event_management/static/description/assets/modules/fleet_rental.png new file mode 100644 index 000000000..0fbbac883 Binary files /dev/null and b/event_management/static/description/assets/modules/fleet_rental.png differ diff --git a/event_management/static/description/assets/modules/front_office_management.png b/event_management/static/description/assets/modules/front_office_management.png new file mode 100644 index 000000000..73b3d7ac4 Binary files /dev/null and b/event_management/static/description/assets/modules/front_office_management.png differ diff --git a/event_management/static/description/assets/modules/insurance_management_cybro.png b/event_management/static/description/assets/modules/insurance_management_cybro.png new file mode 100644 index 000000000..3f5e0a43a Binary files /dev/null and b/event_management/static/description/assets/modules/insurance_management_cybro.png differ diff --git a/event_management/static/description/assets/modules/medical_lab_management.png b/event_management/static/description/assets/modules/medical_lab_management.png new file mode 100644 index 000000000..b19e4c65c Binary files /dev/null and b/event_management/static/description/assets/modules/medical_lab_management.png differ diff --git a/event_management/static/description/assets/modules/salon_management.png b/event_management/static/description/assets/modules/salon_management.png new file mode 100644 index 000000000..c54c3f001 Binary files /dev/null and b/event_management/static/description/assets/modules/salon_management.png differ diff --git a/event_management/static/description/assets/screenshots/1.png b/event_management/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..8e48b50cb Binary files /dev/null and b/event_management/static/description/assets/screenshots/1.png differ diff --git a/event_management/static/description/assets/screenshots/2.png b/event_management/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..59f7244ea Binary files /dev/null and b/event_management/static/description/assets/screenshots/2.png differ diff --git a/event_management/static/description/assets/screenshots/3.png b/event_management/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..3528e6a5e Binary files /dev/null and b/event_management/static/description/assets/screenshots/3.png differ diff --git a/event_management/static/description/assets/screenshots/5.png b/event_management/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..edf6be2c6 Binary files /dev/null and b/event_management/static/description/assets/screenshots/5.png differ diff --git a/event_management/static/description/assets/screenshots/7.png b/event_management/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..cedbc85e7 Binary files /dev/null and b/event_management/static/description/assets/screenshots/7.png differ diff --git a/event_management/static/description/assets/screenshots/8.png b/event_management/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..58010b22f Binary files /dev/null and b/event_management/static/description/assets/screenshots/8.png differ diff --git a/event_management/static/description/assets/screenshots/9.png b/event_management/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..4e16cd2e9 Binary files /dev/null and b/event_management/static/description/assets/screenshots/9.png differ diff --git a/event_management/static/description/assets/screenshots/evnt_catrng.png b/event_management/static/description/assets/screenshots/evnt_catrng.png new file mode 100644 index 000000000..ed5dd679b Binary files /dev/null and b/event_management/static/description/assets/screenshots/evnt_catrng.png differ diff --git a/event_management/static/description/assets/screenshots/hero.gif b/event_management/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..fcc2e4c2c Binary files /dev/null and b/event_management/static/description/assets/screenshots/hero.gif differ diff --git a/event_management/static/description/assets/screenshots/img4.png b/event_management/static/description/assets/screenshots/img4.png new file mode 100644 index 000000000..a655b583c Binary files /dev/null and b/event_management/static/description/assets/screenshots/img4.png differ diff --git a/event_management/static/description/assets/screenshots/inv.png b/event_management/static/description/assets/screenshots/inv.png new file mode 100644 index 000000000..a26f5dd7d Binary files /dev/null and b/event_management/static/description/assets/screenshots/inv.png differ diff --git a/event_management/static/description/assets/screenshots/inv2.png b/event_management/static/description/assets/screenshots/inv2.png new file mode 100644 index 000000000..7ac18f25a Binary files /dev/null and b/event_management/static/description/assets/screenshots/inv2.png differ diff --git a/event_management/static/description/assets/screenshots/pdf report.png b/event_management/static/description/assets/screenshots/pdf report.png new file mode 100644 index 000000000..ba8ed1271 Binary files /dev/null and b/event_management/static/description/assets/screenshots/pdf report.png differ diff --git a/event_management/static/description/assets/screenshots/services.png b/event_management/static/description/assets/screenshots/services.png new file mode 100644 index 000000000..ec5d40ed4 Binary files /dev/null and b/event_management/static/description/assets/screenshots/services.png differ diff --git a/event_management/static/description/banner.png b/event_management/static/description/banner.png new file mode 100644 index 000000000..ef86cd097 Binary files /dev/null and b/event_management/static/description/banner.png differ diff --git a/event_management/static/description/icon.png b/event_management/static/description/icon.png new file mode 100644 index 000000000..0d1a5efae Binary files /dev/null and b/event_management/static/description/icon.png differ diff --git a/event_management/static/description/index.html b/event_management/static/description/index.html new file mode 100644 index 000000000..3f76ba339 --- /dev/null +++ b/event_management/static/description/index.html @@ -0,0 +1,803 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.Sh +
+
+
+ +
+
+
+ +

+ Event Management +

+

+ Core Module for Managing Different Types Of Events +

+ + +
+
+
+
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ Event management is a core module which can manage any type of events. + The user can selectively download and install different service modules + to extend the scope of this module. The new service will be + automatically + get attached to this core Event management module. It is different from + Odoo's event module. Here you can manage different types of events and + allocate services to different users. Note: Presently we have released + the service 'Event Catering' under this module. New services are being + developed by our team. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ +
+ + Event Order. + + + + Can create new Event management orders. + +
+
+
+ +
+ + Automatically Service Orders. + + + + Service orders are automatically created on confirming event orders. + +
+
+
+ +
+ + Integrated with Accounting Module. + + + + Can create and view invoices based on services. + +
+
+
+ +
+ + Informative Dashboard + + + Event type related order count is visible and can see the event order + related to each type on clicking the type from Dashboard. + +
+
+
+ +
+ + Event Types. + + + User can configure new Event types and can delete the old ones. + Can configure types from the Dashboard itself. + +
+
+
+ +
+ + Reports + + + Event Management Report in Pdf and Xlsx is available. + +
+
+ +
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Event Management Dashboard View +

+

+ Dashboard view with all the event types and related order counts +

+ +
+
+

+ Event Order Kanban view +

+

+ Kanban view with Event Type image and Event Reference. +

+ +
+
+

+ Event Order Tree view +

+

+ Several details including Customer, Start Date and End Date, + State etc. +

+ +
+
+

+ Install Event Modules +

+

+ Install our event modules (event_catering) from odoo + app store to add option to service line. +

+ +
+
+

+ Event Order Form view +

+

+ In form view user can add the details of order and the services + to be provided. + Add services by clicking smart the button(Pending and Done + services + showing smart button). +

+ +
+
+

+ Services of Events +

+

+ Add services by clicking pending works showing smart button. +

+ +
+
+

+ Create Invoice +

+

+ Can create invoices after the services are done by clicking + CREATE INVOICE button. +

+ +

+ A Draft Invoice will be created for total amount in service + line. +

+ + +
+ +
+

+ Event Management Report +

+

+ Can print pdf and xlsx report with several details including + Customer, Event type, + State and also based on Dates. +

+ +
+
+

+ Pdf Report +

+

+ Pdf report with the Event order details based on the details + from Report. +

+ +
+
+

+ Excel Report +

+

+ Excel report with the Event order details based on the details + from Report. +

+ +
+
+

+ Event Type Form view +

+

+ Configure different Event type with name and Image. +

+ +
+
+

+ Event Type Tree view +

+

+ Tree view of Event type. +

+ +
+ +
+
+ + + +
+
+ +
+

+ Related + Products +

+
+
+
+ +
+
+ + + + +
+
+ +
+

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + +
+
+ +
+

Our + Industries +

+
+
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/event_management/static/img/event_type_image1.jpg b/event_management/static/img/event_type_image1.jpg new file mode 100644 index 000000000..208cf6045 Binary files /dev/null and b/event_management/static/img/event_type_image1.jpg differ diff --git a/event_management/static/img/event_type_image2.jpeg b/event_management/static/img/event_type_image2.jpeg new file mode 100644 index 000000000..c74b7c25f Binary files /dev/null and b/event_management/static/img/event_type_image2.jpeg differ diff --git a/event_management/static/img/event_type_image3.jpeg b/event_management/static/img/event_type_image3.jpeg new file mode 100644 index 000000000..c63d5de66 Binary files /dev/null and b/event_management/static/img/event_type_image3.jpeg differ diff --git a/event_management/static/img/event_type_image4.jpeg b/event_management/static/img/event_type_image4.jpeg new file mode 100644 index 000000000..e60d88943 Binary files /dev/null and b/event_management/static/img/event_type_image4.jpeg differ diff --git a/event_management/static/img/event_type_image5.jpeg b/event_management/static/img/event_type_image5.jpeg new file mode 100644 index 000000000..777a7eeba Binary files /dev/null and b/event_management/static/img/event_type_image5.jpeg differ diff --git a/event_management/static/img/event_type_image6.jpeg b/event_management/static/img/event_type_image6.jpeg new file mode 100644 index 000000000..686b70056 Binary files /dev/null and b/event_management/static/img/event_type_image6.jpeg differ diff --git a/event_management/static/img/event_type_image7.png b/event_management/static/img/event_type_image7.png new file mode 100644 index 000000000..7931ddc80 Binary files /dev/null and b/event_management/static/img/event_type_image7.png differ diff --git a/event_management/static/src/css/event_dashboard.css b/event_management/static/src/css/event_dashboard.css new file mode 100644 index 000000000..f7461404d --- /dev/null +++ b/event_management/static/src/css/event_dashboard.css @@ -0,0 +1,12 @@ +.style_event { + text-align: center; + flex: none !important; + background: none !important; + box-shadow: none !important; +} +.style_event_type { + text-align: center; + flex: none !important; + background: none !important; + box-shadow: none !important; +} diff --git a/event_management/static/src/js/action_manager.js b/event_management/static/src/js/action_manager.js new file mode 100644 index 000000000..4145d6f1a --- /dev/null +++ b/event_management/static/src/js/action_manager.js @@ -0,0 +1,19 @@ +/** @odoo-module **/ +import {registry} from "@web/core/registry"; +import framework from 'web.framework'; +import session from 'web.session'; +//Excel report handler +registry.category("ir.actions.report handlers").add("xlsx_handler", async (action) => { + if (action.report_type === 'xlsx') { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/xlsx_reports', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + } +}); diff --git a/event_management/views/event_management_type_views.xml b/event_management/views/event_management_type_views.xml new file mode 100644 index 000000000..63eb6c009 --- /dev/null +++ b/event_management/views/event_management_type_views.xml @@ -0,0 +1,124 @@ + + + + + event.management.type.view.kanban + event.management.type + kanban + + + + + + + +
+
+ +
+
+ +
+ Image +
+
+ + + Total Orders : + + + +
+
+
+
+
+
+
+
+ + + Dashboard + event.management.type + kanban,form + {} + + + + + + Event Types + event_type + + + + event.management.type.view.tree + event.management.type + + + + + + + + + event.management.type.view.form + event.management.type + +
+ +
+ +
+

+ +

+
+
+
+
+ + + Event type + event.management.type + ir.actions.act_window + tree,form + +

+ Click to add an event type. +

+

+ Here you can create different types of events. +

+
+
+ + + + +
diff --git a/event_management/views/event_management_views.xml b/event_management/views/event_management_views.xml new file mode 100644 index 000000000..6b3a44a70 --- /dev/null +++ b/event_management/views/event_management_views.xml @@ -0,0 +1,221 @@ + + + + + event.management.view.tree + event.management + + + + + + + + + + + + + + + event.management.view.kanban + event.management + + + + + +
+
+ + type + +
+
+
+ + + +
+
+
+
+ + + + + + + + event.management.view.form + event.management + +
+
+
+ +
+ +
+

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + event.management.view.search + event.management + + + + + + + + + + + + + + + + event.management.view.calendar + event.management + + + + + + + + + + + event.management.view.graph + event.management + + + + + + + + + + + Event Management + event.management + ir.actions.act_window + kanban,tree,form,calendar,graph + +

+ Click to add an event order. +

+

+ Here you can create and manage your events. +

+
+
+ + + + + + + + + diff --git a/event_management/wizards/__init__.py b/event_management/wizards/__init__.py new file mode 100644 index 000000000..27ebc8a1d --- /dev/null +++ b/event_management/wizards/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import event_management_report diff --git a/event_management/wizards/event_management_report.py b/event_management/wizards/event_management_report.py new file mode 100644 index 000000000..b08d8d4d3 --- /dev/null +++ b/event_management/wizards/event_management_report.py @@ -0,0 +1,194 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: MOHAMMED DILSHAD TK (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +import json +import pytz +from odoo import fields, models +from odoo.exceptions import ValidationError +from odoo.tools import date_utils, io, xlsxwriter + + +class EventManagementReport(models.TransientModel): + """Creates for event management report""" + _name = 'event.management.report' + _description = 'Event Management Report' + + date_from = fields.Date(string="From", help="Start date event") + date_to = fields.Date(string="To", help="End date of event") + partner_id = fields.Many2one('res.partner', string='Customer', + help="Choose a partner whose associated events" + " are to be displayed.") + type_event_ids = fields.Many2many('event.management.type', 'event_type_rel', + 'report_id', 'type_id', string="Type", + help="Type of event management") + event_state = fields.Selection( + [('draft', 'Draft'), ('confirm', 'Confirmed'), ('invoice', 'Invoiced'), + ('close', 'Close'), ('cancel', 'Canceled')], string="State", + help="Choose a state of the event") + + def action_print_pdf_report(self): + """Method for printing pdf report""" + type_select = self.type_event_ids.ids + data = { + 'model': 'event.management.report', + 'form': self.read()[0], + 'event_types': type_select + } + return self.env.ref( + 'event_management.report_event_management_action').report_action( + self, data=data) + + def action_print_xls_report(self): + """Method of button for printing xlsx report""" + rec = self.env.user.sudo().company_id + if self.date_from and self.date_to and self.date_from > self.date_to: + raise ValidationError('From Date must be less than To Date') + current = pytz.UTC.localize(fields.datetime.now()).astimezone(pytz. + timezone(self.env.user.tz)) + data = { + 'event_type': self.type_event_ids.ids, + 'date_from': self.date_from, + 'date_to': self.date_to, + 'customer': self.partner_id.id, + 'state': self.event_state, + 'today_date': current, + 'company': [rec.partner_id.name, rec.street, rec.favicon] + } + return { + 'type': 'ir.actions.report', + 'report_type': 'xlsx', + 'data': {'model': 'event.management.report', + 'output_format': 'xlsx', + 'options': json.dumps(data, + default=date_utils.json_default), + 'report_name': 'Event Management Report', }, + } + + def get_xlsx_report(self, data, response): + """Method for fetching data and printing xlsx report from controller""" + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + head = workbook.add_format({'align': 'center', + 'bold': True, 'font_size': '20px'}) + cell_head_format = workbook.add_format({'font_size': '12px'}) + cell_data_format = workbook.add_format({'font_size': '10px'}) + txt_head = workbook.add_format({'font_size': '10px', 'border': 2}) + txt = workbook.add_format({'font_size': '10px', 'border': 2}) + sheet.merge_range('F2:M3', 'EVENT MANAGEMENT REPORT', head) + sheet.merge_range('B4:E4', data['company'][0], cell_head_format) + sheet.merge_range('B5:E5', data['company'][1], cell_head_format) + sheet.write('B6', 'Date:', cell_head_format) + sheet.merge_range('C6:E6', data['today_date'], cell_data_format) + if data['date_from'] and data['date_to'] and data['customer']: + customer_name = self.env['res.partner'].browse(int( + data['customer'])).name + sheet.write('B8', 'From:', cell_head_format) + sheet.merge_range('C8:D8', data['date_from'], cell_data_format) + sheet.write('F8', 'To:', cell_head_format) + sheet.merge_range('G8:H8', data['date_to'], cell_data_format) + sheet.merge_range('J8:K8', 'Customer:', cell_head_format) + sheet.merge_range('L8:N8', customer_name, cell_data_format) + elif data['date_from'] and data['date_to']: + sheet.write('B8', 'From:', cell_head_format) + sheet.merge_range('C8:D8', data['date_from'], + cell_data_format) + sheet.write('F8', 'To:', cell_head_format) + sheet.merge_range('G8:H8', data['date_to'], cell_data_format) + elif data['date_from'] and data['customer']: + customer_name = self.env['res.partner'].browse(int( + data['customer'])).name + sheet.write('B8', 'From:', cell_head_format) + sheet.merge_range('C8:D8', data['date_from'], cell_data_format) + sheet.merge_range('F8:G8', 'Customer:', cell_head_format) + sheet.merge_range('H8:J8', customer_name, cell_data_format) + elif data['customer'] and data['date_to']: + customer_name = self.env['res.partner'].browse(int( + data['customer'])).name + sheet.write('B8', 'To:', cell_head_format) + sheet.merge_range('C8:D8', data['date_to'], cell_data_format) + sheet.merge_range('F8:G8', 'Customer:', cell_head_format) + sheet.merge_range('H8:J8', customer_name, cell_data_format) + elif data['date_from']: + sheet.write('B8', 'From:', cell_head_format) + sheet.merge_range('C8:D8', data['date_from'], cell_data_format) + elif data['date_to']: + sheet.write('B8', 'To:', cell_head_format) + sheet.merge_range('C8:D8', data['date_to'], cell_data_format) + elif data['customer']: + customer_name = self.env['res.partner'].browse(int( + data['customer'])).name + sheet.merge_range('B8:C8', 'Customer:', cell_head_format) + sheet.merge_range('D8:E8', customer_name, cell_data_format) + sheet.write(10, 0, 'Sl.no', txt_head) + sheet.merge_range('B11:E11', 'Name', txt_head) + sheet.merge_range('F11:H11', 'Type', txt_head) + sheet.merge_range('I11:K11', 'Customer', txt_head) + sheet.merge_range('L11:M11', 'Register Date', txt_head) + sheet.merge_range('N11:O11', 'Start Date', txt_head) + sheet.merge_range('P11:Q11', 'End Date', txt_head) + sheet.write(10, 17, 'State', txt_head) + where = '1=1' + if data["customer"]: + where += """AND e.partner_id = %s""" % int(data['customer']) + if data['date_from']: + where += """AND e.date>='%s'""" % (data['date_from']) + if data['date_to']: + where += """AND e.date <= '%s'""" % (data['date_to']) + if data['event_type']: + event_list = data['event_type'] + event_ids = f"({event_list[0]})" if len( + event_list) == 1 else tuple(event_list) + where += """AND e.type_of_event_id IN {}""".format(event_ids) + if data['state']: + where += """AND e.state = '%s'""" % (data['state']) + self.env.cr.execute(""" + SELECT e.name as event, t.name as type, r.name as partner, + e.state, e.date, + e.start_date, e.end_date + from event_management e inner join + res_partner r on e.partner_id = r.id + inner join event_management_type t on + e.type_of_event_id = t.id + where %s order by e.date""" % where) + datas = self.env.cr.fetchall() + row = 11 + col = 1 + for i in range(0, len(datas)): + sheet.write(row, 0, col, txt) + sheet.merge_range('B%d:E%d' % (row + 1, row + 1), datas[i][0], txt) + sheet.merge_range('F%d:H%d' % (row + 1, row + 1), datas[i][1], txt) + sheet.merge_range('I%d:K%d' % (row + 1, row + 1), datas[i][2], txt) + sheet.merge_range('L%d:M%d' % (row + 1, row + 1), + fields.Date.to_string(datas[i][4]), txt) + sheet.merge_range('N%d:O%d' % (row + 1, row + 1), + fields.Datetime.to_string(datas[i][5]), txt) + sheet.merge_range('P%d:Q%d' % (row + 1, row + 1), + fields.Datetime.to_string(datas[i][6]), txt) + sheet.write(row, 17, + dict(self.env['event.management']._fields[ + 'state'].selection).get(datas[i][3]), txt) + row += 1 + col += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/event_management/wizards/event_management_report_views.xml b/event_management/wizards/event_management_report_views.xml new file mode 100644 index 000000000..88bff20ee --- /dev/null +++ b/event_management/wizards/event_management_report_views.xml @@ -0,0 +1,51 @@ + + + + + event.management.report.view.form + event.management.report + +
+ + + + + + + + + + + +
+
+
+
+
+ + + Event Management Report + ir.actions.act_window + event.management.report + form + + new + + + + + + + +