Some of the Trading documents are missing the label translations. When you run a report the labels are automatically translated based on user language but for Trade documents it takes more than just translation of labels.
Sales invoice document is an external document for most of the organizations; which means when invoices are sent to customer, those are supposed to be in user-understandable language. I should not sent an invoice written in Arabic to France or Invoice written in Dutch to U.K. etc. This is the reason Microsoft keeps language-id on Customer and vendor master data which further goes to sales order and purchase order invoices respectively.
Sounds good so far. But if you print an invoice some part of it will be printed in current user language. Imagine I have my business in U.K. or US where English is the language used but sitting in English countries my customers can be somewhere in Europe, so sending invoice to some other country in English language might not be a perfect job.
If you run such a control document in AX in a foraging language the results might not be 100% correct for labels. One such example as discussed above, is the sales invoice. If you run the sales invoice report with packing slip details, it will not work perfectly in foreign language. One example for this issue can be seen on following method
AOT >> Classes >> SalesInvoiceDP >> setPackingSlipDetails
Have a look at existing method, given next
hasCustPackingSlipTrans = true;
packingSlipDetails += strFmt("@SYS322353", _custPackingSlipTrans.Qty,
_custPackingSlipTrans.PackingSlipId,
date2str(_custPackingSlipTrans.DeliveryDate, -1, -1, -1, -1, -1, -1, DateFlags::FormatAll));
packingSlipDetails += '\n';
What it will do? It will simply translate the report labels to current user language. This is not great. If you want to fix such issue, it should be taking the language from running invoice or order, or customer/vendor master and passing the correct language to transform labels. Keeping same in mind lets translate above method to correct labels.
LanguageId languageIdUser = LanguageTable::defaultLanguage();/*getting current user language*/
LanguageId languageIdSO = _custPackingSlipTrans.custPackingslipJour().salesTable().LanguageId;/*getting current Order language*/
LanguageId languageIdSys = SystemParameters::find().SystemLanguageId;//default system langauge
LanguageId langIdFinal4Reporting;
if(languageIdSO)
{
langIdFinal4Reporting = languageIdSO;
}
else
{
if(languageIdUser)
{
langIdFinal4Reporting = languageIdUser;
}
else
{
if(languageIdSys)
{
langIdFinal4Reporting = languageIdSys;
}
}
}
hasCustPackingSlipTrans = true;
packingSlipDetails += strFmt(SysLabel::labelId2String2("@"+"SYS322353",langIdFinal4Reporting), _custPackingSlipTrans.Qty,
_custPackingSlipTrans.PackingSlipId,
date2str(_custPackingSlipTrans.DeliveryDate, -1, -1, -1, -1, -1, -1, DateFlags::FormatAll));
packingSlipDetails += '\n';
That’s it. It’s nothing special than use of SysLabel::labelId2String2 ; that is well known to majority of developers. I hope next time, you get a complaint from a customer about labels of trading documents; you will have a look at Data provider class as well.

Like
Report
*This post is locked for comments