[29.x] Bug 649257: [Excise Tax] Improving Excise Duty Calculation - #11116
[29.x] Bug 649257: [Excise Tax] Improving Excise Duty Calculation#11116v-rohangarg20 wants to merge 4 commits into
Conversation
The item-ledger path evaluated RequiresTaxableAmount before the OnAfterUpdateExciseJournalLineFromItemLedgerEntry subscriber applied the rate for the ledger entry item category. When the item category and the ledger entry category resolved to different calculation types, an ad valorem or hybrid line could keep a zero taxable amount and calculate the wrong tax. The taxable amount is now set after the event so the final calculation type is used. Also fixed VerifyFAJournalLinesForAcquisitionCost to create the fixed asset rate with an explicit Excise Calculation Type, so the rate lookup resolves as the test expects.
…29.x The main-branch change deprecated table 7413 and page 7412 in favour of the new Excise Tax Rate table, gating them behind CLEAN30/CLEANSCHEMA33. Deprecating an object in a servicing branch is not valid: the obsolete tags 30.0 and 33.0 refer to versions newer than 29.x, and those CLEAN symbols are not defined here. The old table and page are therefore restored byte-identical to the 29.x baseline, and the preprocessor gates are dropped from the permission sets and the upgrade codeunit so the rate migration always runs. Only the additive part of the feature - the Excise Tax Rate table, the Excise Tax Rates page, the calculation type enum and the calculation changes - is backported.
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesThis change adds rate-based excise duty calculation types, a new rate table with item-category matching, migration from the old rate table, journal and transaction-log fields, and tests for the new rate model. The main calculation flow is in the right place: item ledger entry data is copied, the item category is set, the final rate is applied, and taxable amount is then calculated only for ad valorem or hybrid rates. Problem-solution fitFit: Strong The reported bug is about wrong excise duty when the applicable rate type depends on the final item category. The code change targets that path directly by carrying the item category into the journal line before rate selection and by calculating taxable amount after the final calculation type is known. SuggestionsS1 (🔴 High): Add a posted-entry regression test Risk assessment and necessityRisk: This is a sensitive tax calculation change. A wrong rate lookup or taxable amount can create an incorrect excise tax amount in the journal and then copy that wrong amount to the transaction log. Necessity: The change is needed because the old model only supported specific-per-unit rates and could not model category-driven ad valorem or hybrid rates. The scope is large for a servicing branch, but it is focused on the excise duty rate model and includes migration and UI updates.
|
Fixes AB#649257
Issue
Excise duty calculation in the 29.x branch did not support the new rate-based calculation types and could calculate an incorrect tax amount when the final item category changed the applicable calculation type.
Cause
The 29.x calculation flow used the legacy item and fixed-asset rate model without an explicit calculation type for specific-per-unit, ad valorem, and hybrid duties. For item ledger entries, the taxable amount could be determined before the final rate lookup and calculation type had been applied. Existing rates also needed to be migrated without introducing schema changes from newer releases.
Solution
Validation