22 lines
981 B
Python
22 lines
981 B
Python
|
|
from odoo import models, fields
|
||
|
|
|
||
|
|
|
||
|
|
class RemoteProjectMapping(models.Model):
|
||
|
|
_name = 'project.sync.remote.project'
|
||
|
|
_description = 'Remote Project Mapping'
|
||
|
|
_order = 'sync_status, remote_name'
|
||
|
|
|
||
|
|
sync_config_id = fields.Many2one('project.sync.config', required=True, ondelete='cascade')
|
||
|
|
remote_id = fields.Integer(string='Remote Project ID', required=True)
|
||
|
|
remote_name = fields.Char(string='Remote Project Name', required=True)
|
||
|
|
local_project_id = fields.Many2one('project.project', string='Local Target Project')
|
||
|
|
sync_status = fields.Selection([
|
||
|
|
('pending', 'Pending'),
|
||
|
|
('synced', 'Synced'),
|
||
|
|
('error', 'Error')
|
||
|
|
], default='pending', readonly=True)
|
||
|
|
|
||
|
|
# ✅ NEW: Store error details
|
||
|
|
error_message = fields.Text(string='Error Details', readonly=True)
|
||
|
|
last_sync_attempt = fields.Datetime(string='Last Sync Attempt', readonly=True)
|
||
|
|
tasks_synced_count = fields.Integer(string='Tasks Synced', default=0, readonly=True)
|