Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 14.0 #894 +/- ##
==========================================
+ Coverage 50.37% 50.39% +0.01%
==========================================
Files 1175 1175
Lines 20100 20098 -2
Branches 4271 4271
==========================================
+ Hits 10126 10129 +3
+ Misses 9741 9736 -5
Partials 233 233 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5595e44 to
5fc548e
Compare
|
Closing without merge. Investigation on test3 (deployed PRs on
AST Pro in WooCommerce uses export #2's tracking when firing the shipment email, so the customer receives the email with the tracking number. PR #889's PR #894's state-compute gate was unnecessary and, empirically, broke the timing AST Pro relied on — with #894 applied, the email arrives without tracking. Closing as no-op. The architectural refactor for a proper |
🔁 PR reopened — 2026-04-29Earlier closing was premature. A new field report shows the partial-shipped email arriving without tracking on a recent first-partial delivery (order 19238, 2026-04-28), while a 2026-04-24 reference order (19141) had it correctly. Bug is alive on test3. Empirical verification on test3
Both exports happen synchronously ( The race is genuinely timing-dependent, not a deterministic code path. PR #894's gate approach (defer state transition until tracking is set) was empirically observed to consistently produce emails without tracking, suggesting AST Pro relies on the Path forwardThis PR stays open for discussion. Options: A. Defer Investigation continues. Will update with proposed approach. |
1d069cf to
25801b9
Compare
25801b9 to
5354f94
Compare
Context
Alternative to #889 commit
bc4057ba(status-mapper gate). Same root cause, fix placed at the state definition instead of the transform.Related internal task: connector WooCommerce — propagate state and tracking on partial deliveries.
Bug mechanism
Inside
stock.picking._action_donethere are two separate writes on the picking in one transaction:picking.state = "done"_send_confirmation_email→send_to_shipper):picking.carrier_tracking_ref = ref, after the blocking carrier API callsale.order.woocommerce_order_stateisstore=Truewith@api.depends("picking_ids.state", ...). Any ORM flush between A and B (backorder creation, move_line writes,message_post, etc.) materializes an intermediate state wherestate="done"andcarrier_tracking_ref=False.At that moment
_get_woocommerce_order_statepromotes the order topartial_shipped,on_compute_woocommerce_order_statefires, andexport_batch(delayed=False)exports synchronously. Payload reaches WooCommerce withstatus=partial-shippedand no tracking number → WC fires the "partially shipped" email without tracking.When Write B lands,
stock_picking.writefires the event again → second export updates the metadata, but the email was already sent.Fix
Gate the
processing → partial_shippedtransition on havingcarrier_tracking_refset for alldonepickings whose carrier callssend_to_shipper(integration_level == "rate_and_ship"). Pickings on fixed-rate carriers or without a carrier never auto-populate the ref, so they pass through unchanged.Also add
picking_ids.carrier_tracking_refto_compute_woocommerce_order_state's@api.dependsso the state re-evaluates when the ref lands and the single correct export fires.Why this over PR #889's
bc4057babc4057ba(status mapper gate)export_mapper.py—statustransformsale_order.py—_get_woocommerce_order_stateNone, second sends real)partial_shippedwith no ref — inconsistent with what WC seesprocessinguntil ref is ready@api.dependsre-triggerpicking_ids.carrier_tracking_refKnown trade-off
If the carrier API ever returns successfully with an empty
NumeroEnvio/tracking ref, the order freezes atprocessingon WC. In practice for MRW/SEUR this shouldn't happen — the API either returns a tracking number or raises an error (which would fail_action_doneentirely, so the picking wouldn't reachdone).bc4057bahas the same failure mode at the mapper layer.Test plan
partial_shippedwithout blockingdeliveredwith full payload