rpa-erpnext 1.0.5__tar.gz → 1.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/PKG-INFO +1 -1
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/RPA/ERPNext.py +37 -9
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/pyproject.toml +1 -1
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/rpa_erpnext.egg-info/PKG-INFO +1 -1
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/LICENSE +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/RPA/__init__.py +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/readme.md +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/rpa_erpnext.egg-info/SOURCES.txt +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/rpa_erpnext.egg-info/dependency_links.txt +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/rpa_erpnext.egg-info/requires.txt +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/rpa_erpnext.egg-info/top_level.txt +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/setup.cfg +0 -0
- {rpa_erpnext-1.0.5 → rpa_erpnext-1.0.8}/test/test_functions.py +0 -0
|
@@ -655,14 +655,27 @@ class ERPNextLibrary:
|
|
|
655
655
|
# ===========================================================
|
|
656
656
|
|
|
657
657
|
@keyword("Send RFQ From Material Request")
|
|
658
|
-
def send_rfq_from_mr(self, mr_name
|
|
658
|
+
def send_rfq_from_mr(self, mr_name, suppliers):
|
|
659
659
|
"""Tạo RFQ dựa trên Material Request."""
|
|
660
|
+
# Auto-detect if mr_name is a dict (from previous keyword return)
|
|
661
|
+
if isinstance(mr_name, dict):
|
|
662
|
+
mr_name = mr_name.get("name")
|
|
663
|
+
|
|
664
|
+
# Normalize suppliers to list of strings
|
|
660
665
|
if isinstance(suppliers, str):
|
|
661
666
|
try:
|
|
662
667
|
suppliers = json.loads(suppliers)
|
|
663
668
|
except ValueError:
|
|
664
669
|
# Nếu không phải JSON list, coi như là 1 supplier duy nhất
|
|
665
670
|
suppliers = [suppliers]
|
|
671
|
+
|
|
672
|
+
# Ensure suppliers is a list
|
|
673
|
+
if not isinstance(suppliers, list):
|
|
674
|
+
suppliers = [suppliers]
|
|
675
|
+
|
|
676
|
+
# Flatten if nested list (e.g., [['Supplier A']] -> ['Supplier A'])
|
|
677
|
+
if suppliers and isinstance(suppliers[0], list):
|
|
678
|
+
suppliers = suppliers[0]
|
|
666
679
|
|
|
667
680
|
mr_doc = self.get_doc("Material Request", mr_name)
|
|
668
681
|
company = mr_doc["company"]
|
|
@@ -670,25 +683,40 @@ class ERPNextLibrary:
|
|
|
670
683
|
for s in suppliers:
|
|
671
684
|
self.ensure_supplier_exist(s)
|
|
672
685
|
|
|
686
|
+
|
|
673
687
|
items = []
|
|
674
688
|
for d in mr_doc["items"]:
|
|
689
|
+
# Ensure all fields are proper types (not lists)
|
|
690
|
+
item_code = d["item_code"]
|
|
691
|
+
if isinstance(item_code, list):
|
|
692
|
+
item_code = item_code[0] if item_code else ""
|
|
693
|
+
|
|
694
|
+
warehouse = d.get("warehouse", "")
|
|
695
|
+
if isinstance(warehouse, list):
|
|
696
|
+
warehouse = warehouse[0] if warehouse else ""
|
|
697
|
+
|
|
675
698
|
items.append({
|
|
676
|
-
"item_code":
|
|
677
|
-
"qty": d["qty"],
|
|
678
|
-
"uom": d.get("uom", "Nos"),
|
|
679
|
-
"stock_uom": d.get("stock_uom", "Nos"),
|
|
699
|
+
"item_code": str(item_code),
|
|
700
|
+
"qty": float(d["qty"]),
|
|
701
|
+
"uom": str(d.get("uom", "Nos")),
|
|
702
|
+
"stock_uom": str(d.get("stock_uom", "Nos")),
|
|
680
703
|
"conversion_factor": 1.0,
|
|
681
|
-
"warehouse":
|
|
704
|
+
"warehouse": str(warehouse),
|
|
682
705
|
})
|
|
683
706
|
|
|
684
707
|
rfq_data = {
|
|
685
708
|
"doctype": "Request for Quotation",
|
|
686
|
-
"company": company,
|
|
687
|
-
"transaction_date": mr_doc["schedule_date"],
|
|
688
|
-
"suppliers": [{"supplier": s} for s in suppliers],
|
|
709
|
+
"company": str(company),
|
|
710
|
+
"transaction_date": str(mr_doc["schedule_date"]),
|
|
711
|
+
"suppliers": [{"supplier": str(s)} for s in suppliers],
|
|
689
712
|
"items": items,
|
|
690
713
|
"message_for_supplier": "Xin vui lòng gửi báo giá."
|
|
691
714
|
}
|
|
715
|
+
|
|
716
|
+
# Debug logging
|
|
717
|
+
import logging
|
|
718
|
+
logging.info(f"RFQ Data: {rfq_data}")
|
|
719
|
+
|
|
692
720
|
return self.create_resource("Request for Quotation", rfq_data)
|
|
693
721
|
|
|
694
722
|
# ===========================================================
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|