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:

1 Like
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
         }
    });

});
4 Likes

thank you so much :star_struck: