This commit is contained in:
Rushabh Mehta 2013-12-19 18:27:48 +05:30
parent 91e9822f65
commit 2b08985e16
19 changed files with 715 additions and 1087 deletions

View File

@ -26,8 +26,7 @@ class DocType:
if year_start_end_dates: if year_start_end_dates:
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]: if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
webnotes.throw(_("Cannot change Year Start Date and Year End Date \ webnotes.throw(_("Cannot change Year Start Date and Year End Date once the Fiscal Year is saved."))
once the Fiscal Year is saved."))
def on_update(self): def on_update(self):
# validate year start date and year end date # validate year start date and year end date
@ -43,5 +42,4 @@ class DocType:
for fiscal_year, ysd, yed in year_start_end_dates: for fiscal_year, ysd, yed in year_start_end_dates:
if (getdate(self.doc.year_start_date) == ysd and getdate(self.doc.year_end_date) == yed) \ if (getdate(self.doc.year_start_date) == ysd and getdate(self.doc.year_end_date) == yed) \
and (not webnotes.flags.in_test): and (not webnotes.flags.in_test):
webnotes.throw(_("Year Start Date and Year End Date are already \ webnotes.throw(_("Year Start Date and Year End Date are already set in Fiscal Year: ") + fiscal_year)
set in Fiscal Year: ") + fiscal_year)

View File

@ -152,10 +152,7 @@ def validate_frozen_account(account, 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 who can create / modify entries against this account"))
Either make the account active or assign role in Accounts Settings \
who can create / modify entries against this account"))
elif frozen_accounts_modifier not in webnotes.user.get_roles(): elif frozen_accounts_modifier not in webnotes.user.get_roles():
webnotes.throw(account + _(" is a frozen account. ") + webnotes.throw(account + _(" is a frozen account. To create / edit transactions against this account, you need role") \
_("To create / edit transactions against this account, you need role") + ": " + + ": " + frozen_accounts_modifier)
frozen_accounts_modifier)

View File

@ -236,8 +236,7 @@ class DocType(AccountsController):
if d.against_voucher and webnotes.conn.get_value("Purchase Invoice", if d.against_voucher and webnotes.conn.get_value("Purchase Invoice",
d.against_voucher, "credit_to") != d.account: d.against_voucher, "credit_to") != d.account:
webnotes.throw(_("Debited account (Supplier) is not matching with \ webnotes.throw(_("Debited account (Supplier) is not matching with Purchase Invoice"))
Purchase Invoice"))
def make_gl_entries(self, cancel=0, adv_adj=0): def make_gl_entries(self, cancel=0, adv_adj=0):
from erpnext.accounts.general_ledger import make_gl_entries from erpnext.accounts.general_ledger import make_gl_entries

View File

@ -64,8 +64,7 @@ class DocType(AccountsController):
expense_bal = expense_bal and expense_bal[0][0] or 0 expense_bal = expense_bal and expense_bal[0][0] or 0
if not income_bal and not expense_bal: if not income_bal and not expense_bal:
webnotes.throw(_("Both Income and Expense balances are zero. \ webnotes.throw(_("Both Income and Expense balances are zero. No Need to make Period Closing Entry."))
No Need to make Period Closing Entry."))
def get_pl_balances(self): def get_pl_balances(self):
"""Get balance for pl accounts""" """Get balance for pl accounts"""

View File

@ -93,8 +93,7 @@ def get_conditions(filters, before_report_date=True):
if supplier_accounts: if supplier_accounts:
conditions += " and account in (%s)" % (", ".join(['%s']*len(supplier_accounts))) conditions += " and account in (%s)" % (", ".join(['%s']*len(supplier_accounts)))
else: else:
msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on \ msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on 'Master Type' value in account record."), raise_exception=1)
'Master Type' value in account record."), raise_exception=1)
if filters.get("report_date"): if filters.get("report_date"):
if before_report_date: if before_report_date:

View File

@ -69,8 +69,7 @@ class BuyingController(StockController):
self.doclist.get({"parentfield": "purchase_tax_details"}) self.doclist.get({"parentfield": "purchase_tax_details"})
if d.category in ["Valuation", "Valuation and Total"]] if d.category in ["Valuation", "Valuation and Total"]]
if tax_for_valuation: if tax_for_valuation:
webnotes.msgprint(_("""Tax Category can not be 'Valuation' or 'Valuation and Total' webnotes.msgprint(_("""Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"""), raise_exception=1)
as all items are non-stock items"""), raise_exception=1)
def set_total_in_words(self): def set_total_in_words(self):
from webnotes.utils import money_in_words from webnotes.utils import money_in_words

View File

@ -104,11 +104,9 @@ cur_frm.cscript.set_help = function(doc) {
} else { } else {
if(doc.docstatus==0 && doc.approval_status=="Draft") { if(doc.docstatus==0 && doc.approval_status=="Draft") {
if(user==doc.exp_approver) { if(user==doc.exp_approver) {
cur_frm.set_intro(wn._("You are the Expense Approver for this record. \ cur_frm.set_intro(wn._("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
Please Update the 'Status' and Save"));
} else { } else {
cur_frm.set_intro(wn._("Expense Claim is pending approval. \ cur_frm.set_intro(wn._("Expense Claim is pending approval. Only the Expense Approver can update status."));
Only the Expense Approver can update status."));
} }
} else { } else {
if(doc.approval_status=="Approved") { if(doc.approval_status=="Approved") {

View File

@ -107,8 +107,7 @@ class DocType(DocListController):
self.doc.total_leave_days = self.get_total_leave_days()["total_leave_days"] self.doc.total_leave_days = self.get_total_leave_days()["total_leave_days"]
if self.doc.total_leave_days == 0: if self.doc.total_leave_days == 0:
msgprint(_("Hurray! The day(s) on which you are applying for leave \ msgprint(_("The day(s) on which you are applying for leave coincide with holiday(s). You need not apply for leave."),
coincide with holiday(s). You need not apply for leave."),
raise_exception=1) raise_exception=1)
if not is_lwp(self.doc.leave_type): if not is_lwp(self.doc.leave_type):

View File

@ -60,8 +60,7 @@ class DocType:
ret = webnotes.conn.sql("""select name from `tabSalary Structure` where is_active = 'Yes' ret = webnotes.conn.sql("""select name from `tabSalary Structure` where is_active = 'Yes'
and employee = %s and name!=%s""", (self.doc.employee,self.doc.name)) and employee = %s and name!=%s""", (self.doc.employee,self.doc.name))
if ret and self.doc.is_active=='Yes': if ret and self.doc.is_active=='Yes':
msgprint(_("""Another Salary Structure '%s' is active for employee '%s'. msgprint(_("""Another Salary Structure '%s' is active for employee '%s'. Please make its status 'Inactive' to proceed.""") %
Please make its status 'Inactive' to proceed.""") %
(cstr(ret), self.doc.employee), raise_exception=1) (cstr(ret), self.doc.employee), raise_exception=1)
def validate_amount(self): def validate_amount(self):

View File

@ -12,5 +12,5 @@
"public/js/feature_setup.js", "public/js/feature_setup.js",
"public/js/utils.js", "public/js/utils.js",
"public/js/queries.js" "public/js/queries.js"
], ]
} }

View File

@ -27,9 +27,7 @@ wn.ui.misc.about = function() {
var d = new wn.ui.Dialog({title: wn._('About ERPNext')}) var d = new wn.ui.Dialog({title: wn._('About ERPNext')})
$(d.body).html(repl("<div>\ $(d.body).html(repl("<div>\
<p>"+wn._("ERPNext is an open-source web based ERP made by Web Notes Technologies Pvt Ltd.\ <p>"+wn._("ERPNext is an open-source web based ERP made by Web Notes Technologies Pvt Ltd. to provide an integrated tool to manage most processes in a small organization. For more information about Web Notes, or to buy hosting servies, go to ")+
to provide an integrated tool to manage most processes in a small organization.\
For more information about Web Notes, or to buy hosting servies, go to ")+
"<a href='https://erpnext.com'>https://erpnext.com</a>.</p>\ "<a href='https://erpnext.com'>https://erpnext.com</a>.</p>\
<p>"+wn._("To report an issue, go to ")+"<a href='https://github.com/webnotes/erpnext/issues'>GitHub Issues</a></p>\ <p>"+wn._("To report an issue, go to ")+"<a href='https://github.com/webnotes/erpnext/issues'>GitHub Issues</a></p>\
<hr>\ <hr>\

View File

@ -89,9 +89,7 @@ class DocType(DocListController, WebsiteGenerator):
(self.doc.stock_uom, self.doc.name)) (self.doc.stock_uom, self.doc.name))
if not matched: if not matched:
webnotes.throw(_("Default Unit of Measure can not be changed directly \ webnotes.throw(_("Default Unit of Measure can not be changed directly because you have already made some transaction(s) with another UOM. To change default UOM, use 'UOM Replace Utility' tool under Stock module."))
because you have already made some transaction(s) with another UOM.\n \
To change default UOM, use 'UOM Replace Utility' tool under Stock module."))
def validate_conversion_factor(self): def validate_conversion_factor(self):
check_list = [] check_list = []
@ -103,12 +101,10 @@ class DocType(DocListController, WebsiteGenerator):
check_list.append(cstr(d.uom)) check_list.append(cstr(d.uom))
if d.uom and cstr(d.uom) == cstr(self.doc.stock_uom) and flt(d.conversion_factor) != 1: if d.uom and cstr(d.uom) == cstr(self.doc.stock_uom) and flt(d.conversion_factor) != 1:
msgprint(_("""Conversion Factor of UOM: %s should be equal to 1. msgprint(_("""Conversion Factor of UOM: %s should be equal to 1. As UOM: %s is Stock UOM of Item: %s.""" %
As UOM: %s is Stock UOM of Item: %s.""" %
(d.uom, d.uom, self.doc.name)), raise_exception=1) (d.uom, d.uom, self.doc.name)), raise_exception=1)
elif d.uom and cstr(d.uom)!= self.doc.stock_uom and flt(d.conversion_factor) == 1: elif d.uom and cstr(d.uom)!= self.doc.stock_uom and flt(d.conversion_factor) == 1:
msgprint(_("""Conversion Factor of UOM: %s should not be equal to 1. msgprint(_("""Conversion Factor of UOM: %s should not be equal to 1. As UOM: %s is not Stock UOM of Item: %s""" %
As UOM: %s is not Stock UOM of Item: %s""" %
(d.uom, d.uom, self.doc.name)), raise_exception=1) (d.uom, d.uom, self.doc.name)), raise_exception=1)
def validate_item_type(self): def validate_item_type(self):
@ -190,9 +186,7 @@ class DocType(DocListController, WebsiteGenerator):
vals.has_serial_no != self.doc.has_serial_no or vals.has_serial_no != self.doc.has_serial_no or
cstr(vals.valuation_method) != cstr(self.doc.valuation_method)): cstr(vals.valuation_method) != cstr(self.doc.valuation_method)):
if self.check_if_sle_exists() == "exists": if self.check_if_sle_exists() == "exists":
webnotes.msgprint(_("As there are existing stock transactions for this \ webnotes.throw(_("As there are existing stock transactions for this item, you can not change the values of 'Has Serial No', 'Is Stock Item' and 'Valuation Method'"))
item, you can not change the values of 'Has Serial No', \
'Is Stock Item' and 'Valuation Method'"), raise_exception=1)
def validate_item_type_for_reorder(self): def validate_item_type_for_reorder(self):
if self.doc.re_order_level or len(self.doclist.get({"parentfield": "item_reorder", if self.doc.re_order_level or len(self.doclist.get({"parentfield": "item_reorder",

View File

@ -33,8 +33,7 @@ class DocType:
Validates if delivery note has status as draft Validates if delivery note has status as draft
""" """
if cint(webnotes.conn.get_value("Delivery Note", self.doc.delivery_note, "docstatus")) != 0: if cint(webnotes.conn.get_value("Delivery Note", self.doc.delivery_note, "docstatus")) != 0:
msgprint(_("""Invalid Delivery Note. Delivery Note should exist and should be in msgprint(_("""Invalid Delivery Note. Delivery Note should exist and should be in draft state. Please rectify and try again."""), raise_exception=1)
draft state. Please rectify and try again."""), raise_exception=1)
def validate_items_mandatory(self): def validate_items_mandatory(self):
rows = [d.item_code for d in self.doclist.get({"parentfield": "item_details"})] rows = [d.item_code for d in self.doclist.get({"parentfield": "item_details"})]

View File

@ -167,8 +167,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
if(this.frm.doc.purpose === "Sales Return") { if(this.frm.doc.purpose === "Sales Return") {
if(this.frm.doc.delivery_note_no && this.frm.doc.sales_invoice_no) { if(this.frm.doc.delivery_note_no && this.frm.doc.sales_invoice_no) {
// both specified // both specified
msgprint(wn._("You can not enter both Delivery Note No and Sales Invoice No. \ msgprint(wn._("You can not enter both Delivery Note No and Sales Invoice No. Please enter any one."));
Please enter any one."));
} else if(!(this.frm.doc.delivery_note_no || this.frm.doc.sales_invoice_no)) { } else if(!(this.frm.doc.delivery_note_no || this.frm.doc.sales_invoice_no)) {
// none specified // none specified

View File

@ -243,9 +243,7 @@ class DocType(StockController):
for d in getlist(self.doclist, 'mtn_details'): for d in getlist(self.doclist, 'mtn_details'):
if d.bom_no and flt(d.transfer_qty) != flt(self.doc.fg_completed_qty): if d.bom_no and flt(d.transfer_qty) != flt(self.doc.fg_completed_qty):
msgprint(_("Row #") + " %s: " % d.idx msgprint(_("Row #") + " %s: " % d.idx
+ _("Quantity should be equal to Manufacturing Quantity. ") + _("Quantity should be equal to Manufacturing Quantity. To fetch items again, click on 'Get Items' button or update the Quantity manually."), raise_exception=1)
+ _("To fetch items again, click on 'Get Items' button \
or update the Quantity manually."), raise_exception=1)
def validate_return_reference_doc(self): def validate_return_reference_doc(self):
"""validate item with reference doc""" """validate item with reference doc"""

View File

@ -50,8 +50,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
if(this.frm.doc.reconciliation_json) { if(this.frm.doc.reconciliation_json) {
this.frm.set_intro(wn._("You can submit this Stock Reconciliation.")); this.frm.set_intro(wn._("You can submit this Stock Reconciliation."));
} else { } else {
this.frm.set_intro(wn._("Download the Template, fill appropriate data and \ this.frm.set_intro(wn._("Download the Template, fill appropriate data and attach the modified file."));
attach the modified file."));
} }
} else if(this.frm.doc.docstatus == 1) { } else if(this.frm.doc.docstatus == 1) {
this.frm.set_intro(wn._("Cancelling this Stock Reconciliation will nullify its effect.")); this.frm.set_intro(wn._("Cancelling this Stock Reconciliation will nullify its effect."));

View File

@ -140,10 +140,9 @@ class DocType(StockController):
# check valuation rate mandatory # check valuation rate mandatory
if row.qty != "" and not row.valuation_rate and \ if row.qty != "" and not row.valuation_rate and \
flt(previous_sle.get("qty_after_transaction")) <= 0: flt(previous_sle.get("qty_after_transaction")) <= 0:
webnotes.msgprint(_("As existing qty for item: ") + row.item_code + webnotes.throw(_("As existing qty for item: ") + row.item_code +
_(" at warehouse: ") + row.warehouse + _(" at warehouse: ") + row.warehouse +
_(" is less than equals to zero in the system, \ _(" is less than equals to zero in the system, valuation rate is mandatory for this item"))
valuation rate is mandatory for this item"), raise_exception=1)
change_in_qty = row.qty != "" and \ change_in_qty = row.qty != "" and \
(flt(row.qty) - flt(previous_sle.get("qty_after_transaction"))) (flt(row.qty) - flt(previous_sle.get("qty_after_transaction")))

File diff suppressed because it is too large Load Diff

View File

@ -431,8 +431,7 @@ def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, c
company_currency = webnotes.conn.get_value("Company", company, "default_currency") company_currency = webnotes.conn.get_value("Company", company, "default_currency")
if not conversion_rate: if not conversion_rate:
msgprint(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange \ msgprint(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange record is not created for %(from_currency)s to %(to_currency)s') % {
record is not created for %(from_currency)s to %(to_currency)s') % {
"conversion_rate_label": conversion_rate_label, "conversion_rate_label": conversion_rate_label,
"from_currency": currency, "from_currency": currency,
"to_currency": company_currency "to_currency": company_currency