more message fixes for translation

This commit is contained in:
Rushabh Mehta
2014-04-15 22:54:34 +05:30
parent ff93802d58
commit d85dc868ca
6 changed files with 25 additions and 42 deletions

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import add_days, cstr, getdate, cint
from frappe.utils import add_days, getdate, cint
from frappe import throw, _
from erpnext.utilities.transaction_base import TransactionBase, delete_events
@@ -46,7 +46,7 @@ class MaintenanceSchedule(TransactionBase):
def on_submit(self):
if not self.get('maintenance_schedule_detail'):
throw("Please click on 'Generate Schedule' to get schedule")
throw(_("Please click on 'Generate Schedule' to get schedule"))
self.check_serial_no_added()
self.validate_schedule()
@@ -141,12 +141,12 @@ class MaintenanceSchedule(TransactionBase):
period = (getdate(args['end_date']) - getdate(args['start_date'])).days + 1
if (args['periodicity'] == 'Yearly' or args['periodicity'] == 'Half Yearly' or
args['periodicity'] == 'Quarterly') and period < 365:
throw(cstr(args['periodicity']) + " periodicity can be set for period of atleast 1 year or more only")
args['periodicity'] == 'Quarterly') and period < 90:
throw(_("Period is too short"))
elif args['periodicity'] == 'Monthly' and period < 30:
throw("Monthly periodicity can be set for period of atleast 1 month or more")
throw(_("Period is too short"))
elif args['periodicity'] == 'Weekly' and period < 7:
throw("Weekly periodicity can be set for period of atleast 1 week or more")
throw(_("Period is too short"))
def get_no_of_visits(self, arg):
args = eval(arg)
@@ -192,7 +192,7 @@ class MaintenanceSchedule(TransactionBase):
`tabMaintenance Schedule Item` msi where msi.parent=ms.name and
msi.prevdoc_docname=%s and ms.docstatus=1""", d.prevdoc_docname)
if chk:
throw("Maintenance Schedule against " + d.prevdoc_docname + " already exist")
throw(_("Maintenance Schedule {0} exists against {0}").format(chk[0][0], d.prevdoc_docname))
def validate(self):
self.validate_maintenance_detail()
@@ -213,12 +213,10 @@ class MaintenanceSchedule(TransactionBase):
["warranty_expiry_date", "amc_expiry_date", "status", "delivery_date"], as_dict=1)
if sr_details.warranty_expiry_date and sr_details.warranty_expiry_date>=amc_start_date:
throw("""Serial No: %s is already under warranty upto %s.
Please check AMC Start Date.""" % (serial_no, sr_details.warranty_expiry_date))
throw(_("Serial No {0} is under warranty upto {1}").format(serial_no, sr_details.warranty_expiry_date))
if sr_details.amc_expiry_date and sr_details.amc_expiry_date >= amc_start_date:
throw("""Serial No: %s is already under AMC upto %s.
Please check AMC Start Date.""" % (serial_no, sr_details.amc_expiry_date))
throw(_("Serial No {0} is under maintenance contract upto {1}").format(serial_no, sr_details.amc_start_date))
if sr_details.status=="Delivered" and sr_details.delivery_date and \
sr_details.delivery_date >= amc_start_date:
@@ -252,7 +250,7 @@ class MaintenanceSchedule(TransactionBase):
for m in self.get('maintenance_schedule_detail'):
if serial_present:
if m.item_code in serial_present and not m.serial_no:
throw("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code)
throw(_("Please click on 'Generate Schedule' to fetch Serial No added for Item {0}").format(m.item_code))
def on_cancel(self):
for d in self.get('item_maintenance_detail'):

View File

@@ -15,8 +15,7 @@ class MaintenanceVisit(TransactionBase):
def validate_serial_no(self):
for d in self.get('maintenance_visit_details'):
if d.serial_no and not frappe.db.exists("Serial No", d.serial_no):
frappe.throw("Serial No: "+ d.serial_no + " not exists in the system")
frappe.throw(_("Serial No {0} does not exist").format(d.serial_no))
def validate(self):
self.validate_serial_no()
@@ -51,11 +50,11 @@ class MaintenanceVisit(TransactionBase):
def check_if_last_visit(self):
"""check if last maintenance visit against same sales order/ customer issue"""
check_for_docname = check_for_doctype = None
check_for_docname = None
for d in self.get('maintenance_visit_details'):
if d.prevdoc_docname:
check_for_docname = d.prevdoc_docname
check_for_doctype = d.prevdoc_doctype
#check_for_doctype = d.prevdoc_doctype
if check_for_docname:
check = frappe.db.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.name, check_for_docname, self.mntc_date, self.mntc_date, self.mntc_time))