Anyone know how to customize calculate the total_commission in Sales Order?

I want to calculate the total commission by commission_rate * total_qty how can I achieve this? I’ve tried overriding the SellingController and it’s working but the Delivery Note and Sales Invoice is affected it doesn’t generate accounting entries. Thank you