diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 6b1ce9e669c..27629c11c17 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '11.1.43' +__version__ = '11.1.44' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/doctype/accounting_period/accounting_period.py b/erpnext/accounts/doctype/accounting_period/accounting_period.py index f7190b75e2c..1a366d2f7fb 100644 --- a/erpnext/accounts/doctype/accounting_period/accounting_period.py +++ b/erpnext/accounts/doctype/accounting_period/accounting_period.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.model.document import Document class AccountingPeriod(Document): @@ -16,7 +17,7 @@ class AccountingPeriod(Document): def autoname(self): company_abbr = frappe.get_cached_value('Company', self.company, "abbr") self.name = " - ".join([self.period_name, company_abbr]) - + def validate_overlap(self): existing_accounting_period = frappe.db.sql("""select name from `tabAccounting Period` where ( @@ -33,7 +34,7 @@ class AccountingPeriod(Document): }, as_dict=True) if len(existing_accounting_period) > 0: - frappe.throw("Accounting Period overlaps with {0}".format(existing_accounting_period[0].get("name"))) + frappe.throw(_("Accounting Period overlaps with {0}".format(existing_accounting_period[0].get("name")))) def get_doctypes_for_closing(self): docs_for_closing = [] 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 f5581941ba2..7bfab873b5a 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 @@ -48,7 +48,7 @@ class BankStatementTransactionEntry(Document): def get_statement_headers(self): if not self.bank_settings: - frappe.throw("Bank Data mapper doesn't exist") + frappe.throw(_("Bank Data mapper doesn't exist")) mapper_doc = frappe.get_doc("Bank Statement Settings", self.bank_settings) headers = {entry.mapped_header:entry.stmt_header for entry in mapper_doc.header_items} return headers @@ -57,7 +57,7 @@ class BankStatementTransactionEntry(Document): if self.bank_statement is None: return filename = self.bank_statement.split("/")[-1] if (len(self.new_transaction_items + self.reconciled_transaction_items) > 0): - frappe.throw("Transactions already retreived from the statement") + frappe.throw(_("Transactions already retreived from the statement")) date_format = frappe.get_value("Bank Statement Settings", self.bank_settings, "date_format") if (date_format is None): @@ -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: @@ -414,7 +414,7 @@ def get_transaction_entries(filename, headers): elif (filename.lower().endswith("xls")): rows = get_rows_from_xls_file(filename) else: - frappe.throw("Only .csv and .xlsx files are supported currently") + frappe.throw(_("Only .csv and .xlsx files are supported currently")) stmt_headers = headers.values() for row in rows: diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index f943b345810..4899e6ecf0f 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -91,7 +91,7 @@ def get_paid_amount(payment_entry): return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "total_amount_reimbursed") else: - frappe.throw("Please reconcile {0}: {1} manually".format(payment_entry.payment_document, payment_entry.payment_entry)) + frappe.throw(_("Please reconcile {0}: {1} manually".format(payment_entry.payment_document, payment_entry.payment_entry))) @frappe.whitelist() def unclear_reference_payment(doctype, docname): diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 2d415bb5b17..87835dcdb83 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -157,7 +157,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ can_change_release_date: function(date) { const diff = frappe.datetime.get_diff(date, frappe.datetime.nowdate()); if (diff < 0) { - frappe.throw('New release date should be in the future'); + frappe.throw(__('New release date should be in the future')); return false; } else { return true; diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan.py index d3fef6023ba..625979bee1f 100644 --- a/erpnext/accounts/doctype/subscription_plan/subscription_plan.py +++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.model.document import Document from erpnext.utilities.product import get_price @@ -13,7 +14,7 @@ class SubscriptionPlan(Document): def validate_interval_count(self): if self.billing_interval_count < 1: - frappe.throw('Billing Interval Count cannot be less than 1') + frappe.throw(_('Billing Interval Count cannot be less than 1')) @frappe.whitelist() def get_plan_rate(plan, quantity=1, customer=None): @@ -26,7 +27,7 @@ def get_plan_rate(plan, quantity=1, customer=None): customer_group = frappe.db.get_value("Customer", customer, "customer_group") else: customer_group = None - + price = get_price(item_code=plan.item, price_list=plan.price_list, customer_group=customer_group, company=None, qty=quantity) if not price: return 0 diff --git a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py index f9979752f78..16933dcfe09 100644 --- a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py +++ b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import frappe, json +from frappe import _ from frappe.model.document import Document from erpnext.education.api import get_grade from frappe.utils.pdf import get_pdf @@ -79,7 +80,7 @@ def get_attendance_count(student, academic_year, academic_term=None): from_date, to_date = frappe.db.get_value("Academic Term", academic_term, ["term_start_date", "term_end_date"]) if from_date and to_date: attendance = dict(frappe.db.sql('''select status, count(student) as no_of_days - from `tabStudent Attendance` where student = %s + from `tabStudent Attendance` where student = %s and date between %s and %s group by status''', (student, from_date, to_date))) if "Absent" not in attendance.keys(): @@ -88,4 +89,4 @@ def get_attendance_count(student, academic_year, academic_term=None): attendance["Present"] = 0 return attendance else: - frappe.throw("Provide the academic year and set the starting and ending date.") \ No newline at end of file + frappe.throw(_("Provide the academic year and set the starting and ending date.")) \ No newline at end of file diff --git a/erpnext/erpnext_integrations/connectors/shopify_connection.py b/erpnext/erpnext_integrations/connectors/shopify_connection.py index 88078ab74f6..1d6e8917f50 100644 --- a/erpnext/erpnext_integrations/connectors/shopify_connection.py +++ b/erpnext/erpnext_integrations/connectors/shopify_connection.py @@ -124,7 +124,7 @@ def create_sales_order(shopify_order, shopify_settings, company=None): else: so = frappe.get_doc("Sales Order", so) - + frappe.db.commit() return so @@ -252,6 +252,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/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py index 90bf95770fb..141329b3db1 100644 --- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py +++ b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py @@ -30,7 +30,7 @@ class ClinicalProcedureTemplate(Document): try: frappe.delete_doc("Item",self.item) except Exception: - frappe.throw("""Not permitted. Please disable the Procedure Template""") + frappe.throw(_("""Not permitted. Please disable the Procedure Template""")) def get_item_details(self, args=None): item = frappe.db.sql("""select stock_uom, item_name diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js index c7df5b7cd94..7ea45688fd9 100644 --- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js +++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js @@ -160,7 +160,7 @@ var btn_create_vital_signs = function (frm) { var btn_create_procedure = function (frm) { if(!frm.doc.patient){ - frappe.throw("Please select patient"); + frappe.throw(__("Please select patient")); } frappe.route_options = { "patient": frm.doc.patient, 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 3a80b303659..abb82f2cdd1 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 90391037896..0ce75d1b954 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -618,7 +618,7 @@ class SalarySlip(TransactionBase): elif not self.payment_days and not self.salary_slip_based_on_timesheet and cint(row.depends_on_payment_days): amount, additional_amount = 0, 0 elif not row.amount: - amount = row.default_amount + row.additional_amount + amount = flt(row.default_amount) + flt(row.additional_amount) # apply rounding if frappe.get_cached_value("Salary Component", row.salary_component, "round_to_the_nearest_integer"): diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py index 0c94df31596..75f2c9323aa 100644 --- a/erpnext/hub_node/api.py +++ b/erpnext/hub_node/api.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals import frappe import json +from frappe import _ from frappe import _ from frappe.frappeclient import FrappeClient @@ -120,7 +121,7 @@ def get_valid_items(search_value=''): def publish_selected_items(items_to_publish): items_to_publish = json.loads(items_to_publish) if not len(items_to_publish): - frappe.throw('No items to publish') + frappe.throw(_('No items to publish')) for item in items_to_publish: item_code = item.get('item_code') @@ -165,7 +166,7 @@ def item_sync_preprocess(intended_item_publish_count): frappe.db.set_value("Marketplace Settings", "Marketplace Settings", "sync_in_progress", 1) return response else: - frappe.throw('Unable to update remote activity') + frappe.throw(_('Unable to update remote activity')) def item_sync_postprocess(): @@ -173,7 +174,7 @@ def item_sync_postprocess(): if response: frappe.db.set_value('Marketplace Settings', 'Marketplace Settings', 'last_sync_datetime', frappe.utils.now()) else: - frappe.throw('Unable to update remote activity') + frappe.throw(_('Unable to update remote activity')) frappe.db.set_value('Marketplace Settings', 'Marketplace Settings', 'sync_in_progress', 0) diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index 730a80b547b..cb6b736320e 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -316,6 +316,9 @@ def get_company_country(company): return frappe.get_cached_value('Company', company, 'country') def get_e_invoice_attachments(invoice): + if not invoice.company_tax_id: + return [] + out = [] attachments = get_attachments(invoice.doctype, invoice.name) company_tax_id = invoice.company_tax_id if invoice.company_tax_id.startswith("IT") else "IT" + invoice.company_tax_id