diff --git a/odoo_trello_connector/__init__.py b/odoo_trello_connector/__init__.py index 7ded36cf0..8f7408f3b 100644 --- a/odoo_trello_connector/__init__.py +++ b/odoo_trello_connector/__init__.py @@ -20,3 +20,11 @@ # ################################################################################ from . import models +from odoo.exceptions import UserError + + +def pre_init_hook(env): + dependent_apps = env['ir.module.module'].search([('name', 'in', ['queue_job_cron_jobrunner', 'queue_job'])]) + for app in dependent_apps: + if app.state != 'installed': + raise UserError('Please make sure you have added and installed Queue Job and Queue Job Cron Jobrunner in your system') \ No newline at end of file diff --git a/odoo_trello_connector/__manifest__.py b/odoo_trello_connector/__manifest__.py index 51bb627d3..119d3b777 100644 --- a/odoo_trello_connector/__manifest__.py +++ b/odoo_trello_connector/__manifest__.py @@ -21,7 +21,7 @@ ################################################################################ { 'name': "Odoo Trello Connector", - 'version': '17.0.1.0.0', + 'version': '17.0.1.1.0', 'category': 'Project', 'summary': """Integrate Projects and Tasks between Trello and Odoo""", 'description': """This module helps to import all Projects and Tasks from @@ -40,7 +40,8 @@ ], 'images': ['static/description/banner.jpg'], 'license': 'AGPL-3', + 'pre_init_hook': 'pre_init_hook', 'installable': True, 'auto_install': False, - 'application': False, + 'application': False } diff --git a/odoo_trello_connector/doc/RELEASE_NOTES.md b/odoo_trello_connector/doc/RELEASE_NOTES.md index d4458221c..bf174fecf 100644 --- a/odoo_trello_connector/doc/RELEASE_NOTES.md +++ b/odoo_trello_connector/doc/RELEASE_NOTES.md @@ -5,3 +5,9 @@ #### ADD - Initial commit for Odoo Trello Connector + +#### 17.08.2024 +#### Version 17.0.1.1.0 +#### ADD + +- Added Job queue support for project import from trello diff --git a/odoo_trello_connector/models/project_project.py b/odoo_trello_connector/models/project_project.py index 6858fc6b0..b87305b5e 100644 --- a/odoo_trello_connector/models/project_project.py +++ b/odoo_trello_connector/models/project_project.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ -from odoo import fields, models +from odoo import api, fields, models class ProjectProject(models.Model): diff --git a/odoo_trello_connector/models/res_users.py b/odoo_trello_connector/models/res_users.py index 477e381b7..b2e2d2a99 100644 --- a/odoo_trello_connector/models/res_users.py +++ b/odoo_trello_connector/models/res_users.py @@ -56,41 +56,44 @@ class ResUsers(models.Model): "Accept": "application/json" } member = self.get_member_id(header, self.user_name) - for board in self.get_boards(header, query, - member): - project = self.env['project.project'].sudo().search( - [('trello_reference', '=', board['id'])]) - if not project: - project = self.env['project.project'].sudo().create({ - 'name': board['name'], - 'description': board['desc'], - 'trello_reference': board['id'] + for board in self.get_boards(header, query, member): + self.with_delay( + channel='root.import_project', + description='Importing Board From Trello', max_retries=10)._delay_import( + board, header, query) + + def _delay_import(self, board, header, query): + """Import will performed within the job queue""" + project = self.env['project.project'].sudo().search( + [('trello_reference', '=', board['id'])]) + if not project: + project = self.env['project.project'].sudo().create({ + 'name': board['name'], + 'description': board['desc'], + 'trello_reference': board['id'] + }) + for rec in self.get_list_on_board(header, query, board['id']): + stages = self.env['project.task.type'].search([]) + if rec['name'] not in stages.mapped('name'): + self.env['project.task.type'].sudo().create({ + 'name': rec['name'] + }) + project.sudo().write( + {'type_ids': [(4, stages.search([( + 'name', '=', rec['name'])])[0].id, project.id)]}) + for card in self.get_cards(header, query, board['id']): + if card['id'] not in self.env['project.task'].search([]).mapped('trello_reference'): + self.env['project.task'].create({ + 'name': card['name'], + 'project_id': project.id, + 'stage_id': self.env[ + 'project.task.type'].search([('name', '=', + self.get_a_list( + header, query, + card['idList'])[ + 'name'])])[0].id, + 'trello_reference': card['id'] }) - for rec in self.get_list_on_board(header, query, board['id']): - stages = self.env[ - 'project.task.type'].search([]) - if rec['name'] not in stages.mapped('name'): - self.env['project.task.type'].sudo().create({ - 'name': rec['name'] - }) - project.sudo().write( - {'type_ids': [(4, stages.search([( - 'name', '=', rec['name'])])[0].id, project.id)]}) - for card in self.get_cards(header, query, - board['id']): - if card['id'] not in self.env['project.task'].search([]).mapped( - 'trello_reference'): - self.env['project.task'].create({ - 'name': card['name'], - 'project_id': project.id, - 'stage_id': self.env[ - 'project.task.type'].search([('name', '=', - self.get_a_list( - header, query, - card['idList'])[ - 'name'])])[0].id, - 'trello_reference': card['id'] - }) def action_export(self): """Function that exports Project, Stages and Tasks from Odoo to @@ -146,7 +149,6 @@ class ResUsers(models.Model): response = requests.get( f"https://api.trello.com/1/members/{username}", headers=headers, timeout=10) - print(response,'member') if response.status_code == 200: return response.json()['id'] if response.status_code == 404: diff --git a/odoo_trello_connector/static/description/assets/screenshots/img.png b/odoo_trello_connector/static/description/assets/screenshots/img.png new file mode 100644 index 000000000..7adc227ea Binary files /dev/null and b/odoo_trello_connector/static/description/assets/screenshots/img.png differ diff --git a/odoo_trello_connector/static/description/assets/screenshots/img_1.png b/odoo_trello_connector/static/description/assets/screenshots/img_1.png new file mode 100644 index 000000000..44732a995 Binary files /dev/null and b/odoo_trello_connector/static/description/assets/screenshots/img_1.png differ diff --git a/odoo_trello_connector/static/description/index.html b/odoo_trello_connector/static/description/index.html index e6cad2fc3..2ff28b92a 100644 --- a/odoo_trello_connector/static/description/index.html +++ b/odoo_trello_connector/static/description/index.html @@ -33,7 +33,7 @@ style="background-color:#017E84 !important;font-size: 0.8rem !important; color:#fff !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width: 120px !important;"> Community -
Enterprise
@@ -49,7 +49,7 @@ style="margin: 80px 0px !important;">

- Odoo Trello Connector

+ Odoo Trello Connector

Integrate Projects and Tasks Between Trello and Odoo @@ -81,7 +81,7 @@

- Exports all Projects from Odoo to Trello

+ Exports all Projects from Odoo to Trello

@@ -98,7 +98,7 @@

- Exports all Tasks from Odoo to Trello

+ Exports all Tasks from Odoo to Trello

@@ -115,7 +115,7 @@

- Imports all Tasks from Trello to Odoo

+ Imports all Tasks from Trello to Odoo

@@ -132,7 +132,7 @@

- Imports all Projects from Trello to Odoo

+ Imports all Projects from Trello to Odoo

@@ -164,9 +164,32 @@ class="fa-solid fa-book-open pr-2" style="color: #fff;">Released Notes -
+
+
+
+
+
+

+ Please ensure that the "Job queue and Queue Job Cron Jobrunner" module from Odoo Community Association (OCA) is installed on your system before installing our module.

+
+

Job queue - link to download : + https://apps.odoo.com/apps/modules/17.0/queue_job/

+
+
+

Queue Job Cron Jobrunner - link to download : https://apps.odoo.com/apps/modules/17.0/queue_job_cron_jobrunner/ +

+
+
+
+
+ +
@@ -181,10 +204,10 @@ Steps to set up in Trello platform

Login to Trello Power-Ups - Admin - Portal. - Click on the New button under Power-Ups tab + href="https://trello.com/power-ups/admin">Trello Power-Ups + Admin + Portal. + Click on the New button under Power-Ups tab

@@ -201,9 +224,9 @@

-

+

- Fill all fields and click Create button. + Fill all fields and click Create button.

@@ -220,10 +243,10 @@

-

+

- Click on Generate a new API key button under API key tab. - Click Token to generate Trello token. + Click on Generate a new API key button under API key tab. + Click Token to generate Trello token.

@@ -239,10 +262,11 @@

We can see the Username here. -

+ style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important"> We can see the + Username here. +

- Click Token to generate Trello token + Click Token to generate Trello token

@@ -259,10 +283,10 @@

- We can see the Username here. -

+ We can see the Username here. +

- Clock Allow button + Clock Allow button

@@ -279,9 +303,9 @@

-

-

- We can see the Trello Token here. + +

+ We can see the Trello Token here.

@@ -298,9 +322,9 @@

-

-

- Add the Credentials for connecting with Trello + +

+ Add the Credentials for connecting with Trello

@@ -319,7 +343,7 @@ style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">

- Projects in Odoo before Import + Projects in Odoo before Import

@@ -336,13 +360,39 @@

-

+

Click on IMPORT button

+ +
+
+
+ +
+
+ +
+
+

+

+

+ if you open the Queue Job module, you can see all the data created as queues. Once the queues are complete, all your projects will be loaded. +

+
+
+
+

-

+

- Projects in Trello + Projects in Trello

@@ -374,9 +424,9 @@

-

-

- Imported Projects in Odoo + +

+ Imported Projects in Odoo

@@ -394,7 +444,7 @@

-

+

Tasks in Trello Project

@@ -413,13 +463,13 @@

-

- Tasks in imported Project in Odoo +

+ Tasks in imported Project in Odoo

-
@@ -433,12 +483,12 @@ style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">

- Click on EXPORT button + Click on EXPORT button

-
@@ -451,8 +501,8 @@

-

- Exported Projects in Trello +

+ Exported Projects in Trello

@@ -470,13 +520,13 @@

-

- Tasks in Odoo Project +

+ Tasks in Odoo Project

-
@@ -489,8 +539,9 @@

-

Tasks in exported Project in Trello -

+

Tasks in exported Project in + Trello +

@@ -514,7 +565,7 @@ width="16px"> Exports all Tasks from Odoo to Trello -
  • Imports all Tasks from Trello to Odoo
  • -