Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot issue return on POS Invoice when there is "Change Amount" #36772

Open
phalouvas opened this issue Aug 22, 2023 · 0 comments · May be fixed by #41482
Open

Cannot issue return on POS Invoice when there is "Change Amount" #36772

phalouvas opened this issue Aug 22, 2023 · 0 comments · May be fixed by #41482
Labels

Comments

@phalouvas
Copy link

Information about bug

When create a new POS invoice and the payment is not exact the invoice amount rather it has "Change Amount" when you issue a POS Invoice return you cannot save because of false amounts. See this quick video for clarification:

New.POS.Invoice.-.new-pos-invoice-1.and.4.more.pages.-.Personal.-.Microsoft.Edge.2023-08-22.15-32-05.mp4

I tried to check code for solution but is quite complicated. More specific the copy of the original invoice is done in file https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/sales_and_purchase_return.py function make_return_doc line 323

The code need to change to remove from payment the extra change amount.

I will try to change in code and include PR if I manage. Currently this bug makes the POS unusable.

Module

selling

Version

Frappe version - v14.45.0
Erpnext version - v14.35.2

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

172.21.0.1 - - [22/Aug/2023 12:32:40] "POST /api/method/erpnext.selling.page.point_of_sale.point_of_sale.get_pos_profile_data HTTP/1.1" 200 -
12:32:50 web.1      | Traceback (most recent call last):
12:32:50 web.1      |   File "apps/frappe/frappe/app.py", line 94, in application
12:32:50 web.1      |     response = frappe.api.handle()
12:32:50 web.1      |   File "apps/frappe/frappe/api.py", line 54, in handle
12:32:50 web.1      |     return frappe.handler.handle()
12:32:50 web.1      |   File "apps/frappe/frappe/handler.py", line 47, in handle
12:32:50 web.1      |     data = execute_cmd(cmd)
12:32:50 web.1      |   File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
12:32:50 web.1      |     return frappe.call(method, **frappe.form_dict)
12:32:50 web.1      |   File "apps/frappe/frappe/__init__.py", line 1620, in call
12:32:50 web.1      |     return fn(*args, **newargs)
12:32:50 web.1      |   File "apps/frappe/frappe/desk/form/save.py", line 28, in savedocs
12:32:50 web.1      |     doc.save()
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 305, in save
12:32:50 web.1      |     return self._save(*args, **kwargs)
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 327, in _save
12:32:50 web.1      |     return self.insert()
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 259, in insert
12:32:50 web.1      |     self.run_before_save_methods()
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 1051, in run_before_save_methods
12:32:50 web.1      |     self.run_method("validate")
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 915, in run_method
12:32:50 web.1      |     out = Document.hook(fn)(self, *args, **kwargs)
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 1277, in composer
12:32:50 web.1      |     return composed(self, method, *args, **kwargs)
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 1259, in runner
12:32:50 web.1      |     add_to_return_value(self, fn(self, *args, **kwargs))
12:32:50 web.1      |   File "apps/frappe/frappe/model/document.py", line 912, in fn
12:32:50 web.1      |     return method_object(*args, **kwargs)
12:32:50 web.1      |   File "apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 55, in validate
12:32:50 web.1      |     self.validate_payment_amount()
12:32:50 web.1      |   File "apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 371, in validate_payment_amount
12:32:50 web.1      |     frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
12:32:50 web.1      |   File "apps/frappe/frappe/__init__.py", line 534, in throw
12:32:50 web.1      |     msgprint(
12:32:50 web.1      |   File "apps/frappe/frappe/__init__.py", line 502, in msgprint
12:32:50 web.1      |     _raise_exception()
12:32:50 web.1      |   File "apps/frappe/frappe/__init__.py", line 451, in _raise_exception
12:32:50 web.1      |     raise raise_exception(msg)
12:32:50 web.1      | frappe.exceptions.ValidationError: Total payments amount can't be greater than 1.05
@phalouvas phalouvas added the bug label Aug 22, 2023
@Nihantra-Patel Nihantra-Patel linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

1 participant