mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-26 22:52:10 +01:00
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com> Co-authored-by: Henning Wendtland <156231187+HenningWendtland@users.noreply.github.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
"role_to_override_stop_action",
|
"role_to_override_stop_action",
|
||||||
"column_break_15",
|
"column_break_15",
|
||||||
"maintain_same_sales_rate",
|
"maintain_same_sales_rate",
|
||||||
|
"fallback_to_default_price_list",
|
||||||
"editable_price_list_rate",
|
"editable_price_list_rate",
|
||||||
"validate_selling_price",
|
"validate_selling_price",
|
||||||
"editable_bundle_item_rates",
|
"editable_bundle_item_rates",
|
||||||
@@ -216,6 +217,12 @@
|
|||||||
"fieldname": "allow_zero_qty_in_quotation",
|
"fieldname": "allow_zero_qty_in_quotation",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Allow Quotation with Zero Quantity"
|
"label": "Allow Quotation with Zero Quantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "fallback_to_default_price_list",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Use Prices from Default Price List as Fallback"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grid_page_length": 50,
|
"grid_page_length": 50,
|
||||||
@@ -224,7 +231,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-05-06 15:23:14.332971",
|
"modified": "2025-09-23 21:10:14.826653",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Selling Settings",
|
"name": "Selling Settings",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe import _
|
||||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import cint
|
from frappe.utils import cint
|
||||||
@@ -33,6 +34,7 @@ class SellingSettings(Document):
|
|||||||
editable_bundle_item_rates: DF.Check
|
editable_bundle_item_rates: DF.Check
|
||||||
editable_price_list_rate: DF.Check
|
editable_price_list_rate: DF.Check
|
||||||
enable_discount_accounting: DF.Check
|
enable_discount_accounting: DF.Check
|
||||||
|
fallback_to_default_price_list: DF.Check
|
||||||
hide_tax_id: DF.Check
|
hide_tax_id: DF.Check
|
||||||
maintain_same_rate_action: DF.Literal["Stop", "Warn"]
|
maintain_same_rate_action: DF.Literal["Stop", "Warn"]
|
||||||
maintain_same_sales_rate: DF.Check
|
maintain_same_sales_rate: DF.Check
|
||||||
@@ -69,6 +71,25 @@ class SellingSettings(Document):
|
|||||||
hide_name_field=False,
|
hide_name_field=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.validate_fallback_to_default_price_list()
|
||||||
|
|
||||||
|
def validate_fallback_to_default_price_list(self):
|
||||||
|
if (
|
||||||
|
self.fallback_to_default_price_list
|
||||||
|
and self.has_value_changed("fallback_to_default_price_list")
|
||||||
|
and frappe.get_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing")
|
||||||
|
):
|
||||||
|
stock_meta = frappe.get_meta("Stock Settings")
|
||||||
|
frappe.msgprint(
|
||||||
|
_(
|
||||||
|
"You have enabled {0} and {1} in {2}. This can lead to prices from the default price list being inserted into the transaction price list."
|
||||||
|
).format(
|
||||||
|
"<i>{}</i>".format(_(self.meta.get_label("fallback_to_default_price_list"))),
|
||||||
|
"<i>{}</i>".format(_(stock_meta.get_label("auto_insert_price_list_rate_if_missing"))),
|
||||||
|
frappe.bold(_("Stock Settings")),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def toggle_hide_tax_id(self):
|
def toggle_hide_tax_id(self):
|
||||||
self.hide_tax_id = cint(self.hide_tax_id)
|
self.hide_tax_id = cint(self.hide_tax_id)
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class StockSettings(Document):
|
|||||||
self.validate_clean_description_html()
|
self.validate_clean_description_html()
|
||||||
self.validate_pending_reposts()
|
self.validate_pending_reposts()
|
||||||
self.validate_stock_reservation()
|
self.validate_stock_reservation()
|
||||||
|
self.validate_auto_insert_price_list_rate_if_missing()
|
||||||
self.change_precision_for_for_sales()
|
self.change_precision_for_for_sales()
|
||||||
self.change_precision_for_purchase()
|
self.change_precision_for_purchase()
|
||||||
|
|
||||||
@@ -219,6 +220,23 @@ class StockSettings(Document):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def validate_auto_insert_price_list_rate_if_missing(self):
|
||||||
|
if (
|
||||||
|
self.auto_insert_price_list_rate_if_missing
|
||||||
|
and self.has_value_changed("auto_insert_price_list_rate_if_missing")
|
||||||
|
and frappe.get_single_value("Selling Settings", "fallback_to_default_price_list")
|
||||||
|
):
|
||||||
|
selling_meta = frappe.get_meta("Selling Settings")
|
||||||
|
frappe.msgprint(
|
||||||
|
_(
|
||||||
|
"You have enabled {0} and {1} in {2}. This can lead to prices from the default price list being inserted in the transaction price list."
|
||||||
|
).format(
|
||||||
|
"<i>{}</i>".format(_(self.meta.get_label("auto_insert_price_list_rate_if_missing"))),
|
||||||
|
"<i>{}</i>".format(_(selling_meta.get_label("fallback_to_default_price_list"))),
|
||||||
|
frappe.bold(_("Selling Settings")),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
self.toggle_warehouse_field_for_inter_warehouse_transfer()
|
self.toggle_warehouse_field_for_inter_warehouse_transfer()
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,15 @@ def get_item_details(args, doc=None, for_validate=False, overwrite_warehouse=Tru
|
|||||||
|
|
||||||
out.update(get_price_list_rate(args, item))
|
out.update(get_price_list_rate(args, item))
|
||||||
|
|
||||||
|
if (
|
||||||
|
not out.price_list_rate
|
||||||
|
and args.transaction_type == "selling"
|
||||||
|
and frappe.get_single_value("Selling Settings", "fallback_to_default_price_list")
|
||||||
|
):
|
||||||
|
fallback_args = args.copy()
|
||||||
|
fallback_args.price_list = frappe.get_single_value("Selling Settings", "selling_price_list")
|
||||||
|
out.update(get_price_list_rate(fallback_args, item))
|
||||||
|
|
||||||
args.customer = current_customer
|
args.customer = current_customer
|
||||||
|
|
||||||
if args.customer and cint(args.is_pos):
|
if args.customer and cint(args.is_pos):
|
||||||
|
|||||||
Reference in New Issue
Block a user