npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node2erpnext

v0.0.6

Published

erpnext library in nodejs

Downloads

14

Readme

node-erpnext

This library let you call REST API of erpnext.

var ERPNext = require('node-erpnext');

var erpnext = new ERPNext({
    username : 'username',
    password : 'password',
    baseUrl  : 'http://localhost:8000'
})

Installation

$ npm install node-erpnext

Customers

Get list of customers


erpnext.getCustomers().then(function(customers){
    console.log(customers);
})

Get customer's name list.


erpnext.getCustomersName().then(function(customers){
    console.log(customers);
})

Get customer's info by customer name


 erpnext.getCustomerByName('ram').then(function(customer){
     console.log(customer);
 })

Create customer for parameters follow this.


  erpnext.createCustomer({
    "naming_series": "CUST-",
    "customer_group": "Commercial",
    "doctype": "Customer",
    "communications": [],
    "customer_type": "Company",
    "accounts": [],
    "docstatus": 0,
    "territory": "India",
    "sales_team": [],
    "customer_name": "ram"
  })

update customer by name. for parameters follow this.


  erpnext.updateCustomerByName('ram',{
    "customer_name": "shyam",
  })

Customer Group

Create a new customer group. For parameters follow this.


  erpnext.createCustomerGroup({
     'customer_group_name' : 'new Group',
    'parent_customer_group': 'All Customer Groups',
    'is_group': 'No'
  })

update an existing customer group by group name. For parameters follow this.


  erpnext.updateCustomerGroupByName('new Group',{
    'customer_group_name' : 'new group',
    'parent_customer_group': 'All Customer Groups',
    'is_group': 'No'
  })

Get list of customer groups.


erpnext.getCustomerGroups().then(function(customerGroups){
    console.log(customerGroups);
})

Get customer group's name list.


erpnext.getCustomerGroupsName().then(function(customerGroups){
    console.log(customerGroups);
})

Get customer group's info by group name


 erpnext.getCustomerGroupByName('new Group').then(function(customerGroups){
     console.log(customerGroups);
 })

Sales Order

Create a Sales Order. For parameters follow this.


  erpnext.createSalesOrder({
    "status": "Draft",
    "naming_series": "SO-",
    "currency": "INR",
    "billing_status": "Not Billed",
    "order_type": "Sales",
    "transaction_date": "2017-05-10",
    "territory": "India",
    "delivery_status": "Not Delivered",
    "customer": "Camelport Internal",
    "items": [
      {
        "qty": 5,
        "rate": 2000,
        "stock_uom": "Nos",
        "item_code": "i01",
        "parentfield": "items"
      }
    ],
    "delivery_date": "2017-05-18",
    "sales_team": []
  })

update an existing sales order by sales order name. For parameters follow this.


  erpnext.updateSalesOrderByName('SO-00003',{
    "status": "Submitted",
    "docstatus" : 1
  })

Get list of sales order.


erpnext.getSalesOrder().then(function(salesOrder){
    console.log(salesOrder);
})

Get sales order's name list.


erpnext.getSalesOrdersName().then(function(salesOrder){
    console.log(salesOrder);
})

Get sales order's info by order name


 erpnext.getSalesOrderByName('new Group').then(function(customer){
     console.log(customer);
 })

Item

Create an Item. For param follow https://frappe.github.io/erpnext/current/models/accounts/sales_invoice_item.


  erpnext.createAnItem({
    "has_variants": 0,
    "is_stock_item": "No",
    "valuation_method": "",
    "min_order_qty": 0,
    "is_asset_item": "No",
    "has_batch_no": "No",
    "has_serial_no": "No",
    "is_purchase_item": "Yes",
    "is_sales_item": "Yes",
    "is_service_item": "No",
    "inspection_required": "No",
    "item_code": "item code",
    "item_name": "item name",
    "description": "description",
    "item_group": "Services"
  })

Update an Item. For param follow https://frappe.github.io/erpnext/current/models/selling/sales_order


erpnext.updateItemByName("item code",{
    "has_variants": 0,
    "is_stock_item": "No",
    "valuation_method": "",
    "min_order_qty": 0,
    "is_asset_item": "No",
    "has_batch_no": "No",
    "has_serial_no": "No",
    "is_purchase_item": "Yes",
    "is_sales_item": "Yes",
    "is_service_item": "No",
    "inspection_required": "No",
    "item_code": "item code",
    "item_name": "item name",
    "description": "description",
    "item_group": "Services"
})

Supplier

Create a Supplier. For param follow https://frappe.github.io/erpnext/current/models/buying/supplier.


erpnext.createSupplier({"supplier_type":"Services","supplier_name":"ram"});

Update Supplier. For param follow https://frappe.github.io/erpnext/current/models/buying/supplier.


  erpnext.updateSupplierByName("ram",{
    "supplier_type":"Services",
    "supplier_name":"ram"
  })

Purchase Invoice

Create a Purchase Invoice For param follow https://frappe.github.io/erpnext/current/models/accounts/purchase_invoice


  erpnext.createPurchaseInvoice({
      "supplier": "ram",

      "items": [{
              "item_code": "item code",
              "qty": 4,
              "price_list_rate": 5000,
              "schedule_date": "2017-05-31"
          }]
  })

Update Purchase Invoice. For param follow https://frappe.github.io/erpnext/current/models/accounts/purchase_invoice.


  erpnext.updatePurchaseInvoiceByName("name",{
    "supplier": "ram"
  })

Sales Invoice

Create a Sales Invoice. For param follow https://frappe.github.io/erpnext/current/models/accounts/sales_invoice


  erpnext.createSalesInvoice(
    {
    "due_date": "2017-05-14",
     "customer": "ram",
    "items":[{
        "item_code": "item code",
        "rate": 15000,
        "qty": 3
    }]
  }
)

Update Sales Invoice. For param follow https://frappe.github.io/erpnext/current/models/accounts/sales_invoice


  erpnext.updateSalesInvoiceByName(
    "Sales Invoice",

    {
    "due_date": "2017-05-14",
     "customer": "ram",
    "items":[{
        "item_code": "item code",
        "rate": 15000,
        "qty": 3
    }]
  }
)

Purchase Order

Create a Purchase Order. For param follow https://frappe.github.io/erpnext/current/models/buying/purchase_order


  erpnext.createPurchaseOrder({
     "supplier": "ram",
     "items": [{

             "item_code": "item code",
             "qty": 4,
             "price_list_rate": 5000,
             "schedule_date": "2017-05-31"
         }
     ]
  })

Update Purchase Order. For param follow https://frappe.github.io/erpnext/current/models/buying/purchase_order


 erpnext.updatePurchaseOrderByName("name",{
        "supplier": "ram",
         "items": [{

                 "item_code": "item code",
                 "qty": 4,
                 "price_list_rate": 5000,
                 "schedule_date": "2017-05-31"
             }
         ]
 })