Merge pull request #38269 from GursheenK/skip-fixed-assets-in-product-bundle
fix: skip fixed assets in product bundle
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json
index 2eb54a5..906760e 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.json
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json
@@ -548,8 +548,16 @@
"icon": "fa fa-file-text",
"idx": 176,
"is_submittable": 1,
- "links": [],
- "modified": "2023-08-10 14:32:22.366895",
+ "links": [
+ {
+ "is_child_table": 1,
+ "link_doctype": "Bank Transaction Payments",
+ "link_fieldname": "payment_entry",
+ "parent_doctype": "Bank Transaction",
+ "table_fieldname": "payment_entries"
+ }
+ ],
+ "modified": "2023-11-23 12:11:04.128015",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry",
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 85ef6f7..1cff4c7 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -868,7 +868,7 @@
party_account_currency = d.account_currency
elif frappe.get_cached_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
- bank_amount += d.debit_in_account_currency or d.credit_in_account_currency
+ bank_amount += flt(d.debit_in_account_currency) or flt(d.credit_in_account_currency)
bank_account_currency = d.account_currency
if party_type and pay_to_recd_from:
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index 3ba8cea..3132fe9 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -203,7 +203,8 @@
"fieldtype": "Select",
"label": "Reference Type",
"no_copy": 1,
- "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance\nExchange Rate Revaluation\nInvoice Discounting\nFees\nFull and Final Statement\nPayment Entry"
+ "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance\nExchange Rate Revaluation\nInvoice Discounting\nFees\nFull and Final Statement\nPayment Entry",
+ "search_index": 1
},
{
"fieldname": "reference_name",
@@ -211,7 +212,8 @@
"in_list_view": 1,
"label": "Reference Name",
"no_copy": 1,
- "options": "reference_type"
+ "options": "reference_type",
+ "search_index": 1
},
{
"depends_on": "eval:doc.reference_type&&!in_list(doc.reference_type, ['Expense Claim', 'Asset', 'Employee Loan', 'Employee Advance'])",
@@ -278,13 +280,14 @@
"fieldtype": "Data",
"hidden": 1,
"label": "Reference Detail No",
- "no_copy": 1
+ "no_copy": 1,
+ "search_index": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2023-06-16 14:11:13.507807",
+ "modified": "2023-11-23 11:44:25.841187",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry Account",
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json
index 4d50a35..aa18156 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.json
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json
@@ -750,8 +750,16 @@
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
- "links": [],
- "modified": "2023-11-08 21:51:03.482709",
+ "links": [
+ {
+ "is_child_table": 1,
+ "link_doctype": "Bank Transaction Payments",
+ "link_fieldname": "payment_entry",
+ "parent_doctype": "Bank Transaction",
+ "table_fieldname": "payment_entries"
+ }
+ ],
+ "modified": "2023-11-23 12:07:20.887885",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
index b88791d..ccb9e64 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
@@ -212,9 +212,10 @@
],
"hide_toolbar": 1,
"icon": "icon-resize-horizontal",
+ "is_virtual": 1,
"issingle": 1,
"links": [],
- "modified": "2023-08-15 05:35:50.109290",
+ "modified": "2023-11-17 17:33:55.701726",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation",
@@ -239,6 +240,5 @@
],
"sort_field": "modified",
"sort_order": "DESC",
- "states": [],
- "track_changes": 1
+ "states": []
}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index 43167be..6673e8d 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -29,6 +29,58 @@
self.accounting_dimension_filter_conditions = []
self.ple_posting_date_filter = []
+ def load_from_db(self):
+ # 'modified' attribute is required for `run_doc_method` to work properly.
+ doc_dict = frappe._dict(
+ {
+ "modified": None,
+ "company": None,
+ "party": None,
+ "party_type": None,
+ "receivable_payable_account": None,
+ "default_advance_account": None,
+ "from_invoice_date": None,
+ "to_invoice_date": None,
+ "invoice_limit": 50,
+ "from_payment_date": None,
+ "to_payment_date": None,
+ "payment_limit": 50,
+ "minimum_invoice_amount": None,
+ "minimum_payment_amount": None,
+ "maximum_invoice_amount": None,
+ "maximum_payment_amount": None,
+ "bank_cash_account": None,
+ "cost_center": None,
+ "payment_name": None,
+ "invoice_name": None,
+ }
+ )
+ super(Document, self).__init__(doc_dict)
+
+ def save(self):
+ return
+
+ @staticmethod
+ def get_list(args):
+ pass
+
+ @staticmethod
+ def get_count(args):
+ pass
+
+ @staticmethod
+ def get_stats(args):
+ pass
+
+ def db_insert(self, *args, **kwargs):
+ pass
+
+ def db_update(self, *args, **kwargs):
+ pass
+
+ def delete(self):
+ pass
+
@frappe.whitelist()
def get_unreconciled_entries(self):
self.get_nonreconciled_payment_entries()
diff --git a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json
index 5b8556e..491c678 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json
@@ -159,9 +159,10 @@
"label": "Difference Posting Date"
}
],
+ "is_virtual": 1,
"istable": 1,
"links": [],
- "modified": "2023-10-23 10:44:56.066303",
+ "modified": "2023-11-17 17:33:38.612615",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Allocation",
diff --git a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
index c4dbd7e..7c9d49e 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
@@ -71,9 +71,10 @@
"label": "Exchange Rate"
}
],
+ "is_virtual": 1,
"istable": 1,
"links": [],
- "modified": "2022-11-08 18:18:02.502149",
+ "modified": "2023-11-17 17:33:45.455166",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Invoice",
diff --git a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
index 17f3900..d199236 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
@@ -107,9 +107,10 @@
"options": "Cost Center"
}
],
+ "is_virtual": 1,
"istable": 1,
"links": [],
- "modified": "2023-09-03 07:43:29.965353",
+ "modified": "2023-11-17 17:33:34.818530",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Payment",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index d167783..f209487 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -1615,7 +1615,8 @@
"hide_seconds": 1,
"label": "Inter Company Invoice Reference",
"options": "Purchase Invoice",
- "read_only": 1
+ "read_only": 1,
+ "search_index": 1
},
{
"fieldname": "customer_group",
@@ -2173,7 +2174,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2023-11-20 11:51:43.555197",
+ "modified": "2023-11-23 16:56:29.679499",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 7d91309..6d2a47f 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -1833,6 +1833,28 @@
Table("outstanding").amount_in_account_currency >= self.max_outstanding
)
+ if self.limit and self.get_invoices:
+ outstanding_vouchers = (
+ qb.from_(ple)
+ .select(
+ ple.against_voucher_no.as_("voucher_no"),
+ Sum(ple.amount_in_account_currency).as_("amount_in_account_currency"),
+ )
+ .where(ple.delinked == 0)
+ .where(Criterion.all(filter_on_against_voucher_no))
+ .where(Criterion.all(self.common_filter))
+ .groupby(ple.against_voucher_type, ple.against_voucher_no, ple.party_type, ple.party)
+ .orderby(ple.posting_date, ple.voucher_no)
+ .having(qb.Field("amount_in_account_currency") > 0)
+ .limit(self.limit)
+ .run()
+ )
+ if outstanding_vouchers:
+ filter_on_voucher_no.append(ple.voucher_no.isin([x[0] for x in outstanding_vouchers]))
+ filter_on_against_voucher_no.append(
+ ple.against_voucher_no.isin([x[0] for x in outstanding_vouchers])
+ )
+
# build query for voucher amount
query_voucher_amount = (
qb.from_(ple)
diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py
index 84a428c..66930c0 100644
--- a/erpnext/assets/doctype/asset/depreciation.py
+++ b/erpnext/assets/doctype/asset/depreciation.py
@@ -509,6 +509,9 @@
def depreciate_asset(asset_doc, date, notes):
+ if not asset_doc.calculate_depreciation:
+ return
+
asset_doc.flags.ignore_validate_update_after_submit = True
make_new_active_asset_depr_schedules_and_cancel_current_ones(
@@ -521,6 +524,9 @@
def reset_depreciation_schedule(asset_doc, date, notes):
+ if not asset_doc.calculate_depreciation:
+ return
+
asset_doc.flags.ignore_validate_update_after_submit = True
make_new_active_asset_depr_schedules_and_cancel_current_ones(
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 31bf439..b052f56 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -165,16 +165,17 @@
@frappe.validate_and_sanitize_search_inputs
def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters):
supplier = filters.get("supplier")
- return frappe.db.sql(
- """
- SELECT
- `tabContact`.name from `tabContact`,
- `tabDynamic Link`
- WHERE
- `tabContact`.name = `tabDynamic Link`.parent
- and `tabDynamic Link`.link_name = %(supplier)s
- and `tabDynamic Link`.link_doctype = 'Supplier'
- and `tabContact`.name like %(txt)s
- """,
- {"supplier": supplier, "txt": "%%%s%%" % txt},
- )
+ contact = frappe.qb.DocType("Contact")
+ dynamic_link = frappe.qb.DocType("Dynamic Link")
+
+ return (
+ frappe.qb.from_(contact)
+ .join(dynamic_link)
+ .on(contact.name == dynamic_link.parent)
+ .select(contact.name, contact.email_id)
+ .where(
+ (dynamic_link.link_name == supplier)
+ & (dynamic_link.link_doctype == "Supplier")
+ & (contact.name.like("%{0}%".format(txt)))
+ )
+ ).run(as_dict=False)
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 0badab5..a71d71b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -344,9 +344,8 @@
erpnext.patches.v15_0.update_sre_from_voucher_details
erpnext.patches.v14_0.rename_over_order_allowance_field
erpnext.patches.v14_0.migrate_delivery_stop_lock_field
-execute:frappe.db.set_single_value("Payment Reconciliation", "invoice_limit", 50)
-execute:frappe.db.set_single_value("Payment Reconciliation", "payment_limit", 50)
erpnext.patches.v14_0.add_default_for_repost_settings
+erpnext.patches.v14_0.clear_reconciliation_values_from_singles
erpnext.patches.v15_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month
erpnext.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based
erpnext.patches.v15_0.set_reserved_stock_in_bin
diff --git a/erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py b/erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py
new file mode 100644
index 0000000..c1f5b60
--- /dev/null
+++ b/erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py
@@ -0,0 +1,17 @@
+from frappe import qb
+
+
+def execute():
+ """
+ Clear `tabSingles` and Payment Reconciliation tables of values
+ """
+ singles = qb.DocType("Singles")
+ qb.from_(singles).delete().where(singles.doctype == "Payment Reconciliation").run()
+ doctypes = [
+ "Payment Reconciliation Invoice",
+ "Payment Reconciliation Payment",
+ "Payment Reconciliation Allocation",
+ ]
+ for x in doctypes:
+ dt = qb.DocType(x)
+ qb.from_(dt).delete().run()
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 7eba35d..b083614 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -98,6 +98,7 @@
"Selling Settings", "None", ["maintain_same_rate_action", "role_to_override_stop_action"]
)
+ stop_actions = []
for ref_dt, ref_dn_field, ref_link_field in ref_details:
reference_names = [d.get(ref_link_field) for d in self.get("items") if d.get(ref_link_field)]
reference_details = self.get_reference_details(reference_names, ref_dt + " Item")
@@ -108,7 +109,7 @@
if abs(flt(d.rate - ref_rate, d.precision("rate"))) >= 0.01:
if action == "Stop":
if role_allowed_to_override not in frappe.get_roles():
- frappe.throw(
+ stop_actions.append(
_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4})").format(
d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate
)
@@ -121,6 +122,8 @@
title=_("Warning"),
indicator="orange",
)
+ if stop_actions:
+ frappe.throw(stop_actions, as_list=True)
def get_reference_details(self, reference_names, reference_doctype):
return frappe._dict(