It depends on the tax treatment of the demerger. If it is a non-income distribution (ie. relevant ATO ruling) a common way is to treat it as two transactions:
a capital return of the original stock - being the value of the demerged stock - posting that “cash” to your cash account
a buy of the new demerged stock at the deemed purchase price
These two cash transactions should offset, and create a the appropriate cost base for the demerged stock, and requisite reduction in cost base for the original stock.
Clear as mud?
(note the above ignores other tax treatments, or franking credits that may be involved!)