diff --git a/bemade_odoo2odoo_project/__init__.py b/bemade_odoo2odoo_project/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/bemade_odoo2odoo_project/__manifest__.py b/bemade_odoo2odoo_project/__manifest__.py deleted file mode 100644 index e6eba74..0000000 --- a/bemade_odoo2odoo_project/__manifest__.py +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - project.project.form.inherit.sync.odoo17 - project.project - - - - - - - - - - - - - - diff --git a/bemade_odoo2odoo_project/data/crons.xml b/bemade_odoo2odoo_project/data/crons.xml deleted file mode 100644 index d938c2e..0000000 --- a/bemade_odoo2odoo_project/data/crons.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Synchroniser les Projets avec Bébé - - code - model.sync_projects_with_baby() - 1 - hours - -1 - True - diff --git a/bemade_odoo2odoo_project/models/__init__.py b/bemade_odoo2odoo_project/models/__init__.py deleted file mode 100644 index f211b6d..0000000 --- a/bemade_odoo2odoo_project/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import project_project \ No newline at end of file diff --git a/bemade_odoo2odoo_project/models/odoo2odoo_sync.py b/bemade_odoo2odoo_project/models/odoo2odoo_sync.py deleted file mode 100644 index 488091b..0000000 --- a/bemade_odoo2odoo_project/models/odoo2odoo_sync.py +++ /dev/null @@ -1,47 +0,0 @@ -from odoo import models, fields, api - -class Odoo2OdooSync(models.Model): - _name = 'odoo2odoo.sync' - _description = 'Synchronisation Odoo à Odoo' - - model_id = fields.Many2one( - comodel_name='ir.model', - string='Modèle Cible', - required=True, - help="Le modèle Odoo cible de la synchronisation." - ) - - res_id = fields.Integer( - string='ID Ressource', - required=True, - help="L'ID de la ressource cible dans le modèle spécifié." - ) - - json_rpc_request = fields.Text( - string='Requête JSON RPC', - required=True, - help="Le corps complet de la requête JSON RPC pour la synchronisation." - ) - - state = fields.Selection( - selection=[ - ('draft', 'Brouillon'), - ('success', 'Succès'), - ('failed', 'Échoué') - ], - string='État', - default='draft', - required=True, - help="L'état de la tentative de synchronisation." - ) - - last_attempt = fields.Datetime( - string='Dernière Tentative', - help="La date et l'heure de la dernière tentative de synchronisation." - ) - - confirmation = fields.Datetime( - string='Confirmation', - help="La date et l'heure de la confirmation de la synchronisation réussie." - ) - diff --git a/bemade_odoo2odoo_project/models/project_project.py b/bemade_odoo2odoo_project/models/project_project.py deleted file mode 100644 index 696237c..0000000 --- a/bemade_odoo2odoo_project/models/project_project.py +++ /dev/null @@ -1,92 +0,0 @@ -from odoo import models, fields, api - -class Project(models.Model): - _inherit = 'project.project' # Héritage du modèle projet existant - - customer_project_id = fields.Integer( - string="ID Projet Client", - required=False, - help="L'ID du projet dans le système client." - ) - - customer_odoo_server = fields.Char(string="Serveur Odoo Client") - customer_username = fields.Char(string="Nom d'usager Client") - customer_password = fields.Char(string="Mot de passe Client", invisible=True) - - odoo2odoo_sync_ids = fields.One2many( - comodel_name='odoo2odoo.sync', - inverse_name='project_id', - string='Synchronisations' - ) - - last_push = fields.Datetime( - string="Dernière Tentative de Synchronisation", - compute="_compute_sync_status", - store=True - ) - - last_push_completed = fields.Datetime( - string="Dernière Synchronisation Réussie", - compute="_compute_sync_status", - store=True - ) - - last_updated = fields.Datetime( - string="Dernière Mise à Jour par Bébé", - ompute="_compute_sync_status", - store=True - ) - - odoo2odoo_sync_count = fields.Integer( - string="Nombre de Synchronisations", - compute="_compute_sync_status" - ) - - odoo2odoo_sync_completed_count = fields.Integer( - string="Nombre de Synchronisations Réussies", - compute="_compute_sync_status" - ) - - @api.model - def create(self, vals): - # Appel de la méthode super() pour créer le projet dans Odoo. - new_project = super(Project, self).create(vals) - - if 'customer_odoo_server' in vals and vals['customer_odoo_server']: - # Simulation de données pour la synchronisation avec le système "bébé". - # Vous adapterez cette partie selon votre logique spécifique de synchronisation. - json_rpc_request = json.dumps({ - "jsonrpc": "2.0", - "method": "create_project", - "params": { - "name": new_project.name, - # Ajoutez d'autres paramètres nécessaires pour la création du projet dans le système "bébé". - }, - }) - - # Création d'un enregistrement dans odoo2odoo.sync pour suivre la tentative de synchronisation. - self.env['odoo2odoo.sync'].create({ - 'model_id': self.env.ref('base.model_project_project').id, - 'res_id': new_project.id, - 'json_rpc_request': json_rpc_request, - 'state': 'draft', # Commencez avec l'état 'draft' pour la nouvelle synchronisation. - }) - return new_project - - @api.depends('odoo2odoo_sync_ids.state') - def _compute_sync_status(self): - for project in self: - sync_records = self.env['odoo2odoo.sync'].search([ - ('model_id.model', '=', 'project.project'), - ('res_id', '=', project.id), - ], order='last_attempt desc') - project.odoo2odoo_sync_count = len(sync_records) - if sync_records: - project.odoo2odoo_sync_completed_count = len(sync_records.filtered(lambda r: r.state == 'success')) - project.last_push = sync_records[0].last_attempt - success_records = sync_records.filtered(lambda r: r.state == 'success') - if success_records: - project.last_push_completed = success_records[0].last_attempt - # Assume that 'last_updated' reflects the last successful pull from 'bébé' - # This requires additional logic to track when updates are received from the bébé system - project.last_updated = success_records[0].confirmation if success_records else False \ No newline at end of file diff --git a/bemade_odoo2odoo_project/views/project_view_extension.xml b/bemade_odoo2odoo_project/views/project_view_extension.xml deleted file mode 100644 index af3bb4e..0000000 --- a/bemade_odoo2odoo_project/views/project_view_extension.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file