Mihir Kandoi 28bd1332de fix(accounts): stop counting received qty on non-stock invoice returns (#58924)
* fix(accounts): skip received/rejected qty checks on non-stock return

A Purchase Invoice without Update Stock writes no Stock Ledger Entry, so
received_qty and rejected_qty on its rows move no stock and bill no
amount. The server never derives or validates them either:
validate_accepted_rejected_qty only runs when update_stock is set.

validate_quantity still counted both columns against the source invoice.
Whatever value the form last wrote to the read-only received_qty was
tallied as returned, so a partial return that lowered qty locked out the
rest of the invoice with StockOverReturnError.

Restrict the two columns to documents that actually carry an
accepted/rejected split: Purchase Receipt, Subcontracting Receipt, and a
Purchase Invoice with Update Stock. qty stays validated in every case, so
the billed quantity is still capped at what the source invoice billed.

* test(accounts): cover partial returns of a non-stock invoice

Fails before the previous commit with StockOverReturnError on the second
return, because the stale received_qty carried by the first return is
tallied as a full return of the invoice.

* refactor(accounts): pass frm into the Purchase Invoice hide_fields

hide_fields took a doc but reached for cur_frm to get the grid and to
refresh, so it only worked on whichever form happened to be current. Take
frm instead: all three callers already have one.

frm.toggle_display replaces the hide_field / unhide_field globals, which
resolve the docfield through cur_frm the same way. var becomes let/const.

No change in behaviour.

* fix(accounts): hide stock columns without Update Stock

Received Qty, Rejected Qty and the warehouse section were shown on any
return, including one that updates no stock. received_qty is read-only
there and rejected_qty moves neither stock nor billed amount, so the grid
offered values the user could not correct and the form could not keep in
step with qty.

Show the group only when the invoice updates stock, matching an ordinary
Purchase Invoice. Nothing on these rows needs a warehouse either:
validate_warehouse only checks the warehouses that are set.
2026-09-09 08:55:35 +00:00
2024-08-28 21:00:09 +02:00
2024-03-10 19:45:18 +05:30
2022-03-30 12:36:09 +05:30
2026-05-09 23:14:58 +05:30
2022-04-18 16:45:01 +05:30
2018-07-19 17:47:04 +05:30
2017-07-01 21:35:10 +05:30
2024-03-10 19:45:40 +05:30
2026-08-26 11:38:01 +00:00
2026-05-09 23:14:58 +05:30
2026-03-03 10:36:54 +05:30
2021-03-17 20:06:35 +05:30

ERPNext Logo

ERPNext

Powerful, Intuitive and Open-Source ERP

Learn on Frappe School

CI docker pulls

ERPNext Hero Image

ERPNext

100% Open-Source ERP System to help you run your business.

Motivation

Running a business is a complex task - handling invoices, tracking stock, managing personnel, and other daily operations. In a market where software is sold separately to manage each of these tasks, ERPNext does all of the above and more, for free.

Key Features

  • Accounting: All the tools you need to manage cash flow in one place, right from recording transactions to summarizing and analyzing financial reports.
  • Order Management: Track inventory levels, replenish stock, and manage sales orders, customers, suppliers, shipments, deliverables, and order fulfillment.
  • Manufacturing: Simplifies the production cycle, helps track material consumption, exhibits capacity planning, handles subcontracting, and more!
  • Asset Management: From purchase to disposal, IT infrastructure to equipment. Covers every branch of your organization, all in one centralized system.
  • Projects: Deliver both internal and external projects on time, budget and profitability. Track tasks, timesheets, and issues by project.
More

Under the Hood

  • Frappe Framework: A full-stack web application framework written in Python and JavaScript. The framework provides a robust foundation for building web applications, including a database abstraction layer, user authentication, and a REST API.

  • Frappe UI: A Vue-based UI library, to provide a modern user interface. The Frappe UI library provides a variety of components that can be used to build single-page applications on top of the Frappe Framework.

Production Setup

Managed Hosting

You can try Frappe Cloud, a simple, user-friendly, and sophisticated open-source platform to host Frappe applications reliably and securely.

It handles installation, setup, upgrades, monitoring, maintenance, and support of your Frappe deployments. It is a fully featured developer platform with an ability to manage and control multiple Frappe deployments.

Self-Hosted

Docker

See Frappe Docker Documentation for full documentation & FAQ on Docker setup

Prerequisites

For Docker basics and best practices refer to Docker's documentation

Try on your environment

⚠️ Disposable demo only

This setup is intended for quick evaluation. Expect to throw the environment away. You will not be able to install custom apps to this setup. For production deployments, custom configurations, and detailed explanations, see the full documentation.

First clone the repo:

git clone https://github.com/frappe/frappe_docker
cd frappe_docker

Then run:

docker compose -f pwd.yml up -d

Wait for a couple of minutes for ERPNext site to be created or check the create-site container logs before opening browser on port 8080. (username: Administrator, password: admin)

See Frappe Docker for ARM based docker setup

Development Setup

Manual Install

The Easy Way: our install script for bench will install all dependencies (e.g. MariaDB). See https://github.com/frappe/bench for more details.

New passwords will be created for the ERPNext "Administrator" user, the MariaDB root user, and the Frappe user (the script displays the passwords and saves them to ~/frappe_passwords.txt).

Local

To setup the repository locally follow the steps mentioned below:

  1. Setup bench by following the Installation Steps and start the server

    bench start
    
  2. In a separate terminal window, run the following commands:

    # Create a new site
    bench new-site erpnext.localhost
    
  3. Get the ERPNext app and install it

    # Get the ERPNext app
    bench get-app https://github.com/frappe/erpnext
    
    # Install the app
    bench --site erpnext.localhost install-app erpnext
    
  4. Open the URL http://erpnext.localhost:8000/app in your browser, you should see the app running

Learning and Community

  1. Frappe School - Learn Frappe Framework and ERPNext from the various courses by the maintainers or from the community.
  2. Official documentation - Extensive documentation for ERPNext.
  3. Discussion Forum - Engage with the community of ERPNext users and service providers.
  4. Telegram Group - Get instant help from huge community of users.

Contributing

  1. Issue Guidelines
  2. Report Security Vulnerabilities
  3. Pull Request Requirements
  4. Translations

Logo and Trademark Policy

Please read our Logo and Trademark Policy.



Languages
Python 78.6%
JavaScript 14.4%
TypeScript 4.7%
HTML 1.7%
SCSS 0.3%
Other 0.3%