fix(translations): Incorrect syntax (#20471)
fix(translations): Incorrect syntax
This commit is contained in:
commit
f3287585c0
@ -30,7 +30,7 @@ def validate_service_stop_date(doc):
|
|||||||
frappe.throw(_("Service Stop Date cannot be after Service End Date"))
|
frappe.throw(_("Service Stop Date cannot be after Service End Date"))
|
||||||
|
|
||||||
if old_stop_dates and old_stop_dates.get(item.name) and item.service_stop_date!=old_stop_dates.get(item.name):
|
if old_stop_dates and old_stop_dates.get(item.name) and item.service_stop_date!=old_stop_dates.get(item.name):
|
||||||
frappe.throw(_("Cannot change Service Stop Date for item in row {0}".format(item.idx)))
|
frappe.throw(_("Cannot change Service Stop Date for item in row {0}").format(item.idx))
|
||||||
|
|
||||||
def convert_deferred_expense_to_expense(start_date=None, end_date=None):
|
def convert_deferred_expense_to_expense(start_date=None, end_date=None):
|
||||||
# book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM
|
# book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class TestBankAccount(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
bank_account.validate_iban()
|
bank_account.validate_iban()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
msg = _('BankAccount.validate_iban() failed for empty IBAN')
|
msg = 'BankAccount.validate_iban() failed for empty IBAN'
|
||||||
self.fail(msg=msg)
|
self.fail(msg=msg)
|
||||||
|
|
||||||
for iban in valid_ibans:
|
for iban in valid_ibans:
|
||||||
@ -39,11 +39,11 @@ class TestBankAccount(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
bank_account.validate_iban()
|
bank_account.validate_iban()
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
msg = _('BankAccount.validate_iban() failed for valid IBAN {}'.format(iban))
|
msg = 'BankAccount.validate_iban() failed for valid IBAN {}'.format(iban)
|
||||||
self.fail(msg=msg)
|
self.fail(msg=msg)
|
||||||
|
|
||||||
for not_iban in invalid_ibans:
|
for not_iban in invalid_ibans:
|
||||||
bank_account.iban = not_iban
|
bank_account.iban = not_iban
|
||||||
msg = _('BankAccount.validate_iban() accepted invalid IBAN {}'.format(not_iban))
|
msg = 'BankAccount.validate_iban() accepted invalid IBAN {}'.format(not_iban)
|
||||||
with self.assertRaises(ValidationError, msg=msg):
|
with self.assertRaises(ValidationError, msg=msg):
|
||||||
bank_account.validate_iban()
|
bank_account.validate_iban()
|
||||||
|
|||||||
@ -314,7 +314,7 @@ class BankStatementTransactionEntry(Document):
|
|||||||
try:
|
try:
|
||||||
reconcile_against_document(lst)
|
reconcile_against_document(lst)
|
||||||
except:
|
except:
|
||||||
frappe.throw(_("Exception occurred while reconciling {0}".format(payment.reference_name)))
|
frappe.throw(_("Exception occurred while reconciling {0}").format(payment.reference_name))
|
||||||
|
|
||||||
def submit_payment_entries(self):
|
def submit_payment_entries(self):
|
||||||
for payment in self.new_transaction_items:
|
for payment in self.new_transaction_items:
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class BankTransaction(StatusUpdater):
|
|||||||
|
|
||||||
if paid_amount and allocated_amount:
|
if paid_amount and allocated_amount:
|
||||||
if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount):
|
if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount):
|
||||||
frappe.throw(_("The total allocated amount ({0}) is greated than the paid amount ({1}).".format(flt(allocated_amount[0]["allocated_amount"]), flt(paid_amount))))
|
frappe.throw(_("The total allocated amount ({0}) is greated than the paid amount ({1}).").format(flt(allocated_amount[0]["allocated_amount"]), flt(paid_amount)))
|
||||||
else:
|
else:
|
||||||
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
|
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
|
||||||
self.clear_simple_entry(payment_entry)
|
self.clear_simple_entry(payment_entry)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class CForm(Document):
|
|||||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||||
|
|
||||||
if inv and inv[0][0] != 'Yes':
|
if inv and inv[0][0] != 'Yes':
|
||||||
frappe.throw(_("C-form is not applicable for Invoice: {0}".format(d.invoice_no)))
|
frappe.throw(_("C-form is not applicable for Invoice: {0}").format(d.invoice_no))
|
||||||
|
|
||||||
elif inv and inv[0][1] and inv[0][1] != self.name:
|
elif inv and inv[0][1] and inv[0][1] != self.name:
|
||||||
frappe.throw(_("""Invoice {0} is tagged in another C-form: {1}.
|
frappe.throw(_("""Invoice {0} is tagged in another C-form: {1}.
|
||||||
|
|||||||
@ -616,7 +616,7 @@ class JournalEntry(AccountsController):
|
|||||||
d.reference_name, ("total_sanctioned_amount", "total_amount_reimbursed"))
|
d.reference_name, ("total_sanctioned_amount", "total_amount_reimbursed"))
|
||||||
pending_amount = flt(sanctioned_amount) - flt(reimbursed_amount)
|
pending_amount = flt(sanctioned_amount) - flt(reimbursed_amount)
|
||||||
if d.debit > pending_amount:
|
if d.debit > pending_amount:
|
||||||
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}".format(d.idx, d.reference_name, pending_amount)))
|
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}").format(d.idx, d.reference_name, pending_amount))
|
||||||
|
|
||||||
def validate_credit_debit_note(self):
|
def validate_credit_debit_note(self):
|
||||||
if self.stock_entry:
|
if self.stock_entry:
|
||||||
@ -624,7 +624,7 @@ class JournalEntry(AccountsController):
|
|||||||
frappe.throw(_("Stock Entry {0} is not submitted").format(self.stock_entry))
|
frappe.throw(_("Stock Entry {0} is not submitted").format(self.stock_entry))
|
||||||
|
|
||||||
if frappe.db.exists({"doctype": "Journal Entry", "stock_entry": self.stock_entry, "docstatus":1}):
|
if frappe.db.exists({"doctype": "Journal Entry", "stock_entry": self.stock_entry, "docstatus":1}):
|
||||||
frappe.msgprint(_("Warning: Another {0} # {1} exists against stock entry {2}".format(self.voucher_type, self.name, self.stock_entry)))
|
frappe.msgprint(_("Warning: Another {0} # {1} exists against stock entry {2}").format(self.voucher_type, self.name, self.stock_entry))
|
||||||
|
|
||||||
def validate_empty_accounts_table(self):
|
def validate_empty_accounts_table(self):
|
||||||
if not self.get('accounts'):
|
if not self.get('accounts'):
|
||||||
|
|||||||
@ -1003,7 +1003,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
|||||||
|
|
||||||
# only Purchase Invoice can be blocked individually
|
# only Purchase Invoice can be blocked individually
|
||||||
if doc.doctype == "Purchase Invoice" and doc.invoice_is_blocked():
|
if doc.doctype == "Purchase Invoice" and doc.invoice_is_blocked():
|
||||||
frappe.msgprint(_('{0} is on hold till {1}'.format(doc.name, doc.release_date)))
|
frappe.msgprint(_('{0} is on hold till {1}').format(doc.name, doc.release_date))
|
||||||
else:
|
else:
|
||||||
pe.append("references", {
|
pe.append("references", {
|
||||||
'reference_doctype': dt,
|
'reference_doctype': dt,
|
||||||
|
|||||||
@ -39,8 +39,8 @@ class PaymentRequest(Document):
|
|||||||
ref_amount = get_amount(ref_doc)
|
ref_amount = get_amount(ref_doc)
|
||||||
|
|
||||||
if existing_payment_request_amount + flt(self.grand_total)> ref_amount:
|
if existing_payment_request_amount + flt(self.grand_total)> ref_amount:
|
||||||
frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount"
|
frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount")
|
||||||
.format(self.reference_doctype)))
|
.format(self.reference_doctype))
|
||||||
|
|
||||||
def validate_currency(self):
|
def validate_currency(self):
|
||||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||||
@ -53,14 +53,14 @@ class PaymentRequest(Document):
|
|||||||
for subscription_plan in self.subscription_plans:
|
for subscription_plan in self.subscription_plans:
|
||||||
payment_gateway = frappe.db.get_value("Subscription Plan", subscription_plan.plan, "payment_gateway")
|
payment_gateway = frappe.db.get_value("Subscription Plan", subscription_plan.plan, "payment_gateway")
|
||||||
if payment_gateway != self.payment_gateway_account:
|
if payment_gateway != self.payment_gateway_account:
|
||||||
frappe.throw(_('The payment gateway account in plan {0} is different from the payment gateway account in this payment request'.format(subscription_plan.name)))
|
frappe.throw(_('The payment gateway account in plan {0} is different from the payment gateway account in this payment request').format(subscription_plan.name))
|
||||||
|
|
||||||
rate = get_plan_rate(subscription_plan.plan, quantity=subscription_plan.qty)
|
rate = get_plan_rate(subscription_plan.plan, quantity=subscription_plan.qty)
|
||||||
|
|
||||||
amount += rate
|
amount += rate
|
||||||
|
|
||||||
if amount != self.grand_total:
|
if amount != self.grand_total:
|
||||||
frappe.msgprint(_("The amount of {0} set in this payment request is different from the calculated amount of all payment plans: {1}. Make sure this is correct before submitting the document.".format(self.grand_total, amount)))
|
frappe.msgprint(_("The amount of {0} set in this payment request is different from the calculated amount of all payment plans: {1}. Make sure this is correct before submitting the document.").format(self.grand_total, amount))
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if self.payment_request_type == 'Outward':
|
if self.payment_request_type == 'Outward':
|
||||||
|
|||||||
@ -56,12 +56,12 @@ class PricingRule(Document):
|
|||||||
|
|
||||||
if not self.selling and self.applicable_for in ["Customer", "Customer Group",
|
if not self.selling and self.applicable_for in ["Customer", "Customer Group",
|
||||||
"Territory", "Sales Partner", "Campaign"]:
|
"Territory", "Sales Partner", "Campaign"]:
|
||||||
throw(_("Selling must be checked, if Applicable For is selected as {0}"
|
throw(_("Selling must be checked, if Applicable For is selected as {0}")
|
||||||
.format(self.applicable_for)))
|
.format(self.applicable_for))
|
||||||
|
|
||||||
if not self.buying and self.applicable_for in ["Supplier", "Supplier Group"]:
|
if not self.buying and self.applicable_for in ["Supplier", "Supplier Group"]:
|
||||||
throw(_("Buying must be checked, if Applicable For is selected as {0}"
|
throw(_("Buying must be checked, if Applicable For is selected as {0}")
|
||||||
.format(self.applicable_for)))
|
.format(self.applicable_for))
|
||||||
|
|
||||||
def validate_min_max_qty(self):
|
def validate_min_max_qty(self):
|
||||||
if self.min_qty and self.max_qty and flt(self.min_qty) > flt(self.max_qty):
|
if self.min_qty and self.max_qty and flt(self.min_qty) > flt(self.max_qty):
|
||||||
@ -243,7 +243,7 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None, for_validate=Fa
|
|||||||
|
|
||||||
if pricing_rule.coupon_code_based==1 and args.coupon_code==None:
|
if pricing_rule.coupon_code_based==1 and args.coupon_code==None:
|
||||||
return item_details
|
return item_details
|
||||||
|
|
||||||
if not pricing_rule.validate_applied_rule:
|
if not pricing_rule.validate_applied_rule:
|
||||||
if pricing_rule.price_or_product_discount == "Price":
|
if pricing_rule.price_or_product_discount == "Price":
|
||||||
apply_price_discount_rule(pricing_rule, item_details, args)
|
apply_price_discount_rule(pricing_rule, item_details, args)
|
||||||
|
|||||||
@ -908,7 +908,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
if pi:
|
if pi:
|
||||||
pi = pi[0][0]
|
pi = pi[0][0]
|
||||||
frappe.throw(_("Supplier Invoice No exists in Purchase Invoice {0}".format(pi)))
|
frappe.throw(_("Supplier Invoice No exists in Purchase Invoice {0}").format(pi))
|
||||||
|
|
||||||
def update_billing_status_in_pr(self, update_modified=True):
|
def update_billing_status_in_pr(self, update_modified=True):
|
||||||
updated_pr = []
|
updated_pr = []
|
||||||
|
|||||||
@ -225,7 +225,7 @@ class SalesInvoice(SellingController):
|
|||||||
total_amount_in_payments += payment.amount
|
total_amount_in_payments += payment.amount
|
||||||
invoice_total = self.rounded_total or self.grand_total
|
invoice_total = self.rounded_total or self.grand_total
|
||||||
if total_amount_in_payments < invoice_total:
|
if total_amount_in_payments < invoice_total:
|
||||||
frappe.throw(_("Total payments amount can't be greater than {}".format(-invoice_total)))
|
frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
|
||||||
|
|
||||||
def validate_pos_paid_amount(self):
|
def validate_pos_paid_amount(self):
|
||||||
if len(self.payments) == 0 and self.is_pos:
|
if len(self.payments) == 0 and self.is_pos:
|
||||||
@ -1041,11 +1041,11 @@ class SalesInvoice(SellingController):
|
|||||||
si_serial_nos = set(get_serial_nos(serial_nos))
|
si_serial_nos = set(get_serial_nos(serial_nos))
|
||||||
|
|
||||||
if si_serial_nos - dn_serial_nos:
|
if si_serial_nos - dn_serial_nos:
|
||||||
frappe.throw(_("Serial Numbers in row {0} does not match with Delivery Note".format(item.idx)))
|
frappe.throw(_("Serial Numbers in row {0} does not match with Delivery Note").format(item.idx))
|
||||||
|
|
||||||
if item.serial_no and cint(item.qty) != len(si_serial_nos):
|
if item.serial_no and cint(item.qty) != len(si_serial_nos):
|
||||||
frappe.throw(_("Row {0}: {1} Serial numbers required for Item {2}. You have provided {3}.".format(
|
frappe.throw(_("Row {0}: {1} Serial numbers required for Item {2}. You have provided {3}.").format(
|
||||||
item.idx, item.qty, item.item_code, len(si_serial_nos))))
|
item.idx, item.qty, item.item_code, len(si_serial_nos)))
|
||||||
|
|
||||||
def validate_serial_against_sales_invoice(self):
|
def validate_serial_against_sales_invoice(self):
|
||||||
""" check if serial number is already used in other sales invoice """
|
""" check if serial number is already used in other sales invoice """
|
||||||
@ -1064,8 +1064,8 @@ class SalesInvoice(SellingController):
|
|||||||
and self.name != serial_no_details.sales_invoice:
|
and self.name != serial_no_details.sales_invoice:
|
||||||
sales_invoice_company = frappe.db.get_value("Sales Invoice", serial_no_details.sales_invoice, "company")
|
sales_invoice_company = frappe.db.get_value("Sales Invoice", serial_no_details.sales_invoice, "company")
|
||||||
if sales_invoice_company == self.company:
|
if sales_invoice_company == self.company:
|
||||||
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}"
|
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}")
|
||||||
.format(serial_no, serial_no_details.sales_invoice)))
|
.format(serial_no, serial_no_details.sales_invoice))
|
||||||
|
|
||||||
def update_project(self):
|
def update_project(self):
|
||||||
if self.project:
|
if self.project:
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class ShippingRule(Document):
|
|||||||
if not shipping_country:
|
if not shipping_country:
|
||||||
frappe.throw(_('Shipping Address does not have country, which is required for this Shipping Rule'))
|
frappe.throw(_('Shipping Address does not have country, which is required for this Shipping Rule'))
|
||||||
if shipping_country not in [d.country for d in self.countries]:
|
if shipping_country not in [d.country for d in self.countries]:
|
||||||
frappe.throw(_('Shipping rule not applicable for country {0}'.format(shipping_country)))
|
frappe.throw(_('Shipping rule not applicable for country {0}').format(shipping_country))
|
||||||
|
|
||||||
def add_shipping_rule_to_tax_table(self, doc, shipping_amount):
|
def add_shipping_rule_to_tax_table(self, doc, shipping_amount):
|
||||||
shipping_charge = {
|
shipping_charge = {
|
||||||
|
|||||||
@ -195,7 +195,7 @@ class Subscription(Document):
|
|||||||
doc = frappe.get_doc('Sales Invoice', current.invoice)
|
doc = frappe.get_doc('Sales Invoice', current.invoice)
|
||||||
return doc
|
return doc
|
||||||
else:
|
else:
|
||||||
frappe.throw(_('Invoice {0} no longer exists'.format(current.invoice)))
|
frappe.throw(_('Invoice {0} no longer exists').format(current.invoice))
|
||||||
|
|
||||||
def is_new_subscription(self):
|
def is_new_subscription(self):
|
||||||
"""
|
"""
|
||||||
@ -338,7 +338,7 @@ class Subscription(Document):
|
|||||||
|
|
||||||
# Check invoice dates and make sure it doesn't have outstanding invoices
|
# Check invoice dates and make sure it doesn't have outstanding invoices
|
||||||
return getdate(nowdate()) >= getdate(self.current_invoice_start) and not self.has_outstanding_invoice()
|
return getdate(nowdate()) >= getdate(self.current_invoice_start) and not self.has_outstanding_invoice()
|
||||||
|
|
||||||
def is_current_invoice_paid(self):
|
def is_current_invoice_paid(self):
|
||||||
if self.is_new_subscription():
|
if self.is_new_subscription():
|
||||||
return False
|
return False
|
||||||
@ -346,7 +346,7 @@ class Subscription(Document):
|
|||||||
last_invoice = frappe.get_doc('Sales Invoice', self.invoices[-1].invoice)
|
last_invoice = frappe.get_doc('Sales Invoice', self.invoices[-1].invoice)
|
||||||
if getdate(last_invoice.posting_date) == getdate(self.current_invoice_start) and last_invoice.status == 'Paid':
|
if getdate(last_invoice.posting_date) == getdate(self.current_invoice_start) and last_invoice.status == 'Paid':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def process_for_active(self):
|
def process_for_active(self):
|
||||||
@ -388,7 +388,7 @@ class Subscription(Document):
|
|||||||
"""
|
"""
|
||||||
current_invoice = self.get_current_invoice()
|
current_invoice = self.get_current_invoice()
|
||||||
if not current_invoice:
|
if not current_invoice:
|
||||||
frappe.throw(_('Current invoice {0} is missing'.format(current_invoice.invoice)))
|
frappe.throw(_('Current invoice {0} is missing').format(current_invoice.invoice))
|
||||||
else:
|
else:
|
||||||
if self.is_not_outstanding(current_invoice):
|
if self.is_not_outstanding(current_invoice):
|
||||||
self.status = 'Active'
|
self.status = 'Active'
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class TaxRule(Document):
|
|||||||
|
|
||||||
if tax_rule:
|
if tax_rule:
|
||||||
if tax_rule[0].priority == self.priority:
|
if tax_rule[0].priority == self.priority:
|
||||||
frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule)
|
frappe.throw(_("Tax Rule Conflicts with {0}").format(tax_rule[0].name), ConflictingTaxRule)
|
||||||
|
|
||||||
def validate_use_for_shopping_cart(self):
|
def validate_use_for_shopping_cart(self):
|
||||||
'''If shopping cart is enabled and no tax rule exists for shopping cart, enable this one'''
|
'''If shopping cart is enabled and no tax rule exists for shopping cart, enable this one'''
|
||||||
|
|||||||
@ -175,7 +175,7 @@ def calculate_values(
|
|||||||
d = accounts_by_name.get(entry.account)
|
d = accounts_by_name.get(entry.account)
|
||||||
if not d:
|
if not d:
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Could not retrieve information for {0}.".format(entry.account)), title="Error",
|
_("Could not retrieve information for {0}.").format(entry.account), title="Error",
|
||||||
raise_exception=1
|
raise_exception=1
|
||||||
)
|
)
|
||||||
for period in period_list:
|
for period in period_list:
|
||||||
@ -430,7 +430,7 @@ def get_cost_centers_with_children(cost_centers):
|
|||||||
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
||||||
all_cost_centers += [c.name for c in children]
|
all_cost_centers += [c.name for c in children]
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Cost Center: {0} does not exist".format(d)))
|
frappe.throw(_("Cost Center: {0} does not exist").format(d))
|
||||||
|
|
||||||
return list(set(all_cost_centers))
|
return list(set(all_cost_centers))
|
||||||
|
|
||||||
|
|||||||
@ -373,19 +373,19 @@ def get_columns(filters):
|
|||||||
"width": 180
|
"width": 180
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Debit ({0})".format(currency)),
|
"label": _("Debit ({0})").format(currency),
|
||||||
"fieldname": "debit",
|
"fieldname": "debit",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 100
|
"width": 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Credit ({0})".format(currency)),
|
"label": _("Credit ({0})").format(currency),
|
||||||
"fieldname": "credit",
|
"fieldname": "credit",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 100
|
"width": 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Balance ({0})".format(currency)),
|
"label": _("Balance ({0})").format(currency),
|
||||||
"fieldname": "balance",
|
"fieldname": "balance",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 130
|
"width": 130
|
||||||
|
|||||||
@ -513,7 +513,7 @@ def remove_ref_doc_link_from_jv(ref_type, ref_no):
|
|||||||
where reference_type=%s and reference_name=%s
|
where reference_type=%s and reference_name=%s
|
||||||
and docstatus < 2""", (now(), frappe.session.user, ref_type, ref_no))
|
and docstatus < 2""", (now(), frappe.session.user, ref_type, ref_no))
|
||||||
|
|
||||||
frappe.msgprint(_("Journal Entries {0} are un-linked".format("\n".join(linked_jv))))
|
frappe.msgprint(_("Journal Entries {0} are un-linked").format("\n".join(linked_jv)))
|
||||||
|
|
||||||
def remove_ref_doc_link_from_pe(ref_type, ref_no):
|
def remove_ref_doc_link_from_pe(ref_type, ref_no):
|
||||||
linked_pe = frappe.db.sql_list("""select parent from `tabPayment Entry Reference`
|
linked_pe = frappe.db.sql_list("""select parent from `tabPayment Entry Reference`
|
||||||
@ -536,7 +536,7 @@ def remove_ref_doc_link_from_pe(ref_type, ref_no):
|
|||||||
where name=%s""", (pe_doc.total_allocated_amount, pe_doc.base_total_allocated_amount,
|
where name=%s""", (pe_doc.total_allocated_amount, pe_doc.base_total_allocated_amount,
|
||||||
pe_doc.unallocated_amount, now(), frappe.session.user, pe))
|
pe_doc.unallocated_amount, now(), frappe.session.user, pe))
|
||||||
|
|
||||||
frappe.msgprint(_("Payment Entries {0} are un-linked".format("\n".join(linked_pe))))
|
frappe.msgprint(_("Payment Entries {0} are un-linked").format("\n".join(linked_pe)))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_company_default(company, fieldname):
|
def get_company_default(company, fieldname):
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class CropCycle(Document):
|
|||||||
self.import_disease_tasks(disease.disease, disease.start_date)
|
self.import_disease_tasks(disease.disease, disease.start_date)
|
||||||
disease.tasks_created = True
|
disease.tasks_created = True
|
||||||
|
|
||||||
frappe.msgprint(_("Tasks have been created for managing the {0} disease (on row {1})".format(disease.disease, disease.idx)))
|
frappe.msgprint(_("Tasks have been created for managing the {0} disease (on row {1})").format(disease.disease, disease.idx))
|
||||||
|
|
||||||
def import_disease_tasks(self, disease, start_date):
|
def import_disease_tasks(self, disease, start_date):
|
||||||
disease_doc = frappe.get_doc('Disease', disease)
|
disease_doc = frappe.get_doc('Disease', disease)
|
||||||
|
|||||||
@ -589,7 +589,7 @@ def transfer_asset(args):
|
|||||||
|
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
frappe.msgprint(_("Asset Movement record {0} created").format("<a href='#Form/Asset Movement/{0}'>{0}</a>".format(movement_entry.name)))
|
frappe.msgprint(_("Asset Movement record {0} created").format("<a href='#Form/Asset Movement/{0}'>{0}</a>").format(movement_entry.name))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_item_details(item_code, asset_category):
|
def get_item_details(item_code, asset_category):
|
||||||
@ -611,7 +611,7 @@ def get_asset_account(account_name, asset=None, asset_category=None, company=Non
|
|||||||
if asset:
|
if asset:
|
||||||
account = get_asset_category_account(account_name, asset=asset,
|
account = get_asset_category_account(account_name, asset=asset,
|
||||||
asset_category = asset_category, company = company)
|
asset_category = asset_category, company = company)
|
||||||
|
|
||||||
if not asset and not account:
|
if not asset and not account:
|
||||||
account = get_asset_category_account(account_name, asset_category = asset_category, company = company)
|
account = get_asset_category_account(account_name, asset_category = asset_category, company = company)
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class SupplierScorecardPeriod(Document):
|
|||||||
try:
|
try:
|
||||||
crit.score = min(crit.max_score, max( 0 ,frappe.safe_eval(self.get_eval_statement(crit.formula), None, {'max':max, 'min': min})))
|
crit.score = min(crit.max_score, max( 0 ,frappe.safe_eval(self.get_eval_statement(crit.formula), None, {'max':max, 'min': min})))
|
||||||
except Exception:
|
except Exception:
|
||||||
frappe.throw(_("Could not solve criteria score function for {0}. Make sure the formula is valid.".format(crit.criteria_name)),frappe.ValidationError)
|
frappe.throw(_("Could not solve criteria score function for {0}. Make sure the formula is valid.").format(crit.criteria_name),frappe.ValidationError)
|
||||||
crit.score = 0
|
crit.score = 0
|
||||||
|
|
||||||
def calculate_score(self):
|
def calculate_score(self):
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class AccountsController(TransactionBase):
|
|||||||
(is_supplier_payment and supplier.hold_type in ['All', 'Payments']):
|
(is_supplier_payment and supplier.hold_type in ['All', 'Payments']):
|
||||||
if not supplier.release_date or getdate(nowdate()) <= supplier.release_date:
|
if not supplier.release_date or getdate(nowdate()) <= supplier.release_date:
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_('{0} is blocked so this transaction cannot proceed'.format(supplier_name)), raise_exception=1)
|
_('{0} is blocked so this transaction cannot proceed').format(supplier_name), raise_exception=1)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.get('is_return'):
|
if not self.get('is_return'):
|
||||||
@ -926,7 +926,7 @@ def validate_taxes_and_charges(tax):
|
|||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"))
|
_("Cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"))
|
||||||
elif not tax.row_id:
|
elif not tax.row_id:
|
||||||
frappe.throw(_("Please specify a valid Row ID for row {0} in table {1}".format(tax.idx, _(tax.doctype))))
|
frappe.throw(_("Please specify a valid Row ID for row {0} in table {1}").format(tax.idx, _(tax.doctype)))
|
||||||
elif tax.row_id and cint(tax.row_id) >= cint(tax.idx):
|
elif tax.row_id and cint(tax.row_id) >= cint(tax.idx):
|
||||||
frappe.throw(_("Cannot refer row number greater than or equal to current row number for this Charge type"))
|
frappe.throw(_("Cannot refer row number greater than or equal to current row number for this Charge type"))
|
||||||
|
|
||||||
@ -1173,7 +1173,7 @@ def check_and_delete_children(parent, data):
|
|||||||
|
|
||||||
if parent.doctype == "Purchase Order" and flt(d.received_qty):
|
if parent.doctype == "Purchase Order" and flt(d.received_qty):
|
||||||
frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been received").format(d.idx, d.item_code))
|
frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been received").format(d.idx, d.item_code))
|
||||||
|
|
||||||
if flt(d.billed_amt):
|
if flt(d.billed_amt):
|
||||||
frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been billed.").format(d.idx, d.item_code))
|
frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been billed.").format(d.idx, d.item_code))
|
||||||
|
|
||||||
|
|||||||
@ -168,7 +168,7 @@ class BuyingController(StockController):
|
|||||||
if item.item_code and item.qty and item.item_code in stock_and_asset_items:
|
if item.item_code and item.qty and item.item_code in stock_and_asset_items:
|
||||||
item_proportion = flt(item.base_net_amount) / stock_and_asset_items_amount if stock_and_asset_items_amount \
|
item_proportion = flt(item.base_net_amount) / stock_and_asset_items_amount if stock_and_asset_items_amount \
|
||||||
else flt(item.qty) / stock_and_asset_items_qty
|
else flt(item.qty) / stock_and_asset_items_qty
|
||||||
|
|
||||||
if i == (last_item_idx - 1):
|
if i == (last_item_idx - 1):
|
||||||
item.item_tax_amount = flt(valuation_amount_adjustment,
|
item.item_tax_amount = flt(valuation_amount_adjustment,
|
||||||
self.precision("item_tax_amount", item))
|
self.precision("item_tax_amount", item))
|
||||||
@ -500,8 +500,8 @@ class BuyingController(StockController):
|
|||||||
item_row = item_row.as_dict()
|
item_row = item_row.as_dict()
|
||||||
for fieldname in field_list:
|
for fieldname in field_list:
|
||||||
if flt(item_row[fieldname]) < 0:
|
if flt(item_row[fieldname]) < 0:
|
||||||
frappe.throw(_("Row #{0}: {1} can not be negative for item {2}".format(item_row['idx'],
|
frappe.throw(_("Row #{0}: {1} can not be negative for item {2}").format(item_row['idx'],
|
||||||
frappe.get_meta(item_row.doctype).get_label(fieldname), item_row['item_code'])))
|
frappe.get_meta(item_row.doctype).get_label(fieldname), item_row['item_code']))
|
||||||
|
|
||||||
def check_for_on_hold_or_closed_status(self, ref_doctype, ref_fieldname):
|
def check_for_on_hold_or_closed_status(self, ref_doctype, ref_fieldname):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
@ -699,7 +699,7 @@ class BuyingController(StockController):
|
|||||||
if delete_asset and is_auto_create_enabled:
|
if delete_asset and is_auto_create_enabled:
|
||||||
# need to delete movements to delete assets otherwise throws link exists error
|
# need to delete movements to delete assets otherwise throws link exists error
|
||||||
movements = frappe.db.sql(
|
movements = frappe.db.sql(
|
||||||
"""SELECT asm.name
|
"""SELECT asm.name
|
||||||
FROM `tabAsset Movement` asm, `tabAsset Movement Item` asm_item
|
FROM `tabAsset Movement` asm, `tabAsset Movement Item` asm_item
|
||||||
WHERE asm_item.parent=asm.name and asm_item.asset=%s""", asset.name, as_dict=1)
|
WHERE asm_item.parent=asm.name and asm_item.asset=%s""", asset.name, as_dict=1)
|
||||||
for movement in movements:
|
for movement in movements:
|
||||||
@ -872,9 +872,9 @@ def validate_item_type(doc, fieldname, message):
|
|||||||
items = ", ".join([d for d in invalid_items])
|
items = ", ".join([d for d in invalid_items])
|
||||||
|
|
||||||
if len(invalid_items) > 1:
|
if len(invalid_items) > 1:
|
||||||
error_message = _("Following items {0} are not marked as {1} item. You can enable them as {1} item from its Item master".format(items, message))
|
error_message = _("Following items {0} are not marked as {1} item. You can enable them as {1} item from its Item master").format(items, message)
|
||||||
else:
|
else:
|
||||||
error_message = _("Following item {0} is not marked as {1} item. You can enable them as {1} item from its Item master".format(items, message))
|
error_message = _("Following item {0} is not marked as {1} item. You can enable them as {1} item from its Item master").format(items, message)
|
||||||
|
|
||||||
frappe.throw(error_message)
|
frappe.throw(error_message)
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class AssessmentPlan(Document):
|
|||||||
for d in self.assessment_criteria:
|
for d in self.assessment_criteria:
|
||||||
max_score += d.maximum_score
|
max_score += d.maximum_score
|
||||||
if self.maximum_assessment_score != max_score:
|
if self.maximum_assessment_score != max_score:
|
||||||
frappe.throw(_("Sum of Scores of Assessment Criteria needs to be {0}.".format(self.maximum_assessment_score)))
|
frappe.throw(_("Sum of Scores of Assessment Criteria needs to be {0}.").format(self.maximum_assessment_score))
|
||||||
|
|
||||||
def validate_assessment_criteria(self):
|
def validate_assessment_criteria(self):
|
||||||
assessment_criteria_list = frappe.db.sql_list(''' select apc.assessment_criteria
|
assessment_criteria_list = frappe.db.sql_list(''' select apc.assessment_criteria
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class AssessmentResult(Document):
|
|||||||
assessment_result = frappe.get_list("Assessment Result", filters={"name": ("not in", [self.name]),
|
assessment_result = frappe.get_list("Assessment Result", filters={"name": ("not in", [self.name]),
|
||||||
"student":self.student, "assessment_plan":self.assessment_plan, "docstatus":("!=", 2)})
|
"student":self.student, "assessment_plan":self.assessment_plan, "docstatus":("!=", 2)})
|
||||||
if assessment_result:
|
if assessment_result:
|
||||||
frappe.throw(_("Assessment Result record {0} already exists.".format(getlink("Assessment Result",assessment_result[0].name))))
|
frappe.throw(_("Assessment Result record {0} already exists.").format(getlink("Assessment Result",assessment_result[0].name)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,4 +16,4 @@ class CourseActivity(Document):
|
|||||||
if frappe.db.exists("Course Enrollment", self.enrollment):
|
if frappe.db.exists("Course Enrollment", self.enrollment):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Course Enrollment {0} does not exists".format(self.enrollment)))
|
frappe.throw(_("Course Enrollment {0} does not exists").format(self.enrollment))
|
||||||
@ -13,7 +13,7 @@ class GradingScale(Document):
|
|||||||
thresholds = []
|
thresholds = []
|
||||||
for d in self.intervals:
|
for d in self.intervals:
|
||||||
if d.threshold in thresholds:
|
if d.threshold in thresholds:
|
||||||
frappe.throw(_("Treshold {0}% appears more than once".format(d.threshold)))
|
frappe.throw(_("Treshold {0}% appears more than once").format(d.threshold))
|
||||||
else:
|
else:
|
||||||
thresholds.append(cint(d.threshold))
|
thresholds.append(cint(d.threshold))
|
||||||
if 0 not in thresholds:
|
if 0 not in thresholds:
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class Question(Document):
|
|||||||
options = self.options
|
options = self.options
|
||||||
answers = [item.name for item in options if item.is_correct == True]
|
answers = [item.name for item in options if item.is_correct == True]
|
||||||
if len(answers) == 0:
|
if len(answers) == 0:
|
||||||
frappe.throw(_("No correct answer is set for {0}".format(self.name)))
|
frappe.throw(_("No correct answer is set for {0}").format(self.name))
|
||||||
return None
|
return None
|
||||||
elif len(answers) == 1:
|
elif len(answers) == 1:
|
||||||
return answers[0]
|
return answers[0]
|
||||||
|
|||||||
@ -34,15 +34,15 @@ class StudentGroup(Document):
|
|||||||
students = [d.student for d in program_enrollment] if program_enrollment else []
|
students = [d.student for d in program_enrollment] if program_enrollment else []
|
||||||
for d in self.students:
|
for d in self.students:
|
||||||
if not frappe.db.get_value("Student", d.student, "enabled") and d.active and not self.disabled:
|
if not frappe.db.get_value("Student", d.student, "enabled") and d.active and not self.disabled:
|
||||||
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
|
frappe.throw(_("{0} - {1} is inactive student").format(d.group_roll_number, d.student_name))
|
||||||
|
|
||||||
if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\
|
if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\
|
||||||
and d.student not in students:
|
and d.student not in students:
|
||||||
frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}".format(d.group_roll_number, d.student_name, self.batch)))
|
frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}").format(d.group_roll_number, d.student_name, self.batch))
|
||||||
|
|
||||||
if (self.group_based_on == "Course") and cint(frappe.defaults.get_defaults().validate_course)\
|
if (self.group_based_on == "Course") and cint(frappe.defaults.get_defaults().validate_course)\
|
||||||
and (d.student not in students):
|
and (d.student not in students):
|
||||||
frappe.throw(_("{0} - {1} is not enrolled in the Course {2}".format(d.group_roll_number, d.student_name, self.course)))
|
frappe.throw(_("{0} - {1} is not enrolled in the Course {2}").format(d.group_roll_number, d.student_name, self.course))
|
||||||
|
|
||||||
def validate_and_set_child_table_fields(self):
|
def validate_and_set_child_table_fields(self):
|
||||||
roll_numbers = [d.group_roll_number for d in self.students if d.group_roll_number]
|
roll_numbers = [d.group_roll_number for d in self.students if d.group_roll_number]
|
||||||
@ -55,7 +55,7 @@ class StudentGroup(Document):
|
|||||||
max_roll_no += 1
|
max_roll_no += 1
|
||||||
d.group_roll_number = max_roll_no
|
d.group_roll_number = max_roll_no
|
||||||
if d.group_roll_number in roll_no_list:
|
if d.group_roll_number in roll_no_list:
|
||||||
frappe.throw(_("Duplicate roll number for student {0}".format(d.student_name)))
|
frappe.throw(_("Duplicate roll number for student {0}").format(d.student_name))
|
||||||
else:
|
else:
|
||||||
roll_no_list.append(d.group_roll_number)
|
roll_no_list.append(d.group_roll_number)
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ def get_students(academic_year, group_based_on, academic_term=None, program=None
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
def get_program_enrollment(academic_year, academic_term=None, program=None, batch=None, student_category=None, course=None):
|
def get_program_enrollment(academic_year, academic_term=None, program=None, batch=None, student_category=None, course=None):
|
||||||
|
|
||||||
condition1 = " "
|
condition1 = " "
|
||||||
condition2 = " "
|
condition2 = " "
|
||||||
if academic_term:
|
if academic_term:
|
||||||
@ -93,9 +93,9 @@ def get_program_enrollment(academic_year, academic_term=None, program=None, batc
|
|||||||
condition2 = ", `tabProgram Enrollment Course` pec"
|
condition2 = ", `tabProgram Enrollment Course` pec"
|
||||||
|
|
||||||
return frappe.db.sql('''
|
return frappe.db.sql('''
|
||||||
select
|
select
|
||||||
pe.student, pe.student_name
|
pe.student, pe.student_name
|
||||||
from
|
from
|
||||||
`tabProgram Enrollment` pe {condition2}
|
`tabProgram Enrollment` pe {condition2}
|
||||||
where
|
where
|
||||||
pe.academic_year = %(academic_year)s {condition1}
|
pe.academic_year = %(academic_year)s {condition1}
|
||||||
|
|||||||
@ -74,4 +74,4 @@ class StudentGroupCreationTool(Document):
|
|||||||
student_group.append('students', student)
|
student_group.append('students', student)
|
||||||
student_group.save()
|
student_group.save()
|
||||||
|
|
||||||
frappe.msgprint(_("{0} Student Groups created.".format(l)))
|
frappe.msgprint(_("{0} Student Groups created.").format(l))
|
||||||
@ -185,7 +185,7 @@ def add_activity(course, content_type, content, program):
|
|||||||
|
|
||||||
student = get_current_student()
|
student = get_current_student()
|
||||||
if not student:
|
if not student:
|
||||||
return frappe.throw(_("Student with email {0} does not exist".format(frappe.session.user)), frappe.DoesNotExistError)
|
return frappe.throw(_("Student with email {0} does not exist").format(frappe.session.user), frappe.DoesNotExistError)
|
||||||
|
|
||||||
enrollment = get_or_create_course_enrollment(course, program)
|
enrollment = get_or_create_course_enrollment(course, program)
|
||||||
if content_type == 'Quiz':
|
if content_type == 'Quiz':
|
||||||
@ -220,7 +220,7 @@ def get_quiz(quiz_name, course):
|
|||||||
quiz = frappe.get_doc("Quiz", quiz_name)
|
quiz = frappe.get_doc("Quiz", quiz_name)
|
||||||
questions = quiz.get_questions()
|
questions = quiz.get_questions()
|
||||||
except:
|
except:
|
||||||
frappe.throw(_("Quiz {0} does not exist".format(quiz_name)))
|
frappe.throw(_("Quiz {0} does not exist").format(quiz_name))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
questions = [{
|
questions = [{
|
||||||
@ -347,7 +347,7 @@ def get_or_create_course_enrollment(course, program):
|
|||||||
if not course_enrollment:
|
if not course_enrollment:
|
||||||
program_enrollment = get_enrollment('program', program, student.name)
|
program_enrollment = get_enrollment('program', program, student.name)
|
||||||
if not program_enrollment:
|
if not program_enrollment:
|
||||||
frappe.throw(_("You are not enrolled in program {0}".format(program)))
|
frappe.throw(_("You are not enrolled in program {0}").format(program))
|
||||||
return
|
return
|
||||||
return student.enroll_in_course(course_name=course, program_enrollment=get_enrollment('program', program, student.name))
|
return student.enroll_in_course(course_name=course, program_enrollment=get_enrollment('program', program, student.name))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -259,6 +259,6 @@ def get_tax_account_head(tax):
|
|||||||
{"parent": "Shopify Settings", "shopify_tax": tax_title}, "tax_account")
|
{"parent": "Shopify Settings", "shopify_tax": tax_title}, "tax_account")
|
||||||
|
|
||||||
if not tax_account:
|
if not tax_account:
|
||||||
frappe.throw(_("Tax Account not specified for Shopify Tax {0}".format(tax.get("title"))))
|
frappe.throw(_("Tax Account not specified for Shopify Tax {0}").format(tax.get("title")))
|
||||||
|
|
||||||
return tax_account
|
return tax_account
|
||||||
|
|||||||
@ -63,7 +63,7 @@ def add_bank_accounts(response, bank, company):
|
|||||||
|
|
||||||
default_gl_account = get_default_bank_cash_account(company, "Bank")
|
default_gl_account = get_default_bank_cash_account(company, "Bank")
|
||||||
if not default_gl_account:
|
if not default_gl_account:
|
||||||
frappe.throw(_("Please setup a default bank account for company {0}".format(company)))
|
frappe.throw(_("Please setup a default bank account for company {0}").format(company))
|
||||||
|
|
||||||
for account in response["accounts"]:
|
for account in response["accounts"]:
|
||||||
acc_type = frappe.db.get_value("Account Type", account["type"])
|
acc_type = frappe.db.get_value("Account Type", account["type"])
|
||||||
|
|||||||
@ -102,7 +102,7 @@ def invoice_appointment(appointment_doc):
|
|||||||
|
|
||||||
sales_invoice.save(ignore_permissions=True)
|
sales_invoice.save(ignore_permissions=True)
|
||||||
sales_invoice.submit()
|
sales_invoice.submit()
|
||||||
frappe.msgprint(_("Sales Invoice {0} created as paid".format(sales_invoice.name)), alert=True)
|
frappe.msgprint(_("Sales Invoice {0} created as paid").format(sales_invoice.name), alert=True)
|
||||||
|
|
||||||
def appointment_cancel(appointment_id):
|
def appointment_cancel(appointment_id):
|
||||||
appointment = frappe.get_doc("Patient Appointment", appointment_id)
|
appointment = frappe.get_doc("Patient Appointment", appointment_id)
|
||||||
@ -111,7 +111,7 @@ def appointment_cancel(appointment_id):
|
|||||||
sales_invoice = exists_sales_invoice(appointment)
|
sales_invoice = exists_sales_invoice(appointment)
|
||||||
if sales_invoice and cancel_sales_invoice(sales_invoice):
|
if sales_invoice and cancel_sales_invoice(sales_invoice):
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Appointment {0} and Sales Invoice {1} cancelled".format(appointment.name, sales_invoice.name))
|
_("Appointment {0} and Sales Invoice {1} cancelled").format(appointment.name, sales_invoice.name)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
validity = validity_exists(appointment.practitioner, appointment.patient)
|
validity = validity_exists(appointment.practitioner, appointment.patient)
|
||||||
@ -121,7 +121,7 @@ def appointment_cancel(appointment_id):
|
|||||||
visited = fee_validity.visited - 1
|
visited = fee_validity.visited - 1
|
||||||
frappe.db.set_value("Fee Validity", fee_validity.name, "visited", visited)
|
frappe.db.set_value("Fee Validity", fee_validity.name, "visited", visited)
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Appointment cancelled, Please review and cancel the invoice {0}".format(fee_validity.ref_invoice))
|
_("Appointment cancelled, Please review and cancel the invoice {0}").format(fee_validity.ref_invoice)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
frappe.msgprint(_("Appointment cancelled"))
|
frappe.msgprint(_("Appointment cancelled"))
|
||||||
@ -203,7 +203,7 @@ def get_availability_data(date, practitioner):
|
|||||||
if employee:
|
if employee:
|
||||||
# Check if it is Holiday
|
# Check if it is Holiday
|
||||||
if is_holiday(employee, date):
|
if is_holiday(employee, date):
|
||||||
frappe.throw(_("{0} is a company holiday".format(date)))
|
frappe.throw(_("{0} is a company holiday").format(date))
|
||||||
|
|
||||||
# Check if He/She on Leave
|
# Check if He/She on Leave
|
||||||
leave_record = frappe.db.sql("""select half_day from `tabLeave Application`
|
leave_record = frappe.db.sql("""select half_day from `tabLeave Application`
|
||||||
@ -221,7 +221,7 @@ def get_availability_data(date, practitioner):
|
|||||||
if schedule.schedule:
|
if schedule.schedule:
|
||||||
practitioner_schedule = frappe.get_doc("Practitioner Schedule", schedule.schedule)
|
practitioner_schedule = frappe.get_doc("Practitioner Schedule", schedule.schedule)
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master".format(practitioner)))
|
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master").format(practitioner))
|
||||||
|
|
||||||
if practitioner_schedule:
|
if practitioner_schedule:
|
||||||
available_slots = []
|
available_slots = []
|
||||||
@ -259,7 +259,7 @@ def get_availability_data(date, practitioner):
|
|||||||
"avail_slot":available_slots, 'appointments': appointments})
|
"avail_slot":available_slots, 'appointments': appointments})
|
||||||
|
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master".format(practitioner)))
|
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master").format(practitioner))
|
||||||
|
|
||||||
if not available_slots and not slot_details:
|
if not available_slots and not slot_details:
|
||||||
# TODO: return available slots in nearby dates
|
# TODO: return available slots in nearby dates
|
||||||
|
|||||||
@ -32,8 +32,8 @@ class HotelRoomReservation(Document):
|
|||||||
+ d.qty + self.rooms_booked.get(d.item)
|
+ d.qty + self.rooms_booked.get(d.item)
|
||||||
total_rooms = self.get_total_rooms(d.item)
|
total_rooms = self.get_total_rooms(d.item)
|
||||||
if total_rooms < rooms_booked:
|
if total_rooms < rooms_booked:
|
||||||
frappe.throw(_("Hotel Rooms of type {0} are unavailable on {1}".format(d.item,
|
frappe.throw(_("Hotel Rooms of type {0} are unavailable on {1}").format(d.item,
|
||||||
frappe.format(day, dict(fieldtype="Date")))), exc=HotelRoomUnavailableError)
|
frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomUnavailableError)
|
||||||
|
|
||||||
self.rooms_booked[d.item] += rooms_booked
|
self.rooms_booked[d.item] += rooms_booked
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ class HotelRoomReservation(Document):
|
|||||||
net_rate += day_rate[0][0]
|
net_rate += day_rate[0][0]
|
||||||
else:
|
else:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Please set Hotel Room Rate on {}".format(
|
_("Please set Hotel Room Rate on {}").format(
|
||||||
frappe.format(day, dict(fieldtype="Date")))), exc=HotelRoomPricingNotSetError)
|
frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomPricingNotSetError)
|
||||||
d.rate = net_rate
|
d.rate = net_rate
|
||||||
d.amount = net_rate * flt(d.qty)
|
d.amount = net_rate * flt(d.qty)
|
||||||
self.net_total += d.amount
|
self.net_total += d.amount
|
||||||
|
|||||||
@ -97,9 +97,9 @@ class DailyWorkSummary(Document):
|
|||||||
|
|
||||||
return dict(replies=replies,
|
return dict(replies=replies,
|
||||||
original_message=dws_group.message,
|
original_message=dws_group.message,
|
||||||
title=_('Work Summary for {0}'.format(
|
title=_('Work Summary for {0}').format(
|
||||||
global_date_format(self.creation)
|
global_date_format(self.creation)
|
||||||
)),
|
),
|
||||||
did_not_reply=', '.join(did_not_reply) or '',
|
did_not_reply=', '.join(did_not_reply) or '',
|
||||||
did_not_reply_title=_('No replies from'))
|
did_not_reply_title=_('No replies from'))
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ def get_benefit_pro_rata_ratio_amount(employee, on_date, sal_struct):
|
|||||||
pay_against_benefit_claim, max_benefit_amount = frappe.db.get_value("Salary Component", sal_struct_row.salary_component, ["pay_against_benefit_claim", "max_benefit_amount"])
|
pay_against_benefit_claim, max_benefit_amount = frappe.db.get_value("Salary Component", sal_struct_row.salary_component, ["pay_against_benefit_claim", "max_benefit_amount"])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# show the error in tests?
|
# show the error in tests?
|
||||||
frappe.throw(_("Unable to find Salary Component {0}".format(sal_struct_row.salary_component)))
|
frappe.throw(_("Unable to find Salary Component {0}").format(sal_struct_row.salary_component))
|
||||||
if sal_struct_row.is_flexible_benefit == 1 and pay_against_benefit_claim != 1:
|
if sal_struct_row.is_flexible_benefit == 1 and pay_against_benefit_claim != 1:
|
||||||
total_pro_rata_max += max_benefit_amount
|
total_pro_rata_max += max_benefit_amount
|
||||||
if total_pro_rata_max > 0:
|
if total_pro_rata_max > 0:
|
||||||
|
|||||||
@ -364,11 +364,11 @@ class SalarySlip(TransactionBase):
|
|||||||
return amount
|
return amount
|
||||||
|
|
||||||
except NameError as err:
|
except NameError as err:
|
||||||
frappe.throw(_("Name error: {0}".format(err)))
|
frappe.throw(_("Name error: {0}").format(err))
|
||||||
except SyntaxError as err:
|
except SyntaxError as err:
|
||||||
frappe.throw(_("Syntax error in formula or condition: {0}".format(err)))
|
frappe.throw(_("Syntax error in formula or condition: {0}").format(err))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
frappe.throw(_("Error in formula or condition: {0}".format(e)))
|
frappe.throw(_("Error in formula or condition: {0}").format(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def add_employee_benefits(self, payroll_period):
|
def add_employee_benefits(self, payroll_period):
|
||||||
@ -705,11 +705,11 @@ class SalarySlip(TransactionBase):
|
|||||||
if condition:
|
if condition:
|
||||||
return frappe.safe_eval(condition, self.whitelisted_globals, data)
|
return frappe.safe_eval(condition, self.whitelisted_globals, data)
|
||||||
except NameError as err:
|
except NameError as err:
|
||||||
frappe.throw(_("Name error: {0}".format(err)))
|
frappe.throw(_("Name error: {0}").format(err))
|
||||||
except SyntaxError as err:
|
except SyntaxError as err:
|
||||||
frappe.throw(_("Syntax error in condition: {0}".format(err)))
|
frappe.throw(_("Syntax error in condition: {0}").format(err))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
frappe.throw(_("Error in formula or condition: {0}".format(e)))
|
frappe.throw(_("Error in formula or condition: {0}").format(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_salary_slip_row(self, salary_component):
|
def get_salary_slip_row(self, salary_component):
|
||||||
|
|||||||
@ -57,8 +57,8 @@ class StaffingPlan(Document):
|
|||||||
and sp.to_date >= %s and sp.from_date <= %s and sp.company = %s
|
and sp.to_date >= %s and sp.from_date <= %s and sp.company = %s
|
||||||
""", (staffing_plan_detail.designation, self.from_date, self.to_date, self.company))
|
""", (staffing_plan_detail.designation, self.from_date, self.to_date, self.company))
|
||||||
if overlap and overlap [0][0]:
|
if overlap and overlap [0][0]:
|
||||||
frappe.throw(_("Staffing Plan {0} already exist for designation {1}"
|
frappe.throw(_("Staffing Plan {0} already exist for designation {1}")
|
||||||
.format(overlap[0][0], staffing_plan_detail.designation)))
|
.format(overlap[0][0], staffing_plan_detail.designation))
|
||||||
|
|
||||||
def validate_with_parent_plan(self, staffing_plan_detail):
|
def validate_with_parent_plan(self, staffing_plan_detail):
|
||||||
if not frappe.get_cached_value('Company', self.company, "parent_company"):
|
if not frappe.get_cached_value('Company', self.company, "parent_company"):
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class MaintenanceSchedule(TransactionBase):
|
|||||||
email_map[d.sales_person] = sp.get_email_id()
|
email_map[d.sales_person] = sp.get_email_id()
|
||||||
except frappe.ValidationError:
|
except frappe.ValidationError:
|
||||||
no_email_sp.append(d.sales_person)
|
no_email_sp.append(d.sales_person)
|
||||||
|
|
||||||
if no_email_sp:
|
if no_email_sp:
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
frappe._("Setting Events to {0}, since the Employee attached to the below Sales Persons does not have a User ID{1}").format(
|
frappe._("Setting Events to {0}, since the Employee attached to the below Sales Persons does not have a User ID{1}").format(
|
||||||
@ -66,7 +66,7 @@ class MaintenanceSchedule(TransactionBase):
|
|||||||
parent=%s""", (d.sales_person, d.item_code, self.name), as_dict=1)
|
parent=%s""", (d.sales_person, d.item_code, self.name), as_dict=1)
|
||||||
|
|
||||||
for key in scheduled_date:
|
for key in scheduled_date:
|
||||||
description =frappe._("Reference: {0}, Item Code: {1} and Customer: {2}").format(self.name, d.item_code, self.customer)
|
description =frappe._("Reference: {0}, Item Code: {1} and Customer: {2}").format(self.name, d.item_code, self.customer)
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype": "Event",
|
"doctype": "Event",
|
||||||
"owner": email_map.get(d.sales_person, self.owner),
|
"owner": email_map.get(d.sales_person, self.owner),
|
||||||
@ -146,11 +146,11 @@ class MaintenanceSchedule(TransactionBase):
|
|||||||
if not d.item_code:
|
if not d.item_code:
|
||||||
throw(_("Please select item code"))
|
throw(_("Please select item code"))
|
||||||
elif not d.start_date or not d.end_date:
|
elif not d.start_date or not d.end_date:
|
||||||
throw(_("Please select Start Date and End Date for Item {0}".format(d.item_code)))
|
throw(_("Please select Start Date and End Date for Item {0}").format(d.item_code))
|
||||||
elif not d.no_of_visits:
|
elif not d.no_of_visits:
|
||||||
throw(_("Please mention no of visits required"))
|
throw(_("Please mention no of visits required"))
|
||||||
elif not d.sales_person:
|
elif not d.sales_person:
|
||||||
throw(_("Please select a Sales Person for item: {0}".format(d.item_name)))
|
throw(_("Please select a Sales Person for item: {0}").format(d.item_name))
|
||||||
|
|
||||||
if getdate(d.start_date) >= getdate(d.end_date):
|
if getdate(d.start_date) >= getdate(d.end_date):
|
||||||
throw(_("Start date should be less than end date for Item {0}").format(d.item_code))
|
throw(_("Start date should be less than end date for Item {0}").format(d.item_code))
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import datetime
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import (flt, cint, time_diff_in_hours, get_datetime, getdate,
|
from frappe.utils import (flt, cint, time_diff_in_hours, get_datetime, getdate,
|
||||||
get_time, add_to_date, time_diff, add_days, get_datetime_str)
|
get_time, add_to_date, time_diff, add_days, get_datetime_str)
|
||||||
|
|
||||||
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
|
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
|
||||||
@ -43,7 +43,7 @@ class JobCard(Document):
|
|||||||
|
|
||||||
def get_overlap_for(self, args, check_next_available_slot=False):
|
def get_overlap_for(self, args, check_next_available_slot=False):
|
||||||
production_capacity = 1
|
production_capacity = 1
|
||||||
|
|
||||||
if self.workstation:
|
if self.workstation:
|
||||||
production_capacity = frappe.get_cached_value("Workstation",
|
production_capacity = frappe.get_cached_value("Workstation",
|
||||||
self.workstation, 'production_capacity') or 1
|
self.workstation, 'production_capacity') or 1
|
||||||
@ -195,8 +195,8 @@ class JobCard(Document):
|
|||||||
frappe.throw(_("Total completed qty must be greater than zero"))
|
frappe.throw(_("Total completed qty must be greater than zero"))
|
||||||
|
|
||||||
if self.total_completed_qty != self.for_quantity:
|
if self.total_completed_qty != self.for_quantity:
|
||||||
frappe.throw(_("The total completed qty({0}) must be equal to qty to manufacture({1})"
|
frappe.throw(_("The total completed qty({0}) must be equal to qty to manufacture({1})")
|
||||||
.format(frappe.bold(self.total_completed_qty),frappe.bold(self.for_quantity))))
|
.format(frappe.bold(self.total_completed_qty),frappe.bold(self.for_quantity)))
|
||||||
|
|
||||||
def update_work_order(self):
|
def update_work_order(self):
|
||||||
if not self.work_order:
|
if not self.work_order:
|
||||||
@ -372,7 +372,7 @@ def get_job_details(start, end, filters=None):
|
|||||||
conditions = get_filters_cond("Job Card", filters, [])
|
conditions = get_filters_cond("Job Card", filters, [])
|
||||||
|
|
||||||
job_cards = frappe.db.sql(""" SELECT `tabJob Card`.name, `tabJob Card`.work_order,
|
job_cards = frappe.db.sql(""" SELECT `tabJob Card`.name, `tabJob Card`.work_order,
|
||||||
`tabJob Card`.employee_name, `tabJob Card`.status, ifnull(`tabJob Card`.remarks, ''),
|
`tabJob Card`.employee_name, `tabJob Card`.status, ifnull(`tabJob Card`.remarks, ''),
|
||||||
min(`tabJob Card Time Log`.from_time) as from_time,
|
min(`tabJob Card Time Log`.from_time) as from_time,
|
||||||
max(`tabJob Card Time Log`.to_time) as to_time
|
max(`tabJob Card Time Log`.to_time) as to_time
|
||||||
FROM `tabJob Card` , `tabJob Card Time Log`
|
FROM `tabJob Card` , `tabJob Card Time Log`
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class ProductionPlan(Document):
|
|||||||
def validate_data(self):
|
def validate_data(self):
|
||||||
for d in self.get('po_items'):
|
for d in self.get('po_items'):
|
||||||
if not d.bom_no:
|
if not d.bom_no:
|
||||||
frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
|
frappe.throw(_("Please select BOM for Item in Row {0}").format(d.idx))
|
||||||
else:
|
else:
|
||||||
validate_bom_no(d.item_code, d.bom_no)
|
validate_bom_no(d.item_code, d.bom_no)
|
||||||
|
|
||||||
|
|||||||
@ -461,7 +461,7 @@ class WorkOrder(Document):
|
|||||||
def validate_operation_time(self):
|
def validate_operation_time(self):
|
||||||
for d in self.operations:
|
for d in self.operations:
|
||||||
if not d.time_in_mins > 0:
|
if not d.time_in_mins > 0:
|
||||||
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}".format(d.operation)))
|
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}").format(d.operation))
|
||||||
|
|
||||||
def update_required_items(self):
|
def update_required_items(self):
|
||||||
'''
|
'''
|
||||||
|
|||||||
@ -188,7 +188,7 @@ class Project(Document):
|
|||||||
def send_welcome_email(self):
|
def send_welcome_email(self):
|
||||||
url = get_url("/project/?name={0}".format(self.name))
|
url = get_url("/project/?name={0}".format(self.name))
|
||||||
messages = (
|
messages = (
|
||||||
_("You have been invited to collaborate on the project: {0}".format(self.name)),
|
_("You have been invited to collaborate on the project: {0}").format(self.name),
|
||||||
url,
|
url,
|
||||||
_("Join")
|
_("Join")
|
||||||
)
|
)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class QualityProcedure(NestedSet):
|
|||||||
if process.procedure:
|
if process.procedure:
|
||||||
doc = frappe.get_doc("Quality Procedure", process.procedure)
|
doc = frappe.get_doc("Quality Procedure", process.procedure)
|
||||||
if doc.parent_quality_procedure:
|
if doc.parent_quality_procedure:
|
||||||
frappe.throw(_("{0} already has a Parent Procedure {1}.".format(process.procedure, doc.parent_quality_procedure)))
|
frappe.throw(_("{0} already has a Parent Procedure {1}.").format(process.procedure, doc.parent_quality_procedure))
|
||||||
self.is_group = 1
|
self.is_group = 1
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from erpnext import get_region
|
|||||||
def check_deletion_permission(doc, method):
|
def check_deletion_permission(doc, method):
|
||||||
region = get_region(doc.company)
|
region = get_region(doc.company)
|
||||||
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
||||||
frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
|
frappe.throw(_("Deletion is not permitted for country {0}").format(region))
|
||||||
|
|
||||||
def create_transaction_log(doc, method):
|
def create_transaction_log(doc, method):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -417,7 +417,7 @@ class GSTR3BReport(Document):
|
|||||||
if gst_details:
|
if gst_details:
|
||||||
return gst_details[0]
|
return gst_details[0]
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Please enter GSTIN and state for the Company Address {0}".format(self.company_address)))
|
frappe.throw(_("Please enter GSTIN and state for the Company Address {0}").format(self.company_address))
|
||||||
|
|
||||||
def get_account_heads(self):
|
def get_account_heads(self):
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ class GSTR3BReport(Document):
|
|||||||
if account_heads:
|
if account_heads:
|
||||||
return account_heads
|
return account_heads
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Please set account heads in GST Settings for Compnay {0}".format(self.company)))
|
frappe.throw(_("Please set account heads in GST Settings for Compnay {0}").format(self.company))
|
||||||
|
|
||||||
def get_missing_field_invoices(self):
|
def get_missing_field_invoices(self):
|
||||||
|
|
||||||
|
|||||||
@ -550,9 +550,9 @@ def validate_sales_invoice(doc):
|
|||||||
|
|
||||||
for fieldname in reqd_fields:
|
for fieldname in reqd_fields:
|
||||||
if not doc.get(fieldname):
|
if not doc.get(fieldname):
|
||||||
frappe.throw(_('{} is required to generate e-Way Bill JSON'.format(
|
frappe.throw(_('{} is required to generate e-Way Bill JSON').format(
|
||||||
doc.meta.get_label(fieldname)
|
doc.meta.get_label(fieldname)
|
||||||
)))
|
))
|
||||||
|
|
||||||
if len(doc.company_gstin) < 15:
|
if len(doc.company_gstin) < 15:
|
||||||
frappe.throw(_('You must be a registered supplier to generate e-Way Bill'))
|
frappe.throw(_('You must be a registered supplier to generate e-Way Bill'))
|
||||||
|
|||||||
@ -252,7 +252,7 @@ def sales_invoice_validate(doc):
|
|||||||
else:
|
else:
|
||||||
for row in doc.taxes:
|
for row in doc.taxes:
|
||||||
if row.rate == 0 and row.tax_amount == 0 and not row.tax_exemption_reason:
|
if row.rate == 0 and row.tax_amount == 0 and not row.tax_exemption_reason:
|
||||||
frappe.throw(_("Row {0}: Please set at Tax Exemption Reason in Sales Taxes and Charges".format(row.idx)),
|
frappe.throw(_("Row {0}: Please set at Tax Exemption Reason in Sales Taxes and Charges").format(row.idx),
|
||||||
title=_("E-Invoicing Information Missing"))
|
title=_("E-Invoicing Information Missing"))
|
||||||
|
|
||||||
for schedule in doc.payment_schedule:
|
for schedule in doc.payment_schedule:
|
||||||
@ -272,10 +272,10 @@ def sales_invoice_on_submit(doc, method):
|
|||||||
else:
|
else:
|
||||||
for schedule in doc.payment_schedule:
|
for schedule in doc.payment_schedule:
|
||||||
if not schedule.mode_of_payment:
|
if not schedule.mode_of_payment:
|
||||||
frappe.throw(_("Row {0}: Please set the Mode of Payment in Payment Schedule".format(schedule.idx)),
|
frappe.throw(_("Row {0}: Please set the Mode of Payment in Payment Schedule").format(schedule.idx),
|
||||||
title=_("E-Invoicing Information Missing"))
|
title=_("E-Invoicing Information Missing"))
|
||||||
elif not frappe.db.get_value("Mode of Payment", schedule.mode_of_payment, "mode_of_payment_code"):
|
elif not frappe.db.get_value("Mode of Payment", schedule.mode_of_payment, "mode_of_payment_code"):
|
||||||
frappe.throw(_("Row {0}: Please set the correct code on Mode of Payment {1}".format(schedule.idx, schedule.mode_of_payment)),
|
frappe.throw(_("Row {0}: Please set the correct code on Mode of Payment {1}").format(schedule.idx, schedule.mode_of_payment),
|
||||||
title=_("E-Invoicing Information Missing"))
|
title=_("E-Invoicing Information Missing"))
|
||||||
|
|
||||||
prepare_and_attach_invoice(doc)
|
prepare_and_attach_invoice(doc)
|
||||||
@ -355,7 +355,7 @@ def validate_address(address_name):
|
|||||||
|
|
||||||
for field in fields:
|
for field in fields:
|
||||||
if not data.get(field):
|
if not data.get(field):
|
||||||
frappe.throw(_("Please set {0} for address {1}".format(field.replace('-',''), address_name)),
|
frappe.throw(_("Please set {0} for address {1}").format(field.replace('-',''), address_name),
|
||||||
title=_("E-Invoicing Information Missing"))
|
title=_("E-Invoicing Information Missing"))
|
||||||
|
|
||||||
def get_unamended_name(doc):
|
def get_unamended_name(doc):
|
||||||
|
|||||||
@ -719,9 +719,9 @@ def get_company_gstin_number(company):
|
|||||||
if gstin:
|
if gstin:
|
||||||
return gstin[0]["gstin"]
|
return gstin[0]["gstin"]
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Please set valid GSTIN No. in Company Address for company {0}".format(
|
frappe.throw(_("Please set valid GSTIN No. in Company Address for company {0}").format(
|
||||||
frappe.bold(company)
|
frappe.bold(company)
|
||||||
)))
|
))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def download_json_file():
|
def download_json_file():
|
||||||
|
|||||||
@ -50,8 +50,8 @@ class POSClosingVoucher(Document):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
frappe.throw(_("POS Closing Voucher alreday exists for {0} between date {1} and {2}"
|
frappe.throw(_("POS Closing Voucher alreday exists for {0} between date {1} and {2}")
|
||||||
.format(self.user, self.period_start_date, self.period_end_date)))
|
.format(self.user, self.period_start_date, self.period_end_date))
|
||||||
|
|
||||||
def set_invoice_list(self, invoice_list):
|
def set_invoice_list(self, invoice_list):
|
||||||
self.sales_invoices_summary = []
|
self.sales_invoices_summary = []
|
||||||
|
|||||||
@ -78,19 +78,19 @@ def get_columns(filters, period_list, partner_doctype):
|
|||||||
|
|
||||||
columns.extend([{
|
columns.extend([{
|
||||||
"fieldname": target_key,
|
"fieldname": target_key,
|
||||||
"label": _("Target ({})".format(period.label)),
|
"label": _("Target ({})").format(period.label),
|
||||||
"fieldtype": fieldtype,
|
"fieldtype": fieldtype,
|
||||||
"options": options,
|
"options": options,
|
||||||
"width": 100
|
"width": 100
|
||||||
}, {
|
}, {
|
||||||
"fieldname": period.key,
|
"fieldname": period.key,
|
||||||
"label": _("Achieved ({})".format(period.label)),
|
"label": _("Achieved ({})").format(period.label),
|
||||||
"fieldtype": fieldtype,
|
"fieldtype": fieldtype,
|
||||||
"options": options,
|
"options": options,
|
||||||
"width": 100
|
"width": 100
|
||||||
}, {
|
}, {
|
||||||
"fieldname": variance_key,
|
"fieldname": variance_key,
|
||||||
"label": _("Variance ({})".format(period.label)),
|
"label": _("Variance ({})").format(period.label),
|
||||||
"fieldtype": fieldtype,
|
"fieldtype": fieldtype,
|
||||||
"options": options,
|
"options": options,
|
||||||
"width": 100
|
"width": 100
|
||||||
|
|||||||
@ -81,7 +81,7 @@ class TestCompany(unittest.TestCase):
|
|||||||
filters["is_group"] = 1
|
filters["is_group"] = 1
|
||||||
|
|
||||||
has_matching_accounts = frappe.get_all("Account", filters)
|
has_matching_accounts = frappe.get_all("Account", filters)
|
||||||
error_message = _("No Account matched these filters: {}".format(json.dumps(filters)))
|
error_message = _("No Account matched these filters: {}").format(json.dumps(filters))
|
||||||
|
|
||||||
self.assertTrue(has_matching_accounts, msg=error_message)
|
self.assertTrue(has_matching_accounts, msg=error_message)
|
||||||
finally:
|
finally:
|
||||||
@ -124,7 +124,7 @@ def create_child_company():
|
|||||||
child_company.insert()
|
child_company.insert()
|
||||||
else:
|
else:
|
||||||
child_company = frappe.get_doc("Company", child_company)
|
child_company = frappe.get_doc("Company", child_company)
|
||||||
|
|
||||||
return child_company.name
|
return child_company.name
|
||||||
|
|
||||||
def create_test_lead_in_company(company):
|
def create_test_lead_in_company(company):
|
||||||
|
|||||||
@ -143,5 +143,5 @@ def insert_record(records):
|
|||||||
|
|
||||||
def welcome_email():
|
def welcome_email():
|
||||||
site_name = get_default_company()
|
site_name = get_default_company()
|
||||||
title = _("Welcome to {0}".format(site_name))
|
title = _("Welcome to {0}").format(site_name)
|
||||||
return title
|
return title
|
||||||
|
|||||||
@ -431,7 +431,7 @@ def get_debtors_account(cart_settings):
|
|||||||
payment_gateway_account_currency = \
|
payment_gateway_account_currency = \
|
||||||
frappe.get_doc("Payment Gateway Account", cart_settings.payment_gateway_account).currency
|
frappe.get_doc("Payment Gateway Account", cart_settings.payment_gateway_account).currency
|
||||||
|
|
||||||
account_name = _("Debtors ({0})".format(payment_gateway_account_currency))
|
account_name = _("Debtors ({0})").format(payment_gateway_account_currency)
|
||||||
|
|
||||||
debtors_account_name = get_account_name("Receivable", "Asset", is_group=0,\
|
debtors_account_name = get_account_name("Receivable", "Asset", is_group=0,\
|
||||||
account_currency=payment_gateway_account_currency, company=cart_settings.company)
|
account_currency=payment_gateway_account_currency, company=cart_settings.company)
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class DeliveryTrip(Document):
|
|||||||
note_doc.save()
|
note_doc.save()
|
||||||
|
|
||||||
delivery_notes = [get_link_to_form("Delivery Note", note) for note in delivery_notes]
|
delivery_notes = [get_link_to_form("Delivery Note", note) for note in delivery_notes]
|
||||||
frappe.msgprint(_("Delivery Notes {0} updated".format(", ".join(delivery_notes))))
|
frappe.msgprint(_("Delivery Notes {0} updated").format(", ".join(delivery_notes)))
|
||||||
|
|
||||||
def process_route(self, optimize):
|
def process_route(self, optimize):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -814,7 +814,7 @@ class Item(WebsiteGenerator):
|
|||||||
for d in self.attributes:
|
for d in self.attributes:
|
||||||
if d.attribute in attributes:
|
if d.attribute in attributes:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Attribute {0} selected multiple times in Attributes Table".format(d.attribute)))
|
_("Attribute {0} selected multiple times in Attributes Table").format(d.attribute))
|
||||||
else:
|
else:
|
||||||
attributes.append(d.attribute)
|
attributes.append(d.attribute)
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class ItemAlternative(Document):
|
|||||||
def validate_duplicate(self):
|
def validate_duplicate(self):
|
||||||
if frappe.db.get_value("Item Alternative", {'item_code': self.item_code,
|
if frappe.db.get_value("Item Alternative", {'item_code': self.item_code,
|
||||||
'alternative_item_code': self.alternative_item_code, 'name': ('!=', self.name)}):
|
'alternative_item_code': self.alternative_item_code, 'name': ('!=', self.name)}):
|
||||||
frappe.throw(_("Already record exists for the item {0}".format(self.item_code)))
|
frappe.throw(_("Already record exists for the item {0}").format(self.item_code))
|
||||||
|
|
||||||
def get_alternative_items(doctype, txt, searchfield, start, page_len, filters):
|
def get_alternative_items(doctype, txt, searchfield, start, page_len, filters):
|
||||||
return frappe.db.sql(""" (select alternative_item_code from `tabItem Alternative`
|
return frappe.db.sql(""" (select alternative_item_code from `tabItem Alternative`
|
||||||
|
|||||||
@ -371,7 +371,7 @@ def get_material_requests_based_on_supplier(supplier):
|
|||||||
supplier_items = [d.parent for d in frappe.db.get_all("Item Default",
|
supplier_items = [d.parent for d in frappe.db.get_all("Item Default",
|
||||||
{"default_supplier": supplier}, 'parent')]
|
{"default_supplier": supplier}, 'parent')]
|
||||||
if not supplier_items:
|
if not supplier_items:
|
||||||
frappe.throw(_("{0} is not the default supplier for any items.".format(supplier)))
|
frappe.throw(_("{0} is not the default supplier for any items.").format(supplier))
|
||||||
|
|
||||||
material_requests = frappe.db.sql_list("""select distinct mr.name
|
material_requests = frappe.db.sql_list("""select distinct mr.name
|
||||||
from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
|
from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
|
||||||
|
|||||||
@ -167,11 +167,11 @@ class Issue(Document):
|
|||||||
|
|
||||||
if not service_level_agreement:
|
if not service_level_agreement:
|
||||||
if frappe.db.get_value("Issue", self.name, "service_level_agreement"):
|
if frappe.db.get_value("Issue", self.name, "service_level_agreement"):
|
||||||
frappe.throw(_("Couldn't Set Service Level Agreement {0}.".format(self.service_level_agreement)))
|
frappe.throw(_("Couldn't Set Service Level Agreement {0}.").format(self.service_level_agreement))
|
||||||
return
|
return
|
||||||
|
|
||||||
if (service_level_agreement.customer and self.customer) and not (service_level_agreement.customer == self.customer):
|
if (service_level_agreement.customer and self.customer) and not (service_level_agreement.customer == self.customer):
|
||||||
frappe.throw(_("This Service Level Agreement is specific to Customer {0}".format(service_level_agreement.customer)))
|
frappe.throw(_("This Service Level Agreement is specific to Customer {0}").format(service_level_agreement.customer))
|
||||||
|
|
||||||
self.service_level_agreement = service_level_agreement.name
|
self.service_level_agreement = service_level_agreement.name
|
||||||
self.priority = service_level_agreement.default_priority if not priority else priority
|
self.priority = service_level_agreement.default_priority if not priority else priority
|
||||||
@ -238,7 +238,7 @@ def get_expected_time_for(parameter, service_level, start_date_time):
|
|||||||
allotted_days = service_level.get("resolution_time")
|
allotted_days = service_level.get("resolution_time")
|
||||||
time_period = service_level.get("resolution_time_period")
|
time_period = service_level.get("resolution_time_period")
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("{0} parameter is invalid".format(parameter)))
|
frappe.throw(_("{0} parameter is invalid").format(parameter))
|
||||||
|
|
||||||
allotted_hours = 0
|
allotted_hours = 0
|
||||||
if time_period == 'Hour':
|
if time_period == 'Hour':
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class ServiceLevel(Document):
|
|||||||
for priority in self.priorities:
|
for priority in self.priorities:
|
||||||
# Check if response and resolution time is set for every priority
|
# Check if response and resolution time is set for every priority
|
||||||
if not (priority.response_time or priority.resolution_time):
|
if not (priority.response_time or priority.resolution_time):
|
||||||
frappe.throw(_("Set Response Time and Resolution for Priority {0} at index {1}.".format(priority.priority, priority.idx)))
|
frappe.throw(_("Set Response Time and Resolution for Priority {0} at index {1}.").format(priority.priority, priority.idx))
|
||||||
|
|
||||||
priorities.append(priority.priority)
|
priorities.append(priority.priority)
|
||||||
|
|
||||||
@ -44,12 +44,12 @@ class ServiceLevel(Document):
|
|||||||
resolution = priority.resolution_time * 7
|
resolution = priority.resolution_time * 7
|
||||||
|
|
||||||
if response > resolution:
|
if response > resolution:
|
||||||
frappe.throw(_("Response Time for {0} at index {1} can't be greater than Resolution Time.".format(priority.priority, priority.idx)))
|
frappe.throw(_("Response Time for {0} at index {1} can't be greater than Resolution Time.").format(priority.priority, priority.idx))
|
||||||
|
|
||||||
# Check if repeated priority
|
# Check if repeated priority
|
||||||
if not len(set(priorities)) == len(priorities):
|
if not len(set(priorities)) == len(priorities):
|
||||||
repeated_priority = get_repeated(priorities)
|
repeated_priority = get_repeated(priorities)
|
||||||
frappe.throw(_("Priority {0} has been repeated.".format(repeated_priority)))
|
frappe.throw(_("Priority {0} has been repeated.").format(repeated_priority))
|
||||||
|
|
||||||
# Check if repeated default priority
|
# Check if repeated default priority
|
||||||
if not len(set(default_priority)) == len(default_priority):
|
if not len(set(default_priority)) == len(default_priority):
|
||||||
@ -81,7 +81,7 @@ class ServiceLevel(Document):
|
|||||||
# Check for repeated workday
|
# Check for repeated workday
|
||||||
if not len(set(support_days)) == len(support_days):
|
if not len(set(support_days)) == len(support_days):
|
||||||
repeated_days = get_repeated(support_days)
|
repeated_days = get_repeated(support_days)
|
||||||
frappe.throw(_("Workday {0} has been repeated.".format(repeated_days)))
|
frappe.throw(_("Workday {0} has been repeated.").format(repeated_days))
|
||||||
|
|
||||||
def get_repeated(values):
|
def get_repeated(values):
|
||||||
unique_list = []
|
unique_list = []
|
||||||
|
|||||||
@ -64,7 +64,7 @@ def check_mandate(data, reference_doctype, reference_docname):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
redirect_flow = client.redirect_flows.create(params={
|
redirect_flow = client.redirect_flows.create(params={
|
||||||
"description": _("Pay {0} {1}".format(data['amount'], data['currency'])),
|
"description": _("Pay {0} {1}").format(data['amount'], data['currency']),
|
||||||
"session_token": frappe.session.user,
|
"session_token": frappe.session.user,
|
||||||
"success_redirect_url": success_url,
|
"success_redirect_url": success_url,
|
||||||
"prefilled_customer": prefilled_customer
|
"prefilled_customer": prefilled_customer
|
||||||
|
|||||||
@ -36,4 +36,4 @@ class FindItemBot(BotParser):
|
|||||||
return "\n\n".join(out)
|
return "\n\n".join(out)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return _("Did not find any item called {0}".format(item))
|
return _("Did not find any item called {0}").format(item)
|
||||||
@ -22,7 +22,7 @@ def get_program(program_name):
|
|||||||
try:
|
try:
|
||||||
return frappe.get_doc('Program', program_name)
|
return frappe.get_doc('Program', program_name)
|
||||||
except frappe.DoesNotExistError:
|
except frappe.DoesNotExistError:
|
||||||
frappe.throw(_("Program {0} does not exist.".format(program_name)))
|
frappe.throw(_("Program {0} does not exist.").format(program_name))
|
||||||
|
|
||||||
def get_course_progress(courses, program):
|
def get_course_progress(courses, program):
|
||||||
progress = {course.name: utils.get_course_progress(course, program) for course in courses}
|
progress = {course.name: utils.get_course_progress(course, program) for course in courses}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user