From c3b1aef9f9143b488b2c5d38f6398a88f4a354a0 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Sun, 18 Oct 2020 19:28:26 +0530 Subject: [PATCH] fix(minor): msgprint not defined in POS Invoice (#23680) * fix(minor): msgprint not defined in POS Invoice * fix: translation friendly syntax --- .../doctype/pos_invoice/pos_invoice.py | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 1669ca4094..7229aff43a 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -92,21 +92,19 @@ class POSInvoice(SalesInvoice): if len(invalid_serial_nos): multiple_nos = 's' if len(invalid_serial_nos) > 1 else '' - frappe.throw(_("Row #{}: Serial No{}. {} has already been transacted into another POS Invoice. \ - Please select valid serial no.".format(d.idx, multiple_nos, - frappe.bold(', '.join(invalid_serial_nos)))), title=_("Not Available")) + frappe.throw(_("Row #{}: Serial No{}. {} has already been transacted into another POS Invoice. Please select valid serial no.").format( + d.idx, multiple_nos, frappe.bold(', '.join(invalid_serial_nos))), title=_("Not Available")) else: if allow_negative_stock: return available_stock = get_stock_availability(d.item_code, d.warehouse) if not (flt(available_stock) > 0): - frappe.throw(_('Row #{}: Item Code: {} is not available under warehouse {}.' - .format(d.idx, frappe.bold(d.item_code), frappe.bold(d.warehouse))), title=_("Not Available")) + frappe.throw(_('Row #{}: Item Code: {} is not available under warehouse {}.').format( + d.idx, frappe.bold(d.item_code), frappe.bold(d.warehouse)), title=_("Not Available")) elif flt(available_stock) < flt(d.qty): - frappe.msgprint(_('Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. \ - Available quantity {}.'.format(d.idx, frappe.bold(d.item_code), - frappe.bold(d.warehouse), frappe.bold(d.qty))), title=_("Not Available")) + frappe.msgprint(_('Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}.').format( + d.idx, frappe.bold(d.item_code), frappe.bold(d.warehouse), frappe.bold(d.qty)), title=_("Not Available")) def validate_serialised_or_batched_item(self): for d in self.get("items"): @@ -117,14 +115,14 @@ class POSInvoice(SalesInvoice): if serialized and batched and (no_batch_selected or no_serial_selected): - frappe.throw(_('Row #{}: Please select a serial no and batch against item: {} or remove it to complete transaction.' - .format(d.idx, frappe.bold(d.item_code))), title=_("Invalid Item")) + frappe.throw(_('Row #{}: Please select a serial no and batch against item: {} or remove it to complete transaction.').format( + d.idx, frappe.bold(d.item_code)), title=_("Invalid Item")) if serialized and no_serial_selected: - frappe.throw(_('Row #{}: No serial number selected against item: {}. Please select one or remove it to complete transaction.' - .format(d.idx, frappe.bold(d.item_code))), title=_("Invalid Item")) + frappe.throw(_('Row #{}: No serial number selected against item: {}. Please select one or remove it to complete transaction.').format( + d.idx, frappe.bold(d.item_code)), title=_("Invalid Item")) if batched and no_batch_selected: - frappe.throw(_('Row #{}: No batch selected against item: {}. Please select a batch or remove it to complete transaction.' - .format(d.idx, frappe.bold(d.item_code))), title=_("Invalid Item")) + frappe.throw(_('Row #{}: No batch selected against item: {}. Please select a batch or remove it to complete transaction.').format( + d.idx, frappe.bold(d.item_code)), title=_("Invalid Item")) def validate_return_items(self): if not self.get("is_return"): return @@ -151,7 +149,7 @@ class POSInvoice(SalesInvoice): self.base_change_amount = flt(self.base_paid_amount - base_grand_total + flt(self.base_write_off_amount)) if flt(self.change_amount) and not self.account_for_change_amount: - msgprint(_("Please enter Account for Change Amount"), raise_exception=1) + frappe.msgprint(_("Please enter Account for Change Amount"), raise_exception=1) def verify_payment_amount(self): for entry in self.payments: @@ -167,7 +165,7 @@ class POSInvoice(SalesInvoice): 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_loyalty_transaction(self): if self.redeem_loyalty_points and (not self.loyalty_redemption_account or not self.loyalty_redemption_cost_center):