In Core > Global Settings > Accounting, you can set your default discount account. The discount account has to be an income or an expense account, and applies to both A/R and A/P.
If you select any other account, say Cost of Goods Sold, the discount transactions won't be associated with this account. Typically, discounts go to an income account, say for client invoices (sales discount) and vendor bills (discount for an early payment).
If you have been specifying a discount account other than an income or expense account, you should discontinue that and set or create a new discount account. Then move the discount transactions to the new account via general journal entries. You must determine if the discount is for sales or COGS, and then create the journal entry accordingly.
For A/P invoices (vendor bills), create an activity or expense ID and assign the appropriate A/P expense account to them for discounts. You can assign a COGS account here, if you want. Use this new activity or expense ID on the vendor bill you would like to discount. Make sure to add a negative amount against the activity or expense for the discount.