Fixes in frozen accounts validation
This commit is contained in:
parent
35a9d585b4
commit
14bf711d04
@ -146,11 +146,12 @@ def update_outstanding_amt(account, against_voucher_type, against_voucher, on_ca
|
|||||||
webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
|
webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
|
||||||
(against_voucher_type, bal, against_voucher))
|
(against_voucher_type, bal, against_voucher))
|
||||||
|
|
||||||
def validate_frozen_account(account, adv_adj):
|
def validate_frozen_account(account, adv_adj=None):
|
||||||
frozen_account = webnotes.conn.get_value("Account", account, "freeze_account")
|
frozen_account = webnotes.conn.get_value("Account", account, "freeze_account")
|
||||||
if frozen_account == 'Yes' and not adv_adj:
|
if frozen_account == 'Yes' and not adv_adj:
|
||||||
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
||||||
'frozen_accounts_modifier')
|
'frozen_accounts_modifier')
|
||||||
|
|
||||||
if not frozen_accounts_modifier:
|
if not frozen_accounts_modifier:
|
||||||
webnotes.throw(account + _(" is a frozen account. \
|
webnotes.throw(account + _(" is a frozen account. \
|
||||||
Either make the account active or assign role in Accounts Settings \
|
Either make the account active or assign role in Accounts Settings \
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _, msgprint, throw
|
from webnotes import _, throw
|
||||||
from webnotes.utils import flt, cint, today, cstr
|
from webnotes.utils import flt, cint, today, cstr
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from setup.utils import get_company_currency
|
from setup.utils import get_company_currency
|
||||||
@ -44,14 +44,13 @@ class AccountsController(TransactionBase):
|
|||||||
def validate_for_freezed_account(self):
|
def validate_for_freezed_account(self):
|
||||||
for fieldname in ["customer", "supplier"]:
|
for fieldname in ["customer", "supplier"]:
|
||||||
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
|
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
|
||||||
accounts = webnotes.conn.get_values("Account", {"master_type": fieldname.title(),
|
accounts = webnotes.conn.get_values("Account",
|
||||||
"master_name": self.doc.fields[fieldname], "company": self.doc.company},
|
{"master_type": fieldname.title(), "master_name": self.doc.fields[fieldname],
|
||||||
"freeze_account", as_dict=1)
|
"company": self.doc.company}, "name")
|
||||||
|
|
||||||
if accounts:
|
if accounts:
|
||||||
if not filter(lambda x: cstr(x.freeze_account) in ["", "No"], accounts):
|
from accounts.doctype.gl_entry.gl_entry import validate_frozen_account
|
||||||
throw(_("Account for this ") + fieldname + _(" has been freezed. ") +
|
for account in accounts:
|
||||||
self.doc.doctype + _(" can not be made."))
|
validate_frozen_account(account[0])
|
||||||
|
|
||||||
def set_price_list_currency(self, buying_or_selling):
|
def set_price_list_currency(self, buying_or_selling):
|
||||||
if self.meta.get_field("currency"):
|
if self.meta.get_field("currency"):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user