From eec40513be4804ef226b5fd68f884dfebd56dff9 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 2 Sep 2021 17:42:45 +0530 Subject: [PATCH] fix: minor linting issues (#27314) * fix: syntax error in gratuity * fix: unpacking None into three variables * fix: unexpected kwarg for delete_accounting_dimensions --- .../doctype/accounting_dimension/accounting_dimension.py | 4 ++-- erpnext/accounts/doctype/payment_entry/payment_entry.py | 6 +++--- erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py index f3d1b3dc93..af8255f944 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py @@ -48,9 +48,9 @@ class AccountingDimension(Document): def on_trash(self): if frappe.flags.in_test: - delete_accounting_dimension(doc=self, queue='long') + delete_accounting_dimension(doc=self) else: - frappe.enqueue(delete_accounting_dimension, doc=self) + frappe.enqueue(delete_accounting_dimension, doc=self, queue='long') def set_fieldname_and_label(self): if not self.label: diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index bbbb7768db..a5303215d5 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1405,7 +1405,7 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre }) def get_amounts_based_on_reference_doctype(reference_doctype, ref_doc, party_account_currency, company_currency, reference_name): - total_amount, outstanding_amount, exchange_rate = None + total_amount = outstanding_amount = exchange_rate = None if reference_doctype == "Fees": total_amount = ref_doc.get("grand_total") exchange_rate = 1 @@ -1425,7 +1425,7 @@ def get_amounts_based_on_reference_doctype(reference_doctype, ref_doc, party_acc return total_amount, outstanding_amount, exchange_rate def get_amounts_based_on_ref_doc(reference_doctype, ref_doc, party_account_currency, company_currency): - total_amount, outstanding_amount, exchange_rate = None + total_amount = outstanding_amount = exchange_rate = None if ref_doc.doctype == "Expense Claim": total_amount = flt(ref_doc.total_sanctioned_amount) + flt(ref_doc.total_taxes_and_charges) elif ref_doc.doctype == "Employee Advance": @@ -1465,7 +1465,7 @@ def get_total_amount_exchange_rate_base_on_currency(party_account_currency, comp return total_amount, exchange_rate def get_bill_no_and_update_amounts(reference_doctype, ref_doc, total_amount, exchange_rate, party_account_currency, company_currency): - outstanding_amount, bill_no = None + outstanding_amount = bill_no = None if reference_doctype in ("Sales Invoice", "Purchase Invoice"): outstanding_amount = ref_doc.get("outstanding_amount") bill_no = ref_doc.get("bill_no") diff --git a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py index 28159bb06b..95d2929fff 100644 --- a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py +++ b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py @@ -14,7 +14,7 @@ class GratuityRule(Document): def validate(self): for current_slab in self.gratuity_rule_slabs: if (current_slab.from_year > current_slab.to_year) and current_slab.to_year != 0: - frappe(_("Row {0}: From (Year) can not be greater than To (Year)").format(current_slab.idx)) + frappe.throw(_("Row {0}: From (Year) can not be greater than To (Year)").format(current_slab.idx)) if current_slab.to_year == 0 and current_slab.from_year == 0 and len(self.gratuity_rule_slabs) > 1: frappe.throw(_("You can not define multiple slabs if you have a slab with no lower and upper limits."))