frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.66k stars 7.29k forks source link

POS - Payment request failed, during Mpesa, Request for Payment #34505

Closed muchai closed 1 year ago

muchai commented 1 year ago

Information about bug

UnboundLocalError: local variable 'grand_total' referenced before assignment

Module

accounts, selling

Version

ERPNext: v14.18.3 (HEAD) Frappe Framework: v14.28.2 (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

request.js:457 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 66, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1607, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/handler.py", line 304, in run_doc_method
    response = doc.run_method(method)
  File "apps/frappe/frappe/model/document.py", line 914, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1264, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1246, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 911, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 578, in create_payment_request
    pay_req = self.get_new_payment_request(pay)
  File "apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 605, in get_new_payment_request
    return make_payment_request(**args)
  File "apps/erpnext/erpnext/accounts/doctype/payment_request/payment_request.py", line 408, in make_payment_request
    grand_total = get_amount(ref_doc, gateway_account.get("payment_account"))
  File "apps/erpnext/erpnext/accounts/doctype/payment_request/payment_request.py", line 512, in get_amount
    if grand_total > 0:
UnboundLocalError: local variable 'grand_total' referenced before assignment
muchai commented 1 year ago

This was Ok, till latest updates

akshatakulkarni25 commented 1 year ago

hey @muchai can i work on this issue

muchai commented 1 year ago

Hey @akshatakulkarni25 please do

deepeshgarg007 commented 1 year ago

@muchai Are you still facing this issue, please reopen if the issue still persists

muchai commented 1 year ago

@deepeshgarg007 This is fixed/Ok on std POS.