Hi,
Based on my understanding, you purchase 300kg from your vendor and got 30 for free.
You can two approaches to achieve it.
First one, you can copy your purchase order to AP invoice. And then you can add a new line with quantity 30kg with zero price. In this case you only need pay for 300kg. Stock is increased by 330kg in quantity aspect and increased by 800 in value aspect.
the JE will look like below (not consider tax),
AP account for BP credit 800
Inventory account debit 800
Second one, I think this is what you want. You can revise your purchase order to quantity 330 which is same as vendor delivered.
Then copy it to AP invoice.
Currently JE will look like below(not consider tax)
AP account for BP credit 1000
Inventory account debit 1000
Then When you want to create outgoing payment for this AP invoice, you can give a 20% discount because vendor gave you some item for free.
Then the payment JE will look like
AP account for BP debit 1000
Cash account credit 800
discount account credit 200