Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -120,8 +120,10 @@ def extract_text(image):
|
|
| 120 |
|
| 121 |
# Function to find product name from the predefined list
|
| 122 |
def match_product_name(text):
|
|
|
|
|
|
|
| 123 |
for product_name in PRODUCT_NAMES:
|
| 124 |
-
if
|
| 125 |
return product_name
|
| 126 |
return None
|
| 127 |
|
|
@@ -225,7 +227,8 @@ def subtract_stock_from_inventory(data):
|
|
| 225 |
|
| 226 |
sf_object.update(record_id, {"Quantity_Sold__c": updated_quantity_sold})
|
| 227 |
|
| 228 |
-
return f"Stock updated successfully in exit mode. Quantity sold for product
|
|
|
|
| 229 |
except Exception as e:
|
| 230 |
return f"Error updating stock in Inventory_Management__c: {str(e)}"
|
| 231 |
|
|
|
|
| 120 |
|
| 121 |
# Function to find product name from the predefined list
|
| 122 |
def match_product_name(text):
|
| 123 |
+
# Normalize text and product names for better matching
|
| 124 |
+
normalized_text = text.lower()
|
| 125 |
for product_name in PRODUCT_NAMES:
|
| 126 |
+
if product_name.lower() in normalized_text:
|
| 127 |
return product_name
|
| 128 |
return None
|
| 129 |
|
|
|
|
| 227 |
|
| 228 |
sf_object.update(record_id, {"Quantity_Sold__c": updated_quantity_sold})
|
| 229 |
|
| 230 |
+
return f"Stock updated successfully in exit mode. Quantity sold for product
|
| 231 |
+
'{product_name}': {updated_quantity_sold}."
|
| 232 |
except Exception as e:
|
| 233 |
return f"Error updating stock in Inventory_Management__c: {str(e)}"
|
| 234 |
|