fix: removed duplicate code
diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
index fa59003..00c402f 100644
--- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
@@ -986,19 +986,23 @@
msg = f"Serial No {args.serial_no} not available for Item {args.item}"
frappe.throw(_(msg))
+ pos_invoice_item = {
+ "warehouse": args.warehouse or "_Test Warehouse - _TC",
+ "qty": args.qty or 1,
+ "rate": args.rate if args.get("rate") is not None else 100,
+ "income_account": args.income_account or "Sales - _TC",
+ "expense_account": args.expense_account or "Cost of Goods Sold - _TC",
+ "cost_center": args.cost_center or "_Test Cost Center - _TC",
+ "serial_and_batch_bundle": bundle_id,
+ }
# append in pos invoice items without item_code by checking flag without_item_code
if args.without_item_code:
pos_inv.append(
"items",
{
+ **pos_invoice_item,
"item_name": args.item_name or "_Test Item",
"description": args.item_name or "_Test Item",
- "warehouse": args.warehouse or "_Test Warehouse - _TC",
- "qty": args.qty or 1,
- "rate": args.rate if args.get("rate") is not None else 100,
- "income_account": args.income_account or "Sales - _TC",
- "expense_account": args.expense_account or "Cost of Goods Sold - _TC",
- "cost_center": args.cost_center or "_Test Cost Center - _TC",
},
)
@@ -1006,14 +1010,8 @@
pos_inv.append(
"items",
{
+ **pos_invoice_item,
"item_code": args.item or args.item_code or "_Test Item",
- "warehouse": args.warehouse or "_Test Warehouse - _TC",
- "qty": args.qty or 1,
- "rate": args.rate if args.get("rate") is not None else 100,
- "income_account": args.income_account or "Sales - _TC",
- "expense_account": args.expense_account or "Cost of Goods Sold - _TC",
- "cost_center": args.cost_center or "_Test Cost Center - _TC",
- "serial_and_batch_bundle": bundle_id,
},
)