test: Improve test case for not coping payment terms

This commit is contained in:
Deepesh Garg 2021-08-07 17:39:40 +05:30
parent a27ef14db6
commit 25d131a39f
3 changed files with 10 additions and 4 deletions

View File

@ -471,6 +471,7 @@ def get_mapped_purchase_invoice(source_name, target_doc=None, ignore_permissions
"party_account_currency": "party_account_currency",
"supplier_warehouse":"supplier_warehouse"
},
"field_no_map" : ["payment_terms_template"],
"validation": {
"docstatus": ["=", 1],
}

View File

@ -633,13 +633,17 @@ class TestPurchaseOrder(unittest.TestCase):
raise Exception
def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self):
po = create_purchase_order()
self.assertTrue(po.get('payment_schedule'))
po = create_purchase_order(do_not_save=1)
po.payment_terms_template = '_Test Payment Term Template'
po.save()
po.submit()
company = frappe.get_doc('Company', '_Test Company', 'payment_terms', '_Test Payment Term Template 1')
pi = make_pi_from_po(po.name)
pi.save()
self.assertFalse(pi.get('payment_schedule'))
self.assertEqual(pi.get('payment_terms_template'), '_Test Payment Term Template 1')
frappe.db.set_value('Company', '_Test Company', 'payment_terms', '')
def test_terms_copied(self):
po = create_purchase_order(do_not_save=1)

View File

@ -670,6 +670,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
"party_account_currency": "party_account_currency",
"payment_terms_template": "payment_terms_template"
},
"field_no_map": ["payment_terms_template"],
"validation": {
"docstatus": ["=", 1]
}