sales line discount to apply in Sales order only when enum value is yes


I added an enum field in Trade agreement journals, when I create a sales order i want to include discount line only if that enum field value is yes.

I don’t know where to write my logic, please help me out here.

Thank you.

Added field in PriceDiscAdmtrans table

Tale a look at pricedisc. That class should have all the logic to find prices and discounts in it.