[Shopify] Fix Price List header defaults in dated discount test helper - #9804
Open
onbuyuka wants to merge 1 commit into
Open
[Shopify] Fix Price List header defaults in dated discount test helper#9804onbuyuka wants to merge 1 commit into
onbuyuka wants to merge 1 commit into
Conversation
After AB#642673's isolation fix re-enabled UnitTestCalcPriceUsesCurrentWorkDate, the test failed at CreateDatedAllCustDiscPriceList with: Ending Date must be equal to '' in Price List Line ... Current value is '01/01/27'. CreatePriceHeader leaves "Allow Updating Defaults" = false, so Price List Line validation (TestHeadersValue) forces each line's Starting/Ending Date to match the header's (empty) dates. The helper deliberately needs two "All Customers" discount lines with different date ranges, which is only possible when the header allows per-line defaults. Set "Allow Updating Defaults" := true on the header (Status still Draft, no side effects) before adding the lines, so each line keeps its own date range. Fixes AB#642673 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 04b7fe58-2158-4039-a77b-0011d9bed440
Groenbech96
approved these changes
Jul 29, 2026
darjoo
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Follow-up to #9709 (AB#642673). That PR fixed the test-isolation duplicate-key error so
UnitTestCalcPriceUsesCurrentWorkDate(codeunit 139605) could be re-enabled. With the test now running end-to-end in NAV, it surfaced a second, latent bug in theCreateDatedAllCustDiscPriceListhelper (codeunit 139603):LibraryPriceCalculation.CreatePriceHeaderleaves"Allow Updating Defaults" = false. With that off,Price List Line.TestHeadersValueforces every line'sStarting Date/Ending Dateto equal the header's (empty) dates. The helper deliberately creates two "All Customers" discount lines with different date ranges (50% up to the boundary date, 20% from the day after), which a single header can only express when it allows per-line defaults.Fix
Set
"Allow Updating Defaults" := trueon the header right after creation — while it is still inDraftstatus, and turning the flag on has no side effects (the field's guard only fires when turning it off with existing lines). Each line then keeps its own date range; activation propagates status only and does not reset the line dates.Linked work
Fixes AB#642673
How I validated this
PriceListLine.Table.alTestHeadersValue(dates are only skipped whenAllow Updating Defaultsis true) andPriceListHeader.Table.al(the flag'sOnValidateonly checks lines when turning it off).MockAzureKeyVaultSecretProviderDotNet assembly probing path in an untouched file); CI has these test assemblies, so the re-enabled test exercises this path there.Follow-up
The test remains disabled NAV-side in
App/DisabledTests/ShpfyProductPriceCalcTest.DisabledTest.json. Once this is uptaken, that entry should be removed to re-enable it (the NAV re-enable PR was failing on the error fixed here).