diff --git a/event_management/README.rst b/event_management/README.rst new file mode 100644 index 000000000..28b5cb7a1 --- /dev/null +++ b/event_management/README.rst @@ -0,0 +1,33 @@ +==================== +Event Management v-16 +==================== +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 creation. +* Automatically creates service orders. +* Allocate the services to different users. +* Integrated with Accounting module. +* Simple Workflow. +* Attractive Design. + +Contributors +============ + +* (Odoo 14) Avinash Nk +* (Odoo 16) Robin K + + +Maintainer +========== + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com diff --git a/event_management/__init__.py b/event_management/__init__.py new file mode 100644 index 000000000..1079f65f0 --- /dev/null +++ b/event_management/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import models +from . import reports +from . import wizards +from . import controllers diff --git a/event_management/__manifest__.py b/event_management/__manifest__.py new file mode 100644 index 000000000..444e3d94f --- /dev/null +++ b/event_management/__manifest__.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +{ + 'name': 'Event Management', + 'version': '16.0.1.0.0', + 'summary': """Core Module for Managing Different Types Of Events.""", + 'description': """Core Module for Managing Different Types Of Events""", + "category": "Industry", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['product', 'account'], + 'data': ['security/event_security.xml', + 'security/ir.model.access.csv', + 'views/event_management_view.xml', + 'views/event_type_view.xml', + 'views/dashboard.xml', + 'data/event_management.xml', + 'reports/event_management_pdf_report.xml', + 'reports/pdf_report_template.xml', + 'wizards/event_management_wizard.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, + 'application': True, +} diff --git a/event_management/controllers/__init__.py b/event_management/controllers/__init__.py new file mode 100644 index 000000000..a7037b5b3 --- /dev/null +++ b/event_management/controllers/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import main diff --git a/event_management/controllers/main.py b/event_management/controllers/main.py new file mode 100644 index 000000000..d20b4a4f8 --- /dev/null +++ b/event_management/controllers/main.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +"""Controller for xlsx report""" +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) + token = 'dummy-because-api-expects-one' + 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.xml b/event_management/data/event_management.xml new file mode 100644 index 000000000..f9edf8ad5 --- /dev/null +++ b/event_management/data/event_management.xml @@ -0,0 +1,40 @@ + + + + + + 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..ca4c5cf3a --- /dev/null +++ b/event_management/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module + +#### 24.11.2022 +#### Version 16.0.1.0.0 +#### Module Migrated diff --git a/event_management/models/__init__.py b/event_management/models/__init__.py new file mode 100644 index 000000000..3a63b9a05 --- /dev/null +++ b/event_management/models/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import event_management diff --git a/event_management/models/event_management.py b/event_management/models/event_management.py new file mode 100644 index 000000000..f7e0c4e00 --- /dev/null +++ b/event_management/models/event_management.py @@ -0,0 +1,269 @@ +# -*- coding: utf-8 -*- +"""Event Management""" +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from ast import literal_eval +from odoo import models, fields, api, _ +from odoo.exceptions import UserError, ValidationError + + +class EventManagement(models.Model): + """Model for managing Event Management""" + _name = 'event.management' + + name = fields.Char('Name', readonly=True, copy=False) + ref = fields.Char(string='Ref', readonly=True) + type_of_event_id = fields.Many2one('event.management.type', string="Type", + required=True) + partner_id = fields.Many2one('res.partner', string="Customer", + required=True) + date = fields.Date(string="Date", default=fields.Date.today, required=True) + start_date = fields.Datetime(string="Start date", + default=lambda self: fields.datetime.now(), + required=True) + end_date = fields.Datetime(string="End date", required=True) + service_line_ids = fields.One2many('event.service.line', 'event_id', + string="Services") + state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirmed'), + ('invoice', 'Invoiced'), + ('close', 'Close'), ('cancel', 'Canceled')], + string="State", default="draft") + note = fields.Text('Terms and conditions') + price_subtotal = fields.Float(string='Total', + compute='_compute_price_subtotal', + readonly=True, store=True) + image = fields.Binary("Image", attachment=True, + help="This field holds the image used as image for " + "the event, limited to 1080x720px.") + currency_id = fields.Many2one('res.currency', readonly=True, + default=lambda self: + self.env.user.company_id.currency_id) + invoice_count = fields.Integer(string='# of Invoices') + invoice_ids = fields.Many2many("account.move", string='Invoices', + copy=False) + pending_invoice = fields.Boolean(string="Invoice Pending", + compute='_compute_pending_invoice') + + @api.depends('service_line_ids', 'service_line_ids.state') + def _compute_pending_invoice(self): + pending = 0 + for lines in self.service_line_ids: + if lines.invoiced is False and lines.state == "done": + pending = 1 + if pending == 1: + self.pending_invoice = True + else: + self.pending_invoice = False + + @api.depends('service_line_ids', 'service_line_ids.amount') + def _compute_price_subtotal(self): + total = 0 + for items in self.service_line_ids: + total += items.amount + self.price_subtotal = total + + @api.model + def create(self, values): + """Crete method for sequencing and checking dates while creating""" + start_date = values['start_date'] + end_date = values['end_date'] + partner_name = self.env['res.partner'].browse(values['partner_id']).name + event_name = self.env['event.management.type'].browse( + values['type_of_event_id']).name + if start_date >= end_date: + raise UserError(_('Start date must be less than End date')) + + name = '%s-%s-%s' % (partner_name, event_name, values['date']) + values['name'] = name + sequence_code = 'event.order.sequence' + sequence_number = self.env['ir.sequence'].next_by_code(sequence_code) + values['ref'] = 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: + invoice = self.env['account.move'] + move_type = 'out_invoice' + invoice = invoice.with_context(default_move_type=move_type) + journal_id = invoice._compute_journal_id() + company_id = self.env.user.company_id.id + inv_obj = self.env['account.move'] + partner = self.partner_id + for records in product_line: + product_id = records['product_id'] + price_unit = records['price_unit'] + 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': 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': move_type, + 'ref': self.name, + 'bank_partner_id': partner.property_account_payable_id.id, + 'partner_id': partner.id, + 'payment_reference': self.name, + 'company_id': company_id, + 'invoice_line_ids': payment_list, + } + inv_id = inv_obj.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 + + +class EventServiceLine(models.Model): + """Model to manage the service lines of the event management""" + _name = 'event.service.line' + + service = fields.Selection([('', '')], string="Services", + required=True) + event_id = fields.Many2one('event.management', string="Event") + date_from = fields.Datetime(string="Date from", required=True) + date_to = fields.Datetime(string="Date to", required=True) + amount = fields.Float(string="Amount", readonly=True) + state = fields.Selection([('done', 'Done'), ('pending', 'Pending')], + string="State", default="pending", + readonly=True) + currency_id = fields.Many2one('res.currency', readonly=True, + default=lambda self: + self.env.user.company_id.currency_id) + invoiced = fields.Boolean(string="Invoiced", readonly=True) + related_product_id = fields.Many2one('product.product', + string="Related 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): + 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)) + + +class EventManagementType(models.Model): + """Model for managing the Event types""" + _name = 'event.management.type' + + name = fields.Char(string="Name") + image = fields.Binary("Image", attachment=True, + help="This field holds the image used as " + "image for the event, limited to 1080x720px.") + event_count = fields.Integer(string="# of Events", + compute='_compute_event_count') + + def _compute_event_count(self): + for records in self: + events = self.env['event.management'].search([ + ('type_of_event_id', '=', records.id)]) + records.event_count = len(events) + + def _get_action(self, action_xml_id): + 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): + return self._get_action( + 'event_management.event_management_action_view_kanban') diff --git a/event_management/reports/__init__.py b/event_management/reports/__init__.py new file mode 100644 index 000000000..69cdcf855 --- /dev/null +++ b/event_management/reports/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import event_management_pdf_report diff --git a/event_management/reports/event_management_pdf_report.py b/event_management/reports/event_management_pdf_report.py new file mode 100644 index 000000000..a741707ee --- /dev/null +++ b/event_management/reports/event_management_pdf_report.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +"""Module for pdf data fetching and carry off pdf report data""" +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +import pytz +import datetime +from odoo import fields, models, api +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): + 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() + user_tz = self.env.user.tz + current = pytz.UTC.localize(fields.datetime.now()) + current = current.astimezone(pytz.timezone(user_tz)) + current = datetime.datetime.strftime(current, "%d-%m-%Y %H:%M:%S") + return { + 'docs': rec, + 'docs2': form_data, + 'today_date': current + } diff --git a/event_management/reports/event_management_pdf_report.xml b/event_management/reports/event_management_pdf_report.xml new file mode 100644 index 000000000..f5c434669 --- /dev/null +++ b/event_management/reports/event_management_pdf_report.xml @@ -0,0 +1,10 @@ + + + + Event Management Report + event.management + qweb-pdf + event_management.report_event_management + event_management.report_event_management + + \ No newline at end of file diff --git a/event_management/reports/pdf_report_template.xml b/event_management/reports/pdf_report_template.xml new file mode 100644 index 000000000..251bed336 --- /dev/null +++ b/event_management/reports/pdf_report_template.xml @@ -0,0 +1,91 @@ + + + + \ No newline at end of file diff --git a/event_management/security/event_security.xml b/event_management/security/event_security.xml new file mode 100644 index 000000000..37af66e76 --- /dev/null +++ b/event_management/security/event_security.xml @@ -0,0 +1,23 @@ + + + + + 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..2a1b16c49 --- /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,event.management.event.manager,event_management.model_event_management,event_management.group_event_manager,1,1,1,1 +access_event_service_line_event_manager,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,event.management.type.event.manager,event_management.model_event_management_type,event_management.group_event_manager,1,1,1,1 +access_event_management_wizard_event_manager,event.management.wizard.event.manager,event_management.model_event_management_wizard,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/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/1.png b/event_management/static/description/assets/modules/1.png new file mode 100644 index 000000000..5238bdeab Binary files /dev/null and b/event_management/static/description/assets/modules/1.png differ diff --git a/event_management/static/description/assets/modules/2.png b/event_management/static/description/assets/modules/2.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/event_management/static/description/assets/modules/2.png differ diff --git a/event_management/static/description/assets/modules/3.png b/event_management/static/description/assets/modules/3.png new file mode 100644 index 000000000..3c3ff1afb Binary files /dev/null and b/event_management/static/description/assets/modules/3.png differ diff --git a/event_management/static/description/assets/modules/4.png b/event_management/static/description/assets/modules/4.png new file mode 100644 index 000000000..3fae4631e Binary files /dev/null and b/event_management/static/description/assets/modules/4.png differ diff --git a/event_management/static/description/assets/modules/5.gif b/event_management/static/description/assets/modules/5.gif new file mode 100644 index 000000000..2a5f8e659 Binary files /dev/null and b/event_management/static/description/assets/modules/5.gif differ diff --git a/event_management/static/description/assets/modules/6.png b/event_management/static/description/assets/modules/6.png new file mode 100644 index 000000000..7f2815273 Binary files /dev/null and b/event_management/static/description/assets/modules/6.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot1.png b/event_management/static/description/assets/screenshots/Screenshot1.png new file mode 100644 index 000000000..3c7d28ed7 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot1.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot2.png b/event_management/static/description/assets/screenshots/Screenshot2.png new file mode 100644 index 000000000..5e62337d7 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot2.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot3.png b/event_management/static/description/assets/screenshots/Screenshot3.png new file mode 100644 index 000000000..c3e607138 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot3.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot4.png b/event_management/static/description/assets/screenshots/Screenshot4.png new file mode 100644 index 000000000..18bf61e97 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot4.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot5.png b/event_management/static/description/assets/screenshots/Screenshot5.png new file mode 100644 index 000000000..127d84c21 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot5.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot6.png b/event_management/static/description/assets/screenshots/Screenshot6.png new file mode 100644 index 000000000..5c8aea46f Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot6.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot7.png b/event_management/static/description/assets/screenshots/Screenshot7.png new file mode 100644 index 000000000..56dec95f1 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot7.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot8.png b/event_management/static/description/assets/screenshots/Screenshot8.png new file mode 100644 index 000000000..74c6bf6d5 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot8.png differ diff --git a/event_management/static/description/assets/screenshots/Screenshot9.png b/event_management/static/description/assets/screenshots/Screenshot9.png new file mode 100644 index 000000000..4cba1c597 Binary files /dev/null and b/event_management/static/description/assets/screenshots/Screenshot9.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..1c67a72be Binary files /dev/null and b/event_management/static/description/assets/screenshots/hero.gif differ diff --git a/event_management/static/description/banner.png b/event_management/static/description/banner.png new file mode 100644 index 000000000..b2fea5e78 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..c3530a7e5 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..e563a7764 --- /dev/null +++ b/event_management/static/description/index.html @@ -0,0 +1,769 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ + + +

+ Event Management System +

+

+ A Module for managing 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 and end date, state etc. +

+ +
+
+

+ Event order Form view +

+

+ In form view user can add the details of order and the services to be provided. +

+ +
+
+

+ Event Management Report wizard +

+

+ 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 wizard. +

+ +
+
+

+ Excel Report +

+

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

+ +
+
+

+ 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..31c4cc30c --- /dev/null +++ b/event_management/static/src/js/action_manager.js @@ -0,0 +1,21 @@ +/** @odoo-module **/ + +import {registry} from "@web/core/registry"; +import { download } from "@web/core/network/download"; +import framework from 'web.framework'; +import session from 'web.session'; + +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/dashboard.xml b/event_management/views/dashboard.xml new file mode 100644 index 000000000..951f8bc78 --- /dev/null +++ b/event_management/views/dashboard.xml @@ -0,0 +1,62 @@ + + + + + event.management.type.view.kanban + event.management.type + kanban + + + + + + + +
+
+ +
+
+
+ +

+
+
+
+ Image +
+
+ + Total Orders : + + +
+
+
+
+
+
+ +
+
+ + + Dashboard + event.management.type + kanban,form + {} + + + + + + Event Types + event_type + +
+
diff --git a/event_management/views/event_management_view.xml b/event_management/views/event_management_view.xml new file mode 100644 index 000000000..bc5503680 --- /dev/null +++ b/event_management/views/event_management_view.xml @@ -0,0 +1,199 @@ + + + + + + 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/views/event_type_view.xml b/event_management/views/event_type_view.xml new file mode 100644 index 000000000..123acd6dc --- /dev/null +++ b/event_management/views/event_type_view.xml @@ -0,0 +1,52 @@ + + + + + + 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. +

+
+
+ + + + +
+
\ No newline at end of file diff --git a/event_management/wizards/__init__.py b/event_management/wizards/__init__.py new file mode 100644 index 000000000..188fd88e6 --- /dev/null +++ b/event_management/wizards/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import event_management_wizard diff --git a/event_management/wizards/event_management_wizard.py b/event_management/wizards/event_management_wizard.py new file mode 100644 index 000000000..5342278bf --- /dev/null +++ b/event_management/wizards/event_management_wizard.py @@ -0,0 +1,194 @@ +# -*- coding: utf-8 -*- +"""Wizard for pdf and xlsx reports""" +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# 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 HotelManagementWizard(models.TransientModel): + """Class for wizard""" + _name = 'event.management.wizard' + _description = 'Event Management Wizard' + + date_from = fields.Date(string="From") + date_to = fields.Date(string="To") + partner_id = fields.Many2one('res.partner', string='Customer') + type_event_ids = fields.Many2many('event.management.type', 'event_type_rel', + 'report_id', 'type_id', string="Type") + event_state = fields.Selection( + [('draft', 'Draft'), ('confirm', 'Confirmed'), ('invoice', 'Invoiced'), + ('close', 'Close'), ('cancel', 'Canceled')], string="State") + + def print_pdf_report(self): + """Method for printing pdf report""" + type_select = self.type_event_ids.ids + data = { + 'model': 'event.management.wizard', + 'form': self.read()[0], + 'event_types': type_select + } + return self.env.ref( + 'event_management.action_event_management_report').report_action( + self, data=data) + + def 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') + user_tz = self.env.user.tz + current = fields.datetime.now() + current = pytz.UTC.localize(current) + current = current.astimezone(pytz.timezone(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.wizard', + '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', '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) + rec = self.env.cr.fetchall() + j = 11 + k = 1 + for i in range(0, len(rec)): + sheet.write(j, 0, k, txt) + sheet.merge_range('B%d:E%d' % (j + 1, j + 1), rec[i][0], txt) + sheet.merge_range('F%d:H%d' % (j + 1, j + 1), rec[i][1], txt) + sheet.merge_range('I%d:K%d' % (j + 1, j + 1), rec[i][2], txt) + sheet.merge_range('L%d:M%d' % (j + 1, j + 1), + fields.Date.to_string(rec[i][4]), txt) + sheet.merge_range('N%d:O%d' % (j + 1, j + 1), + fields.Datetime.to_string(rec[i][5]), txt) + sheet.merge_range('P%d:Q%d' % (j + 1, j + 1), + fields.Datetime.to_string(rec[i][6]), txt) + sheet.write(j, 17, + dict(self.env['event.management']._fields[ + 'state'].selection).get(rec[i][3]), txt) + j += 1 + k += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/event_management/wizards/event_management_wizard.xml b/event_management/wizards/event_management_wizard.xml new file mode 100644 index 000000000..522da15e3 --- /dev/null +++ b/event_management/wizards/event_management_wizard.xml @@ -0,0 +1,48 @@ + + + + event.management.wizard.view.form + event.management.wizard + +
+ + + + + + + + + + + +
+
+
+
+
+ + + Event Management Report + ir.actions.act_window + event.management.wizard + form + + new + + + + + + + +