[Master] - Bug 641055: Sustainability - Fix Scope 3 installation multiplier#9562
Draft
v-rohangarg20 wants to merge 1 commit into
Draft
Conversation
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.
Workitem Bug 641055: [Sustainability] Scope 3 Distance: Installation Multiplier defaults to 1 in Journal but 0 in Purchase Order/Invoice, giving 0 emissions
Fixes AB#641055
Issue: On Purchase Order/Invoice lines using a distance‑based Scope 3 sustainability account, "Installation Multiplier" defaulted to 0. Because distance emissions are calculated as Distance × Emission Factor × Installation Multiplier, the result was always 0 — even with a valid distance and emission factor. The Sustainability Journal behaved correctly because its "Installation Multiplier" field has InitValue = 1, so the two entry points produced inconsistent emissions.
Cause: The purchase line "Installation Multiplier" field had no default value (0), and nothing set it when a sustainability account was assigned. Unlike the journal line, there was no InitValue = 1 equivalent for purchase documents.
Solution: In the "Sust. Account No." OnValidate trigger on the Purchase Line, when the assigned account's category uses Calculation Foundation = Distance, default "Installation Multiplier" to 1 (matching the journal's behavior). The default is intentionally scoped to Distance‑based accounts only, so Fuel/Electricity, Custom, and per‑unit item emission lines keep "Installation Multiplier" = 0 and continue to pass the TestField("Installation Multiplier", 0) validation.