Try ERPNext Buy Support Partners Foundation

How do I create a stock entry by custom script and auto-submit it? :O

I’d like to share a solution that worked for me. Cause open-source right? :slight_smile:

frappe.db.insert({
    doctype: 'Stock Entry',
    stock_entry_type: 'Material Receipt',
    to_warehouse: 'Stores - VTK',
    items: [
        {
            'item_code': '0002',
            'item_name': 'Spring Clip',
            'schedule_date': '30 - 11 - 2021',
            'qty': 12,
            'stock_uom': 'Nos',
            'uom': 'Nos',
            'conversion_factor': 1,
            'warehouse': 'Stores - VTK',
        },
    ]
}).then(function(doc) { 
    frappe.call({
        "method": "frappe.client.submit",
        "args": {
             "doc" : doc
         }
    });

});
1 Like