Skip to content

[Shopify] Fix Price List header defaults in dated discount test helper - #9804

Open
onbuyuka wants to merge 1 commit into
mainfrom
bugs/642673-price-list-header-allow-updating-defaults
Open

[Shopify] Fix Price List header defaults in dated discount test helper#9804
onbuyuka wants to merge 1 commit into
mainfrom
bugs/642673-price-list-header-allow-updating-defaults

Conversation

@onbuyuka

@onbuyuka onbuyuka commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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 the CreateDatedAllCustDiscPriceList helper (codeunit 139603):

Ending Date must be equal to ''  in Price List Line: Price List Code=GU00000034, Line No.=0. Current value is '01/01/27'.
  Price List Line(Table 7001).TestHeadersValue line 25
  Price List Line(Table 7001).Ending Date - OnValidate(Trigger) line 2
  Shpfy Product Init Test(CodeUnit 139603).CreateDatedAllCustDiscPriceList line 15

LibraryPriceCalculation.CreatePriceHeader leaves "Allow Updating Defaults" = false. With that off, Price List Line.TestHeadersValue forces every line's Starting Date / Ending Date to 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" := true on the header right after creation — while it is still in Draft status, 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

  • Root-caused against PriceListLine.Table.al TestHeadersValue (dates are only skipped when Allow Updating Defaults is true) and PriceListHeader.Table.al (the flag's OnValidate only checks lines when turning it off).
  • Changed file compiles clean (AL language server reports 0 errors for the Shopify Test project).
  • A live local test run is currently blocked only by an unrelated local build-environment gap (the MockAzureKeyVaultSecretProvider DotNet 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).

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
@onbuyuka
onbuyuka requested a review from a team July 28, 2026 21:24
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jul 28, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 28, 2026
@onbuyuka onbuyuka changed the title [Shopify] Fix Price List header defaults in dated discount test helper (AB#642673) [Shopify] Fix Price List header defaults in dated discount test helper Jul 28, 2026
@github-actions github-actions Bot added the Integration GitHub request for Integration area label Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants