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

Accounts Settings: Automatically fetch payment terms from Order --> Raises Error #35127

Closed
vorasmit opened this issue May 2, 2023 · 0 comments · Fixed by #35285
Closed

Accounts Settings: Automatically fetch payment terms from Order --> Raises Error #35127

vorasmit opened this issue May 2, 2023 · 0 comments · Fixed by #35285
Assignees

Comments

@vorasmit
Copy link
Collaborator

vorasmit commented May 2, 2023

Information about bug

When partial items are billed from Order to Invoice, the Payment terms template still uses the amount as per order resulting in below issue:

Link to function fetch_payment_terms_from_order from the accounts controller.

def fetch_payment_terms_from_order(self, po_or_so, po_or_so_doctype):

Module

accounts

Version

Frappe Framework: v14.34.0 (version-14)
ERPNext: v14.23.0 (version-14)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

quest.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/desk/form/save.py", line 26, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 305, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 339, in _save
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1045, in run_before_save_methods
    self.run_method("validate")
  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/sales_invoice/sales_invoice.py", line 89, in validate
    super(SalesInvoice, self).validate()
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 32, in validate
    super(SellingController, self).validate()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 45, in validate
    super(StockController, self).validate()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 166, in validate
    self.validate_all_documents_schedule()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 288, in validate_all_documents_schedule
    self.validate_invoice_documents_schedule()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 277, in validate_invoice_documents_schedule
    self.validate_payment_schedule_amount()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 1821, in validate_payment_schedule_amount
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 525, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 493, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 442, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Total Payment Amount in Payment Schedule must be equal to Grand / Rounded Total
@vorasmit vorasmit added the bug label May 2, 2023
@ruthra-kumar ruthra-kumar self-assigned this May 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants