Merge branch 'frappe:develop' into add-employee-name-to-session-user

This commit is contained in:
El-Shafei H.
2025-10-09 08:22:38 +03:00
committed by GitHub
12 changed files with 48 additions and 24 deletions

View File

@@ -13,7 +13,7 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<h2 class="text-center">{{ _("STATEMENT OF ACCOUNTS") }}</h2> <h2 class="text-center">{{ _("GENERAL LEDGER") }}</h2>
<div> <div>
{% if filters.party[0] == filters.party_name[0] %} {% if filters.party[0] == filters.party_name[0] %}
<h5 style="float: left;">{{ _("Customer: ") }} <b>{{ filters.party_name[0] }}</b></h5> <h5 style="float: left;">{{ _("Customer: ") }} <b>{{ filters.party_name[0] }}</b></h5>

View File

@@ -1,5 +1,6 @@
{ {
"actions": [], "actions": [],
"allow_rename": 1,
"autoname": "Prompt", "autoname": "Prompt",
"creation": "2020-05-22 16:46:18.712954", "creation": "2020-05-22 16:46:18.712954",
"doctype": "DocType", "doctype": "DocType",
@@ -69,7 +70,7 @@
"fieldname": "frequency", "fieldname": "frequency",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Frequency", "label": "Frequency",
"options": "Weekly\nMonthly\nQuarterly" "options": "Daily\nWeekly\nBiweekly\nMonthly\nQuarterly"
}, },
{ {
"fieldname": "company", "fieldname": "company",
@@ -416,7 +417,7 @@
} }
], ],
"links": [], "links": [],
"modified": "2025-09-03 14:24:43.608565", "modified": "2025-10-07 12:19:20.719898",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Process Statement Of Accounts", "name": "Process Statement Of Accounts",

View File

@@ -8,7 +8,7 @@ import frappe
from frappe import _ from frappe import _
from frappe.desk.reportview import get_match_cond from frappe.desk.reportview import get_match_cond
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import add_days, add_months, format_date, getdate, today from frappe.utils import add_days, add_months, add_to_date, format_date, getdate, today
from frappe.utils.jinja import validate_template from frappe.utils.jinja import validate_template
from frappe.utils.pdf import get_pdf from frappe.utils.pdf import get_pdf
from frappe.www.printview import get_print_style from frappe.www.printview import get_print_style
@@ -55,7 +55,7 @@ class ProcessStatementOfAccounts(Document):
enable_auto_email: DF.Check enable_auto_email: DF.Check
filter_duration: DF.Int filter_duration: DF.Int
finance_book: DF.Link | None finance_book: DF.Link | None
frequency: DF.Literal["Weekly", "Monthly", "Quarterly"] frequency: DF.Literal["Daily", "Weekly", "Biweekly", "Monthly", "Quarterly"]
from_date: DF.Date | None from_date: DF.Date | None
ignore_cr_dr_notes: DF.Check ignore_cr_dr_notes: DF.Check
ignore_exchange_rate_revaluation_journals: DF.Check ignore_exchange_rate_revaluation_journals: DF.Check
@@ -555,8 +555,9 @@ def send_emails(document_name, from_scheduler=False, posting_date=None):
if doc.enable_auto_email and from_scheduler: if doc.enable_auto_email and from_scheduler:
new_to_date = getdate(posting_date or today()) new_to_date = getdate(posting_date or today())
if doc.frequency == "Weekly": if doc.frequency in ("Daily", "Weekly", "Biweekly"):
new_to_date = add_days(new_to_date, 7) frequency = {"Daily": 1, "Weekly": 7, "Biweekly": 14}
new_to_date = add_days(new_to_date, frequency[doc.frequency])
else: else:
new_to_date = add_months(new_to_date, 1 if doc.frequency == "Monthly" else 3) new_to_date = add_months(new_to_date, 1 if doc.frequency == "Monthly" else 3)
new_from_date = add_months(new_to_date, -1 * doc.filter_duration) new_from_date = add_months(new_to_date, -1 * doc.filter_duration)

View File

@@ -23,7 +23,7 @@
{% endif %} {% endif %}
</div> </div>
<h2 class="text-center" style="margin-top:0">{{ _(report.report_name) }}</h2> <h2 class="text-center" style="margin-top:0">{{ _("STATEMENT OF ACCOUNTS") }}</h2>
<h4 class="text-center"> <h4 class="text-center">
{{ filters.customer_name }} {{ filters.customer_name }}
</h4> </h4>

View File

@@ -5,7 +5,7 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import get_link_to_form from frappe.utils import cstr, get_link_to_form
from erpnext.assets.doctype.asset_activity.asset_activity import add_asset_activity from erpnext.assets.doctype.asset_activity.asset_activity import add_asset_activity
@@ -143,8 +143,8 @@ class AssetMovement(Document):
def update_asset_location_and_custodian(self, asset_id, location, employee): def update_asset_location_and_custodian(self, asset_id, location, employee):
asset = frappe.get_doc("Asset", asset_id) asset = frappe.get_doc("Asset", asset_id)
if employee and employee != asset.custodian: if cstr(employee) != asset.custodian:
frappe.db.set_value("Asset", asset_id, "custodian", employee) frappe.db.set_value("Asset", asset_id, "custodian", cstr(employee))
if location and location != asset.location: if location and location != asset.location:
frappe.db.set_value("Asset", asset_id, "location", location) frappe.db.set_value("Asset", asset_id, "location", location)

View File

@@ -202,6 +202,9 @@ class SubcontractingController(StockController):
self.set(self.raw_material_table, []) self.set(self.raw_material_table, [])
return return
if not self.get(self.raw_material_table):
return
item_dict = self.__get_data_before_save() item_dict = self.__get_data_before_save()
if not item_dict: if not item_dict:
return True return True
@@ -657,6 +660,9 @@ class SubcontractingController(StockController):
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos_for_outward from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos_for_outward
from erpnext.stock.get_item_details import get_filtered_serial_nos from erpnext.stock.get_item_details import get_filtered_serial_nos
if self.is_return:
return
for row in self.supplied_items: for row in self.supplied_items:
item_details = frappe.get_cached_value( item_details = frappe.get_cached_value(
"Item", row.rm_item_code, ["has_batch_no", "has_serial_no"], as_dict=1 "Item", row.rm_item_code, ["has_batch_no", "has_serial_no"], as_dict=1

View File

@@ -1692,6 +1692,17 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
); );
var company_currency = this.get_company_currency(); var company_currency = this.get_company_currency();
if (
this._last_company_currency === company_currency &&
this._last_price_list_currency === this.frm.doc.price_list_currency
) {
return;
}
this._last_company_currency = company_currency;
this._last_price_list_currency = this.frm.doc.price_list_currency;
this.change_form_labels(company_currency); this.change_form_labels(company_currency);
this.change_grid_labels(company_currency); this.change_grid_labels(company_currency);
this.frm.refresh_fields(); this.frm.refresh_fields();

View File

@@ -158,7 +158,7 @@ class Batch(Document):
@frappe.whitelist() @frappe.whitelist()
def recalculate_batch_qty(self): def recalculate_batch_qty(self):
batches = get_batch_qty(batch_no=self.name, item_code=self.item) batches = get_batch_qty(batch_no=self.name, item_code=self.item, for_stock_levels=True)
batch_qty = 0.0 batch_qty = 0.0
if batches: if batches:
for row in batches: for row in batches:

View File

@@ -2337,15 +2337,15 @@ def get_reserved_batches_for_sre(kwargs) -> dict:
if kwargs.batch_no: if kwargs.batch_no:
if isinstance(kwargs.batch_no, list): if isinstance(kwargs.batch_no, list):
query = query.where(sb_entry.batch_no.notin(kwargs.batch_no)) query = query.where(sb_entry.batch_no.isin(kwargs.batch_no))
else: else:
query = query.where(sb_entry.batch_no != kwargs.batch_no) query = query.where(sb_entry.batch_no == kwargs.batch_no)
if kwargs.warehouse: if kwargs.warehouse:
if isinstance(kwargs.warehouse, list): if isinstance(kwargs.warehouse, list):
query = query.where(sre.warehouse.notin(kwargs.warehouse)) query = query.where(sre.warehouse.isin(kwargs.warehouse))
else: else:
query = query.where(sre.warehouse != kwargs.warehouse) query = query.where(sre.warehouse == kwargs.warehouse)
if kwargs.ignore_voucher_nos: if kwargs.ignore_voucher_nos:
query = query.where(sre.name.notin(kwargs.ignore_voucher_nos)) query = query.where(sre.name.notin(kwargs.ignore_voucher_nos))

View File

@@ -1074,16 +1074,15 @@ class update_entries_after:
for d in sabb_data: for d in sabb_data:
incoming_rate = get_incoming_rate_for_serial_and_batch(self.item_code, d, sn_obj) incoming_rate = get_incoming_rate_for_serial_and_batch(self.item_code, d, sn_obj)
if flt(incoming_rate, self.currency_precision) == flt(
d.valuation_rate, self.currency_precision
) and not getattr(d, "stock_queue", None):
continue
amount = incoming_rate * flt(d.qty) amount = incoming_rate * flt(d.qty)
tot_amt += flt(amount) tot_amt += flt(amount)
total_qty += flt(d.qty) total_qty += flt(d.qty)
if flt(incoming_rate, self.currency_precision) == flt(
d.incoming_rate, self.currency_precision
) and not getattr(d, "stock_queue", None):
continue
values_to_update = { values_to_update = {
"incoming_rate": incoming_rate, "incoming_rate": incoming_rate,
"stock_value_difference": amount, "stock_value_difference": amount,

View File

@@ -336,6 +336,10 @@ frappe.ui.form.on("Subcontracting Receipt", {
reset_raw_materials_table: (frm) => { reset_raw_materials_table: (frm) => {
frm.clear_table("supplied_items"); frm.clear_table("supplied_items");
frm.doc.__unsaved = true;
if (!frm.doc.set_posting_time) {
frm.set_value("posting_time", frappe.datetime.now_time());
}
frm.call({ frm.call({
method: "reset_raw_materials", method: "reset_raw_materials",

View File

@@ -649,6 +649,7 @@
"label": "Raw Materials Actions" "label": "Raw Materials Actions"
}, },
{ {
"description": "Click this button if you encounter a negative stock error for a serial or batch item. The system will fetch the available serials or batches automatically.",
"fieldname": "reset_raw_materials_table", "fieldname": "reset_raw_materials_table",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Reset Raw Materials Table" "label": "Reset Raw Materials Table"
@@ -678,7 +679,7 @@
"in_create": 1, "in_create": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2024-12-06 15:24:38.384232", "modified": "2025-10-08 21:43:27.065640",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Subcontracting", "module": "Subcontracting",
"name": "Subcontracting Receipt", "name": "Subcontracting Receipt",
@@ -739,6 +740,7 @@
"write": 1 "write": 1
} }
], ],
"row_format": "Dynamic",
"search_fields": "status, posting_date, supplier", "search_fields": "status, posting_date, supplier",
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "creation", "sort_field": "creation",
@@ -747,4 +749,4 @@
"timeline_field": "supplier", "timeline_field": "supplier",
"title_field": "title", "title_field": "title",
"track_changes": 1 "track_changes": 1
} }