Skip to content

Skip updating prices if "Subscription Option" has not changed #28770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

miljance
Copy link
Contributor

@miljance miljance commented Jun 15, 2025

Summary

When validating the "Subscription Option" field, the code performs several checks. One of them is within the UpdateItemPriceList function, which enforces specific logic for "Subscription Items":

  • If the "Subscription Option" is set to "Subscription Item", the function ensures that the "Allow Invoice Disc." flag is disabled both on the Item and its related sales prices. This is because Subscription Items are excluded from document totals in Sales Quotes and Orders.
  • Conversely, if the "Subscription Option" is changed from "Subscription Item" to another value, the function resets "Allow Invoice Disc." to its default value (true).

This logic should execute only when the "Subscription Option" value changes.

However, when an Item is created from an Item Template where:

  • "Allow Invoice Disc." is already set to false, and
  • "Subscription Option" is "No Subscription",

then this validation should not run and should not modify sales prices — because no change to the "Subscription Option" has occurred.

Work Item(s)

Fixes #28764

@miljance miljance requested a review from a team as a code owner June 15, 2025 13:58
@miljance miljance requested a review from stkillen June 15, 2025 13:58
@miljance
Copy link
Contributor Author

@JesperSchulz I guess this is a Prio 1 issue as it affects the customers that do not have anything to do with Subscription Billing but want to default "Allow Invoice Disc." properly from Item Template. Needed for BC26.x I guess ASAP.

Copy link
Contributor

@pri-kise pri-kise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request describes the issue and the fix very well, but shouldn't we have a test for this bugfix?

I guess you could check the codeunit 138008 "Cust/Vend/Item/Empl Templates" in the SMB Tests for the BaseApp.

And wouldn't we need a validation on the item template to prevent a wrong setup?
e.g. it shouldn't be possible to change the "Allow Inv. Disc." if a subscription option is set?
https://github.com/microsoft/ALAppExtensions/blob/main/Apps/W1/SubscriptionBilling/App/Service%20Objects/Table%20Extensions/ItemTempl.TableExt.al

@miljance
Copy link
Contributor Author

The pull request describes the issue and the fix very well, but shouldn't we have a test for this bugfix?

I guess you could check the codeunit 138008 "Cust/Vend/Item/Empl Templates" in the SMB Tests for the BaseApp.

And wouldn't we need a validation on the item template to prevent a wrong setup? e.g. it shouldn't be possible to change the "Allow Inv. Disc." if a subscription option is set? https://github.com/microsoft/ALAppExtensions/blob/main/Apps/W1/SubscriptionBilling/App/Service%20Objects/Table%20Extensions/ItemTempl.TableExt.al

related PR on the BusinessCentralApps repo:
https://github.com/microsoft/BusinessCentralApps/pull/1421

@miljance miljance requested a review from pri-kise June 16, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Subscription Billing - Item Template cannot create new item with "Allow Invoice Disc." = false
3 participants