diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..511a0ca --- /dev/null +++ b/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import controllers +from . import models \ No newline at end of file diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..4f36385 --- /dev/null +++ b/__manifest__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +{ + 'name': "sql_dashboard", + + 'summary': """ + Short (1 phrase/line) summary of the module's purpose, used as + subtitle on modules listing or apps.openerp.com""", + + 'description': """ + Long description of module's purpose + """, + + 'author': "My Company", + 'website': "https://www.yourcompany.com", + + # Categories can be used to filter modules in modules listing + # Check https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/data/ir_module_category_data.xml + # for the full list + 'category': 'Uncategorized', + 'version': '0.1', + + # any module necessary for this one to work correctly + 'depends': ['base', 'board'], + + # always loaded + 'data': [ + 'security/ir.model.access.csv', + 'views/dashboard_main_view.xml', + 'views/dashboard.xml', + ], + # only loaded in demonstration mode + 'demo': [ + 'demo/demo.xml', + ], + + 'installable': True, + 'application': True +} diff --git a/api/export.csv b/api/export.csv new file mode 100644 index 0000000..090efee --- /dev/null +++ b/api/export.csv @@ -0,0 +1,61 @@ +Number,Subject,Status,Ticket Priority,Ticket Creator,Team Name,First Name,Last Name,Date Created +751105,Report Creation for all Books under the Group,Open,high,Mark Bartolome, Acumatica Support,Rico ,Ybanez,2023/03/09 +685327,Audit History for Transactions On-hold,Open,emergency,Mark Bartolome, Acumatica Support,Rico ,Ybanez,2023/04/03 +567174,Repair of CCTV Line,Open,high,Erwin Isip,Billing,Steffany,Maala,2023/05/18 +813312,High voltage of electricity in McKinley ,Open,high,Ivy Balicat,,Troy,Soliven,2023/09/06 +721494,Renaming lights of smart controller in the system in Dasma ,Open,high,Ivy Balicat,,Newton Jr.,Sanchez,2023/09/13 +719916,Check for the CCTV,Open,emergency,Reisem Gumamit,,Emmanuel,Novero,2023/10/02 +942657,CCTV defective,Open,emergency,arnel llarenas,,Troy,Soliven,2023/10/03 +119032,Request for CCTV record,Open,high,NORIEL ADRIAN VILLANUEVA ALVARAN,,Cesario,Becite,2023/10/19 +956055,Relocate CCTV,Open,emergency,arnel llarenas,,Troy,Soliven,2023/11/12 +975620,Request for Input Module,Open,normal,Hanze Rocel De Asis,,Troy,Soliven,2023/11/21 +388969,LED Posting,Open,high,John Benedict Cheng,,Steffany,Maala,2023/11/21 +698909,Programming and Release/Withdrawal of Strobelights at 18th Floor,Open,high,Hanze Rocel De Asis,,Troy,Soliven,2023/12/01 +207389,BIOMETRICS INSTALLATION,Open,high,cyrrine vera cruz,,Troy,Soliven,2023/12/05 +668765,Turnstile Specifications and Manual,Open,normal,Hanze Rocel De Asis,,Troy,Soliven,2023/12/13 +444861,VMS,Open,normal,remer jalbuna,,Bryan,Del Rosario,2023/12/28 +412610,CCTV NO DISPLAY AND VIEWING ,Open,normal,Angelina Elma,,Troy,Soliven,2024/01/09 +561157,LAPTOP BLINKING SCREEN,Open,high,ELMER MISLANG,,Steffany,Maala,2024/01/10 +519419,REPLACEMENT OF A NEW LAPTOP,Open,emergency,Shelly Ann Jade Vicente,,Angelo Chrismond,Gatela,2024/01/10 +248854,XRay Baggage Machine and Metal Detectors Manuals,Open,normal,Hanze Rocel De Asis,,Troy,Soliven,2024/01/12 +640596,FLTC and OTC Requests,Open,high,Phoebe Godinez,,Newton Jr.,Sanchez,2024/01/15 +379197,Dasma Manual,Open,high,Ivy Balicat,,Newton Jr.,Sanchez,2024/01/15 +315647,Facilitate Repair for Sheehan Ipad.,Open,high,Ivy Balicat,,Newton Jr.,Sanchez,2024/01/15 +344863,Additional Switch at PIVI 12 FLR AUDIT TEAM,Open,high,Angelina Elma,,Cesario,Becite,2024/01/16 +144927,Enhancement in VMS,Open,high,remer jalbuna,,Bryan,Del Rosario,2024/01/17 +214245,CCTV Installation,Open,normal,Hanze Rocel De Asis,,Troy,Soliven,2024/01/17 +909671,FDAS Testing,Open,normal,Hanze Rocel De Asis,,Troy,Soliven,2024/01/17 +308968,Control Panel of Winery,Open,high,Ivy Balicat,,Newton Jr.,Sanchez,2024/01/18 +325193,Oval Conference Table Setup,Open,high,Arthur A. Manero,,Troy,Soliven,2024/01/18 +306150,Cannot access outlook email and hris password,Open,emergency,Meralyn O Masendo,,Steffany,Maala,2024/01/19 +741981,Hris Concern,Open,normal,Dereign BaƱadera ,,Arjay,Lumagdong,2024/01/23 +231332,Telephony Specifications for PMI,Open,normal,Dexter Catampatan,,Cesario,Becite,2024/01/24 +676605,New hire attendance in HRIS,Open,normal,Scarlet Onde Cuarenta,,Arjay,Lumagdong,2024/01/24 +402550,LAN Activation,Open,high,Angelina Elma,,Cesario,Becite,2024/01/25 +390235,update of HRIS leave credits,Open,high,Manilyn Taripe,,Angelo Chrismond,Gatela,2024/01/25 +256165,update of HRIS leave credits,Open,high,Manilyn Taripe,,,,2024/01/25 +245249,CCTV Footage,Open,emergency,NORIEL ADRIAN VILLANUEVA ALVARAN,,Cesario,Becite,2024/01/25 +140997,Netwwork issues I LAN Activation I Sales bidding department,Open,emergency,Angelina Elma,,Cesario,Becite,2024/01/26 +458637,Calling Card Design and Printing for FLTC,Open,emergency,Phoebe Godinez,,Obanana ,Corp,2024/01/26 +331085,Internet Connection,Open,normal,Erlei G. Haling,,Steffany,Maala,2024/01/29 +296532,Testing of Board Room Table,Open,normal,Tiffany Bello,,Cesario,Becite,2024/01/30 +716743,Request File Repository on NAS,Open,normal,Rico P. Ybanez,,Cesario,Becite,2024/01/30 +528127,Request of MOA for Telecom Providers,Open,normal,Ma. Geraldine J. Gaan,,Cesario,Becite,2024/01/31 +373375, LED Lobby Video Display and Turnstile Issues proactive ticket,Open,normal,Troy U. Soliven,,Cesario,Becite,2024/01/31 +838717,Laptop Deployment,Open,normal,Ronamae Caraos,,Angelo Chrismond,Gatela,2024/01/31 +232510,Request for OHP Use,Open,normal,Ma. Eula E. Espe,,,,2024/01/31 +415726,Additional on VMS ,Open,high,remer jalbuna,,Bryan,Del Rosario,2024/02/01 +108894,PERFORMANCE MANAGEMENT ,Open,high,Leslie Ann Tapang,,Arjay,Lumagdong,2024/02/12 +497102,Turnstile X-Ray Baggage Scanner & Metal Detector Additional Informations,Open,normal,Hanze Rocel De Asis,,Cesario,Becite,2024/02/01 +223106,Motorpool,Open,normal,Michael Angelo Cacho,,Newton Jr.,Sanchez,2024/02/02 +155767,CCTV NO DISPLAY AT MANILA WATER,Open,normal,Angelina Elma,,Troy,Soliven,2024/02/06 +106976,CANCELLATION OF APPROVED LEAVE,Open,normal,Ronamae Caraos,,Arjay,Lumagdong,2024/02/08 +157712,HRIS Leave Balance,Open,normal,Rommel Q. Rondolo,,Arjay,Lumagdong,2024/02/08 +867954,acumatica account,Open,high,Aliana Mariah A. Coronel,,,,2024/02/09 +887001,HRIS concerns,Open,normal,cindy lara,,Bryan,Del Rosario,2024/02/11 +375421,Product activation Failed of Laptop of Jalbey Porras,Open,high,Ma. Geraldine J. Gaan,,Angelo Chrismond,Gatela,2024/02/12 +606488,OJT Evaluation,Open,normal,Arlene Dela Torre,,Cesario,Becite,2024/02/12 +568165,Sound system and Microphone,Open,normal,Ronamae Caraos,,Cesario,Becite,2024/02/12 +797129,HRIS LEAVE CREDITS,Open,high,Aileen A. Japa,,,,2024/02/12 +457967,Excel not working,Open,emergency,Marvin L. Paulo,,Angelo Chrismond,Gatela,2024/02/12 +555972,Request to Update Sick Leave Credit,Open,high,Erika Jane Alcantara,,Arjay,Lumagdong,2024/02/13 diff --git a/api/get_csv.py b/api/get_csv.py new file mode 100644 index 0000000..d49155c --- /dev/null +++ b/api/get_csv.py @@ -0,0 +1,47 @@ +import csv +import xmlrpc.client +from datetime import datetime + +url='http://172.22.0.3:8069' +db = 'erp.obanana.com' +username = 'webdev@obanana.com' +password = 'P@$$w0rd!' + +common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url)) +uid = common.authenticate(db, username, password, {}) +if uid: + models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url)) + + model_name = 'dashboard.main' + + # Get a list of all record ids in the model + record_ids = models.execute_kw(db, uid, password, model_name, 'search', [[]]) + + # Delete each record using the unlink method + for record_id in record_ids: + models.execute_kw(db, uid, password, model_name, 'unlink', [[record_id]]) + + with open('/home/obananapay/erp/addons/sql_dashboard/api/export.csv', 'r') as csvfile: + csvreader = csv.reader(csvfile) + fields = next(csvreader) + for row in csvreader: + print("....row.....", row) + status = 'open' if row[2] == 'Open' else 'close' + date_created_str = row[8] # Assuming date_created is in the 9th column (index 8) + date_created = datetime.strptime(date_created_str, '%Y/%m/%d').strftime('%Y-%m-%d') + vals = { + 'number': row[0], + 'subject': row[1], + 'status': status, + 'ticket_priority': row[3], + 'ticket_creator': row[4], + 'team_name': row[5], + 'firstname': row[6], + 'lastname': row[7], + 'date_created': date_created + } + + created_id = models.execute_kw(db, uid, password, model_name, 'create', [vals]) + print("created record ->", created_id) + + diff --git a/controllers/__init__.py b/controllers/__init__.py new file mode 100644 index 0000000..457bae2 --- /dev/null +++ b/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import controllers \ No newline at end of file diff --git a/controllers/controllers.py b/controllers/controllers.py new file mode 100644 index 0000000..721d35d --- /dev/null +++ b/controllers/controllers.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# from odoo import http + + +# class SqlDashboard(http.Controller): +# @http.route('/sql_dashboard/sql_dashboard', auth='public') +# def index(self, **kw): +# return "Hello, world" + +# @http.route('/sql_dashboard/sql_dashboard/objects', auth='public') +# def list(self, **kw): +# return http.request.render('sql_dashboard.listing', { +# 'root': '/sql_dashboard/sql_dashboard', +# 'objects': http.request.env['sql_dashboard.sql_dashboard'].search([]), +# }) + +# @http.route('/sql_dashboard/sql_dashboard/objects/', auth='public') +# def object(self, obj, **kw): +# return http.request.render('sql_dashboard.object', { +# 'object': obj +# }) diff --git a/demo/demo.xml b/demo/demo.xml new file mode 100644 index 0000000..817be16 --- /dev/null +++ b/demo/demo.xml @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..9c824be --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import dashboard_main \ No newline at end of file diff --git a/models/dashboard_main.py b/models/dashboard_main.py new file mode 100644 index 0000000..14b69e1 --- /dev/null +++ b/models/dashboard_main.py @@ -0,0 +1,73 @@ +from datetime import datetime +from odoo import models, fields, api + + +class DashboardMain(models.Model): + _name = 'dashboard.main' + _description = 'SQL Dashboard' + + number = fields.Char('Number') + subject = fields.Text('Subject') + status = fields.Selection([ + ('open', 'Open'), + ('close', 'Close'), + ('resolved', 'Resolved'), + ('archived', 'Archived'), + ('deleted', 'Deleted'), + ], string='Status', default='open') + + ticket_priority = fields.Selection([ + ('low', 'Low'), + ('normal', 'Normal'), + ('high', 'High'), + ('emergency', 'Emergency'), + ], string='Ticket Priority', default='low') + + ticket_creator = fields.Char('Ticket Creator') + team_name = fields.Char('Team Name') + firstname = fields.Char('First Name') + lastname = fields.Char('Last Name') + date_created = fields.Date('Date Created') + + days_since_creation = fields.Integer( + compute='_compute_days_since_creation', + string='Days Since Creation', + ) + + creation_date_group = fields.Selection([ + ('today', 'Today'), + ('this_week', 'This Week'), + ('this_month', 'This Month'), + ('three_months', '3 Months'), + ('three_plus_months', '3+ Months'), + ], compute='_compute_creation_date_group', string='Creation Date Group', store=True) + + @api.depends('date_created') + def _compute_days_since_creation(self): + for record in self: + if record.date_created: + # Get today's date + today = datetime.now().date() + + # Calculate the difference in days + creation_date = fields.Datetime.from_string(record.date_created).date() + difference = (today - creation_date).days + + record.days_since_creation = difference + else: + record.days_since_creation = 0 + + @api.depends('days_since_creation') + def _compute_creation_date_group(self): + for record in self: + if record.days_since_creation == 0: + record.creation_date_group = 'today' + elif 1 <= record.days_since_creation <= 7: + record.creation_date_group = 'this_week' + elif 8 <= record.days_since_creation <= 30: + record.creation_date_group = 'this_month' + elif 31 <= record.days_since_creation <= 90: + record.creation_date_group = 'three_months' + else: + record.creation_date_group = 'three_plus_months' + diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 23b5db7..0000000 --- a/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Obanana Support Dashboard - Odoo \ No newline at end of file diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv new file mode 100644 index 0000000..c45cd90 --- /dev/null +++ b/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_dashboard_main,dashboard.main,model_dashboard_main,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/views/dashboard.xml b/views/dashboard.xml new file mode 100644 index 0000000..368912c --- /dev/null +++ b/views/dashboard.xml @@ -0,0 +1,79 @@ + + + + Tickets Dashboard + dashboard.main + graph + + + + + Tickets Dashboard + dashboard.main + graph + + + + + Tickets Dashboard + dashboard.main + graph + + + + + Tickets Dashboard + dashboard.main + graph + + + + + + Dashboard Form + board.board + +
+ + + + + + + + + + + + + + + +
+
+
+ + + Dashboard + board.board + form + menu + + + + + +
\ No newline at end of file diff --git a/views/dashboard_main_view.xml b/views/dashboard_main_view.xml new file mode 100644 index 0000000..fff574d --- /dev/null +++ b/views/dashboard_main_view.xml @@ -0,0 +1,79 @@ + + + dashboard.main.tree + dashboard.main + + + + + + + + + + + + + + + + + + + + dashboard.main.graph + dashboard.main + + + + + + + + + + dashboard.main.graph + dashboard.main + + + + + + + + + + dashboard.main.graph + dashboard.main + + + + + + + + + + dashboard.main.graph + dashboard.main + + + + + + + + + + Tickets + ir.actions.act_window + dashboard.main + tree,form + current + + + + \ No newline at end of file diff --git a/views/templates.xml b/views/templates.xml new file mode 100644 index 0000000..cea6b39 --- /dev/null +++ b/views/templates.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file