test: add correct test case

This commit is contained in:
Deepesh Garg 2022-02-28 12:41:59 +05:30
parent 0373914704
commit 4e9a9f35a6

View File

@ -2429,14 +2429,22 @@ class TestSalesInvoice(unittest.TestCase):
def test_sales_commission(self): def test_sales_commission(self):
si = frappe.copy_doc(test_records[0]) si = frappe.copy_doc(test_records[2])
frappe.db.set_value('Item', si.get('items')[0].item_code, 'grant_commission', 1)
frappe.db.set_value('Item', si.get('items')[1].item_code, 'grant_commission', 0)
item = copy.deepcopy(si.get('items')[0]) item = copy.deepcopy(si.get('items')[0])
item.update({ item.update({
"qty": 1, "qty": 1,
"rate": 500, "rate": 500,
"grant_commission": 1
}) })
si.append("items", item)
item = copy.deepcopy(si.get('items')[1])
item.update({
"qty": 1,
"rate": 500,
})
# Test valid values # Test valid values
for commission_rate, total_commission in ((0, 0), (10, 50), (100, 500)): for commission_rate, total_commission in ((0, 0), (10, 50), (100, 500)):