We are facing problems in generating Sales Invoice using REST Api after the ERPNext 7 upgrade.
The data that we were sending is same. But the method is breaking and not generating the invoice.
Can you guys help us get around this problem? It is frustrating how the same thing doesnt go through after the upgrade. It takes time to study the API that you provided. Now after the upgrade, same thing doesnt work.
The error we are getting is as below -
Traceback (most recent call last):
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/app.py", line 60, in application
response = frappe.api.handle()
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/api.py", line 115, in handle
"data": frappe.get_doc(data).insert().as_dict()
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 212, in insert
self.run_before_save_methods()
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 710, in run_before_save_methods
self.run_method("validate")
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 661, in run_method
return Document.hook(fn)(self, _args, _kwargs)
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 839, in composer
return composed(self, method, _args, _kwargs)
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 822, in runner
add_to_return_value(self, fn(self, _args, *_kwargs))
File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 655, in
fn = lambda self, args, _kwargs: getattr(self, method)(args, _kwargs)
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 53, in validate
super(SalesInvoice, self).validate()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/selling_controller.py", line 32, in validate
super(SellingController, self).validate()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/accounts_controller.py", line 35, in validate
self.calculate_taxes_and_totals()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/accounts_controller.py", line 93, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 16, in init
self.calculate()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 27, in calculate
self.calculate_total_advance()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 417, in calculate_total_advance
self.calculate_outstanding_amount()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 424, in calculate_outstanding_amount
self.calculate_paid_amount()
File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 456, in calculate_paid_amount
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
Hi Team,
We are facing problems in generating Sales Invoice using REST Api after the ERPNext 7 upgrade.
The data that we were sending is same. But the method is breaking and not generating the invoice.
Can you guys help us get around this problem? It is frustrating how the same thing doesnt go through after the upgrade. It takes time to study the API that you provided. Now after the upgrade, same thing doesnt work.
Input JSON that we are providing is -
{ "taxes_and_charges": "POS Taxes", "items": [ { "cost_center": "Paintball Walk Ins - D9", "qty": 1, "owner": "###@###.com", "item_code": "Field & Equipment Charges", "parenttype": "Sales Invoice", "parentfield": "items" }, { "cost_center": "Paintball Walk Ins - D9", "qty": 1, "owner": "###@###.com", "item_code": "Paintballs - 50", "parenttype": "Sales Invoice", "parentfield": "items" } ], "taxes": [ { "charge_type": "On Net Total", "description": "VAT 4% ", "parenttype": "Sales Invoice", "account_head": "VAT 4% - D9", "parentfield": "taxes", "included_in_print_rate": 1 }, { "charge_type": "On Net Total", "description": "Addl. VAT 1% ", "parenttype": "Sales Invoice", "account_head": "VAT (Addl) - D9", "parentfield": "taxes", "included_in_print_rate": 1 }, { "charge_type": "On Net Total", "description": "Service Tax 14% ", "parenttype": "Sales Invoice", "account_head": "Service Tax - D9", "parentfield": "taxes", "included_in_print_rate": 1 }, { "charge_type": "On Net Total", "description": "Swachh Bharat Cess 0.5% ", "parenttype": "Sales Invoice", "account_head": "Swachh Bharat Cess - D9", "parentfield": "taxes", "included_in_print_rate": 1 } ], "cash_bank_account": "Cash - D9", "is_pos": 1, "submit_on_creation": 1, "against_income_account": "Service - D9,Sales - D9", "party_account_currency": "INR", "owner": "###@###.com", "price_list_currency": "INR", "mode_of_payment": "Cash", "customer_name": "Retail Customer - From App", "update_stock": 1, "company": "### Management LLP", "customer": "Retail Customer - From App", "territory": "Vadodara", "is_opening": "No", "customer_group": "Paintball Operator", "naming_series": "R.#####", "currency": "INR", "debit_to": "Debtors - D9", "remarks": "POS - 100300162", "posting_date": "2016-07-02 04:22:07", "selling_price_list": "Walk In", "discount_amount": 100, "apply_discount_on": "Grand Total" }
The error we are getting is as below - Traceback (most recent call last): File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/app.py", line 60, in application response = frappe.api.handle() File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/api.py", line 115, in handle "data": frappe.get_doc(data).insert().as_dict() File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 212, in insert self.run_before_save_methods() File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 710, in run_before_save_methods self.run_method("validate") File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 661, in run_method return Document.hook(fn)(self, _args, _kwargs) File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 839, in composer return composed(self, method, _args, _kwargs) File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 822, in runner add_to_return_value(self, fn(self, _args, *_kwargs)) File "/home/frappe/benches/bench-2016-08-29/apps/frappe/frappe/model/document.py", line 655, in
fn = lambda self, args, _kwargs: getattr(self, method)(args, _kwargs) File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 53, in validate super(SalesInvoice, self).validate() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/selling_controller.py", line 32, in validate super(SellingController, self).validate() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/accounts_controller.py", line 35, in validate self.calculate_taxes_and_totals() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/accounts_controller.py", line 93, in calculate_taxes_and_totals calculate_taxes_and_totals(self) File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 16, in init self.calculate() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 27, in calculate self.calculate_total_advance() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 417, in calculate_total_advance self.calculate_outstanding_amount() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 424, in calculate_outstanding_amount self.calculate_paid_amount() File "/home/frappe/benches/bench-2016-08-29/apps/erpnext/erpnext/controllers/taxes_and_totals.py", line 456, in calculate_paid_amount payment.base_amount = flt(payment.amount * self.doc.conversion_rate) TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
Please help us with this on urgent basis.