I've worked for a commercial art gallery who sell works on behalf of the artists they represent. The artwork is consigned to the gallery by the artist. There is an agreed sale price, and an agreed % share between the two parties. The gallery does not own the artwork. The artworks are on the primary market, ie. it is the first time they are sold.
As you have suggested, the gallery charges VAT on the full sale price to the customer. They then report the sale to the artist and the artist invoices for their share (often 50%, but whatever was previously agreed) of the net sale price. If the artist is VAT registered they apply VAT to their invoice. As you have said, this artist invoice is a cost of sale.
I've personally only seen the margin scheme used in auction houses so do not have much experience with that, there may be a wider use of it for galleries who deal in the secondary market. The gallery I worked for did not use it because they have not bought the artwork from the artist to sell on at a higher price.
A popular database/inventory system used by galleries is called ArtLogic. Artworks are added to the inventory along with a whole wealth of further information, including financial details. Invoices can be produced within the system. It records all sales info to refer to at a later date.
I hope that helps!
Edited at 20 Sep 2020 08:14 AM GMT
Edited at 20 Sep 2020 08:27 AM GMT