Added Disabled field to Supplier and Customer doctype
Frozen field is moved to More Information section for Customer and Supplier. Any Supplier/Customer which is disabled will not be shown while creating PO/SO
This commit is contained in:
@@ -10,8 +10,8 @@ from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year, get_ac
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
from erpnext.controllers.recurring_document import convert_to_recurring, validate_recurring_document
|
||||
from erpnext.controllers.sales_and_purchase_return import validate_return
|
||||
from erpnext.accounts.party import get_party_account_currency
|
||||
from erpnext.exceptions import CustomerFrozen, InvalidCurrency
|
||||
from erpnext.accounts.party import get_party_account_currency, validate_party_frozen_disabled
|
||||
from erpnext.exceptions import CustomerFrozen, InvalidCurrency, CustomerDisabled
|
||||
|
||||
force_item_fields = ("item_group", "barcode", "brand", "stock_uom")
|
||||
|
||||
@@ -416,23 +416,22 @@ class AccountsController(TransactionBase):
|
||||
return self._abbr
|
||||
|
||||
def validate_party(self):
|
||||
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
|
||||
if frozen_accounts_modifier in frappe.get_roles():
|
||||
return
|
||||
|
||||
party_type, party = self.get_party()
|
||||
|
||||
if party_type:
|
||||
if frappe.db.get_value(party_type, party, "is_frozen"):
|
||||
frappe.throw("{0} {1} is frozen".format(party_type, party), CustomerFrozen)
|
||||
validate_party_frozen_disabled(party, party_type)
|
||||
|
||||
def get_party(self):
|
||||
party_type = None
|
||||
if self.meta.get_field("customer"):
|
||||
party_type = 'Customer'
|
||||
if self.doctype in ("Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"):
|
||||
party_type = 'Customer'
|
||||
|
||||
elif self.doctype in ("Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice"):
|
||||
party_type = 'Supplier'
|
||||
|
||||
elif self.meta.get_field("customer"):
|
||||
party_type = "Customer"
|
||||
|
||||
elif self.meta.get_field("supplier"):
|
||||
party_type = 'Supplier'
|
||||
party_type = "Supplier"
|
||||
|
||||
party = self.get(party_type.lower()) if party_type else None
|
||||
|
||||
@@ -451,7 +450,9 @@ class AccountsController(TransactionBase):
|
||||
frappe.throw(_("Accounting Entry for {0}: {1} can only be made in currency: {2}")
|
||||
.format(party_type, party, party_account_currency), InvalidCurrency)
|
||||
|
||||
# Note: not validating with gle account because we don't have the account at quotation / sales order level and we shouldn't stop someone from creating a sales invoice if sales order is already created
|
||||
# Note: not validating with gle account because we don't have the account
|
||||
# at quotation / sales order level and we shouldn't stop someone
|
||||
# from creating a sales invoice if sales order is already created
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_tax_rate(account_head):
|
||||
|
||||
Reference in New Issue
Block a user