fix: cannot add items to cart (#23795)

* fix: _ is not defined

* fix: item image alt gets overflowed due to large text

* fix: available item qty in pos search

* fix: cash shortcuts overflow
This commit is contained in:
Saqib 2020-11-03 10:07:50 +05:30 committed by GitHub
parent ce7d7155db
commit a53e8404d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View File

@ -14,11 +14,9 @@ from six import string_types
def get_items(start, page_length, price_list, item_group, pos_profile, search_value=""):
data = dict()
result = []
warehouse, hide_unavailable_items = "", False
allow_negative_stock = frappe.db.get_single_value('Stock Settings', 'allow_negative_stock')
if not allow_negative_stock:
warehouse, hide_unavailable_items = frappe.db.get_value('POS Profile', pos_profile, ['warehouse', 'hide_unavailable_items'])
warehouse, hide_unavailable_items = frappe.db.get_value('POS Profile', pos_profile, ['warehouse', 'hide_unavailable_items'])
if not frappe.db.exists('Item Group', item_group):
item_group = get_root_of('Item Group')
@ -97,7 +95,7 @@ def get_items(start, page_length, price_list, item_group, pos_profile, search_va
for item in items_data:
item_code = item.item_code
item_price = item_prices.get(item_code) or {}
if not allow_negative_stock:
if allow_negative_stock:
item_stock_qty = frappe.db.sql("""select ifnull(sum(actual_qty), 0) from `tabBin` where item_code = %s""", item_code)[0][0]
else:
item_stock_qty = get_stock_availability(item_code, warehouse)

View File

@ -637,7 +637,7 @@ erpnext.PointOfSale.Controller = class {
if (!(available_qty > 0)) {
frappe.model.clear_doc(item_row.doctype, item_row.name);
frappe.throw({
title: _("Not Available"),
title: __("Not Available"),
message: __('Item Code: {0} is not available under warehouse {1}.', [bold_item_code, bold_warehouse])
})
} else if (available_qty < qty_needed) {

View File

@ -81,7 +81,7 @@ erpnext.PointOfSale.ItemSelector = class {
function get_item_image_html() {
if (item_image) {
return `<div class="flex items-center justify-center h-32 border-b-grey text-6xl text-grey-100">
<img class="h-full" src="${item_image}" alt="${item_image}" style="object-fit: cover;">
<img class="h-full" src="${item_image}" alt="${frappe.get_abbr(item.item_name)}" style="object-fit: cover;">
</div>`
} else {
return `<div class="flex items-center justify-center h-32 bg-light-grey text-6xl text-grey-100">

View File

@ -409,7 +409,7 @@ erpnext.PointOfSale.Payment = class {
${
shortcuts.map(s => {
return `<div class="shortcut rounded bg-light-grey text-dark-grey pt-2 pb-2 no-select pointer" data-value="${s}">
${format_currency(s, currency)}
${format_currency(s, currency, 0)}
</div>`
}).join('')
}