Margin does not work when "Include Payment (POS)" is checked in Sales Invoice

Hi Guys,
I have been studying ERPNext and i must say that I’m impressed and kudos to you guys for creating this awesome product. However, I have found a small issue in the invoicing. Particularly when creating an invoice using a POS profile. The details are as follows;

The Margin does not work when “Include Payment (POS)” is checked AFTER selecting the item.

  • First make a new sales invoice
  • Select customer and item
  • There we go I can see the Margin and Discount are both applied awesome :slight_smile:
  • But wait; then I go and check the “Include Payment (POS)” checkbox
  • Bam! now only the discount is applied, the margin is gone!

Here is a screenshot of the pricing rule I have created.

Installed Apps

ERPNext: v12.12.1 (version-12)

Frappe Framework: v12.10.2 (version-12)