Browse Source

fix: Travis

develop
deepeshgarg007 5 years ago
parent
commit
737ec6b26e
  1. 6
      erpnext/accounts/party.py
  2. 3
      erpnext/buying/doctype/supplier/test_supplier.py
  3. 1
      erpnext/exceptions.py
  4. 4
      erpnext/selling/doctype/customer/test_customer.py

6
erpnext/accounts/party.py

@ -12,7 +12,7 @@ from frappe.utils import (add_days, getdate, formatdate, date_diff,
from frappe.contacts.doctype.address.address import (get_address_display,
get_default_address, get_company_address)
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
from erpnext.exceptions import PartyFrozen, InvalidAccountCurrency
from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency
from erpnext.accounts.utils import get_fiscal_year
from erpnext import get_company_currency
@ -446,7 +446,9 @@ def validate_party_frozen_disabled(party_type, party_name):
if party_type and party_name:
if party_type in ("Customer", "Supplier"):
party = frappe.get_cached_value(party_type, party_name, ["is_frozen", "disabled"], as_dict=True)
if party.get("is_frozen"):
if party.disabled:
frappe.throw(_("{0} {1} is disabled").format(party_type, party_name), PartyDisabled)
elif party.get("is_frozen"):
frozen_accounts_modifier = frappe.db.get_single_value( 'Accounts Settings', 'frozen_accounts_modifier')
if not frozen_accounts_modifier in frappe.get_roles():
frappe.throw(_("{0} {1} is frozen").format(party_type, party_name), PartyFrozen)

3
erpnext/buying/doctype/supplier/test_supplier.py

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe, unittest
from erpnext.accounts.party import get_due_date
from erpnext.exceptions import PartyDisabled
from frappe.test_runner import make_test_records
test_dependencies = ['Payment Term', 'Payment Terms Template']
@ -70,7 +71,7 @@ class TestSupplier(unittest.TestCase):
po = create_purchase_order(do_not_save=True)
self.assertRaises(frappe.ValidationError, po.save)
self.assertRaises(PartyDisabled, po.save)
frappe.db.set_value("Supplier", "_Test Supplier", "disabled", 0)

1
erpnext/exceptions.py

@ -5,3 +5,4 @@ import frappe
class PartyFrozen(frappe.ValidationError): pass
class InvalidAccountCurrency(frappe.ValidationError): pass
class InvalidCurrency(frappe.ValidationError): pass
class PartyDisabled(frappe.ValidationError):pass

4
erpnext/selling/doctype/customer/test_customer.py

@ -8,7 +8,7 @@ import unittest
from erpnext.accounts.party import get_due_date
from frappe.test_runner import make_test_records
from erpnext.exceptions import PartyFrozen
from erpnext.exceptions import PartyFrozen, PartyDisabled
from frappe.utils import flt
from erpnext.selling.doctype.customer.customer import get_credit_limit, get_customer_outstanding
from erpnext.tests.utils import create_test_contact_and_address
@ -178,7 +178,7 @@ class TestCustomer(unittest.TestCase):
so = make_sales_order(do_not_save=True)
self.assertRaises(frappe.ValidationError, so.save)
self.assertRaises(PartyDisabled, so.save)
frappe.db.set_value("Customer", "_Test Customer", "disabled", 0)

Loading…
Cancel
Save