rpa-erpnext 1.0.6__tar.gz → 1.0.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpa-erpnext
3
- Version: 1.0.6
3
+ Version: 1.0.9
4
4
  Summary: Robot Framework library for automating ERPNext using REST API
5
5
  Author-email: Your Name <youremail@example.com>
6
6
  License: MIT
@@ -661,12 +661,21 @@ class ERPNextLibrary:
661
661
  if isinstance(mr_name, dict):
662
662
  mr_name = mr_name.get("name")
663
663
 
664
+ # Normalize suppliers to list of strings
664
665
  if isinstance(suppliers, str):
665
666
  try:
666
667
  suppliers = json.loads(suppliers)
667
668
  except ValueError:
668
669
  # Nếu không phải JSON list, coi như là 1 supplier duy nhất
669
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]
670
679
 
671
680
  mr_doc = self.get_doc("Material Request", mr_name)
672
681
  company = mr_doc["company"]
@@ -674,25 +683,40 @@ class ERPNextLibrary:
674
683
  for s in suppliers:
675
684
  self.ensure_supplier_exist(s)
676
685
 
686
+
677
687
  items = []
678
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
+
679
698
  items.append({
680
- "item_code": d["item_code"],
681
- "qty": d["qty"],
682
- "uom": d.get("uom", "Nos"),
683
- "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")),
684
703
  "conversion_factor": 1.0,
685
- "warehouse": d["warehouse"],
704
+ "warehouse": str(warehouse),
686
705
  })
687
706
 
688
707
  rfq_data = {
689
708
  "doctype": "Request for Quotation",
690
- "company": company,
691
- "transaction_date": mr_doc["schedule_date"],
692
- "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],
693
712
  "items": items,
694
713
  "message_for_supplier": "Xin vui lòng gửi báo giá."
695
714
  }
715
+
716
+ # Debug logging
717
+ import logging
718
+ logging.info(f"RFQ Data: {rfq_data}")
719
+
696
720
  return self.create_resource("Request for Quotation", rfq_data)
697
721
 
698
722
  # ===========================================================
@@ -770,7 +794,12 @@ class ERPNextLibrary:
770
794
  # ===========================================================
771
795
 
772
796
  @keyword("Create Purchase Order From Quotation")
773
- def create_purchase_order_from_quotation(self, quotation_name: str):
797
+
798
+ def create_purchase_order_from_quotation(self, quotation_name):
799
+ # Auto-detect if quotation_name is a dict (from previous keyword return)
800
+ if isinstance(quotation_name, dict):
801
+ quotation_name = quotation_name.get("name")
802
+
774
803
  sq_doc = self.get_doc("Supplier Quotation", quotation_name)
775
804
  supplier = sq_doc["supplier"]
776
805
  company = sq_doc["company"]
@@ -780,13 +809,18 @@ class ERPNextLibrary:
780
809
 
781
810
  items = []
782
811
  for d in sq_doc["items"]:
812
+ # Ensure proper types
813
+ item_code = d["item_code"]
814
+ if isinstance(item_code, list):
815
+ item_code = item_code[0] if item_code else ""
816
+
783
817
  items.append({
784
- "item_code": d["item_code"],
785
- "qty": d["qty"],
786
- "rate": d["rate"],
818
+ "item_code": str(item_code),
819
+ "qty": float(d["qty"]),
820
+ "rate": float(d["rate"]),
787
821
  "schedule_date": "2026-02-28",
788
822
  "warehouse": f"Stores - EDU",
789
- "uom": d.get("uom", "Nos"),
823
+ "uom": str(d.get("uom", "Nos")),
790
824
  "conversion_factor": 1.0
791
825
  })
792
826
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rpa-erpnext"
7
- version = "1.0.6"
7
+ version = "1.0.9"
8
8
  description = "Robot Framework library for automating ERPNext using REST API"
9
9
  readme = "readme.md"
10
10
  requires-python = ">=3.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpa-erpnext
3
- Version: 1.0.6
3
+ Version: 1.0.9
4
4
  Summary: Robot Framework library for automating ERPNext using REST API
5
5
  Author-email: Your Name <youremail@example.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes