Bug: Next automatically changing the Sales tax template when shipping address is changed in the SO

ERPNext Bug Description: Unexpected Sales Tax Change on Shipping Address Update

Issue: In ERPNext, the Sales Tax template for a Sales Order (SO) is automatically changing upon modification of the shipping address, even if the state remains the same within the same country. This occurs after the SO has already been submitted. Additionally, the system prevents manual correction of the tax template after this automatic change.


  • This bug can lead to incorrect tax calculations on the Sales Order, potentially causing discrepancies between quoted price and final invoice amount.
  • Users lose control over the applied tax template, hindering accurate tax management and potentially causing compliance issues.

Expected Behavior:

  • The Sales Tax template for a Sales Order should only change if the shipping address results in a different tax jurisdiction (e.g., a different state with varying tax rules).
  • If the shipping address update stays within the same state (and country), the originally chosen Sales Tax template should remain applied.
  • Users should have the ability to manually adjust the Sales Tax template if necessary, even after the SO has been submitted, to rectify any potential errors.

Possible Root Cause:

  • The logic for determining the Sales Tax template might be overly reliant on the shipping address and not adequately considering the state information within the SO.
  • The system might be enforcing a strict validation rule that prevents users from modifying the tax template after an automatic change, even if the change seems illogical.


  • A code fix is needed to ensure the Sales Tax template considers the state information within the SO alongside the shipping address.
  • The validation logic needs to be reviewed to allow users to manually correct the tax template if the automatic change appears incorrect (given the same state).