diff --git a/README.md b/README.md index 96093531d3..c26660c5a2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@
[![CI](https://github.com/frappe/erpnext/actions/workflows/server-tests.yml/badge.svg?branch=develop)](https://github.com/frappe/erpnext/actions/workflows/server-tests.yml) +[![UI](https://github.com/erpnext/erpnext_ui_tests/actions/workflows/ui-tests.yml/badge.svg?branch=develop&event=schedule)](https://github.com/erpnext/erpnext_ui_tests/actions/workflows/ui-tests.yml) [![Open Source Helpers](https://www.codetriage.com/frappe/erpnext/badges/users.svg)](https://www.codetriage.com/frappe/erpnext) [![codecov](https://codecov.io/gh/frappe/erpnext/branch/develop/graph/badge.svg?token=0TwvyUg3I5)](https://codecov.io/gh/frappe/erpnext) [![docker pulls](https://img.shields.io/docker/pulls/frappe/erpnext-worker.svg)](https://hub.docker.com/r/frappe/erpnext-worker) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index a3ef38465e..8ae90ceb38 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -160,7 +160,7 @@ frappe.treeview_settings["Account"] = { let root_company = treeview.page.fields_dict.root_company.get_value(); if(root_company) { - frappe.throw(__("Please add the account to root level Company - ") + root_company); + frappe.throw(__("Please add the account to root level Company - {0}"), [root_company]); } else { treeview.new_node(); } diff --git a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js index 990d6d9c8d..a964965c26 100644 --- a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js +++ b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js @@ -200,7 +200,7 @@ frappe.ui.form.on("Bank Statement Import", { }) .then((result) => { if (result.length > 0) { - frm.add_custom_button("Report Error", () => { + frm.add_custom_button(__("Report Error"), () => { let fake_xhr = { responseText: JSON.stringify({ exc: result[0].error, diff --git a/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py b/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py index 3bce4d51c7..402469fc1c 100644 --- a/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py +++ b/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py @@ -3,6 +3,7 @@ import frappe +from frappe import _ from frappe.model.document import Document @@ -16,6 +17,6 @@ class CashFlowMapping(Document): ] if len(checked_fields) > 1: frappe.throw( - frappe._("You can only select a maximum of one option from the list of check boxes."), - title="Error", + _("You can only select a maximum of one option from the list of check boxes."), + title=_("Error"), ) diff --git a/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py b/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py index 04a8e8ea92..edea37dcfd 100644 --- a/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py +++ b/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py @@ -68,9 +68,8 @@ class CurrencyExchangeSettings(Document): str(key.key).format(transaction_date=nowdate(), to_currency="INR", from_currency="USD") ] except Exception: - frappe.throw("Invalid result key. Response: " + response.text) + frappe.throw(_("Invalid result key. Response:") + " " + response.text) if not isinstance(value, (int, float)): frappe.throw(_("Returned exchange rate is neither integer not float.")) self.url = response.url - frappe.msgprint("Exchange rate of USD to INR is " + str(value)) diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py index d0373021a6..ed35d1e094 100644 --- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py +++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py @@ -42,12 +42,7 @@ class ModeofPayment(Document): pos_profiles = list(map(lambda x: x[0], pos_profiles)) if pos_profiles: - message = ( - "POS Profile " - + frappe.bold(", ".join(pos_profiles)) - + " contains \ - Mode of Payment " - + frappe.bold(str(self.name)) - + ". Please remove them to disable this mode." - ) - frappe.throw(_(message), title="Not Allowed") + message = _( + "POS Profile {} contains Mode of Payment {}. Please remove them to disable this mode." + ).format(frappe.bold(", ".join(pos_profiles)), frappe.bold(str(self.name))) + frappe.throw(message, title=_("Not Allowed")) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py index 65fd4af350..e83dc0f11e 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -61,13 +61,13 @@ class POSProfile(Document): if len(item_groups) != len(set(item_groups)): frappe.throw( - _("Duplicate item group found in the item group table"), title="Duplicate Item Group" + _("Duplicate item group found in the item group table"), title=_("Duplicate Item Group") ) if len(customer_groups) != len(set(customer_groups)): frappe.throw( _("Duplicate customer group found in the cutomer group table"), - title="Duplicate Customer Group", + title=_("Duplicate Customer Group"), ) def validate_payment_methods(self): diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.js b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.js index 29f2e98e77..7dd77fbb3c 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.js +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.js @@ -8,7 +8,7 @@ frappe.ui.form.on('Process Statement Of Accounts', { }, refresh: function(frm){ if(!frm.doc.__islocal) { - frm.add_custom_button('Send Emails',function(){ + frm.add_custom_button(__('Send Emails'), function(){ frappe.call({ method: "erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts.send_emails", args: { @@ -24,7 +24,7 @@ frappe.ui.form.on('Process Statement Of Accounts', { } }); }); - frm.add_custom_button('Download',function(){ + frm.add_custom_button(__('Download'), function(){ var url = frappe.urllib.get_full_url( '/api/method/erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts.download_statements?' + 'document_name='+encodeURIComponent(frm.doc.name)) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 5f6e61090b..ee29d2a744 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -141,7 +141,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying. }) }, __("Get Items From")); } - this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes"); + this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted); if (doc.docstatus == 1 && !doc.inter_company_invoice_reference) { frappe.model.with_doc("Supplier", me.frm.doc.supplier, function() { @@ -571,10 +571,10 @@ frappe.ui.form.on("Purchase Invoice", { }, is_subcontracted: function(frm) { - if (frm.doc.is_subcontracted === "Yes") { + if (frm.doc.is_subcontracted) { erpnext.buying.get_default_bom(frm); } - frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes"); + frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted); }, update_stock: function(frm) { diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index bd0116443f..9f87c5ab54 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -543,11 +543,10 @@ "fieldtype": "Column Break" }, { - "default": "No", + "default": "0", "fieldname": "is_subcontracted", - "fieldtype": "Select", - "label": "Raw Materials Supplied", - "options": "No\nYes", + "fieldtype": "Check", + "label": "Is Subcontracted", "print_hide": 1 }, { @@ -1366,7 +1365,7 @@ "width": "50px" }, { - "depends_on": "eval:doc.update_stock && doc.is_subcontracted==\"Yes\"", + "depends_on": "eval:doc.update_stock && doc.is_subcontracted", "fieldname": "supplier_warehouse", "fieldtype": "Link", "label": "Supplier Warehouse", diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 843f66d546..73390dd6f4 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -901,7 +901,7 @@ class TestPurchaseInvoice(unittest.TestCase): ) pi = make_purchase_invoice( - item_code="_Test FG Item", qty=10, rate=500, update_stock=1, is_subcontracted="Yes" + item_code="_Test FG Item", qty=10, rate=500, update_stock=1, is_subcontracted=1 ) self.assertEqual(len(pi.get("supplied_items")), 2) @@ -1611,7 +1611,7 @@ def make_purchase_invoice(**args): pi.conversion_rate = args.conversion_rate or 1 pi.is_return = args.is_return pi.return_against = args.return_against - pi.is_subcontracted = args.is_subcontracted or "No" + pi.is_subcontracted = args.is_subcontracted or 0 pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC" pi.cost_center = args.parent_cost_center @@ -1674,7 +1674,7 @@ def make_purchase_invoice_against_cost_center(**args): pi.is_return = args.is_return pi.is_return = args.is_return pi.credit_to = args.return_against or "Creditors - _TC" - pi.is_subcontracted = args.is_subcontracted or "No" + pi.is_subcontracted = args.is_subcontracted or 0 if args.supplier_warehouse: pi.supplier_warehouse = "_Test Warehouse 1 - _TC" diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index f9b2efd053..6651195e5f 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -623,7 +623,7 @@ }, { "default": "0", - "depends_on": "eval:parent.is_subcontracted == 'Yes'", + "depends_on": "eval:parent.is_subcontracted", "fieldname": "include_exploded_items", "fieldtype": "Check", "label": "Include Exploded Items", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 7d98c22033..1efd3dca0d 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1412,7 +1412,7 @@ class SalesInvoice(SellingController): ) ) else: - frappe.throw(_("Select change amount account"), title="Mandatory Field") + frappe.throw(_("Select change amount account"), title=_("Mandatory Field")) def make_write_off_gl_entry(self, gl_entries): # write off entries, applicable if only pos diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py index 35c2f8494f..a519d8be73 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -34,7 +34,9 @@ class TaxWithholdingCategory(Document): def validate_thresholds(self): for d in self.get("rates"): - if d.cumulative_threshold and d.cumulative_threshold < d.single_threshold: + if ( + d.cumulative_threshold and d.single_threshold and d.cumulative_threshold < d.single_threshold + ): frappe.throw( _("Row #{0}: Cumulative threshold cannot be less than Single Transaction threshold").format( d.idx diff --git a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html b/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html index e658049309..605ce8383e 100644 --- a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html +++ b/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html @@ -1,7 +1,8 @@ {%- from "templates/print_formats/standard_macros.html" import add_header, render_field, print_value -%} -{%- set einvoice = json.loads(doc.signed_einvoice) -%}