refactor: ignore mandatory fields during setup
This commit is contained in:
parent
086d31b59f
commit
c3e1f0e369
@ -1,9 +1,14 @@
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
import unittest
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
class TestSellingSettings(unittest.TestCase):
|
||||
pass
|
||||
def test_defaults_populated(self):
|
||||
# Setup default values are not populated on migrate, this test checks
|
||||
# if setup was completed correctly
|
||||
default = frappe.db.get_single_value("Selling Settings", "maintain_same_rate_action")
|
||||
self.assertEqual("Stop", default)
|
||||
|
@ -56,12 +56,11 @@ def set_single_defaults():
|
||||
)
|
||||
if default_values:
|
||||
try:
|
||||
b = frappe.get_doc(dt, dt)
|
||||
doc = frappe.get_doc(dt, dt)
|
||||
for fieldname, value in default_values:
|
||||
b.set(fieldname, value)
|
||||
b.save()
|
||||
except frappe.MandatoryError:
|
||||
pass
|
||||
doc.set(fieldname, value)
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save()
|
||||
except frappe.ValidationError:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user