fix: sync never changes product map state from mapped

Price conflicts and sync errors were setting woo.product.map state to
'conflict'/'error', making products disappear from the mapped list.
Conflicts are now tracked only in woo.conflict model. Map state stays
'mapped' as long as the product link exists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-03-31 23:01:26 -04:00
parent 1cc3ea7a18
commit 0e84b97c89

View File

@@ -793,7 +793,7 @@ class WooInstance(models.Model):
'woo_value': str(wc_price),
'company_id': self.company_id.id,
})
pm.state = 'conflict'
# Keep state as mapped — conflict is tracked separately
self._log_sync(
'product', 'woo_to_odoo', pm.product_id.display_name,
'conflict', f'Price conflict: Odoo=${odoo_price}, WC=${wc_price}',
@@ -821,7 +821,7 @@ class WooInstance(models.Model):
"Product price sync failed for %s (WC#%s): %s",
pm.product_id.display_name, pm.woo_product_id, e,
)
pm.state = 'error'
# Don't change map state on sync errors — keep it mapped
self._log_sync(
'product', 'odoo_to_woo',
pm.product_id.display_name, 'failed', str(e),