...
def orderAmountCustomFieldId = 'customfield_10316'; // set the id according to your environment
Test
Asset had 20 "number of items in stock", after "Done" transition, it became 32.
Also Stock is reflected to Yes. If the same transition passes, post function will not update asset.