rpa-erpnext 1.0.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpa-erpnext
3
- Version: 1.0.6
3
+ Version: 1.0.8
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
  # ===========================================================
@@ -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.8"
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.8
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