Frappe Rest Triggers for Price List

Hi Team,

I am working with Rest API for ERPNext integration.

We have a rest call that generates invoices from our app hosted on another platform.

We are using curl in order to connect and insert data. All works fine. However, there are invoice level triggers that are working in User Interface inside ERPNext Dashboard. For instance, the price of item added in invoice is fetched after we select the price list. The taxes are calculated on items after the prices are set.

So how can we let the rest call autocalculate the taxes and prices? From Price List? We are sending the Price List in our invoice object. But the price of item remains Rs. 0.

Is it possible using rest to make those User Interface like triggers working?

@Nishil_Tamboli this missing prices are automatically set if you set them as null

Can you check?

Hi,

I was able to add the Taxes by sending “taxes”: array into the object.

But however, I want to add taxes with Tax Template. For the same, if I am doing “taxes_and_charges”: “POS Taxes” where POS Taxes is the tax template, the tax is not getting calculated.

eg. The below object adds the taxes. But the Tax Template doesnt patch up with the invoice doc-

{
“cash_bank_account”: “Cash”,
“is_pos”: “1”,
“taxes_and_charges”: “POS Taxes”,
“party_account_currency”: “INR”,
“owner”: “xxx”,
“price_list_currency”: “INR”,
“mode_of_payment”: “Cash”,
“fiscal_year”: “2016-2017”,
“customer”: “Retail Customer - From App”,
“update_stock”: “1”,
“company”: “XXX LLP”,
“territory”: “xxx”,
“is_opening”: “No”,
“naming_series”: “R.#####”,
“currency”: “INR”,
“debit_to”: “Debtors”,
“remarks”: “POS - 999999999”,
“posting_date”: “2016-04-03”,
“selling_price_list”: “Walk In”,
“items”:[{
“item_code”: “Paintballs - 100”,
“qty”: “1”,
“owner”: “xxx”,
“parenttype”: “Sales Invoice”,
“parentfield”: “items”
},{
“item_code”: “1201 il Donatello”,
“qty”: “1”,
“owner”: “xxx”,
“parenttype”: “Sales Invoice”,
“parentfield”: “items”
}],
“taxes”: [{
“charge_type”: “On Net Total”,
“description”: “VAT 4%
”,
“parenttype”: “Sales Invoice”,
“account_head”: “VAT 4%”,
“parentfield”: “taxes”
},
{
“charge_type”: “On Net Total”,
“description”: “Addl. VAT 1%
”,
“parenttype”: “Sales Invoice”,
“account_head”: “VAT (Addl)”,
“parentfield”: “taxes”
},
{
“charge_type”: “On Net Total”,
“description”: “Service Tax 14%
”,
“parenttype”: “Sales Invoice”,
“account_head”: “Service Tax”,
“parentfield”: “taxes”
},
{
“charge_type”: “On Net Total”,
“description”: “Swachh Bharat Cess 0.5%
”,
“parenttype”: “Sales Invoice”,
“account_head”: “Swachh Bharat Cess”,
“parentfield”: “taxes”
}]
}

Hi Team,

We have been able to do things in a good shape for creating invoice through Frappe REST Api.

However, we are facing an issue with inventory. Like, when the invoice is generated and closed on creation itself, the inventory is not updated properly. The item count doesnt reduce. Instead, it shows 0 and moves ahead.

This is about an entry inside the Stock Ledger - for instance

Here, the Balance Quantity reduces on each stock deduction entry.

However, this Balance Quantity becomes 0 when we close the invoice through REST Api. What is going wrong here?