Merge pull request #35118 from rohitwaghchaure/fixed-don-not-allow-to-repost-valuation
fix: don't allow to make reposting for the closed period
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
index 88f1c90..5ebdf61 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
@@ -2,6 +2,21 @@
// For license information, please see license.txt
frappe.ui.form.on("Journal Entry Template", {
+ onload: function(frm) {
+ if(frm.is_new()) {
+ frappe.call({
+ type: "GET",
+ method: "erpnext.accounts.doctype.journal_entry_template.journal_entry_template.get_naming_series",
+ callback: function(r){
+ if(r.message) {
+ frm.set_df_property("naming_series", "options", r.message.split("\n"));
+ frm.set_value("naming_series", r.message.split("\n")[0]);
+ frm.refresh_field("naming_series");
+ }
+ }
+ });
+ }
+ },
refresh: function(frm) {
frappe.model.set_default_values(frm.doc);
@@ -19,18 +34,6 @@
return { filters: filters };
});
-
- frappe.call({
- type: "GET",
- method: "erpnext.accounts.doctype.journal_entry_template.journal_entry_template.get_naming_series",
- callback: function(r){
- if(r.message){
- frm.set_df_property("naming_series", "options", r.message.split("\n"));
- frm.set_value("naming_series", r.message.split("\n")[0]);
- frm.refresh_field("naming_series");
- }
- }
- });
},
voucher_type: function(frm) {
var add_accounts = function(doc, r) {
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html
index b9680df..03abc93 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html
@@ -15,7 +15,12 @@
</div>
<h2 class="text-center">{{ _("STATEMENTS OF ACCOUNTS") }}</h2>
<div>
- <h5 style="float: left;">{{ _("Customer: ") }} <b>{{filters.party_name[0] }}</b></h5>
+ {% if filters.party[0] == filters.party_name[0] %}
+ <h5 style="float: left;">{{ _("Customer: ") }} <b>{{ filters.party_name[0] }}</b></h5>
+ {% else %}
+ <h5 style="float: left;">{{ _("Customer: ") }} <b>{{ filters.party[0] }}</b></h5>
+ <h5 style="float: left; margin-left:15px">{{ _("Customer Name: ") }} <b>{{filters.party_name[0] }}</b></h5>
+ {% endif %}
<h5 style="float: right;">
{{ _("Date: ") }}
<b>{{ frappe.format(filters.from_date, 'Date')}}
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
index 16602d3..e23620f 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
@@ -36,6 +36,8 @@
"terms_and_conditions",
"section_break_1",
"enable_auto_email",
+ "column_break_ocfq",
+ "sender",
"section_break_18",
"frequency",
"filter_duration",
@@ -298,10 +300,20 @@
"fieldname": "show_net_values_in_party_account",
"fieldtype": "Check",
"label": "Show Net Values in Party Account"
+ },
+ {
+ "fieldname": "sender",
+ "fieldtype": "Link",
+ "label": "Sender",
+ "options": "Email Account"
+ },
+ {
+ "fieldname": "column_break_ocfq",
+ "fieldtype": "Column Break"
}
],
"links": [],
- "modified": "2022-11-10 17:44:17.165991",
+ "modified": "2023-04-26 12:46:43.645455",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Process Statement Of Accounts",
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
index a482931..b36f33b 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
@@ -334,7 +334,7 @@
queue="short",
method=frappe.sendmail,
recipients=recipients,
- sender=frappe.session.user,
+ sender=doc.sender or frappe.session.user,
cc=cc,
subject=subject,
message=message,
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.json b/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.json
index 8bffd6a..1749d72 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.json
+++ b/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.json
@@ -27,7 +27,7 @@
},
{
"fieldname": "billing_email",
- "fieldtype": "Read Only",
+ "fieldtype": "Data",
"in_list_view": 1,
"label": "Billing Email"
},
@@ -41,7 +41,7 @@
],
"istable": 1,
"links": [],
- "modified": "2023-03-13 00:12:34.508086",
+ "modified": "2023-04-26 13:02:41.964499",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Process Statement Of Accounts Customer",
diff --git a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
index 0213328..8426ed4 100644
--- a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
+++ b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
@@ -150,7 +150,9 @@
if d.depreciation_method in ("Straight Line", "Manual"):
end_date = max(s.schedule_date for s in depr_schedule)
total_days = date_diff(end_date, self.date)
- rate_per_day = flt(d.value_after_depreciation) / flt(total_days)
+ rate_per_day = flt(d.value_after_depreciation - d.expected_value_after_useful_life) / flt(
+ total_days
+ )
from_date = self.date
else:
no_of_depreciations = len([s.name for s in depr_schedule if not s.journal_entry])
diff --git a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
index de96a6c..38e0585 100644
--- a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
+++ b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
@@ -69,7 +69,7 @@
"label": _("Id"),
"fieldname": "name",
"fieldtype": "Link",
- "options": "Work Order",
+ "options": "Quality Inspection",
"width": 100,
},
{"label": _("Report Date"), "fieldname": "report_date", "fieldtype": "Date", "width": 150},
diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py
index 40a1851..f47e730 100644
--- a/erpnext/patches/v14_0/update_closing_balances.py
+++ b/erpnext/patches/v14_0/update_closing_balances.py
@@ -26,7 +26,15 @@
pcv_doc.year_start_date = get_fiscal_year(
pcv.posting_date, pcv.fiscal_year, company=pcv.company
)[1]
- gl_entries = pcv_doc.get_gl_entries()
+
+ gl_entries = frappe.db.get_all(
+ "GL Entry", filters={"voucher_no": pcv.name, "is_cancelled": 0}, fields=["*"]
+ )
+ for entry in gl_entries:
+ entry["is_period_closing_voucher_entry"] = 1
+ entry["closing_date"] = pcv_doc.posting_date
+ entry["period_closing_voucher"] = pcv_doc.name
+
closing_entries = pcv_doc.get_grouped_gl_entries(get_opening_entries=get_opening_entries)
make_closing_entries(gl_entries + closing_entries, voucher_name=pcv.name)
company_wise_order[pcv.company].append(pcv.posting_date)
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index ce85702..f3adefb 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -1508,11 +1508,15 @@
elif args.get("against_sales_invoice"):
sales_order = frappe.db.get_all(
"Sales Invoice Item",
- filters={"parent": args.get("against_sales_invoice"), "item_code": args.get("item_code")},
+ filters={
+ "parent": args.get("against_sales_invoice"),
+ "item_code": args.get("item_code"),
+ "docstatus": 1,
+ },
fields="sales_order",
)
if sales_order and sales_order[0]:
- if get_reserved_qty_for_so(sales_order[0][0], args.get("item_code")):
+ if get_reserved_qty_for_so(sales_order[0].sales_order, args.get("item_code")):
reserved_so = sales_order[0]
elif args.get("sales_order"):
if get_reserved_qty_for_so(args.get("sales_order"), args.get("item_code")):