i’m trying to raise a new Sales Order
via rest api. After calling the insert function frappe returning Sales Order voucher no but it is not inserted in reality when i checked in the portal. Also, i confirmed this by checking the voucher no. its always returning the same voucher number that is not saved SO-KDY-2022-00247
.
this is the model data i’m trying to insert
{
'doctype':'Sales Order',
'company':frappe.defaults.get_user_default('Company'),
'branch':'Kondotty T P',
'customer':'Mubeen Api 5',
'delivery_date':datetime.now().strftime('%Y-%m-%d'),
'sales_channel':'App',
'order_type':'Sales',
'transaction_date':datetime.now().strftime('%Y-%m-%d'),
'tax_category':'Cooked foods',
'taxes_and_charges':'In State GST - TMY',
'shipping_address_name':'Mubeen Api 5 - Billing-1-Billing',
'customer_address':'Mubeen Api 5 - Billing-1-Billing',
'shipping_rule':'Within 5 Kilometer',
'items':[{
'parenttype':'Sales Order',
'parentfield':'items',
'item_code':'Margarita Pizza',
'note':'',
'qty':1,
'rate':300,
'amount':300
}],
'taxes':[{
'parenttype':'Sales Order',
'parentfield':'taxes',
'charge_type':'On Net Total',
'description':'CGST @ 2.5',
'account_head':'CGST - TMY',
'rate':2.5,
'included_in_print_rate':1
},
{
'parenttype':'Sales Order',
'parentfield':'taxes',
'charge_type':'On Net Total',
'description':'SGST @ 2.5',
'account_head':'SGST - TMY',
'rate':2.5,
'included_in_print_rate':1
},
{
'parenttype':'Sales Order',
'parentfield':'taxes',
'charge_type':'Actual',
'description':'Within 5 Kilometer',
'account_head':'Delivery Charge - TMY',
'rate':0,
'tax_amount':0
}],
'coupon_code':'RS 120 OFF',
'discount_amount':120
}
This api is for a flutter application integration with frappe erpnext.