Merge branch 'develop' into work-order-partial-transfer

This commit is contained in:
Marica 2022-04-11 16:49:22 +05:30 committed by GitHub
commit 3f8be3ac10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -11,6 +11,8 @@ from frappe.utils import nowdate
class CurrencyExchangeSettings(Document):
def validate(self):
self.set_parameters_and_result()
if frappe.flags.in_test or frappe.flags.in_install or frappe.flags.in_setup_wizard:
return
response, value = self.validate_parameters()
self.validate_result(response, value)
@ -35,9 +37,6 @@ class CurrencyExchangeSettings(Document):
self.append("req_params", {"key": "symbols", "value": "{to_currency}"})
def validate_parameters(self):
if frappe.flags.in_test:
return None, None
params = {}
for row in self.req_params:
params[row.key] = row.value.format(
@ -59,9 +58,6 @@ class CurrencyExchangeSettings(Document):
return response, value
def validate_result(self, response, value):
if frappe.flags.in_test:
return
try:
for key in self.result_key:
value = value[

View File

@ -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)

View File

@ -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