Merge remote-tracking branch 'upstream/version-15-hotfix' into mergify/bp/version-15-hotfix/pr-41384

This commit is contained in:
barredterra
2024-06-20 14:27:08 +02:00
11 changed files with 37 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ import inspect
import frappe
__version__ = "15.22.2"
__version__ = "15.27.6"
def get_default_company(user=None):

View File

@@ -469,7 +469,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-03-15 12:11:36.085158",
"modified": "2024-05-11 23:19:44.673975",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",

View File

@@ -12,6 +12,7 @@ erpnext.buying.setup_buying_controller();
frappe.ui.form.on("Purchase Order", {
setup: function (frm) {
frm.ignore_doctypes_on_cancel_all = ["Unreconcile Payment", "Unreconcile Payment Entries"];
if (frm.doc.is_old_subcontracting_flow) {
frm.set_query("reserve_warehouse", "supplied_items", function () {
return {

View File

@@ -484,7 +484,13 @@ class PurchaseOrder(BuyingController):
self.auto_create_subcontracting_order()
def on_cancel(self):
self.ignore_linked_doctypes = ("GL Entry", "Payment Ledger Entry")
self.ignore_linked_doctypes = (
"GL Entry",
"Payment Ledger Entry",
"Unreconcile Payment",
"Unreconcile Payment Entries",
)
super().on_cancel()
if self.is_against_so():

View File

@@ -9,15 +9,13 @@ def execute():
dt = frappe.qb.DocType(doctype)
records = (
frappe.qb.from_(dt)
.select(dt.name, dt.notes, dt.modified_by, dt.modified)
.where(dt.notes.isnotnull() & dt.notes != "")
frappe.qb.from_(dt).select(dt.name, dt.notes).where(dt.notes.isnotnull() & dt.notes != "")
).run(as_dict=True)
for d in records:
if strip_html(cstr(d.notes)).strip():
doc = frappe.get_doc(doctype, d.name)
doc.append("notes", {"note": d.notes, "added_by": d.modified_by, "added_on": d.modified})
doc.append("notes", {"note": d.notes})
doc.update_child_table("notes")
frappe.db.sql_ddl(f"alter table `tab{doctype}` drop column `notes`")

View File

@@ -12,6 +12,7 @@
{% for(var i=0, l=notes.length; i<l; i++) { %}
<div class="comment-content p-3 row" name="{{ notes[i].name }}">
<div class="mb-2 head col-xs-3">
{% if (notes[i].added_by && notes[i].added_on) %}
<div class="row">
<div class="col-xs-2">
{{ frappe.avatar(notes[i].added_by) }}
@@ -25,6 +26,7 @@
</div>
</div>
</div>
{% } %}
</div>
<div class="content col-xs-8">
{{ notes[i].note }}

View File

@@ -227,7 +227,11 @@ frappe.ui.form.on("Sales Order", {
frm.set_value("advance_paid", 0);
}
frm.ignore_doctypes_on_cancel_all = ["Purchase Order"];
frm.ignore_doctypes_on_cancel_all = [
"Purchase Order",
"Unreconcile Payment",
"Unreconcile Payment Entries",
];
},
delivery_date: function (frm) {

View File

@@ -421,7 +421,13 @@ class SalesOrder(SellingController):
self.create_stock_reservation_entries()
def on_cancel(self):
self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry", "Payment Ledger Entry")
self.ignore_linked_doctypes = (
"GL Entry",
"Stock Ledger Entry",
"Payment Ledger Entry",
"Unreconcile Payment",
"Unreconcile Payment Entries",
)
super().on_cancel()
# Cannot cancel closed SO

View File

@@ -77,7 +77,7 @@ class RepostItemValuation(Document):
def validate_period_closing_voucher(self):
# Period Closing Voucher
year_end_date = self.get_max_year_end_date(self.company)
year_end_date = self.get_max_period_closing_date(self.company)
if year_end_date and getdate(self.posting_date) <= getdate(year_end_date):
date = frappe.format(year_end_date, "Date")
msg = f"Due to period closing, you cannot repost item valuation before {date}"
@@ -120,24 +120,16 @@ class RepostItemValuation(Document):
return frappe.get_all("Closing Stock Balance", fields=["name", "to_date"], filters=filters)
@staticmethod
def get_max_year_end_date(company):
data = frappe.get_all(
"Period Closing Voucher", fields=["fiscal_year"], filters={"docstatus": 1, "company": company}
)
if not data:
return
fiscal_years = [d.fiscal_year for d in data]
table = frappe.qb.DocType("Fiscal Year")
def get_max_period_closing_date(company):
table = frappe.qb.DocType("Period Closing Voucher")
query = (
frappe.qb.from_(table)
.select(Max(table.year_end_date))
.where((table.name.isin(fiscal_years)) & (table.disabled == 0))
.select(Max(table.posting_date))
.where((table.company == company) & (table.docstatus == 1))
).run()
return query[0][0] if query else None
return query[0][0] if query and query[0][0] else None
def validate_accounts_freeze(self):
acc_settings = frappe.db.get_value(

View File

@@ -41,7 +41,7 @@ frappe.ui.form.on("Stock Settings", {
msg += " ";
msg += __("This is considered dangerous from accounting point of view.");
msg += "<br>";
msg += "Do you still want to enable negative inventory?";
msg += __("Do you still want to enable negative inventory?");
frappe.confirm(
msg,

View File

@@ -137,6 +137,10 @@ class StockBalanceReport:
report_data.update(
{"reserved_stock": sre_details.get((report_data.item_code, report_data.warehouse), 0.0)}
)
if report_data and report_data.bal_qty == 0 and report_data.bal_val == 0:
continue
self.data.append(report_data)
def get_item_warehouse_map(self):