-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat - Validate item mapped if they exist hide button on registered p…
…urchases
- Loading branch information
maniamartial
committed
Dec 2, 2024
1 parent
d4ab6ca
commit cadd52f
Showing
6 changed files
with
255 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 32 additions & 1 deletion
33
...compliance/doctype/navari_etims_registered_purchases/navari_etims_registered_purchases.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
# Copyright (c) 2024, Navari Ltd and contributors | ||
# For license information, please see license.txt | ||
|
||
# import frappe | ||
import frappe | ||
from frappe.model.document import Document | ||
|
||
|
||
class NavarieTimsRegisteredPurchases(Document): | ||
pass | ||
import json | ||
import frappe | ||
|
||
@frappe.whitelist() | ||
def validate_item_mapped_and_registered(items): | ||
'''I dont think this method will work | ||
Reason: We have item with same item name which is used as item code during creation of item, | ||
but they have different item classification''' | ||
try: | ||
items = json.loads(items) | ||
|
||
for item in items: | ||
similar_items = frappe.get_all( | ||
"Item", | ||
filters={ | ||
"item_name": item.get("item_name"), | ||
"item_code": item.get("item_name"), | ||
# "custom_item_classification": item.get("item_classification_code"), | ||
#"custom_item_code_etims":item.get("item_code"), | ||
"custom_taxation_type": item.get("taxation_type_code"), | ||
}, | ||
fields=["name", "item_name", "item_code"], | ||
) | ||
if not similar_items: | ||
frappe.response["message"] = False | ||
return | ||
|
||
frappe.response["message"] = True | ||
except Exception as e: | ||
frappe.log_error(f"Error validating items: {str(e)}") | ||
|
Oops, something went wrong.