mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
fix(minor): msgprint not defined in POS Invoice (#23680)
* fix(minor): msgprint not defined in POS Invoice * fix: translation friendly syntax
This commit is contained in:
@@ -92,21 +92,19 @@ class POSInvoice(SalesInvoice):
|
|||||||
|
|
||||||
if len(invalid_serial_nos):
|
if len(invalid_serial_nos):
|
||||||
multiple_nos = 's' if len(invalid_serial_nos) > 1 else ''
|
multiple_nos = 's' if len(invalid_serial_nos) > 1 else ''
|
||||||
frappe.throw(_("Row #{}: Serial No{}. {} has already been transacted into another POS Invoice. \
|
frappe.throw(_("Row #{}: Serial No{}. {} has already been transacted into another POS Invoice. Please select valid serial no.").format(
|
||||||
Please select valid serial no.".format(d.idx, multiple_nos,
|
d.idx, multiple_nos, frappe.bold(', '.join(invalid_serial_nos))), title=_("Not Available"))
|
||||||
frappe.bold(', '.join(invalid_serial_nos)))), title=_("Not Available"))
|
|
||||||
else:
|
else:
|
||||||
if allow_negative_stock:
|
if allow_negative_stock:
|
||||||
return
|
return
|
||||||
|
|
||||||
available_stock = get_stock_availability(d.item_code, d.warehouse)
|
available_stock = get_stock_availability(d.item_code, d.warehouse)
|
||||||
if not (flt(available_stock) > 0):
|
if not (flt(available_stock) > 0):
|
||||||
frappe.throw(_('Row #{}: Item Code: {} is not available under warehouse {}.'
|
frappe.throw(_('Row #{}: Item Code: {} is not available under warehouse {}.').format(
|
||||||
.format(d.idx, frappe.bold(d.item_code), frappe.bold(d.warehouse))), title=_("Not Available"))
|
d.idx, frappe.bold(d.item_code), frappe.bold(d.warehouse)), title=_("Not Available"))
|
||||||
elif flt(available_stock) < flt(d.qty):
|
elif flt(available_stock) < flt(d.qty):
|
||||||
frappe.msgprint(_('Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. \
|
frappe.msgprint(_('Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}.').format(
|
||||||
Available quantity {}.'.format(d.idx, frappe.bold(d.item_code),
|
d.idx, frappe.bold(d.item_code), frappe.bold(d.warehouse), frappe.bold(d.qty)), title=_("Not Available"))
|
||||||
frappe.bold(d.warehouse), frappe.bold(d.qty))), title=_("Not Available"))
|
|
||||||
|
|
||||||
def validate_serialised_or_batched_item(self):
|
def validate_serialised_or_batched_item(self):
|
||||||
for d in self.get("items"):
|
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):
|
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.'
|
frappe.throw(_('Row #{}: Please select a serial no and batch against item: {} or remove it to complete transaction.').format(
|
||||||
.format(d.idx, frappe.bold(d.item_code))), title=_("Invalid Item"))
|
d.idx, frappe.bold(d.item_code)), title=_("Invalid Item"))
|
||||||
if serialized and no_serial_selected:
|
if serialized and no_serial_selected:
|
||||||
frappe.throw(_('Row #{}: No serial number selected against item: {}. Please select one or remove it to complete transaction.'
|
frappe.throw(_('Row #{}: No serial number selected against item: {}. Please select one or remove it to complete transaction.').format(
|
||||||
.format(d.idx, frappe.bold(d.item_code))), title=_("Invalid Item"))
|
d.idx, frappe.bold(d.item_code)), title=_("Invalid Item"))
|
||||||
if batched and no_batch_selected:
|
if batched and no_batch_selected:
|
||||||
frappe.throw(_('Row #{}: No batch selected against item: {}. Please select a batch or remove it to complete transaction.'
|
frappe.throw(_('Row #{}: No batch selected against item: {}. Please select a batch or remove it to complete transaction.').format(
|
||||||
.format(d.idx, frappe.bold(d.item_code))), title=_("Invalid Item"))
|
d.idx, frappe.bold(d.item_code)), title=_("Invalid Item"))
|
||||||
|
|
||||||
def validate_return_items(self):
|
def validate_return_items(self):
|
||||||
if not self.get("is_return"): return
|
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))
|
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:
|
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):
|
def verify_payment_amount(self):
|
||||||
for entry in self.payments:
|
for entry in self.payments:
|
||||||
@@ -167,7 +165,7 @@ class POSInvoice(SalesInvoice):
|
|||||||
total_amount_in_payments += payment.amount
|
total_amount_in_payments += payment.amount
|
||||||
invoice_total = self.rounded_total or self.grand_total
|
invoice_total = self.rounded_total or self.grand_total
|
||||||
if total_amount_in_payments < invoice_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):
|
def validate_loyalty_transaction(self):
|
||||||
if self.redeem_loyalty_points and (not self.loyalty_redemption_account or not self.loyalty_redemption_cost_center):
|
if self.redeem_loyalty_points and (not self.loyalty_redemption_account or not self.loyalty_redemption_cost_center):
|
||||||
|
|||||||
Reference in New Issue
Block a user