Currently, I am struggling with overwriting the tax value inside sales & purchase line. I tried forcing a tax value inside a taxRegulation.allocateAmount(8888), however, (using Purchase order/ line as an example) that value was not successfully written into the VendInvoiceJour.SumTax. I am seeing the default tax percentage value in it (calculated through the tax group when setting up a purchase order)
As there is no error given by the AX, I really cannot find the source of the problem. I have also tried debugging through the allocateAmount and saveTaxRegulation, going through line by line to look for any potential leftout methods which I should call, but no luck...even after going through 3-4 times of debugging...(no customization done to standard AX methods, if this help in providing more info)
The code is as follows:
public void overwritePurchTaxRegulation(PurchTable _purchTable, PurchLine _purchLine, HISLedgerJournalImport _hISLedgerJournalImport)
{
TaxRegulation taxRegulation;
HISLedgerJournalImport hisLedgerJournalImport = _hISLedgerJournalImport;
PurchTable purchTable = PurchTable::find(_purchTable.PurchId);
PurchLine purchLine = PurchLine::find(_purchLine.PurchId);
if (!purchTable || !purchLine)
return;
taxRegulation = TaxRegulation::newTaxRegulation(PurchTotals::getTax(purchTable), null,
tableNum(PurchLine), purchLine.RecId);
if(taxRegulation)
{
//taxRegulation.allocateAmount(hisLedgerJournalImport.LedgerJournalTrans_TaxAmount);
taxRegulation.allocateAmount(8888);
taxRegulation.saveTaxRegulation();
}
}
Thanks in advance.
*This post is locked for comments
I have the same question (0)