In pricing rule not filter selling or buying type and where i use apply on transaction and finally discount percentage apply in selling and buying transaction.
in this code
def get_other_conditions(conditions, values, args):
for field in [“company”, “customer”, “supplier”, “campaign”, “sales_partner”]:
if args.get(field):
conditions += " and ifnull(tabPricing Rule
.{0}, ‘’) in (%({1})s, ‘’)“.format(field, field)
values[field] = args.get(field)
else:
conditions += " and ifnull(tabPricing Rule
.{0}, ‘’) = ‘’”.format(field)
for parenttype in ["Customer Group", "Territory", "Supplier Group"]:
group_condition = _get_tree_conditions(args, parenttype, "`tabPricing Rule`")
if group_condition:
conditions += " and " + group_condition
if args.get("transaction_date"):
conditions += """ and %(transaction_date)s between ifnull(`tabPricing Rule`.valid_from, '2000-01-01')
and ifnull(`tabPricing Rule`.valid_upto, '2500-12-31')"""
values["transaction_date"] = args.get("transaction_date")
return conditions