Hi,
You can create a mass action with a trigger "after an order is created" with an action "update the values" on the column of your custom field with the mode "operation" and some MySQL commands to generate the number. Several propositions are presented here:
stackoverflow.com/questions/3964624/how-...igit-number-in-mysql
I suppose I would try something like that:
LPAD(FLOOR(RAND()*10000),4,'0')
Otherwise, if you update your HikaShop, you'll have the "run PHP code" action in mass actions, and you can do it with PHP code like this:
$order = new stdClass();
$order->order_id = {order_id};
$order->xxx = rand ( 1000 , 9999 );
$class = hikashop_get('class.order');
$class->save($order);
where xxx is the column of your custom field.