mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 15:25:19 +00:00
Merge pull request #54740 from frappe/version-16-hotfix
This commit is contained in:
@@ -34,6 +34,13 @@
|
||||
"account_number": "0430",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Anlagen im Bau": {
|
||||
"is_group": 1,
|
||||
"Andere Anlagen, Betriebs- und Geschäftsausstattung im Bau": {
|
||||
"account_number": "0498",
|
||||
"account_type": "Capital Work in Progress"
|
||||
}
|
||||
},
|
||||
"Accumulated Depreciation": {
|
||||
"account_type": "Accumulated Depreciation"
|
||||
}
|
||||
@@ -317,13 +324,21 @@
|
||||
"account_number": "3800",
|
||||
"account_type": "Expenses Included In Asset Valuation"
|
||||
},
|
||||
"Bestandsveränderungen Roh-, Hilfs- und Betriebsstoffe sowie bezogene Waren": {
|
||||
"account_number": "3960",
|
||||
"account_type": "Stock Adjustment"
|
||||
},
|
||||
"Herstellungskosten": {
|
||||
"account_number": "4996",
|
||||
"account_type": "Cost of Goods Sold"
|
||||
},
|
||||
"Anlagenabgänge Sachanlagen (Restbuchwert bei Buchverlust)": {
|
||||
"account_number": "2310",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Verluste aus dem Abgang von Gegenständen des Anlagevermögens": {
|
||||
"account_number": "2320",
|
||||
"account_type": "Stock Adjustment"
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Verwaltungskosten": {
|
||||
"account_number": "4997",
|
||||
@@ -340,7 +355,7 @@
|
||||
"is_group": 1,
|
||||
"Abschreibungen auf Sachanlagen (ohne AfA auf Kfz und Gebäude)": {
|
||||
"account_number": "4830",
|
||||
"account_type": "Accumulated Depreciation"
|
||||
"account_type": "Depreciation"
|
||||
},
|
||||
"Abschreibungen auf Gebäude": {
|
||||
"account_number": "4831",
|
||||
|
||||
@@ -2328,16 +2328,19 @@ def get_outstanding_reference_documents(args, validate=False):
|
||||
}
|
||||
|
||||
for fieldname, date_fields in date_fields_dict.items():
|
||||
from_date = frappe.db.escape(str(args.get(date_fields[0]))) if args.get(date_fields[0]) else None
|
||||
to_date = frappe.db.escape(str(args.get(date_fields[1]))) if args.get(date_fields[1]) else None
|
||||
|
||||
if args.get(date_fields[0]) and args.get(date_fields[1]):
|
||||
condition += f" and {fieldname} between {frappe.db.escape(args.get(date_fields[0]))} and {frappe.db.escape(args.get(date_fields[1]))}"
|
||||
condition += f" and {fieldname} between {from_date} and {to_date}"
|
||||
posting_and_due_date.append(ple[fieldname][args.get(date_fields[0]) : args.get(date_fields[1])])
|
||||
elif args.get(date_fields[0]):
|
||||
# if only from date is supplied
|
||||
condition += f" and {fieldname} >= {frappe.db.escape(args.get(date_fields[0]))}"
|
||||
condition += f" and {fieldname} >= {from_date}"
|
||||
posting_and_due_date.append(ple[fieldname].gte(args.get(date_fields[0])))
|
||||
elif args.get(date_fields[1]):
|
||||
# if only to date is supplied
|
||||
condition += f" and {fieldname} <= {frappe.db.escape(args.get(date_fields[1]))}"
|
||||
condition += f" and {fieldname} <= {to_date}"
|
||||
posting_and_due_date.append(ple[fieldname].lte(args.get(date_fields[1])))
|
||||
|
||||
if args.get("company"):
|
||||
|
||||
@@ -664,6 +664,7 @@
|
||||
"fieldname": "total_billing_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Billing Amount",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
@@ -1531,6 +1532,7 @@
|
||||
"fieldname": "amount_eligible_for_commission",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount Eligible for Commission",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -1639,7 +1641,7 @@
|
||||
"icon": "fa fa-file-text",
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-28 06:06:14.283612",
|
||||
"modified": "2026-05-01 02:37:30.580568",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Invoice",
|
||||
|
||||
@@ -115,7 +115,12 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.docstatus == 1 && doc.outstanding_amount != 0 && !doc.on_hold) {
|
||||
if (
|
||||
doc.docstatus == 1 &&
|
||||
doc.outstanding_amount != 0 &&
|
||||
!doc.on_hold &&
|
||||
frappe.model.can_create("Payment Entry")
|
||||
) {
|
||||
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
|
||||
this.frm.page.set_inner_btn_group_as_primary(__("Create"));
|
||||
}
|
||||
@@ -130,7 +135,13 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.docstatus == 1 && doc.outstanding_amount > 0 && !cint(doc.is_return) && !doc.on_hold) {
|
||||
if (
|
||||
doc.docstatus == 1 &&
|
||||
doc.outstanding_amount > 0 &&
|
||||
!cint(doc.is_return) &&
|
||||
!doc.on_hold &&
|
||||
frappe.boot.user.in_create.includes("Payment Request")
|
||||
) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment Request"),
|
||||
function () {
|
||||
@@ -443,13 +454,14 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
|
||||
}
|
||||
|
||||
items_add(doc, cdt, cdn) {
|
||||
var row = frappe.get_doc(cdt, cdn);
|
||||
this.frm.script_manager.copy_from_first_row("items", row, [
|
||||
"expense_account",
|
||||
"discount_account",
|
||||
"cost_center",
|
||||
"project",
|
||||
]);
|
||||
const row = frappe.get_doc(cdt, cdn);
|
||||
const field_copy = ["expense_account", "discount_account", "cost_center"];
|
||||
if (doc.project) {
|
||||
frappe.model.set_value(cdt, cdn, "project", doc.project);
|
||||
} else {
|
||||
field_copy.push("project");
|
||||
}
|
||||
this.frm.script_manager.copy_from_first_row("items", row, field_copy);
|
||||
}
|
||||
|
||||
on_submit() {
|
||||
@@ -558,12 +570,6 @@ cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function
|
||||
};
|
||||
};
|
||||
|
||||
cur_frm.fields_dict["items"].grid.get_field("project").get_query = function (doc, cdt, cdn) {
|
||||
return {
|
||||
filters: [["Project", "status", "not in", "Completed, Cancelled"]],
|
||||
};
|
||||
};
|
||||
|
||||
frappe.ui.form.on("Purchase Invoice", {
|
||||
setup: function (frm) {
|
||||
frm.custom_make_buttons = {
|
||||
|
||||
@@ -94,7 +94,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
||||
erpnext.accounts.ledger_preview.show_stock_ledger_preview(this.frm);
|
||||
}
|
||||
|
||||
if (doc.docstatus == 1 && doc.outstanding_amount != 0) {
|
||||
if (doc.docstatus == 1 && doc.outstanding_amount != 0 && frappe.model.can_create("Payment Entry")) {
|
||||
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
|
||||
this.frm.page.set_inner_btn_group_as_primary(__("Create"));
|
||||
}
|
||||
@@ -135,13 +135,15 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
||||
}
|
||||
|
||||
if (doc.outstanding_amount > 0) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment Request"),
|
||||
function () {
|
||||
me.make_payment_request_with_schedule();
|
||||
},
|
||||
__("Create")
|
||||
);
|
||||
if (frappe.boot.user.in_create.includes("Payment Request")) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment Request"),
|
||||
function () {
|
||||
me.make_payment_request_with_schedule();
|
||||
},
|
||||
__("Create")
|
||||
);
|
||||
}
|
||||
this.frm.add_custom_button(
|
||||
__("Invoice Discounting"),
|
||||
this.make_invoice_discounting.bind(this),
|
||||
@@ -552,12 +554,14 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
||||
}
|
||||
|
||||
items_add(doc, cdt, cdn) {
|
||||
var row = frappe.get_doc(cdt, cdn);
|
||||
this.frm.script_manager.copy_from_first_row("items", row, [
|
||||
"income_account",
|
||||
"discount_account",
|
||||
"cost_center",
|
||||
]);
|
||||
const row = frappe.get_doc(cdt, cdn);
|
||||
const field_copy = ["income_account", "discount_account", "cost_center"];
|
||||
if (doc.project) {
|
||||
frappe.model.set_value(cdt, cdn, "project", doc.project);
|
||||
} else {
|
||||
field_copy.push("project");
|
||||
}
|
||||
this.frm.script_manager.copy_from_first_row("items", row, field_copy);
|
||||
}
|
||||
|
||||
set_dynamic_labels() {
|
||||
|
||||
@@ -1152,6 +1152,7 @@
|
||||
"hide_seconds": 1,
|
||||
"label": "Rounding Adjustment",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
@@ -1164,6 +1165,7 @@
|
||||
"label": "Rounded Total",
|
||||
"oldfieldname": "rounded_total",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
@@ -2365,7 +2367,7 @@
|
||||
"link_fieldname": "consolidated_invoice"
|
||||
}
|
||||
],
|
||||
"modified": "2026-04-28 13:08:19.849783",
|
||||
"modified": "2026-05-01 02:37:29.742764",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -195,6 +195,9 @@ def reschedule_depreciation(asset_doc, notes, disposal_date=None):
|
||||
for row in asset_doc.get("finance_books"):
|
||||
current_schedule = get_asset_depr_schedule_doc(asset_doc.name, None, row.finance_book)
|
||||
|
||||
if disposal_date and flt(row.value_after_depreciation) <= flt(row.expected_value_after_useful_life):
|
||||
continue
|
||||
|
||||
if current_schedule:
|
||||
if current_schedule.docstatus == 1:
|
||||
new_schedule = frappe.copy_doc(current_schedule)
|
||||
|
||||
@@ -416,7 +416,11 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
|
||||
__("Create")
|
||||
);
|
||||
|
||||
if (flt(doc.per_billed) < 100 && doc.status != "Delivered") {
|
||||
if (
|
||||
frappe.model.can_create("Payment Entry") &&
|
||||
flt(doc.per_billed) < 100 &&
|
||||
doc.status != "Delivered"
|
||||
) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment"),
|
||||
() => this.make_payment_entry(),
|
||||
@@ -424,7 +428,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
|
||||
);
|
||||
}
|
||||
|
||||
if (flt(doc.per_billed) < 100) {
|
||||
if (flt(doc.per_billed) < 100 && frappe.boot.user.in_create.includes("Payment Request")) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment Request"),
|
||||
function () {
|
||||
@@ -660,12 +664,20 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
|
||||
}
|
||||
|
||||
items_add(doc, cdt, cdn) {
|
||||
var row = frappe.get_doc(cdt, cdn);
|
||||
if (doc.schedule_date) {
|
||||
row.schedule_date = doc.schedule_date;
|
||||
refresh_field("schedule_date", cdn, "items");
|
||||
const row = frappe.get_doc(cdt, cdn);
|
||||
const field_copy = [];
|
||||
if (doc.project) {
|
||||
frappe.model.set_value(cdt, cdn, "project", doc.project);
|
||||
} else {
|
||||
this.frm.script_manager.copy_from_first_row("items", row, ["schedule_date"]);
|
||||
field_copy.push("project");
|
||||
}
|
||||
if (doc.schedule_date) {
|
||||
frappe.model.set_value(cdt, cdn, "schedule_date", doc.schedule_date);
|
||||
} else {
|
||||
field_copy.push("schedule_date");
|
||||
}
|
||||
if (field_copy.length) {
|
||||
this.frm.script_manager.copy_from_first_row("items", row, field_copy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,12 +752,6 @@ cur_frm.cscript.update_status = function (label, status) {
|
||||
});
|
||||
};
|
||||
|
||||
cur_frm.fields_dict["items"].grid.get_field("project").get_query = function (doc, cdt, cdn) {
|
||||
return {
|
||||
filters: [["Project", "status", "not in", "Completed, Cancelled"]],
|
||||
};
|
||||
};
|
||||
|
||||
if (cur_frm.doc.is_old_subcontracting_flow) {
|
||||
cur_frm.fields_dict["items"].grid.get_field("bom").get_query = function (doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
|
||||
@@ -126,9 +126,3 @@ erpnext.buying.SupplierQuotationController = class SupplierQuotationController e
|
||||
|
||||
// for backward compatibility: combine new and previous states
|
||||
extend_cscript(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({ frm: cur_frm }));
|
||||
|
||||
cur_frm.fields_dict["items"].grid.get_field("project").get_query = function (doc, cdt, cdn) {
|
||||
return {
|
||||
filters: [["Project", "status", "not in", "Completed, Cancelled"]],
|
||||
};
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ from frappe import _
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
"fieldname": "demand_planning",
|
||||
"fieldname": "sales_forecast",
|
||||
"transactions": [
|
||||
{
|
||||
"label": _("MPS"),
|
||||
|
||||
@@ -305,17 +305,6 @@
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "BOM",
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "BOM Stock Report",
|
||||
"link_count": 0,
|
||||
"link_to": "BOM Stock Report",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "Work Order",
|
||||
"hidden": 0,
|
||||
@@ -443,7 +432,7 @@
|
||||
"type": "Link"
|
||||
}
|
||||
],
|
||||
"modified": "2026-01-02 15:07:36.968043",
|
||||
"modified": "2026-05-05 11:00:26.131777",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Manufacturing",
|
||||
|
||||
@@ -479,4 +479,5 @@ erpnext.patches.v16_0.merge_repost_settings_to_accounts_settings
|
||||
erpnext.patches.v16_0.set_root_type_in_account_categories
|
||||
erpnext.patches.v16_0.scr_inv_dimension
|
||||
erpnext.patches.v16_0.packed_item_inv_dimen
|
||||
erpnext.patches.v16_0.correct_po_titles
|
||||
erpnext.patches.v16_0.fix_titles
|
||||
erpnext.patches.v16_0.set_not_applicable_on_german_item_tax_templates
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
"""
|
||||
This patch corrects the titles of purchase orders that were set to
|
||||
the text string "{supplier_name}" instead of the actual supplier name.
|
||||
"""
|
||||
|
||||
purchase_order = frappe.qb.DocType("Purchase Order")
|
||||
(
|
||||
frappe.qb.update(purchase_order)
|
||||
.set(purchase_order.title, purchase_order.supplier_name)
|
||||
.where(purchase_order.title == "{supplier_name}")
|
||||
).run()
|
||||
28
erpnext/patches/v16_0/fix_titles.py
Normal file
28
erpnext/patches/v16_0/fix_titles.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
"""
|
||||
This patch corrects the titles of doctypes set to
|
||||
the text strings "{customer_name}" or "{supplier_name}"
|
||||
instead of the actual customer or supplier name.
|
||||
"""
|
||||
|
||||
customer_doctypes = ["POS Invoice", "Sales Invoice", "Quotation", "Sales Order", "Delivery Note"]
|
||||
supplier_doctypes = ["Purchase Invoice", "Purchase Order", "Purchase Receipt"]
|
||||
|
||||
for doctype in customer_doctypes:
|
||||
customer_doctype = frappe.qb.DocType(doctype)
|
||||
(
|
||||
frappe.qb.update(customer_doctype)
|
||||
.set(customer_doctype.title, customer_doctype.customer_name)
|
||||
.where(customer_doctype.title == "{customer_name}")
|
||||
).run()
|
||||
|
||||
for doctype in supplier_doctypes:
|
||||
supplier_doctype = frappe.qb.DocType(doctype)
|
||||
(
|
||||
frappe.qb.update(supplier_doctype)
|
||||
.set(supplier_doctype.title, supplier_doctype.supplier_name)
|
||||
.where(supplier_doctype.title == "{supplier_name}")
|
||||
).run()
|
||||
@@ -0,0 +1,218 @@
|
||||
import frappe
|
||||
|
||||
# Snapshot of the relevant German defaults when this migration was written.
|
||||
# Migration patches must not read mutable setup data, otherwise future edits to
|
||||
# country_wise_tax.json would change what this patch does on sites that have not
|
||||
# run it yet.
|
||||
#
|
||||
# For numbered charts, compare account_number + root_type because Account.account_name
|
||||
# is not unique within a company.
|
||||
SKR04_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS = frozenset(
|
||||
{
|
||||
("3801", "Liability"),
|
||||
("3802", "Liability"),
|
||||
("3835", "Liability"),
|
||||
("1401", "Asset"),
|
||||
("1402", "Asset"),
|
||||
("1541", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
SKR04_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS = frozenset(
|
||||
{
|
||||
("3806", "Liability"),
|
||||
("3804", "Liability"),
|
||||
("3837", "Liability"),
|
||||
("1406", "Asset"),
|
||||
("1404", "Asset"),
|
||||
("1540", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
SKR03_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS = frozenset(
|
||||
{
|
||||
("1771", "Liability"),
|
||||
("1772", "Liability"),
|
||||
("1785", "Liability"),
|
||||
("1571", "Asset"),
|
||||
("1572", "Asset"),
|
||||
("1541", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
SKR03_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS = frozenset(
|
||||
{
|
||||
("1776", "Liability"),
|
||||
("1774", "Liability"),
|
||||
("1787", "Liability"),
|
||||
("1576", "Asset"),
|
||||
("1574", "Asset"),
|
||||
("1540", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
STANDARD_NOT_APPLICABLE_7_PERCENT_ACCOUNT_LABELS = frozenset(
|
||||
{
|
||||
("Umsatzsteuer 7 %", "Liability"),
|
||||
("Umsatzsteuer aus innergemeinschaftlichem Erwerb", "Liability"),
|
||||
("Umsatzsteuer nach § 13b UStG", "Liability"),
|
||||
("Abziehbare Vorsteuer 7 %", "Asset"),
|
||||
("Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", "Asset"),
|
||||
("Abziehbare Vorsteuer nach § 13b UStG", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
STANDARD_NOT_APPLICABLE_19_PERCENT_ACCOUNT_LABELS = frozenset(
|
||||
{
|
||||
("Umsatzsteuer 19 %", "Liability"),
|
||||
("Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", "Liability"),
|
||||
("Umsatzsteuer nach § 13b UStG 19 %", "Liability"),
|
||||
("Abziehbare Vorsteuer 19 %", "Asset"),
|
||||
("Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", "Asset"),
|
||||
("Abziehbare Vorsteuer nach § 13b UStG 19 %", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
STANDARD_WITH_NUMBERS_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS = frozenset(
|
||||
{
|
||||
("2321", "Liability"),
|
||||
("2331", "Liability"),
|
||||
("2341", "Liability"),
|
||||
("1521", "Asset"),
|
||||
("1531", "Asset"),
|
||||
("1541", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
STANDARD_WITH_NUMBERS_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS = frozenset(
|
||||
{
|
||||
("2320", "Liability"),
|
||||
("2330", "Liability"),
|
||||
("2340", "Liability"),
|
||||
("1520", "Asset"),
|
||||
("1530", "Asset"),
|
||||
("1540", "Asset"),
|
||||
}
|
||||
)
|
||||
|
||||
GERMAN_ITEM_TAX_TEMPLATE_NOT_APPLICABLE_ACCOUNTS = {
|
||||
"SKR03 mit Kontonummern": {
|
||||
"identifier_field": "account_number",
|
||||
"templates": {
|
||||
"19 %": SKR03_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS,
|
||||
"7 %": SKR03_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS,
|
||||
"0 %": SKR03_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS
|
||||
| SKR03_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS
|
||||
| frozenset({("1588", "Asset")}),
|
||||
},
|
||||
},
|
||||
"SKR04 mit Kontonummern": {
|
||||
"identifier_field": "account_number",
|
||||
"templates": {
|
||||
"19 %": SKR04_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS,
|
||||
"7 %": SKR04_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS,
|
||||
"0 %": SKR04_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS
|
||||
| SKR04_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS
|
||||
| frozenset({("1433", "Asset")}),
|
||||
},
|
||||
},
|
||||
"Standard": {
|
||||
"identifier_field": "account_name",
|
||||
"templates": {
|
||||
"19 %": STANDARD_NOT_APPLICABLE_7_PERCENT_ACCOUNT_LABELS,
|
||||
"7 %": STANDARD_NOT_APPLICABLE_19_PERCENT_ACCOUNT_LABELS,
|
||||
"0%": STANDARD_NOT_APPLICABLE_7_PERCENT_ACCOUNT_LABELS
|
||||
| STANDARD_NOT_APPLICABLE_19_PERCENT_ACCOUNT_LABELS
|
||||
| frozenset({("Entstandene Einfuhrumsatzsteuer", "Asset")}),
|
||||
},
|
||||
},
|
||||
"Standard with Numbers": {
|
||||
"identifier_field": "account_number",
|
||||
"templates": {
|
||||
"19%": STANDARD_WITH_NUMBERS_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS,
|
||||
"7%": STANDARD_WITH_NUMBERS_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS,
|
||||
"0 %": STANDARD_WITH_NUMBERS_NOT_APPLICABLE_7_PERCENT_ACCOUNT_IDS
|
||||
| STANDARD_WITH_NUMBERS_NOT_APPLICABLE_19_PERCENT_ACCOUNT_IDS
|
||||
| frozenset({("1550", "Asset")}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def update_account_cache(accounts, account_cache):
|
||||
missing_accounts = set(accounts) - set(account_cache)
|
||||
if not missing_accounts:
|
||||
return
|
||||
|
||||
for account in frappe.get_all(
|
||||
"Account",
|
||||
filters={"name": ("in", tuple(sorted(missing_accounts)))},
|
||||
fields=["name", "account_name", "account_number", "root_type"],
|
||||
):
|
||||
account_cache[account.name] = account
|
||||
|
||||
|
||||
def get_account_identifier(account, identifier_field, account_cache):
|
||||
cached_account = account_cache.get(account)
|
||||
if not cached_account:
|
||||
return None
|
||||
|
||||
return cached_account.get(identifier_field), cached_account.root_type
|
||||
|
||||
|
||||
def execute():
|
||||
"""Backfill `not_applicable` on Item Tax Template Details for German companies.
|
||||
|
||||
Before the `not_applicable` flag existed, German default templates used
|
||||
`tax_rate: 0` to mean "this tax does not apply to the item" (as opposed to
|
||||
an explicit 0% rate). For each German company, this patch looks up the
|
||||
historical defaults for its Chart of Accounts and sets
|
||||
`not_applicable = 1` on detail rows that still match those defaults
|
||||
(same template title, same zero-rate tax account identifier set, flag still unset),
|
||||
leaving any user-customised rows untouched.
|
||||
"""
|
||||
companies = frappe.get_all(
|
||||
"Company",
|
||||
filters={"country": "Germany"},
|
||||
fields=["name", "chart_of_accounts"],
|
||||
)
|
||||
account_cache = {}
|
||||
|
||||
for company in companies:
|
||||
chart = GERMAN_ITEM_TAX_TEMPLATE_NOT_APPLICABLE_ACCOUNTS.get(company.chart_of_accounts)
|
||||
if not chart:
|
||||
continue
|
||||
|
||||
identifier_field = chart["identifier_field"]
|
||||
for template_title, target_accounts in chart["templates"].items():
|
||||
itt_names = frappe.get_all(
|
||||
"Item Tax Template",
|
||||
filters={"company": company.name, "title": template_title},
|
||||
pluck="name",
|
||||
)
|
||||
for itt_name in itt_names:
|
||||
zero_rate_details = frappe.get_all(
|
||||
"Item Tax Template Detail",
|
||||
filters={"parent": itt_name, "tax_rate": 0},
|
||||
fields=["name", "tax_type", "not_applicable"],
|
||||
)
|
||||
update_account_cache((d.tax_type for d in zero_rate_details), account_cache)
|
||||
zero_rate_accounts_by_detail = {
|
||||
d.name: get_account_identifier(d.tax_type, identifier_field, account_cache)
|
||||
for d in zero_rate_details
|
||||
}
|
||||
if any(identifier is None for identifier in zero_rate_accounts_by_detail.values()):
|
||||
continue
|
||||
|
||||
if set(zero_rate_accounts_by_detail.values()) != target_accounts:
|
||||
continue
|
||||
|
||||
for d in zero_rate_details:
|
||||
if not d.not_applicable:
|
||||
frappe.db.set_value(
|
||||
"Item Tax Template Detail",
|
||||
d.name,
|
||||
"not_applicable",
|
||||
1,
|
||||
update_modified=False,
|
||||
)
|
||||
@@ -364,13 +364,18 @@ class Project(Document):
|
||||
)
|
||||
|
||||
for user in self.users:
|
||||
# process only users who haven't received the welcome email yet
|
||||
if user.welcome_email_sent == 0:
|
||||
frappe.sendmail(
|
||||
user.user,
|
||||
subject=_("Project Collaboration Invitation"),
|
||||
content=content,
|
||||
)
|
||||
user.welcome_email_sent = 1
|
||||
# fetch canonical User data (enabled status + latest email)
|
||||
user_info = frappe.db.get_value("User", user.user, ["enabled", "email"], as_dict=True)
|
||||
# send email only if user is enabled and has a valid email
|
||||
if user_info and user_info.enabled and user_info.email:
|
||||
frappe.sendmail(
|
||||
recipients=[user_info.email],
|
||||
subject=_("Project Collaboration Invitation"),
|
||||
content=content,
|
||||
)
|
||||
user.welcome_email_sent = 1
|
||||
|
||||
|
||||
def get_timeline_data(doctype: str, name: str) -> dict[int, int]:
|
||||
|
||||
@@ -25,13 +25,15 @@ erpnext.buying = {
|
||||
};
|
||||
});
|
||||
|
||||
this.frm.set_query("project", function (doc) {
|
||||
return {
|
||||
filters: {
|
||||
company: doc.company,
|
||||
},
|
||||
};
|
||||
});
|
||||
const project_filters = {
|
||||
query: "erpnext.controllers.queries.get_project_name",
|
||||
filters: {
|
||||
company: doc.company,
|
||||
},
|
||||
};
|
||||
|
||||
this.frm.set_query("project", (_) => project_filters);
|
||||
this.frm.set_query("project", "items", (_, __, ___) => project_filters);
|
||||
|
||||
if (
|
||||
this.frm.doc.__islocal &&
|
||||
|
||||
@@ -870,10 +870,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
me.apply_rule_on_other_items({ key: item });
|
||||
}
|
||||
},
|
||||
() => {
|
||||
var company_currency = me.get_company_currency();
|
||||
me.update_item_grid_labels(company_currency);
|
||||
},
|
||||
]);
|
||||
}
|
||||
},
|
||||
@@ -1824,63 +1820,51 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
|
||||
if (
|
||||
this._last_currency === this.frm.doc.currency &&
|
||||
this._last_price_list_currency === this.frm.doc.price_list_currency
|
||||
this._last_price_list_currency === this.frm.doc.price_list_currency &&
|
||||
this._last_party_account_currency === this.frm.doc.party_account_currency &&
|
||||
this._last_company_currency === company_currency
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._last_currency = this.frm.doc.currency;
|
||||
this._last_price_list_currency = this.frm.doc.price_list_currency;
|
||||
this._last_party_account_currency = this.frm.doc.party_account_currency;
|
||||
this._last_company_currency = company_currency;
|
||||
|
||||
this.change_form_labels(company_currency);
|
||||
this.change_grid_labels(company_currency);
|
||||
this.frm.refresh_fields();
|
||||
}
|
||||
|
||||
get_currency_label_options(company_currency) {
|
||||
return {
|
||||
currency: this.frm.doc.currency,
|
||||
"Company:company:default_currency": company_currency,
|
||||
party_account_currency: this.frm.doc.party_account_currency,
|
||||
};
|
||||
}
|
||||
|
||||
set_currency_labels_from_options(currency_options, parentfield) {
|
||||
const doctype = parentfield ? this.frm.fields_dict[parentfield].grid.doctype : this.frm.doc.doctype;
|
||||
const docfields = frappe.meta.get_docfields(doctype);
|
||||
|
||||
Object.entries(currency_options).forEach(([options, currency]) => {
|
||||
const fields = docfields
|
||||
.filter((df) => df.fieldtype === "Currency" && df.options === options)
|
||||
.map((df) => df.fieldname);
|
||||
|
||||
this.frm.set_currency_labels(fields, currency, parentfield);
|
||||
});
|
||||
}
|
||||
|
||||
change_form_labels(company_currency) {
|
||||
let me = this;
|
||||
const currency_options = this.get_currency_label_options(company_currency);
|
||||
|
||||
this.frm.set_currency_labels(
|
||||
[
|
||||
"advance_paid",
|
||||
"base_total",
|
||||
"base_net_total",
|
||||
"base_total_taxes_and_charges",
|
||||
"base_discount_amount",
|
||||
"base_taxes_and_charges_added",
|
||||
"base_taxes_and_charges_deducted",
|
||||
"total_amount_to_pay",
|
||||
"base_paid_amount",
|
||||
"base_write_off_amount",
|
||||
"base_change_amount",
|
||||
"base_operating_cost",
|
||||
"base_raw_material_cost",
|
||||
"base_total_cost",
|
||||
"base_secondary_items_cost",
|
||||
"base_totals_section",
|
||||
],
|
||||
company_currency
|
||||
);
|
||||
|
||||
this.frm.set_currency_labels(
|
||||
[
|
||||
"total",
|
||||
"net_total",
|
||||
"total_taxes_and_charges",
|
||||
"discount_amount",
|
||||
"taxes_and_charges_added",
|
||||
"taxes_and_charges_deducted",
|
||||
"tax_withholding_net_total",
|
||||
"paid_amount",
|
||||
"write_off_amount",
|
||||
"operating_cost",
|
||||
"secondary_items_cost",
|
||||
"raw_material_cost",
|
||||
"total_cost",
|
||||
"totals_section",
|
||||
],
|
||||
this.frm.doc.currency
|
||||
);
|
||||
this.set_currency_labels_from_options(currency_options);
|
||||
this.frm.set_currency_labels(["totals_section"], this.frm.doc.currency);
|
||||
this.frm.set_currency_labels(["base_totals_section"], company_currency);
|
||||
|
||||
this.frm.set_currency_labels(
|
||||
["outstanding_amount", "total_advance"],
|
||||
@@ -1961,23 +1945,25 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
|
||||
change_grid_labels(company_currency) {
|
||||
var me = this;
|
||||
|
||||
this.update_item_grid_labels(company_currency);
|
||||
const currency_options = this.get_currency_label_options(company_currency);
|
||||
|
||||
this.toggle_item_grid_columns(company_currency);
|
||||
|
||||
if (this.frm.doc.operations && this.frm.doc.operations.length > 0) {
|
||||
this.frm.set_currency_labels(
|
||||
["operating_cost", "hour_rate"],
|
||||
this.frm.doc.currency,
|
||||
"operations"
|
||||
);
|
||||
this.frm.set_currency_labels(
|
||||
["base_operating_cost", "base_hour_rate"],
|
||||
company_currency,
|
||||
"operations"
|
||||
);
|
||||
for (const child_table of [
|
||||
"items",
|
||||
"operations",
|
||||
"secondary_items",
|
||||
"taxes",
|
||||
"advances",
|
||||
"payment_schedule",
|
||||
"sales_team",
|
||||
]) {
|
||||
if (this.frm.fields_dict[child_table]) {
|
||||
this.set_currency_labels_from_options(currency_options, child_table);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.frm.doc.operations && this.frm.doc.operations.length > 0) {
|
||||
var item_grid = this.frm.fields_dict["operations"].grid;
|
||||
$.each(["base_operating_cost", "base_hour_rate"], function (i, fname) {
|
||||
if (frappe.meta.get_docfield(item_grid.doctype, fname))
|
||||
@@ -1986,9 +1972,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
}
|
||||
|
||||
if (this.frm.doc.secondary_items && this.frm.doc.secondary_items.length > 0) {
|
||||
this.frm.set_currency_labels(["rate", "amount"], this.frm.doc.currency, "secondary_items");
|
||||
this.frm.set_currency_labels(["base_rate", "base_amount"], company_currency, "secondary_items");
|
||||
|
||||
var item_grid = this.frm.fields_dict["secondary_items"].grid;
|
||||
$.each(["base_rate", "base_amount"], function (i, fname) {
|
||||
if (frappe.meta.get_docfield(item_grid.doctype, fname))
|
||||
@@ -1996,74 +1979,12 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
});
|
||||
}
|
||||
|
||||
if (this.frm.doc.taxes && this.frm.doc.taxes.length > 0) {
|
||||
this.frm.set_currency_labels(
|
||||
["tax_amount", "total", "tax_amount_after_discount"],
|
||||
this.frm.doc.currency,
|
||||
"taxes"
|
||||
);
|
||||
|
||||
this.frm.set_currency_labels(
|
||||
["base_tax_amount", "base_total", "base_tax_amount_after_discount"],
|
||||
company_currency,
|
||||
"taxes"
|
||||
);
|
||||
}
|
||||
|
||||
if (this.frm.doc.advances && this.frm.doc.advances.length > 0) {
|
||||
this.frm.set_currency_labels(
|
||||
["advance_amount", "allocated_amount"],
|
||||
this.frm.doc.party_account_currency,
|
||||
"advances"
|
||||
);
|
||||
}
|
||||
|
||||
this.update_payment_schedule_grid_labels(company_currency);
|
||||
}
|
||||
|
||||
update_item_grid_labels(company_currency) {
|
||||
this.frm.set_currency_labels(
|
||||
[
|
||||
"base_rate",
|
||||
"base_net_rate",
|
||||
"base_price_list_rate",
|
||||
"base_amount",
|
||||
"base_net_amount",
|
||||
"base_rate_with_margin",
|
||||
],
|
||||
company_currency,
|
||||
"items"
|
||||
);
|
||||
|
||||
this.frm.set_currency_labels(
|
||||
[
|
||||
"rate",
|
||||
"net_rate",
|
||||
"price_list_rate",
|
||||
"amount",
|
||||
"net_amount",
|
||||
"stock_uom_rate",
|
||||
"rate_with_margin",
|
||||
],
|
||||
this.frm.doc.currency,
|
||||
"items"
|
||||
);
|
||||
}
|
||||
|
||||
update_payment_schedule_grid_labels(company_currency) {
|
||||
const me = this;
|
||||
if (this.frm.doc.payment_schedule && this.frm.doc.payment_schedule.length > 0) {
|
||||
this.frm.set_currency_labels(
|
||||
["base_payment_amount", "base_outstanding", "base_paid_amount"],
|
||||
company_currency,
|
||||
"payment_schedule"
|
||||
);
|
||||
this.frm.set_currency_labels(
|
||||
["payment_amount", "outstanding", "paid_amount"],
|
||||
this.frm.doc.currency,
|
||||
"payment_schedule"
|
||||
);
|
||||
|
||||
var schedule_grid = this.frm.fields_dict["payment_schedule"].grid;
|
||||
$.each(["base_payment_amount", "base_outstanding", "base_paid_amount"], function (i, fname) {
|
||||
if (frappe.meta.get_docfield(schedule_grid.doctype, fname))
|
||||
|
||||
@@ -37,5 +37,6 @@ import "./utils/demo.js";
|
||||
import "./financial_statements.js";
|
||||
import "./sales_trends_filters.js";
|
||||
import "./purchase_trends_filters.js";
|
||||
import "./utils/naming_series_dialog.js";
|
||||
|
||||
// import { sum } from 'frappe/public/utils/util.js'
|
||||
|
||||
312
erpnext/public/js/utils/naming_series_dialog.js
Normal file
312
erpnext/public/js/utils/naming_series_dialog.js
Normal file
@@ -0,0 +1,312 @@
|
||||
frappe.provide("erpnext");
|
||||
|
||||
erpnext.NamingSeriesDialog = class NamingSeriesDialog {
|
||||
constructor(opts = {}) {
|
||||
this.opts = Object.assign(
|
||||
{
|
||||
title: __("Document Naming"),
|
||||
single_doctype: "Document Naming Settings",
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
this.current_doctype = null;
|
||||
this.loaded = false;
|
||||
this.make_dialog();
|
||||
}
|
||||
|
||||
make_dialog() {
|
||||
this.dialog = new frappe.ui.Dialog({
|
||||
title: this.opts.title,
|
||||
size: "medium",
|
||||
fields: [
|
||||
{
|
||||
fieldtype: "Table",
|
||||
fieldname: "naming_series_options",
|
||||
label: __("Add Series Prefix"),
|
||||
reqd: 1,
|
||||
in_place_edit: true,
|
||||
data: [],
|
||||
fields: [
|
||||
{
|
||||
fieldtype: "Data",
|
||||
fieldname: "series",
|
||||
label: __("Series"),
|
||||
in_list_view: 1,
|
||||
change: async function () {
|
||||
const preview = await this.grid_row.grid._naming_dialog.get_series_preview(
|
||||
this.doc.series
|
||||
);
|
||||
this.doc.preview = preview;
|
||||
this.grid_row.refresh_field("preview");
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldtype: "Data",
|
||||
fieldname: "preview",
|
||||
label: __("Preview"),
|
||||
in_list_view: 1,
|
||||
placeholder: " ",
|
||||
read_only: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ fieldtype: "Section Break", label: __("Rules for configuring series"), collapsible: 1 },
|
||||
{
|
||||
fieldtype: "HTML",
|
||||
fieldname: "naming_series_description",
|
||||
},
|
||||
],
|
||||
primary_action_label: __("Update"),
|
||||
primary_action: () => this.save(),
|
||||
});
|
||||
|
||||
this.dialog.fields_dict.naming_series_options.grid._naming_dialog = this;
|
||||
}
|
||||
|
||||
async show() {
|
||||
this.dialog.show();
|
||||
this.render_help();
|
||||
|
||||
if (this.opts.doctype && !this.loaded) {
|
||||
await this.get_transaction(this.opts.doctype);
|
||||
this.loaded = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
render_help() {
|
||||
this.dialog.get_field("naming_series_description").$wrapper.html(`
|
||||
<ul>
|
||||
<li>${__("Allowed special characters are '/' and '-'")}</li>
|
||||
<li>
|
||||
${__(
|
||||
"Optionally, set the number of digits in the series using dot (.) followed by hashes (#). For example, '.####' means that the series will have four digits. Default is five digits."
|
||||
)}
|
||||
</li>
|
||||
<li> ${__("You can also use variables in the series name by putting them between (.) dots")}
|
||||
<br>
|
||||
${__("Supported Variables:")}
|
||||
<ul>
|
||||
<li><code>.YYYY.</code> - ${__("Year in 4 digits")}</li>
|
||||
<li><code>.YY.</code> - ${__("Year in 2 digits")}</li>
|
||||
<li><code>.MM.</code> - ${__("Month")}</li>
|
||||
<li><code>.DD.</code> - ${__("Day of month")}</li>
|
||||
<li><code>.WW.</code> - ${__("Week of the year")}</li>
|
||||
<li>
|
||||
<code>.{fieldname}.</code> - ${__("fieldname on the document e.g.")}
|
||||
<code>branch</code>
|
||||
</li>
|
||||
<li><code>.FY.</code> - ${__("Fiscal Year (requires ERPNext to be installed)")}</li>
|
||||
<li><code>.ABBR.</code> - ${__("Company Abbreviation (requires ERPNext to be installed)")}</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
Examples:
|
||||
<ul>
|
||||
<li>INV-</li>
|
||||
<li>INV-10-</li>
|
||||
<li>INVK-</li>
|
||||
<li>INV-.YYYY.-._{branch}.-.MM.-.####</li>
|
||||
</ul>
|
||||
<br>`);
|
||||
}
|
||||
|
||||
get_series_preview(series) {
|
||||
if (!series) return "";
|
||||
|
||||
return this.get_document_naming_doc().then((doc) => {
|
||||
doc.try_naming_series = series;
|
||||
doc.transaction_type = this.current_doctype;
|
||||
return frappe
|
||||
.call({
|
||||
doc: doc,
|
||||
method: "preview_series",
|
||||
freeze: true,
|
||||
})
|
||||
.then((r) => (r.message || "").split("\n")[0] || "");
|
||||
});
|
||||
}
|
||||
|
||||
get_document_naming_doc() {
|
||||
const dt = this.opts.single_doctype;
|
||||
return frappe.model.with_doc(dt, dt).then(() => {
|
||||
return frappe.model.get_doc(dt, dt);
|
||||
});
|
||||
}
|
||||
|
||||
async get_transaction(doctype) {
|
||||
this.current_doctype = doctype;
|
||||
|
||||
await frappe.model.with_doctype(doctype, async () => {
|
||||
const meta = frappe.get_meta(doctype);
|
||||
const naming_df = (meta?.fields || []).find((df) => df.fieldname === "naming_series");
|
||||
const series_list = (naming_df?.options || "").split("\n").filter(Boolean);
|
||||
const rows = await Promise.all(
|
||||
series_list.map(async (series) => ({
|
||||
series: series,
|
||||
preview: await this.get_series_preview(series),
|
||||
}))
|
||||
);
|
||||
|
||||
this.dialog.fields_dict.naming_series_options.df.data = rows;
|
||||
this.dialog.fields_dict.naming_series_options.grid.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
save() {
|
||||
const rows = this.dialog.fields_dict.naming_series_options.grid.get_data();
|
||||
const naming_series_options = rows
|
||||
.map((r) => (r.series || "").trim())
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
|
||||
if (!this.current_doctype) {
|
||||
frappe.msgprint(__("Please select a transaction."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!naming_series_options) {
|
||||
frappe.msgprint(__("Please add at least one naming series."));
|
||||
return;
|
||||
}
|
||||
|
||||
this.get_document_naming_doc().then((doc) => {
|
||||
doc.transaction_type = this.current_doctype;
|
||||
doc.naming_series_options = naming_series_options;
|
||||
|
||||
frappe.call({
|
||||
doc: doc,
|
||||
method: "update_series",
|
||||
freeze: true,
|
||||
callback: async () => {
|
||||
const updated_rows = await Promise.all(
|
||||
naming_series_options
|
||||
.split("\n")
|
||||
.filter(Boolean)
|
||||
.map(async (series) => ({
|
||||
series: series,
|
||||
preview: await this.get_series_preview(series),
|
||||
}))
|
||||
);
|
||||
|
||||
this.dialog.fields_dict.naming_series_options.df.data = updated_rows;
|
||||
this.dialog.fields_dict.naming_series_options.grid.refresh();
|
||||
|
||||
frappe.show_alert({ message: __("Naming Series updated"), indicator: "green" });
|
||||
this.dialog.hide();
|
||||
this.opts.on_update?.({ doctype: this.current_doctype, naming_series_options });
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
erpnext.NamingSeriesTable = class NamingSeriesTable {
|
||||
constructor(opts = {}) {
|
||||
this.frm = opts.frm;
|
||||
this.transactions = opts.transactions || [];
|
||||
this.$wrapper = opts.frm.get_field(opts.fieldname).$wrapper;
|
||||
}
|
||||
render() {
|
||||
this.$wrapper.html(`
|
||||
<div class="form-grid" style="margin-bottom: 24px;">
|
||||
<table class="table" style="margin: 0;">
|
||||
<thead class="grid-heading-row" style="background-color: var(--subtle-fg);">
|
||||
<tr>
|
||||
<td style="width: 25%; padding: 8px 12px; text-align: left;">
|
||||
${__("Transaction")}
|
||||
</td>
|
||||
<td colspan="2"
|
||||
style="width: 75%; padding: 8px 12px; text-align: left; border-left: 1px solid var(--border-color);">
|
||||
${__("Current Series")}
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="naming-series-table-rows"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
`);
|
||||
|
||||
const $rows = this.$wrapper.find(".naming-series-table-rows");
|
||||
this.map_configure_button($rows);
|
||||
this.get_row_data($rows);
|
||||
}
|
||||
|
||||
map_configure_button($rows) {
|
||||
$rows.on("click", ".configure-btn", (e) => {
|
||||
const $btn = $(e.currentTarget);
|
||||
const doctype = $btn.data("doctype");
|
||||
const label = $btn.data("label");
|
||||
|
||||
if (!this.frm._naming_dialogs) this.frm._naming_dialogs = {};
|
||||
|
||||
if (!this.frm._naming_dialogs[doctype]) {
|
||||
this.frm._naming_dialogs[doctype] = new erpnext.NamingSeriesDialog({
|
||||
doctype: doctype,
|
||||
title: __("{0} Naming Series", [__(label)]),
|
||||
on_update: ({ naming_series_options }) => {
|
||||
const series = naming_series_options.split("\n").filter(Boolean);
|
||||
this.$wrapper
|
||||
.find(`.series-cell-${frappe.scrub(doctype)}`)
|
||||
.html(this.series_list_background(series));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
this.frm._naming_dialogs[doctype].show();
|
||||
});
|
||||
}
|
||||
|
||||
get_row_data($rows) {
|
||||
this.transactions.forEach((t) => {
|
||||
frappe.model.with_doctype(t.doctype, () => {
|
||||
const meta = frappe.get_meta(t.doctype);
|
||||
const naming_df = (meta?.fields || []).find((df) => df.fieldname === "naming_series");
|
||||
const series = (naming_df?.options || "")
|
||||
.split("\n")
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
$rows.append(this.make_row(t, series));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
make_row(t, series) {
|
||||
return $(`
|
||||
<tr>
|
||||
<td style="width: 25%; padding: 8px 12px; vertical-align: top; background-color: var(--card-bg);">
|
||||
${frappe.utils.escape_html(t.label)}
|
||||
</td>
|
||||
<td class="series-cell-${frappe.scrub(t.doctype)}"
|
||||
style="width: 70%; padding: 8px 12px; border-left: 1px solid var(--border-color); white-space: normal; vertical-align: top; background-color: var(--card-bg);">
|
||||
${this.series_list_background(series)}
|
||||
</td>
|
||||
<td class="text-center"
|
||||
style="width: 5%; padding: 8px 12px; border-left: 1px solid var(--border-color); vertical-align: middle; background-color: var(--card-bg);">
|
||||
<a class="btn-link configure-btn"
|
||||
data-doctype="${frappe.utils.escape_html(t.doctype)}"
|
||||
data-label="${frappe.utils.escape_html(t.label)}"
|
||||
style="cursor: pointer; color: var(--text-muted);">
|
||||
${frappe.utils.icon("edit", "sm")}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
series_list_background(series_list) {
|
||||
if (!series_list.length) {
|
||||
return `<span class="text-muted">${__("Not configured")}</span>`;
|
||||
}
|
||||
return series_list
|
||||
.map(
|
||||
(s) => `<span class="badge badge-light"
|
||||
style="margin: 2px; font-family: monospace; font-weight: normal;">
|
||||
${frappe.utils.escape_html(s)}
|
||||
</span>`
|
||||
)
|
||||
.join("");
|
||||
}
|
||||
};
|
||||
@@ -565,7 +565,9 @@ def _make_customer(source_name, ignore_permissions=False):
|
||||
if quotation.quotation_to == "Customer":
|
||||
return frappe.get_doc("Customer", quotation.party_name)
|
||||
elif quotation.quotation_to == "CRM Deal":
|
||||
return frappe.get_doc("Customer", {"crm_deal": quotation.party_name})
|
||||
customer_name = frappe.get_value("Customer", {"crm_deal": quotation.party_name})
|
||||
if customer_name:
|
||||
return frappe.get_doc("Customer", customer_name)
|
||||
|
||||
# Check if a Customer already exists for the Lead or Prospect.
|
||||
existing_customer = None
|
||||
|
||||
@@ -183,6 +183,61 @@ class TestQuotation(ERPNextTestSuite):
|
||||
|
||||
self.assertTrue(quotation.payment_schedule)
|
||||
|
||||
def test_terms_attachments_are_copied_to_quotation(self):
|
||||
terms = make_terms_and_conditions(copy_attachments_to_transaction=True)
|
||||
first_attachment = make_file_attachment(
|
||||
"Terms and Conditions",
|
||||
terms.name,
|
||||
content="First terms attachment",
|
||||
)
|
||||
|
||||
quotation = make_quotation(do_not_save=1)
|
||||
quotation.tc_name = terms.name
|
||||
quotation.insert()
|
||||
|
||||
self.assertEqual(get_attachment_urls("Quotation", quotation.name), {first_attachment.file_url})
|
||||
|
||||
second_attachment = make_file_attachment(
|
||||
"Terms and Conditions",
|
||||
terms.name,
|
||||
content="Second terms attachment",
|
||||
)
|
||||
quotation.valid_till = add_days(getdate(quotation.valid_till), 1)
|
||||
quotation.save()
|
||||
|
||||
quotation_attachments = get_attachment_urls("Quotation", quotation.name)
|
||||
self.assertEqual(quotation_attachments, {first_attachment.file_url})
|
||||
self.assertNotIn(second_attachment.file_url, quotation_attachments)
|
||||
|
||||
new_terms = make_terms_and_conditions(copy_attachments_to_transaction=True)
|
||||
new_terms_attachment = make_file_attachment(
|
||||
"Terms and Conditions",
|
||||
new_terms.name,
|
||||
content="Attachment from updated terms",
|
||||
)
|
||||
quotation.tc_name = new_terms.name
|
||||
quotation.valid_till = add_days(getdate(quotation.valid_till), 1)
|
||||
quotation.save()
|
||||
|
||||
self.assertEqual(
|
||||
get_attachment_urls("Quotation", quotation.name),
|
||||
{first_attachment.file_url, new_terms_attachment.file_url},
|
||||
)
|
||||
|
||||
def test_terms_attachments_are_not_copied_when_disabled(self):
|
||||
terms = make_terms_and_conditions(copy_attachments_to_transaction=False)
|
||||
make_file_attachment(
|
||||
"Terms and Conditions",
|
||||
terms.name,
|
||||
content="Terms attachment should stay on the template",
|
||||
)
|
||||
|
||||
quotation = make_quotation(do_not_save=1)
|
||||
quotation.tc_name = terms.name
|
||||
quotation.insert()
|
||||
|
||||
self.assertFalse(get_attachment_urls("Quotation", quotation.name))
|
||||
|
||||
@ERPNextTestSuite.change_settings(
|
||||
"Accounts Settings",
|
||||
{"automatically_fetch_payment_terms": 1},
|
||||
@@ -1148,6 +1203,42 @@ def get_quotation_dict(party_name=None, item_code=None):
|
||||
}
|
||||
|
||||
|
||||
def make_terms_and_conditions(copy_attachments_to_transaction=False):
|
||||
return frappe.get_doc(
|
||||
{
|
||||
"doctype": "Terms and Conditions",
|
||||
"title": f"_Test Terms and Conditions {frappe.generate_hash(length=8)}",
|
||||
"selling": 1,
|
||||
"terms": "Test terms",
|
||||
"copy_attachments_to_transaction": 1 if copy_attachments_to_transaction else 0,
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
def make_file_attachment(doctype, docname, content):
|
||||
return frappe.get_doc(
|
||||
{
|
||||
"doctype": "File",
|
||||
"file_name": f"terms-attachment-{frappe.generate_hash(length=8)}.txt",
|
||||
"attached_to_doctype": doctype,
|
||||
"attached_to_name": docname,
|
||||
"content": content,
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
def get_attachment_urls(doctype, docname):
|
||||
return {
|
||||
file.file_url
|
||||
for file in frappe.get_all(
|
||||
"File",
|
||||
filters={"attached_to_doctype": doctype, "attached_to_name": docname},
|
||||
fields=["file_url"],
|
||||
)
|
||||
if file.file_url
|
||||
}
|
||||
|
||||
|
||||
def make_quotation(**args):
|
||||
qo = frappe.new_doc("Quotation")
|
||||
args = frappe._dict(args)
|
||||
|
||||
@@ -1162,11 +1162,13 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
||||
}
|
||||
// payment request
|
||||
if (flt(doc.per_billed) < 100 + frappe.boot.sysdefaults.over_billing_allowance) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment Request"),
|
||||
() => this.make_payment_request_with_schedule(),
|
||||
__("Create")
|
||||
);
|
||||
if (frappe.boot.user.in_create.includes("Payment Request")) {
|
||||
this.frm.add_custom_button(
|
||||
__("Payment Request"),
|
||||
() => this.make_payment_request_with_schedule(),
|
||||
__("Create")
|
||||
);
|
||||
}
|
||||
|
||||
if (frappe.model.can_create("Payment Entry")) {
|
||||
this.frm.add_custom_button(
|
||||
@@ -1218,6 +1220,24 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
||||
this.order_type(doc);
|
||||
}
|
||||
|
||||
items_add(doc, cdt, cdn) {
|
||||
const row = frappe.get_doc(cdt, cdn);
|
||||
const field_copy = [];
|
||||
if (doc.project) {
|
||||
frappe.model.set_value(cdt, cdn, "project", doc.project);
|
||||
} else {
|
||||
field_copy.push("project");
|
||||
}
|
||||
if (doc.delivery_date) {
|
||||
frappe.model.set_value(cdt, cdn, "delivery_date", doc.delivery_date);
|
||||
} else {
|
||||
field_copy.push("delivery_date");
|
||||
}
|
||||
if (field_copy.length) {
|
||||
this.frm.script_manager.copy_from_first_row("items", row, field_copy);
|
||||
}
|
||||
}
|
||||
|
||||
create_pick_list() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.selling.doctype.sales_order.sales_order.create_pick_list",
|
||||
|
||||
@@ -847,6 +847,7 @@
|
||||
"hide_days": 1,
|
||||
"hide_seconds": 1,
|
||||
"label": "Loyalty Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
@@ -1480,6 +1481,7 @@
|
||||
"fieldname": "amount_eligible_for_commission",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount Eligible for Commission",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -1763,7 +1765,7 @@
|
||||
"idx": 105,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-28 06:30:35.902868",
|
||||
"modified": "2026-05-01 02:37:30.937916",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order",
|
||||
|
||||
@@ -610,6 +610,7 @@ class SalesOrder(SellingController):
|
||||
self.update_subcontracting_order_status()
|
||||
self.notify_update()
|
||||
clear_doctype_notifications(self)
|
||||
self.update_blanket_order()
|
||||
|
||||
def update_subcontracting_order_status(self):
|
||||
from erpnext.subcontracting.doctype.subcontracting_inward_order.subcontracting_inward_order import (
|
||||
|
||||
@@ -2,7 +2,80 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on("Selling Settings", {
|
||||
refresh(frm) {
|
||||
const display = frm.doc.cust_master_name === "Naming Series";
|
||||
frm.set_df_property("naming_series_details", "hidden", !display);
|
||||
frm.set_df_property("configure", "hidden", !display);
|
||||
if (display) {
|
||||
find_naming_series("Customer", "naming_series_details", frm);
|
||||
}
|
||||
load_default_naming_series(frm);
|
||||
},
|
||||
cust_master_name(frm) {
|
||||
const display = frm.doc.cust_master_name === "Naming Series";
|
||||
frm.set_df_property("naming_series_details", "hidden", !display);
|
||||
frm.set_df_property("configure", "hidden", !display);
|
||||
if (display) {
|
||||
find_naming_series("Customer", "naming_series_details", frm);
|
||||
} else {
|
||||
frm.set_value("naming_series_details", "");
|
||||
}
|
||||
},
|
||||
|
||||
configure(frm) {
|
||||
show_naming_series_dialog("Customer", frm);
|
||||
},
|
||||
|
||||
after_save(frm) {
|
||||
frappe.boot.user.defaults.editable_price_list_rate = frm.doc.editable_price_list_rate;
|
||||
},
|
||||
});
|
||||
|
||||
function show_naming_series_dialog(doctype, frm) {
|
||||
if (!frm._naming_series_dialog) {
|
||||
frm._naming_series_dialog = new erpnext.NamingSeriesDialog({
|
||||
doctype: doctype,
|
||||
title: __("Naming Series for {0}", [__(doctype)]),
|
||||
on_update: ({ naming_series_options }) => {
|
||||
frm.set_value("naming_series_details", naming_series_options);
|
||||
},
|
||||
});
|
||||
}
|
||||
frm._naming_series_dialog.show();
|
||||
}
|
||||
function find_naming_series(doctype, field, frm) {
|
||||
frappe.model.with_doctype(doctype, () => {
|
||||
const meta = frappe.get_meta(doctype);
|
||||
const naming_df = (meta?.fields || []).find((df) => df.fieldname === "naming_series");
|
||||
const options = naming_df?.options || "";
|
||||
const series_list = options
|
||||
.split("\n")
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
frm.doc[field] = series_list.length ? series_list.join("\n") : __("No naming series defined");
|
||||
|
||||
frm.refresh_field(field);
|
||||
});
|
||||
}
|
||||
|
||||
function load_default_naming_series(frm) {
|
||||
let transactions = [
|
||||
{ label: __("Customer"), doctype: "Customer" },
|
||||
{ label: __("Quotation"), doctype: "Quotation" },
|
||||
{ label: __("Sales Order"), doctype: "Sales Order" },
|
||||
{ label: __("Sales Invoice"), doctype: "Sales Invoice" },
|
||||
{ label: __("Delivery Note"), doctype: "Delivery Note" },
|
||||
{ label: __("Payment Entry"), doctype: "Payment Entry" },
|
||||
{ label: __("POS Invoice"), doctype: "POS Invoice" },
|
||||
];
|
||||
|
||||
if (frm.doc.cust_master_name !== "Naming Series") {
|
||||
transactions = transactions.filter((t) => t.doctype !== "Customer");
|
||||
}
|
||||
new erpnext.NamingSeriesTable({
|
||||
frm: frm,
|
||||
fieldname: "transaction_naming_html",
|
||||
transactions: transactions,
|
||||
}).render();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
"customer_defaults_tab",
|
||||
"customer_defaults_section",
|
||||
"cust_master_name",
|
||||
"customer_group",
|
||||
"naming_series_details",
|
||||
"configure",
|
||||
"column_break_4",
|
||||
"customer_group",
|
||||
"territory",
|
||||
"item_price_tab",
|
||||
"item_price_settings_section",
|
||||
@@ -57,7 +59,9 @@
|
||||
"section_break_zwh6",
|
||||
"allow_delivery_of_overproduced_qty",
|
||||
"column_break_mla9",
|
||||
"deliver_secondary_items"
|
||||
"deliver_secondary_items",
|
||||
"default_naming_tab",
|
||||
"transaction_naming_html"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -279,7 +283,7 @@
|
||||
{
|
||||
"fieldname": "item_price_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Item Price"
|
||||
"label": "Pricing"
|
||||
},
|
||||
{
|
||||
"fieldname": "transaction_tab",
|
||||
@@ -377,6 +381,29 @@
|
||||
"fieldname": "blanket_orders_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Blanket Orders"
|
||||
},
|
||||
{
|
||||
"fieldname": "configure",
|
||||
"fieldtype": "Button",
|
||||
"hidden": 1,
|
||||
"label": "Configure Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "naming_series_details",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"is_virtual": 1,
|
||||
"label": "Naming Series options",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "default_naming_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Document Naming"
|
||||
},
|
||||
{
|
||||
"fieldname": "transaction_naming_html",
|
||||
"fieldtype": "HTML"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
@@ -385,7 +412,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-21 21:29:32.890098",
|
||||
"modified": "2026-04-29 11:05:48.836362",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Selling Settings",
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"field_order": [
|
||||
"title",
|
||||
"disabled",
|
||||
"column_break_ofhb",
|
||||
"copy_attachments_to_transaction",
|
||||
"applicable_modules_section",
|
||||
"selling",
|
||||
"buying",
|
||||
@@ -72,12 +74,22 @@
|
||||
{
|
||||
"fieldname": "section_break_7",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_ofhb",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "copy_attachments_to_transaction",
|
||||
"fieldtype": "Check",
|
||||
"label": "Copy Attachments to Transaction"
|
||||
}
|
||||
],
|
||||
"icon": "icon-legal",
|
||||
"idx": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-14 18:22:49.285298",
|
||||
"modified": "2026-04-29 22:51:49.285298",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Terms and Conditions",
|
||||
|
||||
@@ -21,6 +21,7 @@ class TermsandConditions(Document):
|
||||
from frappe.types import DF
|
||||
|
||||
buying: DF.Check
|
||||
copy_attachments_to_transaction: DF.Check
|
||||
disabled: DF.Check
|
||||
selling: DF.Check
|
||||
terms: DF.TextEditor | None
|
||||
|
||||
@@ -1387,6 +1387,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1405,6 +1406,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1423,6 +1425,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1441,6 +1444,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1459,6 +1463,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1477,6 +1482,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1499,6 +1505,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1517,6 +1524,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1535,6 +1543,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1553,6 +1562,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1571,6 +1581,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1589,6 +1600,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1620,6 +1632,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1629,6 +1642,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1638,6 +1652,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1647,6 +1662,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1656,6 +1672,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1665,6 +1682,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1674,6 +1692,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1683,6 +1702,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1692,6 +1712,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1701,6 +1722,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1710,6 +1732,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1719,6 +1742,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -1727,6 +1751,7 @@
|
||||
"account_number": "1433",
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
}
|
||||
]
|
||||
@@ -2150,6 +2175,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2168,6 +2194,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2186,6 +2213,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2204,6 +2232,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2222,6 +2251,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2240,6 +2270,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2262,6 +2293,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2280,6 +2312,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2298,6 +2331,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2316,6 +2350,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2334,6 +2369,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2352,6 +2388,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2383,6 +2420,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2392,6 +2430,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2401,6 +2440,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2410,6 +2450,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2419,6 +2460,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2428,6 +2470,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2437,6 +2480,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2446,6 +2490,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2455,6 +2500,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2464,6 +2510,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2473,6 +2520,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2482,6 +2530,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2490,6 +2539,7 @@
|
||||
"account_number": "1588",
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
}
|
||||
]
|
||||
@@ -2913,6 +2963,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2931,6 +2982,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2949,6 +3001,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2967,6 +3020,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -2985,6 +3039,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3003,6 +3058,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3025,6 +3081,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3043,6 +3100,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3061,7 +3119,8 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"tax_rate": 19.00
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
@@ -3079,6 +3138,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3097,6 +3157,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3115,6 +3176,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3146,6 +3208,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3155,6 +3218,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3164,6 +3228,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3173,6 +3238,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3182,6 +3248,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3191,6 +3258,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3200,6 +3268,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3209,6 +3278,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3218,6 +3288,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3227,6 +3298,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3236,6 +3308,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3245,6 +3318,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3253,6 +3327,7 @@
|
||||
"account_number": "1550",
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
}
|
||||
]
|
||||
@@ -3645,6 +3720,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3661,6 +3737,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3677,6 +3754,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3693,6 +3771,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3709,6 +3788,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3725,6 +3805,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3745,6 +3826,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3761,6 +3843,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3777,6 +3860,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3793,6 +3877,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3809,6 +3894,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3825,6 +3911,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3853,6 +3940,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3861,6 +3949,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3869,6 +3958,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3877,6 +3967,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3885,6 +3976,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3893,6 +3985,7 @@
|
||||
"root_type": "Liability",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3901,6 +3994,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3909,6 +4003,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3917,6 +4012,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3925,6 +4021,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3933,6 +4030,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 19.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3941,6 +4039,7 @@
|
||||
"root_type": "Asset",
|
||||
"tax_rate": 7.00
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
},
|
||||
{
|
||||
@@ -3948,6 +4047,7 @@
|
||||
"account_name": "Entstandene Einfuhrumsatzsteuer",
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"not_applicable": 1,
|
||||
"tax_rate": 0.00
|
||||
}
|
||||
]
|
||||
|
||||
@@ -372,6 +372,15 @@ erpnext.stock.DeliveryNoteController = class DeliveryNoteController extends (
|
||||
});
|
||||
}
|
||||
|
||||
items_add(doc, cdt, cdn) {
|
||||
const row = frappe.get_doc(cdt, cdn);
|
||||
if (doc.project) {
|
||||
frappe.model.set_value(cdt, cdn, "project", doc.project);
|
||||
} else {
|
||||
this.frm.script_manager.copy_from_first_row("items", row, ["project"]);
|
||||
}
|
||||
}
|
||||
|
||||
make_sales_invoice() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
|
||||
@@ -1265,6 +1265,7 @@
|
||||
"fieldname": "amount_eligible_for_commission",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount Eligible for Commission",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -1465,7 +1466,7 @@
|
||||
"idx": 146,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-28 06:37:33.600775",
|
||||
"modified": "2026-05-01 02:37:31.430649",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note",
|
||||
|
||||
@@ -368,11 +368,13 @@ erpnext.stock.PurchaseReceiptController = class PurchaseReceiptController extend
|
||||
|
||||
items_add(doc, cdt, cdn) {
|
||||
const row = frappe.get_doc(cdt, cdn);
|
||||
this.frm.script_manager.copy_from_first_row("items", row, [
|
||||
"expense_account",
|
||||
"cost_center",
|
||||
"project",
|
||||
]);
|
||||
const field_copy = ["expense_account", "cost_center"];
|
||||
if (doc.project) {
|
||||
frappe.model.set_value(cdt, cdn, "project", doc.project);
|
||||
} else {
|
||||
field_copy.push("project");
|
||||
}
|
||||
this.frm.script_manager.copy_from_first_row("items", row, field_copy);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -724,6 +724,9 @@ class PurchaseReceipt(BuyingController):
|
||||
or stock_asset_rbnb
|
||||
)
|
||||
|
||||
if self.is_return and item.expense_account:
|
||||
loss_account = item.expense_account
|
||||
|
||||
cost_center = item.cost_center or frappe.get_cached_value(
|
||||
"Company", self.company, "cost_center"
|
||||
)
|
||||
|
||||
@@ -1049,7 +1049,7 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.use_serial_batch_fields === 0",
|
||||
"depends_on": "eval:doc.use_serial_batch_fields === 0 && parent.docstatus == 0",
|
||||
"fieldname": "add_serial_batch_for_rejected_qty",
|
||||
"fieldtype": "Button",
|
||||
"label": "Add Serial / Batch No (Rejected Qty)"
|
||||
@@ -1064,7 +1064,7 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.use_serial_batch_fields === 0",
|
||||
"depends_on": "eval:doc.use_serial_batch_fields === 0 && parent.docstatus == 0",
|
||||
"fieldname": "add_serial_batch_bundle",
|
||||
"fieldtype": "Button",
|
||||
"label": "Add Serial / Batch No"
|
||||
@@ -1149,7 +1149,7 @@
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-07 15:40:47.032889",
|
||||
"modified": "2026-04-29 16:01:34.154697",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Purchase Receipt Item",
|
||||
|
||||
@@ -411,8 +411,15 @@ def repost(doc):
|
||||
message = message.get("message")
|
||||
|
||||
status = "Failed"
|
||||
# If failed because of timeout, set status to In Progress
|
||||
if traceback and ("timeout" in traceback.lower() or "Deadlock found" in traceback):
|
||||
# If failed because of a recoverable error (timeout, deadlock), set status to In Progress
|
||||
# so the scheduler automatically retries instead of leaving it permanently failed.
|
||||
# NOTE: isinstance check comes first because the traceback string matching is unreliable
|
||||
# when SIGALRM kills the process mid-C-extension (JobTimeoutException may not appear
|
||||
# in the traceback if the exception handler itself was interrupted).
|
||||
traceback_lower = traceback.lower() if traceback else ""
|
||||
if isinstance(e, RecoverableErrors) or (
|
||||
traceback_lower and ("timeout" in traceback_lower or "deadlock found" in traceback_lower)
|
||||
):
|
||||
status = "In Progress"
|
||||
|
||||
if traceback:
|
||||
|
||||
@@ -8,11 +8,10 @@ from collections import Counter, defaultdict
|
||||
|
||||
import frappe
|
||||
import frappe.query_builder
|
||||
import frappe.query_builder.functions
|
||||
from frappe import _, _dict, bold
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.naming import make_autoname
|
||||
from frappe.query_builder.functions import Concat_ws, Locate, Sum
|
||||
from frappe.query_builder.functions import Concat_ws, Sum
|
||||
from frappe.utils import (
|
||||
cint,
|
||||
cstr,
|
||||
@@ -3358,22 +3357,21 @@ def get_stock_ledgers_for_serial_nos(kwargs):
|
||||
serial_nos = [serial_nos]
|
||||
|
||||
if serial_nos:
|
||||
import re
|
||||
|
||||
escaped_serial_nos = [re.escape(sn) for sn in serial_nos if sn]
|
||||
regex_pattern = r"\n(" + "|".join(escaped_serial_nos) + r")\n"
|
||||
|
||||
query = (
|
||||
query.left_join(serial_batch_entry)
|
||||
.on(stock_ledger_entry.serial_and_batch_bundle == serial_batch_entry.parent)
|
||||
.where(
|
||||
serial_batch_entry.serial_no.isin(serial_nos)
|
||||
| Concat_ws("", "\n", stock_ledger_entry.serial_no, "\n").regexp(regex_pattern)
|
||||
)
|
||||
.distinct()
|
||||
)
|
||||
|
||||
bundle_match = serial_batch_entry.serial_no.isin(serial_nos)
|
||||
|
||||
padded_serial_no = Concat_ws("", "\n", stock_ledger_entry.serial_no, "\n")
|
||||
direct_match = None
|
||||
for sn in serial_nos:
|
||||
cond = Locate(f"\n{sn}\n", padded_serial_no) > 0
|
||||
direct_match = cond if direct_match is None else (direct_match | cond)
|
||||
|
||||
query = query.where(bundle_match | direct_match)
|
||||
|
||||
if kwargs.ignore_voucher_detail_no:
|
||||
query = query.where(stock_ledger_entry.voucher_detail_no != kwargs.ignore_voucher_detail_no)
|
||||
|
||||
|
||||
@@ -1117,6 +1117,7 @@ def insert_item_price(ctx: ItemDetailsCtx):
|
||||
currency=ctx.currency,
|
||||
uom=ctx.stock_uom,
|
||||
price_list=ctx.price_list,
|
||||
valid_from=transaction_date,
|
||||
)
|
||||
item_price.insert()
|
||||
frappe.msgprint(
|
||||
@@ -1139,6 +1140,7 @@ def insert_item_price(ctx: ItemDetailsCtx):
|
||||
"currency": ctx.currency,
|
||||
"price_list_rate": price_list_rate,
|
||||
"uom": ctx.stock_uom,
|
||||
"valid_from": transaction_date,
|
||||
}
|
||||
)
|
||||
item_price.insert()
|
||||
|
||||
@@ -7,6 +7,7 @@ import frappe
|
||||
from frappe import _
|
||||
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos as get_serial_nos_from_sle
|
||||
from erpnext.stock.serial_batch_bundle import get_serial_no_status
|
||||
from erpnext.stock.stock_ledger import get_stock_ledger_entries
|
||||
|
||||
BUYING_VOUCHER_TYPES = ["Purchase Invoice", "Purchase Receipt", "Subcontracting Receipt"]
|
||||
@@ -111,7 +112,7 @@ def get_data(filters):
|
||||
"posting_time": row.posting_time,
|
||||
"voucher_type": row.voucher_type,
|
||||
"voucher_no": row.voucher_no,
|
||||
"status": "Active" if row.actual_qty > 0 else "Delivered",
|
||||
"status": get_serial_no_status(row),
|
||||
"company": row.company,
|
||||
"warehouse": row.warehouse,
|
||||
"qty": 1 if row.actual_qty > 0 else -1,
|
||||
|
||||
@@ -73,6 +73,7 @@ def execute(filters=None):
|
||||
inv_dimension_wise_dict, filters, inv_dimension_key=inv_dimension_key, opening_row=opening_row
|
||||
)
|
||||
|
||||
item_wh_wise_prev_sle = {}
|
||||
for sle in sl_entries:
|
||||
item_detail = item_details[sle.item_code]
|
||||
|
||||
@@ -114,6 +115,21 @@ def execute(filters=None):
|
||||
elif sle.voucher_type == "Stock Reconciliation":
|
||||
sle["in_out_rate"] = sle.valuation_rate
|
||||
|
||||
if (
|
||||
sle.voucher_type == "Stock Reconciliation"
|
||||
and not sle.in_qty
|
||||
and not sle.out_qty
|
||||
and not sle.actual_qty
|
||||
):
|
||||
if prev_sle := item_wh_wise_prev_sle.get((sle.item_code, sle.warehouse)):
|
||||
bal_qty = prev_sle.get("qty_after_transaction", 0)
|
||||
qty = sle.qty_after_transaction - bal_qty
|
||||
if qty > 0:
|
||||
sle.in_qty = qty
|
||||
elif qty < 0:
|
||||
sle.out_qty = qty
|
||||
|
||||
item_wh_wise_prev_sle[(sle.item_code, sle.warehouse)] = sle
|
||||
data.append(sle)
|
||||
|
||||
if include_uom:
|
||||
|
||||
@@ -15,6 +15,45 @@ from erpnext.stock.deprecated_serial_batch import (
|
||||
)
|
||||
from erpnext.stock.valuation import round_off_if_near_zero
|
||||
|
||||
CONSUMED_SERIAL_NO_STOCK_ENTRY_PURPOSES = (
|
||||
"Manufacture",
|
||||
"Material Issue",
|
||||
"Repack",
|
||||
"Material Consumption for Manufacture",
|
||||
)
|
||||
INACTIVE_SERIAL_NO_STOCK_ENTRY_PURPOSES = ("Disassemble", "Material Receipt")
|
||||
|
||||
|
||||
def get_serial_no_status(sle):
|
||||
warehouse = sle.warehouse if sle.actual_qty > 0 else None
|
||||
if warehouse:
|
||||
return "Active"
|
||||
|
||||
status = get_status_for_serial_nos(sle)
|
||||
if sle.voucher_type == "Stock Entry" and sle.actual_qty < 0:
|
||||
purpose = frappe.get_cached_value("Stock Entry", sle.voucher_no, "purpose")
|
||||
if purpose in INACTIVE_SERIAL_NO_STOCK_ENTRY_PURPOSES:
|
||||
status = "Inactive"
|
||||
|
||||
return status
|
||||
|
||||
|
||||
def get_status_for_serial_nos(sle):
|
||||
status = "Inactive"
|
||||
if sle.actual_qty < 0:
|
||||
status = "Delivered"
|
||||
if sle.voucher_type == "Stock Entry":
|
||||
purpose = frappe.get_cached_value("Stock Entry", sle.voucher_no, "purpose")
|
||||
if purpose in CONSUMED_SERIAL_NO_STOCK_ENTRY_PURPOSES:
|
||||
status = "Consumed"
|
||||
|
||||
if sle.is_cancelled == 1 and (
|
||||
sle.voucher_type in ["Purchase Invoice", "Purchase Receipt"] or status == "Consumed"
|
||||
):
|
||||
status = "Inactive"
|
||||
|
||||
return status
|
||||
|
||||
|
||||
class SerialBatchBundle:
|
||||
def __init__(self, **kwargs):
|
||||
@@ -429,25 +468,7 @@ class SerialBatchBundle:
|
||||
self.update_serial_no_status_warehouse(self.sle, serial_nos)
|
||||
|
||||
def get_status_for_serial_nos(self, sle):
|
||||
status = "Inactive"
|
||||
if sle.actual_qty < 0:
|
||||
status = "Delivered"
|
||||
if sle.voucher_type == "Stock Entry":
|
||||
purpose = frappe.get_cached_value("Stock Entry", sle.voucher_no, "purpose")
|
||||
if purpose in [
|
||||
"Manufacture",
|
||||
"Material Issue",
|
||||
"Repack",
|
||||
"Material Consumption for Manufacture",
|
||||
]:
|
||||
status = "Consumed"
|
||||
|
||||
if sle.is_cancelled == 1 and (
|
||||
sle.voucher_type in ["Purchase Invoice", "Purchase Receipt"] or status == "Consumed"
|
||||
):
|
||||
status = "Inactive"
|
||||
|
||||
return status
|
||||
return get_status_for_serial_nos(sle)
|
||||
|
||||
def update_serial_no_status_warehouse(self, sle, serial_nos):
|
||||
warehouse = sle.warehouse if sle.actual_qty > 0 else None
|
||||
@@ -455,19 +476,12 @@ class SerialBatchBundle:
|
||||
if isinstance(serial_nos, str):
|
||||
serial_nos = [serial_nos]
|
||||
|
||||
status = "Active"
|
||||
if not warehouse:
|
||||
status = self.get_status_for_serial_nos(sle)
|
||||
status = get_serial_no_status(sle)
|
||||
|
||||
customer = None
|
||||
if sle.voucher_type in ["Sales Invoice", "Delivery Note"] and sle.actual_qty < 0:
|
||||
customer = frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "customer")
|
||||
|
||||
if sle.voucher_type in ["Stock Entry"] and sle.actual_qty < 0:
|
||||
purpose = frappe.get_cached_value("Stock Entry", sle.voucher_no, "purpose")
|
||||
if purpose in ["Disassemble", "Material Receipt"]:
|
||||
status = "Inactive"
|
||||
|
||||
sn_table = frappe.qb.DocType("Serial No")
|
||||
|
||||
query = (
|
||||
|
||||
@@ -18,6 +18,14 @@ class UOMMustBeIntegerError(frappe.ValidationError):
|
||||
|
||||
|
||||
class TransactionBase(StatusUpdater):
|
||||
def on_change(self):
|
||||
# `on_change` also fires for `db_set()`, so only run during an actual insert/save.
|
||||
is_real_save = self.flags.in_insert or (self.doctype, self.name) in frappe.flags.currently_saving
|
||||
if not is_real_save:
|
||||
return
|
||||
|
||||
self.copy_terms_and_conditions_attachments()
|
||||
|
||||
def validate_posting_time(self):
|
||||
# set Edit Posting Date and Time to 1 while data import and restore
|
||||
if (frappe.flags.in_import or self.flags.from_restore) and self.posting_date:
|
||||
@@ -36,6 +44,56 @@ class TransactionBase(StatusUpdater):
|
||||
def validate_uom_is_integer(self, uom_field, qty_fields, child_dt=None):
|
||||
validate_uom_is_integer(self, uom_field, qty_fields, child_dt)
|
||||
|
||||
def copy_terms_and_conditions_attachments(self):
|
||||
if (
|
||||
not self.name
|
||||
or not self.meta.has_field("tc_name")
|
||||
or not self.tc_name
|
||||
or not self.has_value_changed("tc_name")
|
||||
):
|
||||
return
|
||||
|
||||
copy_attachments_to_transaction = frappe.db.get_value(
|
||||
"Terms and Conditions", self.tc_name, "copy_attachments_to_transaction"
|
||||
)
|
||||
if not cint(copy_attachments_to_transaction):
|
||||
return
|
||||
|
||||
source_attachments = frappe.get_all(
|
||||
"File",
|
||||
filters={
|
||||
"attached_to_doctype": "Terms and Conditions",
|
||||
"attached_to_name": self.tc_name,
|
||||
},
|
||||
fields=["name", "file_url"],
|
||||
)
|
||||
if not source_attachments:
|
||||
return
|
||||
|
||||
existing_file_urls = {
|
||||
attachment.file_url
|
||||
for attachment in frappe.get_all(
|
||||
"File",
|
||||
filters={
|
||||
"attached_to_doctype": self.doctype,
|
||||
"attached_to_name": self.name,
|
||||
},
|
||||
fields=["file_url"],
|
||||
)
|
||||
if attachment.file_url
|
||||
}
|
||||
|
||||
for source_attachment in source_attachments:
|
||||
if not source_attachment.file_url or source_attachment.file_url in existing_file_urls:
|
||||
continue
|
||||
|
||||
# Reuse the existing file metadata so the same on-disk blob is shared.
|
||||
new_attachment = frappe.get_doc("File", source_attachment.name).create_attachment_copy(
|
||||
attached_to_doctype=self.doctype,
|
||||
attached_to_name=self.name,
|
||||
)
|
||||
existing_file_urls.add(new_attachment.file_url)
|
||||
|
||||
def validate_with_previous_doc(self, ref):
|
||||
self.exclude_fields = ["conversion_factor", "uom"] if self.get("is_return") else []
|
||||
|
||||
|
||||
@@ -289,17 +289,6 @@
|
||||
"show_arrow": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"child": 1,
|
||||
"collapsible": 1,
|
||||
"indent": 0,
|
||||
"keep_closed": 0,
|
||||
"label": "BOM Stock Report",
|
||||
"link_to": "BOM Stock Report",
|
||||
"link_type": "Report",
|
||||
"show_arrow": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"child": 1,
|
||||
"collapsible": 1,
|
||||
@@ -437,7 +426,7 @@
|
||||
"type": "Link"
|
||||
}
|
||||
],
|
||||
"modified": "2026-02-20 16:45:00.399936",
|
||||
"modified": "2026-05-05 11:01:50.260118",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"module_onboarding": "Manufacturing Onboarding",
|
||||
|
||||
Reference in New Issue
Block a user