I do not see the point to store the barcode if it is just generated from the chicken_number. So it could be just a Function field that use the value of chicken_number. Of course you can not have a default method for it but using a on_change_with_barcode_chicken as getter will update it on the fly.
Also what is the point to duplicate the chicken_number into the chicken_code. It is simpler to have a unique source of data.
Do i have to input the number manually or is there any option to generate random 12 digit number which will not change every time on opening the form ?
You have to store for each record the random number generated.
So you could define a default value for the field but in this case you must disable the cache on the RPC of default_get (otherwise the same value will be used for all record created by the same client).
Or you can extend the ModelStorage.create method to fill the field with random value (like it is done for ir.session).