There have been several bugs raised and fixes implemented to try to fix "Maintain Same Rate" Settings but none of them actually address the issue, which is major.
The problem is that validation of a transaction triggers set_missing_values in the Accounts Controller.
This effectively triggers recalculation of the whole document including running pricing rules. So if, for example, you have imported lines from various Sales Orders to a Delivery Note, the whole Delivery Note will be recalculated. This includes manually modified lines. So if there are pricing rules or price lists, the document changes. Then your Sales Invoice is also wrong.
So what needs to happen is this:
Importing lines from a document which has been manually created or ignore_pricing_rule is set, also means this flag needs to ALWAYS be set on the created document;
maintain_same_sales_rate on both Selling and Buying needs to ensure set_missing_values is never run, and/or ignore_pricing_rule is ALWAYS enabled on child documents;
To reproduce:
Ensure Selling Settings: Maintain Same Rate throughout... is set
Create Items
Create Price Lists
Create Pricing Rules
Create 2 Sales Orders using items with price lists and pricing rules for the SAME customer: enable ignore pricing rule on ONE of them and manually adjust pricing
Create a Delivery Note from the Sales Order where ignore pricing rule is SET, do not save
Import the lines from Sales Order where ignore pricing rule is NOT SET
Note: ignore pricing rule is no longer set
Save Delivery Note
Manual pricing has now changed to match price lists and pricing rules
Information about bug
There have been several bugs raised and fixes implemented to try to fix "Maintain Same Rate" Settings but none of them actually address the issue, which is major.
The problem is that validation of a transaction triggers
set_missing_values
in theAccounts Controller
.https://github.com/frappe/erpnext/blob/5442487b6c6b88cbc9364d7304a97ab8afdb13be/erpnext/controllers/accounts_controller.py#L180
This effectively triggers recalculation of the whole document including running pricing rules. So if, for example, you have imported lines from various Sales Orders to a Delivery Note, the whole Delivery Note will be recalculated. This includes manually modified lines. So if there are pricing rules or price lists, the document changes. Then your Sales Invoice is also wrong.
So what needs to happen is this:
ignore_pricing_rule
is set, also means this flag needs to ALWAYS be set on the created document;maintain_same_sales_rate
on both Selling and Buying needs to ensureset_missing_values
is never run, and/orignore_pricing_rule
is ALWAYS enabled on child documents;To reproduce:
Maintain Same Rate throughout...
is set@deepeshgarg007 @tundebabzy @rohitwaghchaure @rtdany10 @Nihantra-Patel
Related:
40159
https://github.com/frappe/erpnext/pull/32923 https://github.com/frappe/erpnext/issues/35528 https://github.com/frappe/erpnext/issues/35485
Module
accounts, buying, selling
Version
ERPNext v13 onwards
Installation method
None
Relevant log output / Stack trace / Full Error Message.
No response