Fixes throw
This commit is contained in:
parent
0900beecb2
commit
cbbf451974
@ -123,7 +123,6 @@ class PurchaseInvoice(BuyingController):
|
||||
stopped = frappe.db.sql("select name from `tabPurchase Order` where status = 'Stopped' and name = %s", d.purchase_order)
|
||||
if stopped:
|
||||
throw(_("Purchase Order {0} is 'Stopped'").format(d.purchase_order))
|
||||
raise Exception
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
super(PurchaseInvoice, self).validate_with_previous_doc(self.tname, {
|
||||
@ -168,8 +167,7 @@ class PurchaseInvoice(BuyingController):
|
||||
if self.is_opening != 'Yes':
|
||||
self.aging_date = self.posting_date
|
||||
elif not self.aging_date:
|
||||
msgprint(_("Ageing date is mandatory for opening entry"))
|
||||
raise Exception
|
||||
throw(_("Ageing date is mandatory for opening entry"))
|
||||
|
||||
def set_against_expense_account(self):
|
||||
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
|
||||
@ -210,7 +208,6 @@ class PurchaseInvoice(BuyingController):
|
||||
for d in self.get('entries'):
|
||||
if not d.purchase_receipt:
|
||||
throw(_("Purchase Receipt number required for Item {0}").format(d.item_code))
|
||||
raise Exception
|
||||
|
||||
def validate_write_off_account(self):
|
||||
if self.write_off_amount and not self.write_off_account:
|
||||
|
@ -301,9 +301,7 @@ class SalesInvoice(SellingController):
|
||||
if self.is_opening != 'Yes':
|
||||
self.aging_date = self.posting_date
|
||||
elif not self.aging_date:
|
||||
msgprint(_("Ageing Date is mandatory for opening entry"))
|
||||
raise Exception
|
||||
|
||||
throw(_("Ageing Date is mandatory for opening entry"))
|
||||
|
||||
def set_against_income_account(self):
|
||||
"""Set against account for debit to account"""
|
||||
@ -336,8 +334,7 @@ class SalesInvoice(SellingController):
|
||||
where name = %s and (customer = %s or
|
||||
ifnull(customer,'')='')""", (self.project_name, self.customer))
|
||||
if not res:
|
||||
msgprint(_("Customer {0} does not belong to project {1}").format(self.customer,self.project_name))
|
||||
raise Exception
|
||||
throw(_("Customer {0} does not belong to project {1}").format(self.customer,self.project_name))
|
||||
|
||||
def validate_pos(self):
|
||||
if not self.cash_bank_account and flt(self.paid_amount):
|
||||
@ -440,8 +437,7 @@ class SalesInvoice(SellingController):
|
||||
submitted = frappe.db.sql("""select name from `tabDelivery Note`
|
||||
where docstatus = 1 and name = %s""", d.delivery_note)
|
||||
if not submitted:
|
||||
msgprint(_("Delivery Note {0} is not submitted").format(d.delivery_note))
|
||||
raise Exception
|
||||
throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
|
||||
|
||||
def update_stock_ledger(self):
|
||||
sl_entries = []
|
||||
|
@ -168,8 +168,7 @@ class PurchaseOrder(BuyingController):
|
||||
where t1.name = t2.parent and t2.purchase_order = %s and t1.docstatus = 1""",
|
||||
self.name)
|
||||
if submitted:
|
||||
msgprint(_("Purchase Invoice {0} is already submitted").format(", ".join(submitted)))
|
||||
raise Exception
|
||||
throw(_("Purchase Invoice {0} is already submitted").format(", ".join(submitted)))
|
||||
|
||||
frappe.db.set(self,'status','Cancelled')
|
||||
self.update_prevdoc_status()
|
||||
|
@ -71,8 +71,8 @@ class LeaveApplication(DocListController):
|
||||
|
||||
if block_dates:
|
||||
if self.status == "Approved":
|
||||
frappe.msgprint(_("Cannot approve leave as you are not authorized to approve leaves on Block Dates"))
|
||||
raise LeaveDayBlockedError
|
||||
frappe.throw(_("Cannot approve leave as you are not authorized to approve leaves on Block Dates"),
|
||||
LeaveDayBlockedError)
|
||||
|
||||
def get_holidays(self):
|
||||
tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1
|
||||
|
@ -49,8 +49,7 @@ class Opportunity(TransactionBase):
|
||||
|
||||
return ret
|
||||
else:
|
||||
msgprint("Customer : %s does not exist in system." % (name))
|
||||
raise Exception
|
||||
frappe.throw(_("Customer {0} does not exist").format(name), frappe.DoesNotExistError)
|
||||
|
||||
def on_update(self):
|
||||
self.add_calendar_event()
|
||||
|
@ -35,7 +35,6 @@ class AuthorizationControl(TransactionBase):
|
||||
if not has_common(appr_roles, frappe.user.get_roles()) and not has_common(appr_users, [session['user']]):
|
||||
frappe.msgprint(_("Not authroized since {0} exceeds limits").format(_(based_on)))
|
||||
frappe.throw(_("Can be approved by {0}").format(comma_or(appr_roles + appr_users)))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Check if authorization rule is set specific to user
|
||||
|
Loading…
Reference in New Issue
Block a user