Merge pull request #38159 from ruthra-kumar/provision_to_truncate_remarks
refactor: provision to truncate `remarks` in General Ledger and Accounts Receivable/Payable reports
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index b3ae627..9a6f8ec 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -853,6 +853,7 @@
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
} else if (in_list(["Customer", "Supplier"], frm.doc.party_type)) {
+ total_negative_outstanding = flt(total_negative_outstanding, precision("outstanding_amount"))
if(paid_amount > total_negative_outstanding) {
if(total_negative_outstanding == 0) {
frappe.msgprint(
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 5a41336..017bfa9 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -789,6 +789,28 @@
w = self.make()
self.assertEqual(w.outstanding_amount, w.base_rounded_total)
+ def test_rounded_total_with_cash_discount(self):
+ si = frappe.copy_doc(test_records[2])
+
+ item = copy.deepcopy(si.get("items")[0])
+ item.update(
+ {
+ "qty": 1,
+ "rate": 14960.66,
+ }
+ )
+
+ si.set("items", [item])
+ si.set("taxes", [])
+ si.apply_discount_on = "Grand Total"
+ si.is_cash_or_non_trade_discount = 1
+ si.discount_amount = 1
+ si.insert()
+
+ self.assertEqual(si.grand_total, 14959.66)
+ self.assertEqual(si.rounded_total, 14960)
+ self.assertEqual(si.rounding_adjustment, 0.34)
+
def test_payment(self):
w = self.make()
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 371474e..5c18e50 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -236,7 +236,9 @@
if shipping_address:
party_details.update(
shipping_address=shipping_address,
- shipping_address_display=render_address(shipping_address),
+ shipping_address_display=render_address(
+ shipping_address, check_permissions=not ignore_permissions
+ ),
**get_fetch_values(doctype, "shipping_address", shipping_address)
)
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index ad1aa2b..1891261 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -20,6 +20,10 @@
"valid_till",
"quotation_number",
"amended_from",
+ "accounting_dimensions_section",
+ "cost_center",
+ "dimension_col_break",
+ "project",
"currency_and_price_list",
"currency",
"conversion_rate",
@@ -896,6 +900,27 @@
"fieldtype": "Small Text",
"label": "Billing Address Details",
"read_only": 1
+ },
+ {
+ "fieldname": "cost_center",
+ "fieldtype": "Link",
+ "label": "Cost Center",
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "project",
+ "fieldtype": "Link",
+ "label": "Project",
+ "options": "Project"
+ },
+ {
+ "fieldname": "dimension_col_break",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "accounting_dimensions_section",
+ "fieldtype": "Section Break",
+ "label": "Accounting Dimensions"
}
],
"icon": "fa fa-shopping-cart",
@@ -903,7 +928,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2023-11-03 13:21:40.172508",
+ "modified": "2023-11-17 12:34:30.083077",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation",
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
index 4bbcacf..a6229b5 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -68,6 +68,8 @@
"column_break_15",
"manufacturer_part_no",
"ad_sec_break",
+ "cost_center",
+ "dimension_col_break",
"project",
"section_break_44",
"page_break"
@@ -133,7 +135,6 @@
"fieldtype": "Column Break"
},
{
- "fetch_from": "item_code.image",
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -554,13 +555,23 @@
"fieldname": "expected_delivery_date",
"fieldtype": "Date",
"label": "Expected Delivery Date"
+ },
+ {
+ "fieldname": "cost_center",
+ "fieldtype": "Link",
+ "label": "Cost Center",
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "dimension_col_break",
+ "fieldtype": "Column Break"
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2023-11-14 18:35:03.435817",
+ "modified": "2023-11-17 12:25:26.235367",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 96284d6..f9f68a1 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -54,6 +54,7 @@
if self.doc.apply_discount_on == "Grand Total" and self.doc.get("is_cash_or_non_trade_discount"):
self.doc.grand_total -= self.doc.discount_amount
self.doc.base_grand_total -= self.doc.base_discount_amount
+ self.doc.rounding_adjustment = self.doc.base_rounding_adjustment = 0.0
self.set_rounded_total()
self.calculate_shipping_charges()
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 5483a10..55ffaca 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -539,6 +539,8 @@
"Subcontracting Receipt",
"Subcontracting Receipt Item",
"Account Closing Balance",
+ "Supplier Quotation",
+ "Supplier Quotation Item",
]
get_matching_queries = (
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 0aeadce..6c10dd9 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -350,5 +350,6 @@
erpnext.patches.v15_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month
erpnext.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based
erpnext.patches.v15_0.set_reserved_stock_in_bin
+erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation
# below migration patch should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
diff --git a/erpnext/patches/v14_0/create_accounting_dimensions_in_supplier_quotation.py b/erpnext/patches/v14_0/create_accounting_dimensions_in_supplier_quotation.py
new file mode 100644
index 0000000..6966db1
--- /dev/null
+++ b/erpnext/patches/v14_0/create_accounting_dimensions_in_supplier_quotation.py
@@ -0,0 +1,8 @@
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ create_accounting_dimensions_for_doctype,
+)
+
+
+def execute():
+ create_accounting_dimensions_for_doctype(doctype="Supplier Quotation")
+ create_accounting_dimensions_for_doctype(doctype="Supplier Quotation Item")
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 6b613ce..d24c4e6 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -43,6 +43,9 @@
if (this.frm.doc.apply_discount_on == "Grand Total" && this.frm.doc.is_cash_or_non_trade_discount) {
this.frm.doc.grand_total -= this.frm.doc.discount_amount;
this.frm.doc.base_grand_total -= this.frm.doc.base_discount_amount;
+ this.frm.doc.rounding_adjustment = 0;
+ this.frm.doc.base_rounding_adjustment = 0;
+ this.set_rounded_total();
}
await this.calculate_shipping_charges();
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 459fc9f..88ed1c6 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -629,8 +629,12 @@
"is_primary_contact": is_primary_contact,
"links": [{"link_doctype": args.get("doctype"), "link_name": args.get("name")}],
}
- if args.customer_type == "Individual":
- first, middle, last = parse_full_name(args.get("customer_name"))
+
+ party_type = args.customer_type if args.doctype == "Customer" else args.supplier_type
+ party_name_key = "customer_name" if args.doctype == "Customer" else "supplier_name"
+
+ if party_type == "Individual":
+ first, middle, last = parse_full_name(args.get(party_name_key))
values.update(
{
"first_name": first,
@@ -641,9 +645,10 @@
else:
values.update(
{
- "company_name": args.get("customer_name"),
+ "company_name": args.get(party_name_key),
}
)
+
contact = frappe.get_doc(values)
if args.get("email_id"):
@@ -672,10 +677,12 @@
title=_("Missing Values Required"),
)
+ party_name_key = "customer_name" if args.doctype == "Customer" else "supplier_name"
+
address = frappe.get_doc(
{
"doctype": "Address",
- "address_title": args.get("customer_name"),
+ "address_title": args.get(party_name_key),
"address_line1": args.get("address_line1"),
"address_line2": args.get("address_line2"),
"city": args.get("city"),
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index c13d3eb..13f3be8 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -504,7 +504,7 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Variant Attributes",
- "mandatory_depends_on": "has_variants",
+ "mandatory_depends_on": "eval:(doc.has_variants || doc.variant_of) && doc.variant_based_on==='Item Attribute'",
"options": "Item Variant Attribute"
},
{
@@ -888,7 +888,7 @@
"index_web_pages_for_search": 1,
"links": [],
"make_attachments_public": 1,
- "modified": "2023-09-11 13:46:32.688051",
+ "modified": "2023-09-18 15:41:32.688051",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py
index ab47b4a..a53a9f2 100644
--- a/erpnext/stock/report/item_prices/item_prices.py
+++ b/erpnext/stock/report/item_prices/item_prices.py
@@ -202,7 +202,7 @@
bin_data = (
frappe.qb.from_(bin)
.select(
- bin.item_code, Sum(bin.actual_qty * bin.valuation_rate) / Sum(bin.actual_qty).as_("val_rate")
+ bin.item_code, (Sum(bin.actual_qty * bin.valuation_rate) / Sum(bin.actual_qty)).as_("val_rate")
)
.where(bin.actual_qty > 0)
.groupby(bin.item_code)