Skip to content

Instantly share code, notes, and snippets.

@ManotLuijiu
Created July 20, 2025 10:22
Show Gist options
  • Save ManotLuijiu/16d26fb4926e873642d0e595c29e2d4e to your computer and use it in GitHub Desktop.
Save ManotLuijiu/16d26fb4926e873642d0e595c29e2d4e to your computer and use it in GitHub Desktop.
Purchasing Workflow

No-Code Customer PO Allocation Workflow

Simple Solution Using Standard Frappe Features

No custom coding needed! Use existing Frappe functionality with some custom fields.


Method 1: Custom Fields in Purchase Order (Simplest)

Step 1: Add Custom Fields to Purchase Order Item

Location: Setup > Customize Form > Purchase Order Item

Add these fields:

Field 1:
- Label: Customer Allocation Details
- Type: Long Text
- Field Name: customer_allocation_details

Field 2: 
- Label: Total Customers
- Type: Int
- Field Name: total_customers_count

Step 2: Manual Entry Format in "Customer Allocation Details"

For each item, enter customer breakdown like this:

กุ้งก้นถ้วย (Total: 5.50 KG)
- PC 19 ROSS: 0.50 KG (PO: ROSS-001)
- PC 19 STAFF CANTEEN: 3.00 KG (PO: STAFF-001)  
- เบอร์ 10 ปั่นกะลิบ: 2.00 KG (PO: B10-001)

พริกจินดาแดง (Total: 1.00 KG)
- PC 19 ROSS: 1.00 KG (PO: ROSS-001)

Method 2: Using Comments System (Zero Setup)

Use Purchase Order Comments for Tracking

When creating PO, add a comment with customer breakdown:

Comment Title: "Customer Allocation"

Comment Content:

CUSTOMER ALLOCATION BREAKDOWN:

กุ้งก้นถ้วย - 5.50 KG Total:
✓ PC 19 ROSS (MAIN KITCHEN): 0.50 KG
✓ PC 19 STAFF CANTEEN: 3.00 KG  
✓ เบอร์ 10 ปั่นกะลิบ: 2.00 KG

พริกจินดาแดง - 1.00 KG Total:
✓ PC 19 ROSS (MAIN KITCHEN): 1.00 KG

กิ่งก้นถ้วย - 3.00 KG Total:
✓ PC 19 STAFF CANTEEN: 3.00 KG

Method 3: Simple Excel-Style Table (Recommended)

Step 1: Create Custom Child Table

Location: Setup > DocType > New

DocType Name: Customer PO Allocation Is Child Table: ✓ Yes

Fields:

customer (Link to Customer)
customer_po_no (Data)
item_code (Link to Item) 
allocated_qty (Float)
delivery_date (Date)
notes (Data)

Step 2: Add Child Table to Purchase Order

Location: Setup > Customize Form > Purchase Order

Add Field:

Label: Customer Allocations
Type: Table
Options: Customer PO Allocation
Field Name: customer_allocations

Step 3: Fill the Table

When creating PO, add rows like this:

Customer Customer PO No Item Code Allocated Qty Delivery Date Notes
PC 19 ROSS ROSS-001 กุ้งก้นถ้วย 0.50 15/01/2024 Main Kitchen
PC 19 STAFF STAFF-001 กุ้งก้นถ้วย 3.00 16/01/2024 Staff Canteen
เบอร์ 10 B10-001 กุ้งก้นถ้วย 2.00 17/01/2024 ปั่นกะลิบ
PC 19 ROSS ROSS-001 พริกจินดาแดง 1.00 15/01/2024 Main Kitchen

Method 4: Using Print Format (Visual Solution)

Step 1: Create Custom Print Format

Location: Setup > Print Format > New

Print Format Name: PO with Customer Allocation

Step 2: Add HTML Template

<h3>Purchase Order: {{ doc.name }}</h3>
<h4>Supplier: {{ doc.supplier }}</h4>

<table class="table table-bordered">
    <thead>
        <tr>
            <th>Item</th>
            <th>Total Qty</th>
            <th>Customer Breakdown</th>
        </tr>
    </thead>
    <tbody>
        {% for item in doc.items %}
        <tr>
            <td>{{ item.item_code }}</td>
            <td>{{ item.qty }} {{ item.uom }}</td>
            <td>
                <!-- Manual customer breakdown -->
                {{ item.customer_allocation_details or "No allocation details" }}
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>

Method 5: Simple Spreadsheet Integration

Create Excel Template

Keep a simple Excel file alongside your Frappe PO:

File Name: PO_Customer_Allocation_{{ po_name }}.xlsx

PO Number Item Code Total Qty Customer 1 Qty 1 Customer 2 Qty 2 Customer 3 Qty 3
PO-001 กุ้งก้นถ้วย 5.50 PC 19 ROSS 0.50 PC 19 STAFF 3.00 เบอร์ 10 2.00
PO-001 พริกจินดาแดง 1.00 PC 19 ROSS 1.00

Attach this Excel to your Purchase Order using the "Attach" button.


Method 6: Using Tags System

Step 1: Create Customer Tags

Location: Setup > Tags

Create tags for each customer:

  • #PC19-ROSS
  • #PC19-STAFF
  • #BERTH-10

Step 2: Tag Purchase Order Items

For each PO item, add tags in the description:

กุ้งก้นถ้วย - 5.50 KG
#PC19-ROSS (0.50kg) #PC19-STAFF (3.00kg) #BERTH-10 (2.00kg)

พริกจินดาแดง - 1.00 KG  
#PC19-ROSS (1.00kg)

Quick Implementation Guide (Choose One Method)

🏆 Recommended: Method 3 (Custom Child Table)

Time to Setup: 15 minutes Benefits:

  • Clean tabular view
  • Easy to search and filter
  • Can create reports later
  • Professional appearance

🚀 Fastest: Method 2 (Comments)

Time to Setup: 0 minutes
Benefits:

  • Use immediately
  • No configuration needed
  • Works with existing system

📊 Best for Reporting: Method 5 (Excel)

Time to Setup: 5 minutes Benefits:

  • Easy calculations
  • Can share with others
  • Familiar interface

Delivery Process (No Code)

When Goods Arrive:

  1. Open your Purchase Order
  2. Check the Customer Allocation table/comment
  3. Create separate Delivery Notes:

For PC 19 ROSS:

Delivery Note: DN-ROSS-001
Items:
- กุ้งก้นถ้วย: 0.50 KG
- พริกจินดาแดง: 1.00 KG
Reference: Customer PO ROSS-001

For PC 19 STAFF:

Delivery Note: DN-STAFF-001  
Items:
- กุ้งก้นถ้วย: 3.00 KG
Reference: Customer PO STAFF-001

For เบอร์ 10:

Delivery Note: DN-B10-001
Items:
- กุ้งก้นถ้วย: 2.00 KG  
Reference: Customer PO B10-001

Real Example Using Your Data

Purchase Order: PO-26/5/68

Supplier: Your Main Supplier Date: 26/05/2568

Items with Customer Allocation:

Item 1: กุ้งก้นถ้วย - 5.50 KG

Customer Allocation Details:
- PC 19 ROSS (MAIN KITCHEN): 0.50 KG (PO: ROSS-26/5/68)
- PC 19 STAFF CANTEEN: 3.00 KG (PO: STAFF-26/5/68)  
- เบอร์ 10 ปั่นกะลิบ: 2.00 KG (PO: B10-26/5/68)
Total: 5.50 KG ✓

Item 2: พริกจินดาแดง เด็ดก้าน - 1.00 KG

Customer Allocation Details:
- PC 19 ROSS (MAIN KITCHEN): 1.00 KG (PO: ROSS-26/5/68)
Total: 1.00 KG ✓

Item 3: กิ่งก้นถ้วย - 3.00 KG

Customer Allocation Details:
- PC 19 STAFF CANTEEN: 1.00 KG (PO: STAFF-26/5/68)
- PC 19 STAFF CANTEEN: 2.00 KG (PO: STAFF-26/5/68)  
Total: 3.00 KG ✓

Summary

Choose Method 3 (Custom Child Table) for the best balance of:

  • ✅ Easy to implement (15 minutes setup)
  • ✅ Professional appearance
  • ✅ Easy to track and manage
  • ✅ Can generate reports later
  • ✅ No coding required

Total Implementation Time: 15 minutes Maintenance: Zero - use standard Frappe features

This gives you complete customer allocation tracking without any coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment