From 48e9bc3fc9486e522c2f3ac491b8d3f019226dc7 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 29 Jan 2020 15:06:18 +0530 Subject: [PATCH] fix: Incorrect translation syntax --- erpnext/accounts/deferred_revenue.py | 2 +- .../doctype/bank_account/test_bank_account.py | 4 ++-- .../bank_statement_transaction_entry.py | 2 +- .../doctype/bank_transaction/bank_transaction.py | 2 +- erpnext/accounts/doctype/c_form/c_form.py | 2 +- .../doctype/journal_entry/journal_entry.py | 4 ++-- .../doctype/payment_entry/payment_entry.py | 2 +- .../doctype/payment_request/payment_request.py | 8 ++++---- .../doctype/pricing_rule/pricing_rule.py | 10 +++++----- .../doctype/purchase_invoice/purchase_invoice.py | 2 +- .../doctype/sales_invoice/sales_invoice.py | 8 ++++---- .../doctype/shipping_rule/shipping_rule.py | 2 +- .../doctype/subscription/subscription.py | 8 ++++---- erpnext/accounts/doctype/tax_rule/tax_rule.py | 2 +- erpnext/accounts/report/financial_statements.py | 4 ++-- .../report/general_ledger/general_ledger.py | 6 +++--- erpnext/accounts/utils.py | 4 ++-- .../agriculture/doctype/crop_cycle/crop_cycle.py | 2 +- erpnext/assets/doctype/asset/asset.py | 4 ++-- .../supplier_scorecard_period.py | 2 +- erpnext/controllers/accounts_controller.py | 6 +++--- erpnext/controllers/buying_controller.py | 8 ++++---- .../doctype/assessment_plan/assessment_plan.py | 2 +- .../assessment_result/assessment_result.py | 2 +- .../doctype/course_activity/course_activity.py | 2 +- .../doctype/grading_scale/grading_scale.py | 2 +- erpnext/education/doctype/question/question.py | 2 +- .../doctype/student_group/student_group.py | 16 ++++++++-------- .../student_group_creation_tool.py | 2 +- erpnext/education/utils.py | 6 +++--- .../connectors/shopify_connection.py | 2 +- .../doctype/plaid_settings/plaid_settings.py | 2 +- .../patient_appointment/patient_appointment.py | 12 ++++++------ .../employee_benefit_claim.py | 2 +- erpnext/hr/doctype/salary_slip/salary_slip.py | 12 ++++++------ .../hr/doctype/staffing_plan/staffing_plan.py | 4 ++-- .../maintenance_schedule/maintenance_schedule.py | 8 ++++---- .../manufacturing/doctype/job_card/job_card.py | 10 +++++----- .../doctype/production_plan/production_plan.py | 2 +- .../doctype/work_order/work_order.py | 2 +- erpnext/projects/doctype/project/project.py | 2 +- .../quality_procedure/quality_procedure.py | 2 +- erpnext/regional/__init__.py | 2 +- .../doctype/gstr_3b_report/gstr_3b_report.py | 4 ++-- erpnext/regional/italy/utils.py | 8 ++++---- .../pos_closing_voucher/pos_closing_voucher.py | 4 ++-- .../item_group_wise_sales_target_variance.py | 6 +++--- erpnext/setup/doctype/company/test_company.py | 4 ++-- erpnext/setup/utils.py | 2 +- erpnext/shopping_cart/cart.py | 2 +- .../stock/doctype/delivery_trip/delivery_trip.py | 2 +- erpnext/stock/doctype/item/item.py | 2 +- .../doctype/item_alternative/item_alternative.py | 2 +- .../doctype/material_request/material_request.py | 2 +- erpnext/support/doctype/issue/issue.py | 6 +++--- .../doctype/service_level/service_level.py | 8 ++++---- .../pages/integrations/gocardless_checkout.py | 2 +- erpnext/utilities/bot.py | 2 +- erpnext/www/lms/program.py | 2 +- 59 files changed, 124 insertions(+), 124 deletions(-) diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py index 62a8f05c65..3b6a5881ca 100644 --- a/erpnext/accounts/deferred_revenue.py +++ b/erpnext/accounts/deferred_revenue.py @@ -30,7 +30,7 @@ def validate_service_stop_date(doc): 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): - 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): # book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index f3bb086fa9..26e93c5188 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -39,11 +39,11 @@ class TestBankAccount(unittest.TestCase): try: bank_account.validate_iban() 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) for not_iban in invalid_ibans: 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): bank_account.validate_iban() diff --git a/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py b/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py index 1318cf18d7..5b6eb9dc24 100644 --- a/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py +++ b/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py @@ -314,7 +314,7 @@ class BankStatementTransactionEntry(Document): try: reconcile_against_document(lst) 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): for payment in self.new_transaction_items: diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index b8ebebaa93..0e45db3dbc 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -49,7 +49,7 @@ class BankTransaction(StatusUpdater): if paid_amount and allocated_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: if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]: self.clear_simple_entry(payment_entry) diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py index 2dcf958556..9b64f8100f 100644 --- a/erpnext/accounts/doctype/c_form/c_form.py +++ b/erpnext/accounts/doctype/c_form/c_form.py @@ -18,7 +18,7 @@ class CForm(Document): `tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no) 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: frappe.throw(_("""Invoice {0} is tagged in another C-form: {1}. diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 88973373ed..458e4a2526 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -616,7 +616,7 @@ class JournalEntry(AccountsController): d.reference_name, ("total_sanctioned_amount", "total_amount_reimbursed")) pending_amount = flt(sanctioned_amount) - flt(reimbursed_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): if self.stock_entry: @@ -624,7 +624,7 @@ class JournalEntry(AccountsController): 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}): - 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): if not self.get('accounts'): diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 214d608866..e36e23add8 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -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 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: pe.append("references", { 'reference_doctype': dt, diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 1aff43c717..0fade8c456 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -39,8 +39,8 @@ class PaymentRequest(Document): ref_amount = get_amount(ref_doc) if existing_payment_request_amount + flt(self.grand_total)> ref_amount: - frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount" - .format(self.reference_doctype))) + frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount") + .format(self.reference_doctype)) def validate_currency(self): 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: payment_gateway = frappe.db.get_value("Subscription Plan", subscription_plan.plan, "payment_gateway") 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) amount += rate 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): if self.payment_request_type == 'Outward': diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 3c14819e6f..924e108130 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -56,12 +56,12 @@ class PricingRule(Document): if not self.selling and self.applicable_for in ["Customer", "Customer Group", "Territory", "Sales Partner", "Campaign"]: - throw(_("Selling must be checked, if Applicable For is selected as {0}" - .format(self.applicable_for))) + throw(_("Selling must be checked, if Applicable For is selected as {0}") + .format(self.applicable_for)) if not self.buying and self.applicable_for in ["Supplier", "Supplier Group"]: - throw(_("Buying must be checked, if Applicable For is selected as {0}" - .format(self.applicable_for))) + throw(_("Buying must be checked, if Applicable For is selected as {0}") + .format(self.applicable_for)) def validate_min_max_qty(self): 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: return item_details - + if not pricing_rule.validate_applied_rule: if pricing_rule.price_or_product_discount == "Price": apply_price_discount_rule(pricing_rule, item_details, args) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 1a14a2a732..64caf98778 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -907,7 +907,7 @@ class PurchaseInvoice(BuyingController): if pi: 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): updated_pr = [] diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 703df796c0..73e0762ef0 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -225,7 +225,7 @@ class SalesInvoice(SellingController): total_amount_in_payments += payment.amount invoice_total = self.rounded_total or self.grand_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): if len(self.payments) == 0 and self.is_pos: @@ -1041,7 +1041,7 @@ class SalesInvoice(SellingController): si_serial_nos = set(get_serial_nos(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): frappe.throw(_("Row {0}: {1} Serial numbers required for Item {2}. You have provided {3}.".format( @@ -1064,8 +1064,8 @@ class SalesInvoice(SellingController): and self.name != serial_no_details.sales_invoice: sales_invoice_company = frappe.db.get_value("Sales Invoice", serial_no_details.sales_invoice, "company") if sales_invoice_company == self.company: - frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}" - .format(serial_no, serial_no_details.sales_invoice))) + frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}") + .format(serial_no, serial_no_details.sales_invoice)) def update_project(self): if self.project: diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py index 8c4efbebe8..1fd340c731 100644 --- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py @@ -82,7 +82,7 @@ class ShippingRule(Document): if not shipping_country: 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]: - 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): shipping_charge = { diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py index 5482750375..af096fe907 100644 --- a/erpnext/accounts/doctype/subscription/subscription.py +++ b/erpnext/accounts/doctype/subscription/subscription.py @@ -195,7 +195,7 @@ class Subscription(Document): doc = frappe.get_doc('Sales Invoice', current.invoice) return doc 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): """ @@ -338,7 +338,7 @@ class Subscription(Document): # 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() - + def is_current_invoice_paid(self): if self.is_new_subscription(): return False @@ -346,7 +346,7 @@ class Subscription(Document): 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': return True - + return False def process_for_active(self): @@ -388,7 +388,7 @@ class Subscription(Document): """ current_invoice = self.get_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: if self.is_not_outstanding(current_invoice): self.status = 'Active' diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index ff87ba36b4..e4ebc6d12f 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -95,7 +95,7 @@ class TaxRule(Document): if tax_rule: 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): '''If shopping cart is enabled and no tax rule exists for shopping cart, enable this one''' diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 40d5682726..5a91805d5d 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -175,7 +175,7 @@ def calculate_values( d = accounts_by_name.get(entry.account) if not d: 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 ) 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]}) all_cost_centers += [c.name for c in children] 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)) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index ec3fb1fc9c..08c1b38928 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -373,19 +373,19 @@ def get_columns(filters): "width": 180 }, { - "label": _("Debit ({0})".format(currency)), + "label": _("Debit ({0})").format(currency), "fieldname": "debit", "fieldtype": "Float", "width": 100 }, { - "label": _("Credit ({0})".format(currency)), + "label": _("Credit ({0})").format(currency), "fieldname": "credit", "fieldtype": "Float", "width": 100 }, { - "label": _("Balance ({0})".format(currency)), + "label": _("Balance ({0})").format(currency), "fieldname": "balance", "fieldtype": "Float", "width": 130 diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index e01d6d5dc7..039ec1f7f7 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -513,7 +513,7 @@ def remove_ref_doc_link_from_jv(ref_type, ref_no): where reference_type=%s and reference_name=%s 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): 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, 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() def get_company_default(company, fieldname): diff --git a/erpnext/agriculture/doctype/crop_cycle/crop_cycle.py b/erpnext/agriculture/doctype/crop_cycle/crop_cycle.py index 3e51933df7..cae150c428 100644 --- a/erpnext/agriculture/doctype/crop_cycle/crop_cycle.py +++ b/erpnext/agriculture/doctype/crop_cycle/crop_cycle.py @@ -44,7 +44,7 @@ class CropCycle(Document): self.import_disease_tasks(disease.disease, disease.start_date) 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): disease_doc = frappe.get_doc('Disease', disease) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 86b5a11a1d..a774daad22 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -589,7 +589,7 @@ def transfer_asset(args): frappe.db.commit() - frappe.msgprint(_("Asset Movement record {0} created").format("{0}".format(movement_entry.name))) + frappe.msgprint(_("Asset Movement record {0} created").format("{0}").format(movement_entry.name)) @frappe.whitelist() 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: account = get_asset_category_account(account_name, asset=asset, asset_category = asset_category, company = company) - + if not asset and not account: account = get_asset_category_account(account_name, asset_category = asset_category, company = company) diff --git a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py index 737ddd6ddd..87f10336f4 100644 --- a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py +++ b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py @@ -43,7 +43,7 @@ class SupplierScorecardPeriod(Document): try: crit.score = min(crit.max_score, max( 0 ,frappe.safe_eval(self.get_eval_statement(crit.formula), None, {'max':max, 'min': min}))) 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 def calculate_score(self): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 7faf792d20..56a09c356d 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -58,7 +58,7 @@ class AccountsController(TransactionBase): (is_supplier_payment and supplier.hold_type in ['All', 'Payments']): if not supplier.release_date or getdate(nowdate()) <= supplier.release_date: 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): if not self.get('is_return'): @@ -926,7 +926,7 @@ def validate_taxes_and_charges(tax): frappe.throw( _("Cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for first row")) 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): 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): frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been received").format(d.idx, d.item_code)) - + if flt(d.billed_amt): frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been billed.").format(d.idx, d.item_code)) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 75b896bb13..df583efcb9 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -168,7 +168,7 @@ class BuyingController(StockController): 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 \ else flt(item.qty) / stock_and_asset_items_qty - + if i == (last_item_idx - 1): item.item_tax_amount = flt(valuation_amount_adjustment, self.precision("item_tax_amount", item)) @@ -699,7 +699,7 @@ class BuyingController(StockController): if delete_asset and is_auto_create_enabled: # need to delete movements to delete assets otherwise throws link exists error movements = frappe.db.sql( - """SELECT asm.name + """SELECT asm.name 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) for movement in movements: @@ -872,9 +872,9 @@ def validate_item_type(doc, fieldname, message): items = ", ".join([d for d in invalid_items]) 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: - 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) diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.py b/erpnext/education/doctype/assessment_plan/assessment_plan.py index c9576760ea..16136c19f7 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.py +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.py @@ -37,7 +37,7 @@ class AssessmentPlan(Document): for d in self.assessment_criteria: max_score += d.maximum_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): assessment_criteria_list = frappe.db.sql_list(''' select apc.assessment_criteria diff --git a/erpnext/education/doctype/assessment_result/assessment_result.py b/erpnext/education/doctype/assessment_result/assessment_result.py index 08ae4c6f0a..6b873ecf97 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.py +++ b/erpnext/education/doctype/assessment_result/assessment_result.py @@ -41,7 +41,7 @@ class AssessmentResult(Document): assessment_result = frappe.get_list("Assessment Result", filters={"name": ("not in", [self.name]), "student":self.student, "assessment_plan":self.assessment_plan, "docstatus":("!=", 2)}) 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))) diff --git a/erpnext/education/doctype/course_activity/course_activity.py b/erpnext/education/doctype/course_activity/course_activity.py index 054b192097..e7fc08a1d7 100644 --- a/erpnext/education/doctype/course_activity/course_activity.py +++ b/erpnext/education/doctype/course_activity/course_activity.py @@ -16,4 +16,4 @@ class CourseActivity(Document): if frappe.db.exists("Course Enrollment", self.enrollment): return True else: - frappe.throw(_("Course Enrollment {0} does not exists".format(self.enrollment))) \ No newline at end of file + frappe.throw(_("Course Enrollment {0} does not exists").format(self.enrollment)) \ No newline at end of file diff --git a/erpnext/education/doctype/grading_scale/grading_scale.py b/erpnext/education/doctype/grading_scale/grading_scale.py index e981f9f587..6309d02c15 100644 --- a/erpnext/education/doctype/grading_scale/grading_scale.py +++ b/erpnext/education/doctype/grading_scale/grading_scale.py @@ -13,7 +13,7 @@ class GradingScale(Document): thresholds = [] for d in self.intervals: 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: thresholds.append(cint(d.threshold)) if 0 not in thresholds: diff --git a/erpnext/education/doctype/question/question.py b/erpnext/education/doctype/question/question.py index 9a973c7615..a7deeab6f6 100644 --- a/erpnext/education/doctype/question/question.py +++ b/erpnext/education/doctype/question/question.py @@ -38,7 +38,7 @@ class Question(Document): options = self.options answers = [item.name for item in options if item.is_correct == True] 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 elif len(answers) == 1: return answers[0] diff --git a/erpnext/education/doctype/student_group/student_group.py b/erpnext/education/doctype/student_group/student_group.py index aba1b5ff5f..aa542ddfbf 100644 --- a/erpnext/education/doctype/student_group/student_group.py +++ b/erpnext/education/doctype/student_group/student_group.py @@ -34,15 +34,15 @@ class StudentGroup(Document): students = [d.student for d in program_enrollment] if program_enrollment else [] for d in self.students: 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)\ 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)\ 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): 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 d.group_roll_number = max_roll_no 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: 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 [] def get_program_enrollment(academic_year, academic_term=None, program=None, batch=None, student_category=None, course=None): - + condition1 = " " condition2 = " " if academic_term: @@ -93,9 +93,9 @@ def get_program_enrollment(academic_year, academic_term=None, program=None, batc condition2 = ", `tabProgram Enrollment Course` pec" return frappe.db.sql(''' - select - pe.student, pe.student_name - from + select + pe.student, pe.student_name + from `tabProgram Enrollment` pe {condition2} where pe.academic_year = %(academic_year)s {condition1} diff --git a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py index 643093ee48..d7645e30cd 100644 --- a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py +++ b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py @@ -74,4 +74,4 @@ class StudentGroupCreationTool(Document): student_group.append('students', student) student_group.save() - frappe.msgprint(_("{0} Student Groups created.".format(l))) \ No newline at end of file + frappe.msgprint(_("{0} Student Groups created.").format(l)) \ No newline at end of file diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py index e0b278c2b1..cffc3960a0 100644 --- a/erpnext/education/utils.py +++ b/erpnext/education/utils.py @@ -185,7 +185,7 @@ def add_activity(course, content_type, content, program): student = get_current_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) if content_type == 'Quiz': @@ -220,7 +220,7 @@ def get_quiz(quiz_name, course): quiz = frappe.get_doc("Quiz", quiz_name) questions = quiz.get_questions() except: - frappe.throw(_("Quiz {0} does not exist".format(quiz_name))) + frappe.throw(_("Quiz {0} does not exist").format(quiz_name)) return None questions = [{ @@ -347,7 +347,7 @@ def get_or_create_course_enrollment(course, program): if not course_enrollment: program_enrollment = get_enrollment('program', program, student.name) 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 student.enroll_in_course(course_name=course, program_enrollment=get_enrollment('program', program, student.name)) else: diff --git a/erpnext/erpnext_integrations/connectors/shopify_connection.py b/erpnext/erpnext_integrations/connectors/shopify_connection.py index 3be08a2757..ca0e1609cb 100644 --- a/erpnext/erpnext_integrations/connectors/shopify_connection.py +++ b/erpnext/erpnext_integrations/connectors/shopify_connection.py @@ -259,6 +259,6 @@ def get_tax_account_head(tax): {"parent": "Shopify Settings", "shopify_tax": tax_title}, "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 diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py index a04d6c5be7..92111337fd 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py @@ -63,7 +63,7 @@ def add_bank_accounts(response, bank, company): default_gl_account = get_default_bank_cash_account(company, "Bank") 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"]: acc_type = frappe.db.get_value("Account Type", account["type"]) diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py index 7aa41c546c..d5622454eb 100755 --- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py +++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py @@ -102,7 +102,7 @@ def invoice_appointment(appointment_doc): sales_invoice.save(ignore_permissions=True) 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): appointment = frappe.get_doc("Patient Appointment", appointment_id) @@ -111,7 +111,7 @@ def appointment_cancel(appointment_id): sales_invoice = exists_sales_invoice(appointment) if sales_invoice and cancel_sales_invoice(sales_invoice): 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: validity = validity_exists(appointment.practitioner, appointment.patient) @@ -121,7 +121,7 @@ def appointment_cancel(appointment_id): visited = fee_validity.visited - 1 frappe.db.set_value("Fee Validity", fee_validity.name, "visited", visited) 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: frappe.msgprint(_("Appointment cancelled")) @@ -203,7 +203,7 @@ def get_availability_data(date, practitioner): if employee: # Check if it is Holiday 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 leave_record = frappe.db.sql("""select half_day from `tabLeave Application` @@ -221,7 +221,7 @@ def get_availability_data(date, practitioner): if schedule.schedule: practitioner_schedule = frappe.get_doc("Practitioner Schedule", schedule.schedule) 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: available_slots = [] @@ -259,7 +259,7 @@ def get_availability_data(date, practitioner): "avail_slot":available_slots, 'appointments': appointments}) 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: # TODO: return available slots in nearby dates diff --git a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py index abb82f2cdd..3a12c9c9f9 100644 --- a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py +++ b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py @@ -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"]) except TypeError: # 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: total_pro_rata_max += max_benefit_amount if total_pro_rata_max > 0: diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 555f74c64a..ea531cbf9b 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -364,11 +364,11 @@ class SalarySlip(TransactionBase): return amount except NameError as err: - frappe.throw(_("Name error: {0}".format(err))) + frappe.throw(_("Name error: {0}").format(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: - frappe.throw(_("Error in formula or condition: {0}".format(e))) + frappe.throw(_("Error in formula or condition: {0}").format(e)) raise def add_employee_benefits(self, payroll_period): @@ -705,11 +705,11 @@ class SalarySlip(TransactionBase): if condition: return frappe.safe_eval(condition, self.whitelisted_globals, data) except NameError as err: - frappe.throw(_("Name error: {0}".format(err))) + frappe.throw(_("Name error: {0}").format(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: - frappe.throw(_("Error in formula or condition: {0}".format(e))) + frappe.throw(_("Error in formula or condition: {0}").format(e)) raise def get_salary_slip_row(self, salary_component): diff --git a/erpnext/hr/doctype/staffing_plan/staffing_plan.py b/erpnext/hr/doctype/staffing_plan/staffing_plan.py index 595bcaa8d4..5b84d00bd6 100644 --- a/erpnext/hr/doctype/staffing_plan/staffing_plan.py +++ b/erpnext/hr/doctype/staffing_plan/staffing_plan.py @@ -57,8 +57,8 @@ class StaffingPlan(Document): 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)) if overlap and overlap [0][0]: - frappe.throw(_("Staffing Plan {0} already exist for designation {1}" - .format(overlap[0][0], staffing_plan_detail.designation))) + frappe.throw(_("Staffing Plan {0} already exist for designation {1}") + .format(overlap[0][0], staffing_plan_detail.designation)) def validate_with_parent_plan(self, staffing_plan_detail): if not frappe.get_cached_value('Company', self.company, "parent_company"): diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py index 94d85f77ef..5f44d63955 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py @@ -54,7 +54,7 @@ class MaintenanceSchedule(TransactionBase): email_map[d.sales_person] = sp.get_email_id() except frappe.ValidationError: no_email_sp.append(d.sales_person) - + if no_email_sp: frappe.msgprint( 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) 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({ "doctype": "Event", "owner": email_map.get(d.sales_person, self.owner), @@ -146,11 +146,11 @@ class MaintenanceSchedule(TransactionBase): if not d.item_code: throw(_("Please select item code")) 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: throw(_("Please mention no of visits required")) 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): throw(_("Start date should be less than end date for Item {0}").format(d.item_code)) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index 9a2aaa5b36..029db1cb4e 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -8,7 +8,7 @@ import datetime from frappe import _ from frappe.model.mapper import get_mapped_doc 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) 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): production_capacity = 1 - + if self.workstation: production_capacity = frappe.get_cached_value("Workstation", self.workstation, 'production_capacity') or 1 @@ -195,8 +195,8 @@ class JobCard(Document): frappe.throw(_("Total completed qty must be greater than zero")) if self.total_completed_qty != self.for_quantity: - 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)))) + 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))) def update_work_order(self): if not self.work_order: @@ -372,7 +372,7 @@ def get_job_details(start, end, filters=None): conditions = get_filters_cond("Job Card", filters, []) 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, max(`tabJob Card Time Log`.to_time) as to_time FROM `tabJob Card` , `tabJob Card Time Log` diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 8876253e8e..7b3eda2290 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -22,7 +22,7 @@ class ProductionPlan(Document): def validate_data(self): for d in self.get('po_items'): 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: validate_bom_no(d.item_code, d.bom_no) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 619b21a5ac..dd4a87266c 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -461,7 +461,7 @@ class WorkOrder(Document): def validate_operation_time(self): for d in self.operations: 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): ''' diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index bf6e21aa4d..afdb5b7a01 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -188,7 +188,7 @@ class Project(Document): def send_welcome_email(self): url = get_url("/project/?name={0}".format(self.name)) 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, _("Join") ) diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py index b4de03e1e4..d29710dd8e 100644 --- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py +++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py @@ -15,7 +15,7 @@ class QualityProcedure(NestedSet): if process.procedure: doc = frappe.get_doc("Quality Procedure", process.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 def on_update(self): diff --git a/erpnext/regional/__init__.py b/erpnext/regional/__init__.py index 630d5fae2a..faa59129a5 100644 --- a/erpnext/regional/__init__.py +++ b/erpnext/regional/__init__.py @@ -9,7 +9,7 @@ from erpnext import get_region def check_deletion_permission(doc, method): region = get_region(doc.company) 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): """ diff --git a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py index 79dace7925..a2b32fec78 100644 --- a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py +++ b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py @@ -417,7 +417,7 @@ class GSTR3BReport(Document): if gst_details: return gst_details[0] 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): @@ -430,7 +430,7 @@ class GSTR3BReport(Document): if account_heads: return account_heads 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): diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index 2af72f8e27..6842fb2a61 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -252,7 +252,7 @@ def sales_invoice_validate(doc): else: for row in doc.taxes: 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")) for schedule in doc.payment_schedule: @@ -272,10 +272,10 @@ def sales_invoice_on_submit(doc, method): else: for schedule in doc.payment_schedule: 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")) 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")) prepare_and_attach_invoice(doc) @@ -355,7 +355,7 @@ def validate_address(address_name): for field in fields: 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")) def get_unamended_name(doc): diff --git a/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py b/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py index c45571f57c..bb5f83ed05 100644 --- a/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py +++ b/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py @@ -50,8 +50,8 @@ class POSClosingVoucher(Document): }) if user: - 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))) + 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)) def set_invoice_list(self, invoice_list): self.sales_invoices_summary = [] diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py index d7ebafc217..0cb606b277 100644 --- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py +++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py @@ -78,19 +78,19 @@ def get_columns(filters, period_list, partner_doctype): columns.extend([{ "fieldname": target_key, - "label": _("Target ({})".format(period.label)), + "label": _("Target ({})").format(period.label), "fieldtype": fieldtype, "options": options, "width": 100 }, { "fieldname": period.key, - "label": _("Achieved ({})".format(period.label)), + "label": _("Achieved ({})").format(period.label), "fieldtype": fieldtype, "options": options, "width": 100 }, { "fieldname": variance_key, - "label": _("Variance ({})".format(period.label)), + "label": _("Variance ({})").format(period.label), "fieldtype": fieldtype, "options": options, "width": 100 diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 1664b660b8..af30abd3ad 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -81,7 +81,7 @@ class TestCompany(unittest.TestCase): filters["is_group"] = 1 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) finally: @@ -124,7 +124,7 @@ def create_child_company(): child_company.insert() else: child_company = frappe.get_doc("Company", child_company) - + return child_company.name def create_test_lead_in_company(company): diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py index 1a86b79ad1..439e6a5acc 100644 --- a/erpnext/setup/utils.py +++ b/erpnext/setup/utils.py @@ -143,5 +143,5 @@ def insert_record(records): def welcome_email(): site_name = get_default_company() - title = _("Welcome to {0}".format(site_name)) + title = _("Welcome to {0}").format(site_name) return title diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 813d0dd196..1dac9bd162 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -431,7 +431,7 @@ def get_debtors_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,\ account_currency=payment_gateway_account_currency, company=cart_settings.company) diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.py b/erpnext/stock/doctype/delivery_trip/delivery_trip.py index e2c5b91f51..a34db45114 100644 --- a/erpnext/stock/doctype/delivery_trip/delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.py @@ -88,7 +88,7 @@ class DeliveryTrip(Document): note_doc.save() 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): """ diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index a1f06b2995..d036a0a1fb 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -814,7 +814,7 @@ class Item(WebsiteGenerator): for d in self.attributes: if d.attribute in attributes: 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: attributes.append(d.attribute) diff --git a/erpnext/stock/doctype/item_alternative/item_alternative.py b/erpnext/stock/doctype/item_alternative/item_alternative.py index 8e54539b18..b14683b652 100644 --- a/erpnext/stock/doctype/item_alternative/item_alternative.py +++ b/erpnext/stock/doctype/item_alternative/item_alternative.py @@ -25,7 +25,7 @@ class ItemAlternative(Document): def validate_duplicate(self): if frappe.db.get_value("Item Alternative", {'item_code': self.item_code, '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): return frappe.db.sql(""" (select alternative_item_code from `tabItem Alternative` diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 6531e095b8..941f904102 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -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", {"default_supplier": supplier}, 'parent')] 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 from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py index b748e3fa46..1ca6de48cb 100644 --- a/erpnext/support/doctype/issue/issue.py +++ b/erpnext/support/doctype/issue/issue.py @@ -167,11 +167,11 @@ class Issue(Document): if not 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 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.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") time_period = service_level.get("resolution_time_period") else: - frappe.throw(_("{0} parameter is invalid".format(parameter))) + frappe.throw(_("{0} parameter is invalid").format(parameter)) allotted_hours = 0 if time_period == 'Hour': diff --git a/erpnext/support/doctype/service_level/service_level.py b/erpnext/support/doctype/service_level/service_level.py index 4e70a01c7a..89fa25c233 100644 --- a/erpnext/support/doctype/service_level/service_level.py +++ b/erpnext/support/doctype/service_level/service_level.py @@ -22,7 +22,7 @@ class ServiceLevel(Document): for priority in self.priorities: # Check if response and resolution time is set for every priority 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) @@ -44,12 +44,12 @@ class ServiceLevel(Document): resolution = priority.resolution_time * 7 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 if not len(set(priorities)) == len(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 if not len(set(default_priority)) == len(default_priority): @@ -81,7 +81,7 @@ class ServiceLevel(Document): # Check for repeated workday if not len(set(support_days)) == len(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): unique_list = [] diff --git a/erpnext/templates/pages/integrations/gocardless_checkout.py b/erpnext/templates/pages/integrations/gocardless_checkout.py index e604b944f9..96a0f42a05 100644 --- a/erpnext/templates/pages/integrations/gocardless_checkout.py +++ b/erpnext/templates/pages/integrations/gocardless_checkout.py @@ -64,7 +64,7 @@ def check_mandate(data, reference_doctype, reference_docname): try: 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, "success_redirect_url": success_url, "prefilled_customer": prefilled_customer diff --git a/erpnext/utilities/bot.py b/erpnext/utilities/bot.py index 23e1dd4fa5..0e5e95d1a8 100644 --- a/erpnext/utilities/bot.py +++ b/erpnext/utilities/bot.py @@ -36,4 +36,4 @@ class FindItemBot(BotParser): return "\n\n".join(out) else: - return _("Did not find any item called {0}".format(item)) \ No newline at end of file + return _("Did not find any item called {0}").format(item) \ No newline at end of file diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py index 7badedcc85..d3b04c2f8f 100644 --- a/erpnext/www/lms/program.py +++ b/erpnext/www/lms/program.py @@ -22,7 +22,7 @@ def get_program(program_name): try: return frappe.get_doc('Program', program_name) 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): progress = {course.name: utils.get_course_progress(course, program) for course in courses}