Stop currency conversion on Purchase Orders from Line Item

ben_tes
Kilo Contributor

The purchase order proc_po takes the Total Cost from the purchase order line items proc_po_item

We're set to GBP which is fine until I create a line item that is in USD. The line item shows as USD but the po converts it to local currency. How do I get this to just show the current / amount from proc_po_item ?

1 ACCEPTED SOLUTION

Hello Ben,



New idea, include the u_total_cost field in the form. Hide it with a UI policy. Create an onChange client script on the cost field:



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }


   


    g_form.setValue('u_total_cost', newValue );


   


}



The business rule will not be needed.



Thank you!


View solution in original post

5 REPLIES 5

edwin_munoz
Mega Guru

Hello Ben,



I would suggest you to create a new field as a string in the proc_po_item table .( Lets call it u_total_cost for this example)



Then create a business rule to have the new field synced with the original total cost field.



Business rule should run on the proc_po_item table before insert and update. This should be the code:




current.u_total_cost = current.total_cost.toString();



Please make sure that the field name are correct.



Then you need to replace the field in the PO form.



Thanks


Thanks Edwin, I've given this a go but the original Total cost field shows the currency converted value already as well.



I need to pick up the po_proc_item.cost but i've changed the Business Rule to :



function onBefore(current, previous) {


  //This function will be automatically called when this rule is processed.


  current.u_total_cost = current.cost.toString();


}



But it is still picking up the currency converted number


Hello Ben,



New idea, include the u_total_cost field in the form. Hide it with a UI policy. Create an onChange client script on the cost field:



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }


   


    g_form.setValue('u_total_cost', newValue );


   


}



The business rule will not be needed.



Thank you!


I'll give it a go!