Skip to content

a ERPNext assist making AI use the api to do repetitive tasks and quickly draft tools from the ui

License

Notifications You must be signed in to change notification settings

samletnorge/Assist-v0

Repository files navigation

ERPNext Assist

License: MIT Python 3.10+ ERPNext

🚀 Transform ERPNext into an AI-powered platform with visual tool creation, automatic background removal, and universal AI integration.

An ERPNext custom app that extends ERPNext with AI-powered tools using the Model Context Protocol (MCP). This app enables users to draft custom tools visually through the UI without programming knowledge, and integrates with various AI providers (online and offline).

✨ Quick Highlights

  • 🎨 No-Code Tool Builder - Create custom tools visually, no programming required
  • 📸 AI Background Removal - Professional product images with dual APIs (U²-Net local + altlokalt.com cloud)
  • 🤖 Universal AI Support - Works with Claude, OpenAI, Ollama, and custom providers
  • 🔒 Privacy-First - All processing happens locally on your server
  • 📦 18 Ready-to-Use Tools - Marketplace (Norwegian templates), camera, barcode, receipt scanner, price comparison, voice queries, RDS 81346, S1000D, GitHub import, warehouse finder, Norwegian accounting (NS 4102/DFØ), Skatteetaten tax integration, Kommune services, and more
  • 🇳🇴 Norwegian Government Integration - Skatteetaten (tax authority) and Kommune (municipal services)
  • 🌐 Offline Capable - Full functionality without internet connection

Features

🛠️ Visual Tool Drafting (No Programming Required)

  • Assist Tool Draft: Create custom tools through an intuitive UI
  • Define tool parameters, actions, and AI prompts visually
  • Choose from multiple action types: Create Document, Update Document, API Call, or Custom Code
  • Support for any AI provider (OpenAI, Claude, Local/Offline models via Ollama, etc.)

📦 Built-in Tools

1. Marketplace Posting Tool with Pickup Orchestration & Norwegian Messages

  • Post stock items or assets to marketplaces like Facebook Marketplace and FINN.no
  • NEW: Asset Rental Posting - Post company-owned assets (tools, equipment) to rental services like leid.no
  • NEW: Chart of Account Integration - Automatically identify rental-eligible assets by account codes (1202 - Maskiner og anlegg, 1203 - Inventar, 1204 - Transportmidler)
  • Automatically track and manage listings
  • Save and monitor marketplace searches based on purchase or material requests
  • NEW: Orchestrate efficient pickup routes by contacting sellers and scheduling optimal pickup days
  • NEW: Standard Norwegian message templates for seller communication (price inquiries, storage, free goods, apologies)
  • NEW: Phone control integration for automated marketplace browsing
  • NEW: Material Request integration - automatically search for items from your purchase requests
  • DocTypes: Marketplace Listing, Saved Marketplace Search
  • MCP Tools: post_to_marketplace, post_asset_for_rental, get_rental_eligible_assets, track_saved_search, orchestrate_pickup_route, manage_marketplace_listings_with_phone_ctrl

2. Camera-based Quick Item Addition with Dual AI Background Removal

  • Quickly add new items (stock or assets) using camera capture
  • Dual AI-powered background removal:
    • Local processing with rembg + U²-Net AI model (privacy-focused, offline)
    • Cloud API via receipt-ocr.altlokalt.com (faster processing)
    • Automatic fallback between APIs
  • Automatic image enhancement (brightness, contrast, sharpness)
  • Perfect for warehouses with disorganized or new inventory
  • Automatic image attachment and stock entry creation
  • MCP Tool: quick_add_item_from_camera
  • API Endpoints:
    • remove_image_background - Remove background from any image (dual API support)
    • enhance_image - Enhance image quality
    • quick_add_item - Complete item addition with image processing

3. Barcode Warehouse Location Scanner

  • Scan barcodes to instantly check item warehouse locations
  • View stock levels across all warehouses
  • See default warehouse assignments
  • MCP Tool: scan_barcode_for_location

4. Receipt Scanner (OCR-powered)

  • Scan receipt images and automatically extract items
  • Add items as stock or assets with quantities and prices
  • OCR-powered text extraction (requires pytesseract or similar)
  • MCP Tool: scan_receipt_and_add_items

5. Price Comparison with Prisjakt.no

  • Compare prices across internal vendors and Prisjakt.no
  • Pull complete vendor catalogs for suggestions
  • Find the cheapest supplier for any item
  • MCP Tool: compare_vendor_prices

6. Natural Language Inventory Query (Voice-enabled)

  • Ask inventory questions in plain language: "do we have pliers?"
  • Voice-to-text compatible for hands-free operation
  • Get instant answers about availability and location
  • MCP Tool: query_inventory_natural_language

7. RDS 81346 Equipment Reference Designation

  • Generate ISO/IEC 81346 compliant reference designations
  • Standardized equipment naming and documentation
  • Support for function, product, location, and type aspects
  • Hierarchical system structuring
  • MCP Tool: generate_rds_81346_designation
  • API Endpoint: erpnext_assist.api.generate_rds_designation

8. S1000D Issue 6 Technical Documentation

  • Create S1000D compliant data modules for technical publications
  • XML-based modular documentation for aerospace/defense
  • Common Source Database (CSDB) compatible structure
  • Support for multiple content types (procedural, descriptive, fault, crew)
  • MCP Tool: create_s1000d_data_module
  • API Endpoint: erpnext_assist.api.create_s1000d_module

9. GitHub Repos as Assets Importer

  • Import all GitHub repositories from a user or organization
  • Automatically create assets or items for each repository
  • Capture metadata: stars, forks, language, description
  • Support for private repos (with GitHub token)
  • MCP Tool: import_github_repos_as_assets
  • API Endpoint: erpnext_assist.api.import_github_repos

10. Warehouse Finder (Norway-wide including Northern Norway)

  • Find warehouses anywhere in Norway via FINN.no
  • Search in northern regions like Tromsø, Bodø, Finnmark
  • Phone control support for automated browsing
  • Automatically add found warehouses to ERPNext
  • Check 24/7 access and storage specifications
  • MCP Tool: find_warehouses_on_finn
  • API Endpoint: erpnext_assist.api.find_warehouses

11. Enhanced Marketplace Communication with Material Requests

  • Manage Facebook Marketplace and FINN.no listings with phone control
  • Automatically fetch Material Request items for searching
  • Norwegian standard message templates for seller communication:
    • Standard: "Hvor mye for hele bunken?"
    • Storage: "jeg vil gjerne prøve dere ut, passer idag og er tilgangen 24/7"
    • Free Goods: "Er disse forsatt ledig kan hente imørgen hvis det passer... 😃"
    • Apology: "Hei. Beklager sent svar men det var mange.., det er hentet"
  • Add listings to saved lists for tracking
  • MCP Tool: manage_marketplace_listings_with_phone_ctrl
  • API Endpoint: erpnext_assist.api.manage_marketplace_with_phone

12. Norwegian Chart of Accounts (NS 4102 + DFØ)

  • Import Norwegian accounting standards chart of accounts
  • NS 4102 - Private sector accounting standard
  • DFØ Standard Kontoplan - Government sector accounting
  • Automatic account hierarchy creation in ERPNext
  • Support for both private and public sector organizations
  • MCP Tool: import_norwegian_chart_of_accounts
  • API Endpoint: erpnext_assist.api.import_norwegian_accounts

13. Skatteetaten (Norwegian Tax Authority) Integration

  • Interact with Norwegian Tax Authority for tax submissions
  • A-melding - Employee registration reporting
  • Skattemelding - Tax return filing
  • Fradrag - Tax deduction requests
  • Check report deadlines and tax account status
  • Phone control support for web portal navigation
  • MCP Tool: manage_skatteetaten_submissions
  • API Endpoint: erpnext_assist.api.interact_with_skatteetaten

14. Lyngdal Kommune (Municipal Services) Integration

  • Submit applications to Norwegian municipal services
  • Byggesøknad - Building permit applications
  • Renovation permits - Painting and property improvements
  • Property value tracking for upgrades
  • Works with any Norwegian kommune (Lyngdal, Oslo, Bergen, etc.)
  • Phone control support for municipal portals
  • MCP Tool: submit_lyngdal_kommune_application
  • API Endpoint: erpnext_assist.api.submit_kommune_application

📋 Standards Compliance Matrix

This app implements multiple international and Norwegian standards for various industries:

Tool/Feature Standard/API Type Compliance Level Jurisdiction
Chart of Accounts NS 4102 Norwegian Accounting ✅ Full Norway (Private Sector)
Chart of Accounts DFØ Standard Kontoplan Government Accounting ✅ Full Norway (Government)
RDS 81346 Tool ISO/IEC 81346 Equipment Designation ✅ Full International
S1000D Tool ASD S1000D Issue 6 Technical Documentation ✅ Full International (Aerospace/Defense)
Skatteetaten Integration Skatteetaten API Tax Authority ✅ Supported Norway
Kommune Integration Municipal APIs Local Government ✅ Supported Norway (All Municipalities)
Background Removal receipt-ocr.altlokalt.com Private API ✅ Supported International
Background Removal U²-Net AI Model Open Source ✅ Full International (Offline)
Price Comparison Prisjakt.no API E-commerce ✅ Supported Norway/Scandinavia
Marketplace Facebook Marketplace Social Commerce ✅ Supported International
Marketplace FINN.no Norwegian Classifieds ✅ Supported Norway
GitHub Integration GitHub REST API v3 Developer Platform ✅ Full International

Standard Categories

Accounting & Financial:

  • NS 4102 (Private sector accounting)
  • DFØ Standard Kontoplan (Government accounting)
  • Skatteetaten tax compliance

Industrial & Technical:

  • ISO/IEC 81346 (Equipment reference designation)
  • ASD S1000D Issue 6 (Aerospace technical publications)

Government & Municipal:

  • Skatteetaten (Norwegian Tax Authority)
  • Norwegian Kommune services (all municipalities)

AI & Image Processing:

  • U²-Net (Background removal - local)
  • receipt-ocr.altlokalt.com (Background removal - cloud)

E-commerce & Marketplace:

  • Facebook Marketplace
  • FINN.no
  • Prisjakt.no

Architecture

MCP Integration

This app uses the Model Context Protocol (MCP) to expose ERPNext operations as tools that AI models can use. The MCP server:

  • Runs locally or remotely
  • Supports both stdio and HTTP transports
  • Dynamically loads user-drafted tools from the database
  • Works with any MCP-compatible AI client

Directory Structure

erpnext_assist/
├── __init__.py              # App initialization
├── hooks.py                 # Frappe app hooks
├── modules.txt              # App modules
├── config/
│   └── desktop.py           # Desktop configuration
├── assist_tools/            # Main module
│   └── doctype/
│       ├── assist_tool_draft/          # Visual tool builder
│       ├── assist_tool_parameter/      # Tool parameters (child table)
│       ├── marketplace_listing/        # Marketplace listings
│       ├── marketplace_listing_image/  # Listing images (child table)
│       └── saved_marketplace_search/   # Saved searches
└── mcp_server/
    └── server.py            # MCP server implementation

Installation

Prerequisites

  • ERPNext (v14 or v15)
  • Python 3.10+
  • Frappe Framework

Install the App

# Get the app
bench get-app https://github.com/samletnorge/Assist---ERPNext

# Install on your site
bench --site [your-site-name] install-app erpnext_assist

# Restart bench
bench restart

Usage

Creating a Custom Tool (No Programming Required!)

  1. Navigate to Assist Tools > Assist Tool Draft

  2. Click New

  3. Fill in the tool details:

    • Tool Name: A unique name for your tool
    • Tool Description: What the tool does
    • AI Provider: Choose your preferred AI (or "Any")
    • Category: Classify your tool (Inventory, Sales, etc.)
  4. Configure the AI Prompt:

    • Write in natural language what you want the AI to do
    • Use {{parameter_name}} for variables
    • Example: "Create a purchase order for {{item_code}} with quantity {{qty}} from supplier {{supplier}}"
  5. Define Parameters:

    • Add rows for each input your tool needs
    • Specify parameter name, type, and whether it's required
    • Example: item_code (Link to Item), qty (Number), supplier (Link to Supplier)
  6. Choose Action Type:

    • Create Document: Create a new ERPNext document
    • Update Document: Modify an existing document
    • API Call: Call an external API endpoint
    • Custom Code: Write Python code (for advanced users)
  7. Save and Enable: Your tool is now available through the MCP server!

Running the MCP Server

Stdio Mode (for local AI clients)

cd /path/to/erpnext_assist
python -m erpnext_assist.mcp_server.server

HTTP Mode (for web-based AI clients)

export MCP_TRANSPORT=streamable-http
python -m erpnext_assist.mcp_server.server

Using Built-in Tools

Post to Marketplace (Sale)

import frappe
from erpnext_assist.mcp_server.server import post_to_marketplace

result = post_to_marketplace(
    marketplace="Facebook Marketplace",
    title="Quality Office Chair",
    description="Excellent condition, barely used",
    price=250.00,
    item_code="ITEM-001",
    listing_type="Sale",
    images=["/files/chair1.jpg", "/files/chair2.jpg"]
)

Post Asset for Rental (NEW)

from erpnext_assist.mcp_server.server import post_asset_for_rental

# Post a hydraulic drill to leid.no
result = post_asset_for_rental(
    asset_code="DRILL-HYD-001",
    marketplace="leid.no",
    title="Professional Hydraulic Drill",
    description="High-power drill for heavy construction work. Daily/weekly rates available.",
    rental_rate=750.00,  # Rate per day/week
    images=["/files/drill1.jpg", "/files/drill2.jpg"]
)

Get Rental-Eligible Assets (NEW)

from erpnext_assist.mcp_server.server import get_rental_eligible_assets

# Get all tools and equipment suitable for rental
result = get_rental_eligible_assets(
    company="My Company",
    chart_of_account_code="1202"  # Maskiner og anlegg (Machinery and equipment)
)

# Returns list of assets with their details
for asset in result["assets"]:
    print(f"{asset['asset_name']} - {asset['category']}")

Quick Add Item from Camera with Background Removal

from erpnext_assist.mcp_server.server import quick_add_item_from_camera

# With automatic background removal (default)
result = quick_add_item_from_camera(
    image_data="base64_encoded_image_data",
    warehouse="Main Warehouse",
    item_group="Products",
    valuation_rate=100.00,
    remove_background=True,  # AI-powered background removal
    enhance_image=True       # Automatic image enhancement
)

# Or use the API from client-side JavaScript
frappe.call({
    method: "erpnext_assist.api.quick_add_item",
    args: {
        image_data: base64_image,
        warehouse: "Main Warehouse",
        remove_background: true,
        enhance_image_quality: true
    },
    callback: function(r) {
        console.log(r.message);
    }
});

Remove Background from Existing Image

from erpnext_assist.api import remove_image_background

result = remove_image_background(
    image_data="base64_encoded_image_data",
    enhance=True
)
# Returns: processed image with transparent background

)

Scan Barcode for Location

from erpnext_assist.mcp_server.server import scan_barcode_for_location

result = scan_barcode_for_location(barcode="1234567890")
# Returns warehouse locations and stock levels

MCP Client Configuration

For Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "erpnext-assist": {
      "command": "python",
      "args": ["-m", "erpnext_assist.mcp_server.server"],
      "cwd": "/path/to/erpnext_assist"
    }
  }
}

For Cursor/Other IDEs

Configure the MCP server endpoint in your IDE's settings to point to:

  • Stdio: python -m erpnext_assist.mcp_server.server
  • HTTP: http://localhost:8000 (if running in HTTP mode)

AI Provider Support

This app works with any AI provider that supports MCP:

  • ✅ OpenAI (GPT-4, GPT-3.5)
  • ✅ Anthropic Claude
  • ✅ Local models via Ollama (Llama, Mistral, etc.) - OFFLINE CAPABLE
  • ✅ Custom AI endpoints
  • ✅ Any MCP-compatible AI client

Image Processing Technology

Automatic Background Removal

The camera tool uses AI-powered background removal (via rembg library) to create professional product images:

  • U²-Net model: Deep learning model trained on thousands of images
  • Automatic subject detection: Intelligently identifies the main subject
  • Clean transparent background: Perfect for marketplaces and catalogs
  • Fast processing: Typically completes in 2-5 seconds
  • Offline capable: Runs locally without external API calls

Image Enhancement

Automatic image quality improvements:

  • Brightness adjustment: Ensures proper lighting (10% boost)
  • Contrast enhancement: Makes details pop (10% boost)
  • Sharpness increase: Crisper, clearer images (20% boost)

Privacy & Performance

  • All image processing happens locally on your server
  • No external API calls or data sharing
  • No subscription fees for image processing
  • Works completely offline once models are downloaded

Example Use Cases

1. Bulk Inventory Update Tool

Create a tool that updates multiple items at once:

  • Parameters: item_codes (list), field_to_update (text), new_value (text)
  • Action: Update Documents
  • No coding required - just configure in the UI!

2. Smart Reorder Tool

Create a tool that analyzes stock and creates purchase orders:

  • Parameters: warehouse (link), threshold (number)
  • Prompt: "Analyze items below {{threshold}} quantity in {{warehouse}} and create purchase orders"
  • Action: Multiple Actions

3. Customer Follow-up Scheduler

Create automated follow-ups:

  • Parameters: customer (link), days_after_order (number)
  • Action: Create Document (Task/ToDo)

Development

Running Tests

bench --site [site-name] run-tests --app erpnext_assist

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License

Support

For issues and questions:

Credits

Built with:

About

a ERPNext assist making AI use the api to do repetitive tasks and quickly draft tools from the ui

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages