Jatin3128 eeb3cd238e fix(subscription): don't reactivate a cancelled subscription (backport #57774)
* fix(subscription): don't reactivate a cancelled subscription

Backport of #57774 to version-16-hotfix.

set_subscription_status() unconditionally set status to Active once
there was no outstanding invoice, even if the subscription had been
intentionally cancelled. Paying off an invoice issued before
cancellation (directly, or via the Payment Entry -> refresh hook)
flipped a Cancelled subscription back to Active while cancelation_date
stayed set.

process()'s cancel_at_period_end check compared posting_date against
getdate(self.end_date), and getdate(None) returns today, so an empty
end_date was silently treated as "cancel now" on every scheduler run.
Combined with the reactivation bug, this let a cancelled subscription
toggle Cancelled -> Active on each run and generate another invoice at
the next period boundary.

Fixes #57761

* test: fix flaky test_update_bom_cost_in_all_boms via valuation reset

Backport of #56796 to version-16-hotfix.

reset_item_valuation_rate() only reconciled warehouses where the item
currently has positive stock (actual_qty > 0). get_valuation_rate()
averages Sum(stock_value)/Sum(actual_qty) across all of an item's
bins, so a negative balance left over in another warehouse by a prior
test can cancel out the reset qty and collapse the average to 0,
failing the assertion with 0.0 != 10.0.

This branch never got #56796 (it predates the frappe.get_all
refactor of this helper and still uses raw SQL), so applying the same
fix here: reconcile every warehouse with a non-zero balance, not just
positive ones.

* fix(subscription): don't let period rollover defeat cancel_at_period_end

process() can advance current_invoice_end to the next period (via
update_subscription_period(), when generating the current period's
invoice) before the cancel_at_period_end check further down runs. For
a subscription with no end_date, that check now compared posting_date
against the already-rolled-forward current_invoice_end, which is
always in the future, so cancel_at_period_end was silently never
honored.

Snapshot current_invoice_end before any rollover and use that in the
check instead, so it still targets the period that just ended.

Found via review on the version-15-hotfix backport (#57780).

---------

Co-authored-by: test <test@test.com>
2026-08-05 12:23:31 +05:30
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-01-21 10:13:32 +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
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

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 even more ad-hoc activities. 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 perishment, IT infrastructure to equipment. Cover every branch of your organization, all in one centralized system.
  • Projects: Delivery 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 with peace of mind.

It takes care of 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

Prerequisites: docker, docker-compose, git. Refer Docker Documentation for more details on Docker setup.

Run following commands:

git clone https://github.com/frappe/frappe_docker
cd frappe_docker
docker compose -f pwd.yml up -d

After a couple of minutes, site should be accessible on your localhost port: 8080. Use below default login credentials to access the site.

  • 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 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.5%
JavaScript 14.3%
TypeScript 4.9%
HTML 1.8%
SCSS 0.3%
Other 0.2%