more message fixing
This commit is contained in:
parent
c5e057f676
commit
8a40c136ce
@ -42,7 +42,7 @@ class BankReconciliation(Document):
|
||||
for d in self.get('entries'):
|
||||
if d.clearance_date:
|
||||
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
|
||||
frappe.throw("Clearance Date can not be before Cheque Date (Row #%s)" % d.idx)
|
||||
frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx))
|
||||
|
||||
frappe.db.set_value("Journal Voucher", d.voucher_id, "clearance_date", d.clearance_date)
|
||||
frappe.db.sql("""update `tabJournal Voucher` set clearance_date = %s, modified = %s
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import flt, fmt_money, getdate
|
||||
from frappe.utils import flt, fmt_money, getdate, formatdate
|
||||
from frappe import _
|
||||
|
||||
from frappe.model.document import Document
|
||||
@ -34,18 +34,16 @@ class GLEntry(Document):
|
||||
mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
|
||||
for k in mandatory:
|
||||
if not self.get(k):
|
||||
frappe.throw(k + _(" is mandatory for GL Entry"))
|
||||
frappe.throw(_("{0} is required").format(k))
|
||||
|
||||
# Zero value transaction is not allowed
|
||||
if not (flt(self.debit) or flt(self.credit)):
|
||||
frappe.throw(_("GL Entry: Debit or Credit amount is mandatory for ") +
|
||||
self.account)
|
||||
frappe.throw(_("Either debit or credit amount is required for {0}").format(self.account))
|
||||
|
||||
def pl_must_have_cost_center(self):
|
||||
if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss":
|
||||
if not self.cost_center and self.voucher_type != 'Period Closing Voucher':
|
||||
frappe.throw(_("Cost Center must be specified for Profit and Loss type account: ")
|
||||
+ self.account)
|
||||
frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}").format(self.account))
|
||||
elif self.cost_center:
|
||||
self.cost_center = None
|
||||
|
||||
@ -56,8 +54,7 @@ class GLEntry(Document):
|
||||
def check_pl_account(self):
|
||||
if self.is_opening=='Yes' and \
|
||||
frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss":
|
||||
frappe.throw(_("For opening balance entry, account can not be \
|
||||
a Profit and Loss type account"))
|
||||
frappe.throw(_("'Profit and Loss' type account {0} not allowed in Opening Entry").format(self.account))
|
||||
|
||||
def validate_account_details(self, adv_adj):
|
||||
"""Account must be ledger, active and not freezed"""
|
||||
@ -66,14 +63,13 @@ class GLEntry(Document):
|
||||
from tabAccount where name=%s""", self.account, as_dict=1)[0]
|
||||
|
||||
if ret.group_or_ledger=='Group':
|
||||
frappe.throw(_("Account") + ": " + self.account + _(" is not a ledger"))
|
||||
frappe.throw(_("Account {0} cannot be a Group").format(self.account))
|
||||
|
||||
if ret.docstatus==2:
|
||||
frappe.throw(_("Account") + ": " + self.account + _(" is not active"))
|
||||
frappe.throw(_("Account {0} is inactive").format(self.account))
|
||||
|
||||
if ret.company != self.company:
|
||||
frappe.throw(_("Account") + ": " + self.account +
|
||||
_(" does not belong to the company") + ": " + self.company)
|
||||
frappe.throw(_("Account {0} does not belong to Company {1}").format(self.account, self.company))
|
||||
|
||||
def validate_cost_center(self):
|
||||
if not hasattr(self, "cost_center_company"):
|
||||
@ -87,8 +83,7 @@ class GLEntry(Document):
|
||||
return self.cost_center_company[self.cost_center]
|
||||
|
||||
if self.cost_center and _get_cost_center_company() != self.company:
|
||||
frappe.throw(_("Cost Center") + ": " + self.cost_center +
|
||||
_(" does not belong to the company") + ": " + self.company)
|
||||
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
|
||||
|
||||
def validate_balance_type(account, adv_adj=False):
|
||||
if not adv_adj and account:
|
||||
@ -99,8 +94,7 @@ def validate_balance_type(account, adv_adj=False):
|
||||
|
||||
if (balance_must_be=="Debit" and flt(balance) < 0) or \
|
||||
(balance_must_be=="Credit" and flt(balance) > 0):
|
||||
frappe.throw("Credit" if balance_must_be=="Debit" else "Credit"
|
||||
+ _(" balance is not allowed for account ") + account)
|
||||
frappe.throw(_("Balance for Account {0} must always be {1}").format(account, _(balance_must_be)))
|
||||
|
||||
def check_freezing_date(posting_date, adv_adj=False):
|
||||
"""
|
||||
@ -113,8 +107,7 @@ def check_freezing_date(posting_date, adv_adj=False):
|
||||
bde_auth_role = frappe.db.get_value( 'Accounts Settings', None,'bde_auth_role')
|
||||
if getdate(posting_date) <= getdate(acc_frozen_upto) \
|
||||
and not bde_auth_role in frappe.user.get_roles():
|
||||
frappe.throw(_("You are not authorized to do/modify back dated entries before ")
|
||||
+ getdate(acc_frozen_upto).strftime('%d-%m-%Y'))
|
||||
frappe.throw(_("You are not authorized to add or update entries before {0}").format(formatdate(acc_frozen_upto)))
|
||||
|
||||
def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False):
|
||||
# get final outstanding amt
|
||||
@ -137,9 +130,7 @@ def update_outstanding_amt(account, against_voucher_type, against_voucher, on_ca
|
||||
|
||||
# Validation : Outstanding can not be negative
|
||||
if bal < 0 and not on_cancel:
|
||||
frappe.throw(_("Outstanding for Voucher ") + against_voucher + _(" will become ") +
|
||||
fmt_money(bal) + _(". Outstanding cannot be less than zero. \
|
||||
Please match exact outstanding."))
|
||||
frappe.throw(_("Outstanding for {0} cannot be less than zero ({1})").format(against_voucher, fmt_money(bal)))
|
||||
|
||||
# Update outstanding amt on against voucher
|
||||
if against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
|
||||
@ -153,7 +144,6 @@ def validate_frozen_account(account, adv_adj=None):
|
||||
'frozen_accounts_modifier')
|
||||
|
||||
if not frozen_accounts_modifier:
|
||||
frappe.throw(account + _(" is a frozen account. Either make the account active or assign role in Accounts Settings who can create / modify entries against this account"))
|
||||
frappe.throw(_("Account {0} is frozen").format(account))
|
||||
elif frozen_accounts_modifier not in frappe.user.get_roles():
|
||||
frappe.throw(account + _(" is a frozen account. To create / edit transactions against this account, you need role") \
|
||||
+ ": " + frozen_accounts_modifier)
|
||||
frappe.throw(_("Not authorized to edit frozen Account {0}").format(account))
|
||||
|
||||
@ -225,13 +225,11 @@ class JournalVoucher(AccountsController):
|
||||
for d in self.get("entries"):
|
||||
if d.against_invoice and frappe.db.get_value("Sales Invoice",
|
||||
d.against_invoice, "debit_to") != d.account:
|
||||
frappe.throw(_("Row #") + cstr(d.idx) + ": " +
|
||||
_("Account is not matching with Debit To account of Sales Invoice"))
|
||||
frappe.throw(_("Account {0} must be sames as Debit To Account in Sales Invoice in row {0}").format(d.account, d.idx))
|
||||
|
||||
if d.against_voucher and frappe.db.get_value("Purchase Invoice",
|
||||
d.against_voucher, "credit_to") != d.account:
|
||||
frappe.throw(_("Row #") + cstr(d.idx) + ": " +
|
||||
_("Account is not matching with Credit To account of Purchase Invoice"))
|
||||
frappe.throw(_("Account {0} must be sames as Credit To Account in Purchase Invoice in row {0}").format(d.account, d.idx))
|
||||
|
||||
def make_gl_entries(self, cancel=0, adv_adj=0):
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
|
||||
@ -43,7 +43,7 @@ class POSSetting(Document):
|
||||
for link_dn in dn_list:
|
||||
if link_dn and not frappe.db.exists({"doctype": link_dt,
|
||||
"company": self.company, "name": link_dn}):
|
||||
frappe.throw(link_dn +_(" does not belong to ") + self.company)
|
||||
frappe.throw(_("{0} does not belong to Company {1}").format(link_dn, self.company))
|
||||
|
||||
def on_update(self):
|
||||
self.set_defaults()
|
||||
|
||||
@ -18,8 +18,7 @@ class PricingRule(DocListController):
|
||||
for field in ["apply_on", "applicable_for", "price_or_discount"]:
|
||||
val = self.get("applicable_for")
|
||||
if val and not self.get(frappe.scrub(val)):
|
||||
throw("{fname} {msg}".format(fname = _(val), msg = _(" is mandatory")),
|
||||
frappe.MandatoryError)
|
||||
throw(_("{0} is required").format(val), frappe.MandatoryError)
|
||||
|
||||
def cleanup_fields_value(self):
|
||||
for logic_field in ["apply_on", "applicable_for", "price_or_discount"]:
|
||||
@ -33,4 +32,3 @@ class PricingRule(DocListController):
|
||||
f = frappe.scrub(f)
|
||||
if f!=fieldname:
|
||||
self.set(f, None)
|
||||
|
||||
@ -221,11 +221,11 @@ class PurchaseInvoice(BuyingController):
|
||||
if d.purchase_order:
|
||||
submitted = frappe.db.sql("select name from `tabPurchase Order` where docstatus = 1 and name = %s", d.purchase_order)
|
||||
if not submitted:
|
||||
frappe.throw("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
|
||||
frappe.throw(_("Purchase Order {0} is not submitted").format(d.purchase_order))
|
||||
if d.purchase_receipt:
|
||||
submitted = frappe.db.sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = %s", d.purchase_receipt)
|
||||
if not submitted:
|
||||
frappe.throw("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
|
||||
frappe.throw(_("Purchase Receipt {0} is not submitted").format(d.purchase_receipt))
|
||||
|
||||
|
||||
def update_against_document_in_jv(self):
|
||||
@ -305,9 +305,7 @@ class PurchaseInvoice(BuyingController):
|
||||
# accumulate valuation tax
|
||||
if tax.category in ("Valuation", "Valuation and Total") and flt(tax.tax_amount):
|
||||
if auto_accounting_for_stock and not tax.cost_center:
|
||||
frappe.throw(_("Row %(row)s: Cost Center is mandatory \
|
||||
if tax/charges category is Valuation or Valuation and Total" %
|
||||
{"row": tax.idx}))
|
||||
frappe.throw(_("Cost Center is required in row {0} in Taxes table for type {1}").format(tax.idx, _(tax.category)))
|
||||
valuation_tax.setdefault(tax.cost_center, 0)
|
||||
valuation_tax[tax.cost_center] += \
|
||||
(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.tax_amount)
|
||||
|
||||
@ -45,7 +45,7 @@ def get_item_code(barcode_serial_no):
|
||||
if item_code:
|
||||
return item_code, input_via
|
||||
else:
|
||||
frappe.throw("Invalid Barcode / Serial No")
|
||||
frappe.throw(frappe._("Invalid Barcode or Serial No"))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_mode_of_payment():
|
||||
|
||||
@ -23,7 +23,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
|
||||
party = out[party_type.lower()]
|
||||
|
||||
if not ignore_permissions and not frappe.has_permission(party_type, "read", party):
|
||||
frappe.throw("Not Permitted", frappe.PermissionError)
|
||||
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
||||
|
||||
party = frappe.get_doc(party_type, party)
|
||||
|
||||
|
||||
@ -294,20 +294,19 @@ def validate_expense_against_budget(args):
|
||||
|
||||
args["month_end_date"] = frappe.db.sql("select LAST_DAY(%s)",
|
||||
args.posting_date)[0][0]
|
||||
action_for, action = "Monthly", monthly_action
|
||||
action_for, action = _("Monthly"), monthly_action
|
||||
|
||||
elif yearly_action in ["Stop", "Warn"]:
|
||||
budget_amount = budget[0].budget_allocated
|
||||
action_for, action = "Monthly", yearly_action
|
||||
action_for, action = _("Annual"), yearly_action
|
||||
|
||||
if action_for:
|
||||
actual_expense = get_actual_expense(args)
|
||||
if actual_expense > budget_amount:
|
||||
throw(action_for + _(" budget ") + cstr(budget_amount) +
|
||||
_(" for account ") + args.account + _(" against cost center ") +
|
||||
args.cost_center + _(" will exceed by ") +
|
||||
cstr(actual_expense - budget_amount) + _(" after this transaction.")
|
||||
, exc=BudgetError if action=="Stop" else False)
|
||||
frappe.msgprint(_("{0} budget for Account {1} against Cost Center {2} will exceed by {3}").format(
|
||||
_(action_for), args.account, args.cost_center, cstr(actual_expense - budget_amount)))
|
||||
if action=="Stop":
|
||||
raise BudgetError
|
||||
|
||||
def get_allocated_budget(distribution_id, posting_date, fiscal_year, yearly_budget):
|
||||
if distribution_id:
|
||||
|
||||
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import cstr, flt
|
||||
from frappe import msgprint, _
|
||||
from frappe import _
|
||||
|
||||
from erpnext.stock.doctype.item.item import get_last_purchase_details
|
||||
from erpnext.controllers.buying_controller import BuyingController
|
||||
@ -33,8 +33,7 @@ class PurchaseCommon(BuyingController):
|
||||
if flt(d.conversion_factor):
|
||||
last_purchase_rate = flt(d.base_rate) / flt(d.conversion_factor)
|
||||
else:
|
||||
frappe.throw(_("Row ") + cstr(d.idx) + ": " +
|
||||
_("UOM Conversion Factor is mandatory"))
|
||||
frappe.throw(_("UOM Conversion factor is required in row {0}").format(d.idx))
|
||||
|
||||
# update last purchsae rate
|
||||
if last_purchase_rate:
|
||||
@ -71,7 +70,7 @@ class PurchaseCommon(BuyingController):
|
||||
for d in obj.get(obj.fname):
|
||||
# validation for valid qty
|
||||
if flt(d.qty) < 0 or (d.parenttype != 'Purchase Receipt' and not flt(d.qty)):
|
||||
frappe.throw("Please enter valid qty for item %s" % cstr(d.item_code))
|
||||
frappe.throw(_("Please enter quantity for Item {0}").format(d.item_code))
|
||||
|
||||
# udpate with latest quantities
|
||||
bin = frappe.db.sql("""select projected_qty from `tabBin` where
|
||||
@ -86,19 +85,17 @@ class PurchaseCommon(BuyingController):
|
||||
|
||||
item = frappe.db.sql("""select is_stock_item, is_purchase_item,
|
||||
is_sub_contracted_item, end_of_life from `tabItem` where name=%s""", d.item_code)
|
||||
if not item:
|
||||
frappe.throw("Item %s does not exist in Item Master." % cstr(d.item_code))
|
||||
|
||||
from erpnext.stock.doctype.item.item import validate_end_of_life
|
||||
validate_end_of_life(d.item_code, item[0][3])
|
||||
|
||||
# validate stock item
|
||||
if item[0][0]=='Yes' and d.qty and not d.warehouse:
|
||||
frappe.throw("Warehouse is mandatory for %s, since it is a stock item" % d.item_code)
|
||||
frappe.throw(_("Warehouse is mandatory for stock Item {0} in row {1}").format(d.item_code, d.idx))
|
||||
|
||||
# validate purchase item
|
||||
if item[0][1] != 'Yes' and item[0][2] != 'Yes':
|
||||
frappe.throw("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code))
|
||||
frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx))
|
||||
|
||||
# list criteria that should not repeat if item is stock item
|
||||
e = [getattr(d, "schedule_date", None), d.item_code, d.description, d.warehouse, d.uom,
|
||||
@ -114,16 +111,14 @@ class PurchaseCommon(BuyingController):
|
||||
if ch and ch[0][0] == 'Yes':
|
||||
# check for same items
|
||||
if e in check_list:
|
||||
frappe.throw("""Item %s has been entered more than once with same description, schedule date, warehouse and uom.\n
|
||||
Please change any of the field value to enter the item twice""" % d.item_code)
|
||||
frappe.throw(_("Item {0} has been entered multiple times with same description or date or warehouse").format(d.item_code))
|
||||
else:
|
||||
check_list.append(e)
|
||||
|
||||
elif ch and ch[0][0] == 'No':
|
||||
# check for same items
|
||||
if f in chk_dupl_itm:
|
||||
frappe.throw("""Item %s has been entered more than once with same description, schedule date.\n
|
||||
Please change any of the field value to enter the item twice.""" % d.item_code)
|
||||
frappe.throw(_("Item {0} has been entered multiple times with same description or date").format(d.item_code))
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
@ -152,8 +147,7 @@ class PurchaseCommon(BuyingController):
|
||||
stopped = frappe.db.sql("""select name from `tab%s` where name = %s and
|
||||
status = 'Stopped'""" % (doctype, '%s'), docname)
|
||||
if stopped:
|
||||
frappe.throw("One cannot do any transaction against %s : %s, it's status is 'Stopped'" %
|
||||
(doctype, docname), exc=frappe.InvalidStatusError)
|
||||
frappe.throw("{0} {1} status is 'Stopped'".format(doctype, docname), frappe.InvalidStatusError)
|
||||
|
||||
def check_docstatus(self, check, doctype, docname, detail_doctype = ''):
|
||||
if check == 'Next':
|
||||
@ -161,11 +155,10 @@ class PurchaseCommon(BuyingController):
|
||||
where t1.name = t2.parent and t2.prevdoc_docname = %s and t1.docstatus = 1"""
|
||||
% (doctype, detail_doctype, '%s'), docname)
|
||||
if submitted:
|
||||
frappe.throw(cstr(doctype) + ": " + cstr(submitted[0][0])
|
||||
+ _("has already been submitted."))
|
||||
frappe.throw(_("{0} {1} has already been submitted").format(doctype, submitted[0][0]))
|
||||
|
||||
if check == 'Previous':
|
||||
submitted = frappe.db.sql("""select name from `tab%s`
|
||||
where docstatus = 1 and name = %s""" % (doctype, '%s'), docname)
|
||||
if not submitted:
|
||||
frappe.throw(cstr(doctype) + ": " + cstr(submitted[0][0]) + _("not submitted"))
|
||||
frappe.throw(_("{0} {1} is not submitted").format(doctype, submitted[0][0]))
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _, throw
|
||||
from frappe.utils import flt, cint, today, cstr
|
||||
from frappe.utils import flt, cint, today
|
||||
from erpnext.setup.utils import get_company_currency
|
||||
from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
@ -191,38 +191,17 @@ class AccountsController(TransactionBase):
|
||||
"""
|
||||
if tax.charge_type in ["On Previous Row Amount", "On Previous Row Total"] and \
|
||||
(not tax.row_id or cint(tax.row_id) >= tax.idx):
|
||||
throw((_("Row") + " # %(idx)s [%(taxes_doctype)s]: " + \
|
||||
_("Please specify a valid") + " %(row_id_label)s") % {
|
||||
"idx": tax.idx,
|
||||
"taxes_doctype": tax.doctype,
|
||||
"row_id_label": self.meta.get_label("row_id",
|
||||
parentfield=self.other_fname)
|
||||
})
|
||||
throw(_("Please specify a valid Row ID for {0} in row {1}").format(_(tax.doctype), tax.idx))
|
||||
|
||||
def validate_inclusive_tax(self, tax):
|
||||
def _on_previous_row_error(row_range):
|
||||
throw((_("Row") + " # %(idx)s [%(doctype)s]: " +
|
||||
_("to be included in Item's rate, it is required that: ") +
|
||||
" [" + _("Row") + " # %(row_range)s] " + _("also be included in Item's rate")) % {
|
||||
"idx": tax.idx,
|
||||
"doctype": tax.doctype,
|
||||
"inclusive_label": frappe.get_meta(tax.doctype).get_label("included_in_print_rate"),
|
||||
"charge_type_label": frappe.get_meta(tax.doctype).get_label("charge_type"),
|
||||
"charge_type": tax.charge_type,
|
||||
"row_range": row_range
|
||||
})
|
||||
throw(_("To include tax in row {0} in Item rate, taxes in rows {1} must also be included").format(tax.idx,
|
||||
row_range))
|
||||
|
||||
if cint(getattr(tax, "included_in_print_rate", None)):
|
||||
if tax.charge_type == "Actual":
|
||||
# inclusive tax cannot be of type Actual
|
||||
throw((_("Row")
|
||||
+ " # %(idx)s [%(doctype)s]: %(charge_type_label)s = \"%(charge_type)s\" "
|
||||
+ "cannot be included in Item's rate") % {
|
||||
"idx": tax.idx,
|
||||
"doctype": tax.doctype,
|
||||
"charge_type_label": frappe.get_meta(tax.doctype).get_label("charge_type"),
|
||||
"charge_type": tax.charge_type,
|
||||
})
|
||||
throw(_("Charge of type 'Actual' in row {0} cannot be included in Item Rate").format(tax.idx))
|
||||
elif tax.charge_type == "On Previous Row Amount" and \
|
||||
not cint(self.tax_doclist[cint(tax.row_id) - 1].included_in_print_rate):
|
||||
# referred row should also be inclusive
|
||||
@ -434,17 +413,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
if total_billed_amt - max_allowed_amt > 0.01:
|
||||
reduce_by = total_billed_amt - max_allowed_amt
|
||||
|
||||
frappe.throw(_("Row #") + cstr(item.idx) + ": " +
|
||||
_(" Max amount allowed for Item ") + cstr(item.item_code) +
|
||||
_(" against ") + ref_dt + " " +
|
||||
cstr(item.get(ref_dt.lower().replace(" ", "_"))) + _(" is ") +
|
||||
cstr(max_allowed_amt) + ". \n" +
|
||||
_("""If you want to increase your overflow tolerance, please increase \
|
||||
tolerance % in Global Defaults or Item master.
|
||||
Or, you must reduce the amount by """) + cstr(reduce_by) + "\n" +
|
||||
_("""Also, please check if the order item has already been billed \
|
||||
in the Sales Order"""))
|
||||
frappe.throw(_("Cannot overbill for Item {0} in row {0} more than {1}. To allow overbilling, please set in 'Setup' > 'Global Defaults'").format(item.item_code, item.row, max_allowed_amt))
|
||||
|
||||
def get_company_default(self, fieldname):
|
||||
from erpnext.accounts.utils import get_company_default
|
||||
|
||||
@ -361,9 +361,7 @@ class SellingController(StockController):
|
||||
if d.get(ref_fieldname):
|
||||
status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status")
|
||||
if status == "Stopped":
|
||||
frappe.throw(self.doctype +
|
||||
_(" can not be created/modified against stopped Sales Order ") +
|
||||
d.get(ref_fieldname))
|
||||
frappe.throw(_("Sales Order {0} is stopped").format(d.get(ref_fieldname)))
|
||||
|
||||
def check_active_sales_items(obj):
|
||||
for d in obj.get(obj.fname):
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import cstr, flt, getdate
|
||||
from frappe.utils import flt, getdate
|
||||
|
||||
from frappe import msgprint, _
|
||||
from frappe import _
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from frappe.model.document import Document
|
||||
|
||||
@ -34,9 +34,7 @@ class Appraisal(Document):
|
||||
or (end_date>=%s and end_date<=%s))""",
|
||||
(self.employee,self.start_date,self.end_date,self.start_date,self.end_date))
|
||||
if chk:
|
||||
frappe.throw("You have already created Appraisal "\
|
||||
+cstr(chk[0][0])+" in the current date range for employee "\
|
||||
+cstr(self.employee_name))
|
||||
frappe.throw(_("Appraisal {0} created for Employee {1} in the given date range").format(chk[0][0], self.employee_name))
|
||||
|
||||
def calculate_total(self):
|
||||
total, total_w = 0, 0
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import getdate, validate_email_add, cstr, cint
|
||||
from frappe.utils import getdate, validate_email_add, cint
|
||||
from frappe.model.naming import make_autoname
|
||||
from frappe import msgprint, throw, _
|
||||
from frappe import throw, _
|
||||
import frappe.permissions
|
||||
from frappe.defaults import get_restrictions
|
||||
from frappe.model.controller import DocListController
|
||||
@ -146,22 +146,13 @@ class Employee(DocListController):
|
||||
enabled = frappe.db.sql("""select name from `tabUser` where
|
||||
name=%s and enabled=1""", self.user_id)
|
||||
if not enabled:
|
||||
throw("{id}: {user_id} {msg}".format(**{
|
||||
"id": _("User ID"),
|
||||
"user_id": self.user_id,
|
||||
"msg": _("is disabled.")
|
||||
}))
|
||||
throw(_("User {0} is disabled").format(self.user_id))
|
||||
|
||||
def validate_duplicate_user_id(self):
|
||||
employee = frappe.db.sql_list("""select name from `tabEmployee` where
|
||||
user_id=%s and status='Active' and name!=%s""", (self.user_id, self.name))
|
||||
if employee:
|
||||
throw("{id}: {user_id} {msg}: {employee}".format(**{
|
||||
"id": _("User ID"),
|
||||
"user_id": self.user_id,
|
||||
"msg": _("is already assigned to Employee"),
|
||||
"employee": employee[0]
|
||||
}))
|
||||
throw(_("User {0} is already assigned to Employee {1}").format(self.user_id, employee[0]))
|
||||
|
||||
def validate_employee_leave_approver(self):
|
||||
from frappe.utils.user import User
|
||||
@ -169,8 +160,7 @@ class Employee(DocListController):
|
||||
|
||||
for l in self.get("employee_leave_approvers"):
|
||||
if "Leave Approver" not in User(l.leave_approver).get_roles():
|
||||
throw(_("Invalid Leave Approver") + ": \"" + l.leave_approver + "\"",
|
||||
exc=InvalidLeaveApproverError)
|
||||
throw(_("{0} is not a valid Leave Approver").format(l.leave_approver), InvalidLeaveApproverError)
|
||||
|
||||
def update_dob_event(self):
|
||||
if self.status == "Active" and self.date_of_birth \
|
||||
|
||||
@ -7,11 +7,8 @@ frappe.provide('erpnext');
|
||||
$(document).bind('toolbar_setup', function() {
|
||||
frappe.app.name = "ERPNext";
|
||||
|
||||
var brand = ($("<div></div>").append(frappe.boot.website_settings.brand_html).text() || 'erpnext');
|
||||
$('.navbar-brand').html('<div style="display: inline-block;">\
|
||||
<object type="image/svg+xml" data="assets/erpnext/images/splash.svg" class="toolbar-splash"></object>\
|
||||
</div>' + brand)
|
||||
.attr("title", brand)
|
||||
$('.navbar-brand').html('<i class="icon-home"></i>')
|
||||
.attr("title", "Home")
|
||||
.addClass("navbar-icon-home")
|
||||
.css({
|
||||
"max-width": "200px",
|
||||
@ -27,7 +24,8 @@ frappe.ui.misc.about = function() {
|
||||
|
||||
$(d.body).html(repl("<div>\
|
||||
<h2>ERPNext</h2> \
|
||||
<p>"+__("An open source ERP made for the web.</p>") +
|
||||
<h4 class='text-muted'>"+__("Built on") + " Frappe Framework"+"</h4> \
|
||||
<p>"+__("Open source ERP built for the web") + "</p>" +
|
||||
"<p>"+__("To report an issue, go to ")+"<a href='https://github.com/frappe/erpnext/issues'>GitHub Issues</a></p> \
|
||||
<p><a href='http://erpnext.org' target='_blank'>http://erpnext.org</a>.</p>\
|
||||
<p><a href='http://www.gnu.org/copyleft/gpl.html'>License: GNU General Public License Version 3</a></p>\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user