diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-26 11:56:21 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-26 11:56:21 +0700 |
| commit | 206cf21b9818c4bc2fcc070a2837d27af9b320fc (patch) | |
| tree | 9379101f5848716496cb0f3466e575a0183edd75 /fixco_custom/models | |
| parent | 9a76bdcf4918afbfb8ff20d5989ade6904cebe71 (diff) | |
push
Diffstat (limited to 'fixco_custom/models')
| -rwxr-xr-x | fixco_custom/models/detail_order.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py index fadea7b..b392f20 100755 --- a/fixco_custom/models/detail_order.py +++ b/fixco_custom/models/detail_order.py @@ -124,11 +124,15 @@ class DetailOrder(models.Model): def process_queue_item_detail(self, limit=100): domain = [('execute_status', '=', 'detail_order')] records = self.search(domain, order='create_date asc', limit=limit) + for rec in records: try: + # Start a new savepoint for each record with self.env.cr.savepoint(): rec.execute_queue_detail() + self.env.cr.commit() # Explicit commit after each successful record except Exception as e: + self.env.cr.rollback() # Explicit rollback on failure _logger.error("Failed to process record %s: %s", rec.id, str(e)) rec.write({ 'message_error': json.dumps({'error': str(e)}) |
