diff --git a/bemade_odoo2odoo_project/__init__.py b/bemade_odoo2odoo_project/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/bemade_odoo2odoo_project/__manifest__.py b/bemade_odoo2odoo_project/__manifest__.py
new file mode 100644
index 0000000..e6eba74
--- /dev/null
+++ b/bemade_odoo2odoo_project/__manifest__.py
@@ -0,0 +1,21 @@
+
+
+
+
+
+ project.project.form.inherit.sync.odoo17
+ project.project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bemade_odoo2odoo_project/data/crons.xml b/bemade_odoo2odoo_project/data/crons.xml
new file mode 100644
index 0000000..d938c2e
--- /dev/null
+++ b/bemade_odoo2odoo_project/data/crons.xml
@@ -0,0 +1,10 @@
+
+ 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
new file mode 100644
index 0000000..f211b6d
--- /dev/null
+++ b/bemade_odoo2odoo_project/models/__init__.py
@@ -0,0 +1 @@
+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
new file mode 100644
index 0000000..488091b
--- /dev/null
+++ b/bemade_odoo2odoo_project/models/odoo2odoo_sync.py
@@ -0,0 +1,47 @@
+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
new file mode 100644
index 0000000..696237c
--- /dev/null
+++ b/bemade_odoo2odoo_project/models/project_project.py
@@ -0,0 +1,92 @@
+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
new file mode 100644
index 0000000..af3bb4e
--- /dev/null
+++ b/bemade_odoo2odoo_project/views/project_view_extension.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bemade_odoo_partner_scrapper/views/res_partner_views.xml b/bemade_odoo_partner_scrapper/views/res_partner_views.xml
index 160c0e9..22402a4 100644
--- a/bemade_odoo_partner_scrapper/views/res_partner_views.xml
+++ b/bemade_odoo_partner_scrapper/views/res_partner_views.xml
@@ -60,10 +60,10 @@
-
+
oe_kanban_global_click o_kanban_record_has_image_fill o_res_partner_kanban oe_kanban_color_#{record.color}
-
+