From 1937059870c7399565b187c248d7ea03cf6ae185 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 20 Mar 2024 05:23:16 +0000 Subject: [PATCH 01/34] chore(release): Bumped to Version 15.17.2 ## [15.17.2](https://github.com/frappe/erpnext/compare/v15.17.1...v15.17.2) (2024-03-20) ### Bug Fixes * achieved targets for sales partners ([1ac8887](https://github.com/frappe/erpnext/commit/1ac888715c2039f807297da92f268177e117165b)) * advance journal fetching logic in Advances section ([bfa78aa](https://github.com/frappe/erpnext/commit/bfa78aaf7455aadf08de7718cddbe1a48f2ed2f9)) * attribute error on Bank Statement Import retry ([a0bf22c](https://github.com/frappe/erpnext/commit/a0bf22c9a577e92d8698e7c5537f5b3e8103ed9e)) * auto-update due date for invoices via data import ([9cdde50](https://github.com/frappe/erpnext/commit/9cdde50f7ccf17f499da3e5e809916268593f55f)) * balance qty in the stock ledger report (backport [#40506](https://github.com/frappe/erpnext/issues/40506)) ([#40507](https://github.com/frappe/erpnext/issues/40507)) ([69f442d](https://github.com/frappe/erpnext/commit/69f442dd79395431feeb1298976e0dde174f7483)) * currency symbol for Landed Cost Voucher Amount (backport [#40550](https://github.com/frappe/erpnext/issues/40550)) ([#40554](https://github.com/frappe/erpnext/issues/40554)) ([1c90797](https://github.com/frappe/erpnext/commit/1c9079787948f316336608bb4c2c741839188006)) * Data too long for column 'stock_queue' (backport [#40436](https://github.com/frappe/erpnext/issues/40436)) ([#40451](https://github.com/frappe/erpnext/issues/40451)) ([ba6b856](https://github.com/frappe/erpnext/commit/ba6b8561c9695a4ac00d6bac7a94ca3f3ab68d0d)) * don't validate for currency, if account is unavailable ([5729ee5](https://github.com/frappe/erpnext/commit/5729ee563c110b4b28040c22b06e5d0a5f7952ff)) * flaky Accounts Receivable test case ([0bb4a7d](https://github.com/frappe/erpnext/commit/0bb4a7d13a1418f241fc70a5a788dc614eda4e07)) * incorrect gross profit on the quotation (backport [#40438](https://github.com/frappe/erpnext/issues/40438)) ([#40442](https://github.com/frappe/erpnext/issues/40442)) ([ce2626e](https://github.com/frappe/erpnext/commit/ce2626e911379efdb17c00daddd1da77e7ea5a33)) * index error on Exchange Rate Revaluation creation ([ebd967d](https://github.com/frappe/erpnext/commit/ebd967d7d3c3ad02a8ee0a9328377ae8cbe0c26a)) * invalid exchange loss booking on invoice againts base accounts ([72c9cd5](https://github.com/frappe/erpnext/commit/72c9cd5582c99f3a2b48c619ea28c7b77d429564)) * missing range for ageing summary ([dacc69c](https://github.com/frappe/erpnext/commit/dacc69c56f851a5024f88f0dccb2141e4dcd0621)) * not able to delete cancelled delivery note (backport [#40508](https://github.com/frappe/erpnext/issues/40508)) ([#40510](https://github.com/frappe/erpnext/issues/40510)) ([917a21b](https://github.com/frappe/erpnext/commit/917a21b989744774796c42d2e14e7793fb13805e)) * rate changing while making PR (negative discount) (backport [#40539](https://github.com/frappe/erpnext/issues/40539)) ([#40540](https://github.com/frappe/erpnext/issues/40540)) ([0bdda12](https://github.com/frappe/erpnext/commit/0bdda1226f947f03348a82853417ef004fb66116)) * Remove custom queries for customer ([3133505](https://github.com/frappe/erpnext/commit/313350534f5b4ddbde3e7283d2de3ee4df91a666)) * serial and batch for internal transfer (backport [#40467](https://github.com/frappe/erpnext/issues/40467)) ([#40477](https://github.com/frappe/erpnext/issues/40477)) ([61d59b3](https://github.com/frappe/erpnext/commit/61d59b392a7c97743a4b07959ea3a0eeb22958b8)) * show correct variance for durations with no vouchers ([bc78bc3](https://github.com/frappe/erpnext/commit/bc78bc33f1a0a8ecac34338298ab334bd51aa8a7)) * stock reco negative batch (backport [#40533](https://github.com/frappe/erpnext/issues/40533)) ([#40535](https://github.com/frappe/erpnext/issues/40535)) ([7f1f780](https://github.com/frappe/erpnext/commit/7f1f7809c854ecb8a6e679ea35f553f1dc84faa4)) * stopped mr showing in the popup (backport [#40478](https://github.com/frappe/erpnext/issues/40478)) ([#40480](https://github.com/frappe/erpnext/issues/40480)) ([74b30a6](https://github.com/frappe/erpnext/commit/74b30a6a1d9679f3ce8be20c71200353c8a9797d)) * **Supplier Quotation Comparison:** group by options ([1e16d2c](https://github.com/frappe/erpnext/commit/1e16d2ca25de711fc210392a6124f8e2d87a9585)) * Taxes not getting updated on change ([75b610d](https://github.com/frappe/erpnext/commit/75b610d7fc18efe29ea271cc682ede1d7666de53)) * **test:** manually filter rows and assert ([df13517](https://github.com/frappe/erpnext/commit/df1351783edf4db4e508b99e1f3992fc964376cb)) * Update Existing Price List Rate not working (backport [#40333](https://github.com/frappe/erpnext/issues/40333)) ([#40527](https://github.com/frappe/erpnext/issues/40527)) ([44bbf4b](https://github.com/frappe/erpnext/commit/44bbf4b9838c43a488415c17538217ce0626cdc4)) * use in_import flag for checking imported records ([8242a9c](https://github.com/frappe/erpnext/commit/8242a9cd465e706a7be1a37a31298b3f0109df12)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0ca6ab7ad47..c368f51972e 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.17.1" +__version__ = "15.17.2" def get_default_company(user=None): From 64672e655af626ea661e275fe5fb1a2c5e26e248 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 20 Mar 2024 16:09:14 +0530 Subject: [PATCH 02/34] fix: use Text Editor for rendering tax breakup table (cherry picked from commit 1c639838736dee633c435ec728e4b7319cbd9748) # Conflicts: # erpnext/buying/doctype/purchase_order/purchase_order.json # erpnext/buying/doctype/supplier_quotation/supplier_quotation.json --- erpnext/accounts/doctype/pos_invoice/pos_invoice.json | 4 ++-- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 2 +- .../accounts/doctype/purchase_invoice/purchase_invoice.json | 4 ++-- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 2 +- erpnext/accounts/doctype/sales_invoice/sales_invoice.json | 6 +++--- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 +- erpnext/buying/doctype/purchase_order/purchase_order.json | 6 +++++- erpnext/buying/doctype/purchase_order/purchase_order.py | 3 ++- .../doctype/supplier_quotation/supplier_quotation.json | 6 +++++- .../buying/doctype/supplier_quotation/supplier_quotation.py | 2 +- erpnext/selling/doctype/quotation/quotation.json | 4 ++-- erpnext/selling/doctype/quotation/quotation.py | 2 +- erpnext/selling/doctype/sales_order/sales_order.json | 4 ++-- erpnext/selling/doctype/sales_order/sales_order.py | 4 +++- erpnext/stock/doctype/delivery_note/delivery_note.json | 4 ++-- erpnext/stock/doctype/delivery_note/delivery_note.py | 4 ++-- .../stock/doctype/purchase_receipt/purchase_receipt.json | 4 ++-- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 18 files changed, 38 insertions(+), 27 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json index 955b66a1b81..d7b173667ec 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json @@ -775,7 +775,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -1563,7 +1563,7 @@ "icon": "fa fa-file-text", "is_submittable": 1, "links": [], - "modified": "2023-11-20 12:27:12.848149", + "modified": "2024-03-20 16:00:34.268756", "modified_by": "Administrator", "module": "Accounts", "name": "POS Invoice", diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 9b0b3ecfab7..eb96cd12094 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -109,7 +109,7 @@ class POSInvoice(SalesInvoice): loyalty_redemption_cost_center: DF.Link | None naming_series: DF.Literal["ACC-PSINV-.YYYY.-"] net_total: DF.Currency - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None outstanding_amount: DF.Currency packed_items: DF.Table[PackedItem] paid_amount: DF.Currency diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index d6e606f73b5..9e8bf78a2f1 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -760,7 +760,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -1637,7 +1637,7 @@ "idx": 204, "is_submittable": 1, "links": [], - "modified": "2024-03-11 14:46:30.298184", + "modified": "2024-03-20 15:57:00.736868", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index ee3ec82ea89..2072217247d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -147,7 +147,7 @@ class PurchaseInvoice(BuyingController): net_total: DF.Currency on_hold: DF.Check only_include_allocated_payments: DF.Check - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None outstanding_amount: DF.Currency paid_amount: DF.Currency party_account_currency: DF.Link | None diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 4f6e5ba9206..2792c18b862 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -944,7 +944,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "hide_days": 1, "hide_seconds": 1, "label": "Taxes and Charges Calculation", @@ -2184,7 +2184,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2024-03-15 16:44:17.778370", + "modified": "2024-03-20 16:02:52.237732", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", @@ -2239,4 +2239,4 @@ "title_field": "title", "track_changes": 1, "track_seen": 1 -} +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 02a61d1cd9c..e04685e43da 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -146,7 +146,7 @@ class SalesInvoice(SellingController): naming_series: DF.Literal["ACC-SINV-.YYYY.-", "ACC-SINV-RET-.YYYY.-"] net_total: DF.Currency only_include_allocated_payments: DF.Check - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None outstanding_amount: DF.Currency packed_items: DF.Table[PackedItem] paid_amount: DF.Currency diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index f74df6630e9..b57a887d900 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -641,7 +641,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -1275,7 +1275,11 @@ "idx": 105, "is_submittable": 1, "links": [], +<<<<<<< HEAD "modified": "2023-10-01 20:58:07.851037", +======= + "modified": "2024-03-20 16:03:31.611808", +>>>>>>> 1c63983873 (fix: use Text Editor for rendering tax breakup table) "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 9ca20a9ba2f..09ff381feff 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -57,6 +57,7 @@ class PurchaseOrder(BuyingController): additional_discount_percentage: DF.Float address_display: DF.SmallText | None advance_paid: DF.Currency + advance_payment_status: DF.Literal["Not Initiated", "Initiated", "Partially Paid", "Fully Paid"] amended_from: DF.Link | None apply_discount_on: DF.Literal["", "Grand Total", "Net Total"] apply_tds: DF.Check @@ -109,7 +110,7 @@ class PurchaseOrder(BuyingController): net_total: DF.Currency order_confirmation_date: DF.Date | None order_confirmation_no: DF.Data | None - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None party_account_currency: DF.Link | None payment_schedule: DF.Table[PaymentSchedule] payment_terms_template: DF.Link | None diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json index d3c80cc49e7..2d2633feff5 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json @@ -462,7 +462,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Markdown Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -928,7 +928,11 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], +<<<<<<< HEAD "modified": "2023-11-20 11:15:30.083077", +======= + "modified": "2024-03-20 16:03:59.069145", +>>>>>>> 1c63983873 (fix: use Text Editor for rendering tax breakup table) "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation", diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py index e2b737ba6fe..b716f7f0427 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py @@ -71,7 +71,7 @@ class SupplierQuotation(BuyingController): naming_series: DF.Literal["PUR-SQTN-.YYYY.-"] net_total: DF.Currency opportunity: DF.Link | None - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.MarkdownEditor | None plc_conversion_rate: DF.Float price_list_currency: DF.Link | None pricing_rules: DF.Table[PricingRuleDetail] diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 8c816cf6e4e..982e7326775 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -557,7 +557,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -1073,7 +1073,7 @@ "idx": 82, "is_submittable": 1, "links": [], - "modified": "2023-06-03 16:21:04.980033", + "modified": "2024-03-20 16:04:21.567847", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 5541cc711e7..4835c0c27d3 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -78,7 +78,7 @@ class Quotation(SellingController): opportunity: DF.Link | None order_lost_reason: DF.SmallText | None order_type: DF.Literal["", "Sales", "Maintenance", "Shopping Cart"] - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None packed_items: DF.Table[PackedItem] party_name: DF.DynamicLink | None payment_schedule: DF.Table[PaymentSchedule] diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 01d047ceadb..1c144749074 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -776,7 +776,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "hide_days": 1, "hide_seconds": 1, "label": "Taxes and Charges Calculation", @@ -1644,7 +1644,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2023-10-18 12:41:54.813462", + "modified": "2024-03-20 16:04:43.627183", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index aafacdfa907..3c7215cae30 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -66,6 +66,7 @@ class SalesOrder(SellingController): additional_discount_percentage: DF.Float address_display: DF.SmallText | None advance_paid: DF.Currency + advance_payment_status: DF.Literal["Not Requested", "Requested", "Partially Paid", "Fully Paid"] amended_from: DF.Link | None amount_eligible_for_commission: DF.Currency apply_discount_on: DF.Literal["", "Grand Total", "Net Total"] @@ -122,7 +123,7 @@ class SalesOrder(SellingController): naming_series: DF.Literal["SAL-ORD-.YYYY.-"] net_total: DF.Currency order_type: DF.Literal["", "Sales", "Maintenance", "Shopping Cart"] - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None packed_items: DF.Table[PackedItem] party_account_currency: DF.Link | None payment_schedule: DF.Table[PaymentSchedule] @@ -155,6 +156,7 @@ class SalesOrder(SellingController): "", "Draft", "On Hold", + "To Pay", "To Deliver and Bill", "To Bill", "To Deliver", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index d07a825331d..87c333370b2 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -680,7 +680,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -1397,7 +1397,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2024-03-05 11:58:47.784349", + "modified": "2024-03-20 16:05:02.854990", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 4c2c023b6ae..fb19d0ec20b 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -76,7 +76,7 @@ class DeliveryNote(SellingController): ignore_pricing_rule: DF.Check in_words: DF.Data | None incoterm: DF.Link | None - installation_status: DF.Literal + installation_status: DF.Literal[None] instructions: DF.Text | None inter_company_reference: DF.Link | None is_internal_customer: DF.Check @@ -90,7 +90,7 @@ class DeliveryNote(SellingController): named_place: DF.Data | None naming_series: DF.Literal["MAT-DN-.YYYY.-", "MAT-DN-RET-.YYYY.-"] net_total: DF.Currency - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None packed_items: DF.Table[PackedItem] per_billed: DF.Percent per_installed: DF.Percent diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index a1810221219..b926e9826eb 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -651,7 +651,7 @@ }, { "fieldname": "other_charges_calculation", - "fieldtype": "Long Text", + "fieldtype": "Text Editor", "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", @@ -1252,7 +1252,7 @@ "idx": 261, "is_submittable": 1, "links": [], - "modified": "2023-12-18 17:26:41.279663", + "modified": "2024-03-20 16:05:31.713453", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index e249cf386fa..ed43d553713 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -86,7 +86,7 @@ class PurchaseReceipt(BuyingController): named_place: DF.Data | None naming_series: DF.Literal["MAT-PRE-.YYYY.-", "MAT-PR-RET-.YYYY.-"] net_total: DF.Currency - other_charges_calculation: DF.LongText | None + other_charges_calculation: DF.TextEditor | None per_billed: DF.Percent per_returned: DF.Percent plc_conversion_rate: DF.Float From 07bb8360d5b34fac1f2b2f90adf2de6f9aff435d Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 20 Mar 2024 16:56:30 +0530 Subject: [PATCH 03/34] fix: style for tax breakup (cherry picked from commit 967540da18351705dfdcf7bebae62d5445eec7e2) --- erpnext/public/scss/erpnext.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/public/scss/erpnext.scss b/erpnext/public/scss/erpnext.scss index e45ae5038f5..03dd31104e1 100644 --- a/erpnext/public/scss/erpnext.scss +++ b/erpnext/public/scss/erpnext.scss @@ -548,3 +548,7 @@ body[data-route="pos"] { align-items: center; justify-content: center; } + +.frappe-control[data-fieldname="other_charges_calculation"] .ql-editor { + white-space: normal; +} From 4ede3a9ba593fc5b3f961f8e854ef67207c88ba9 Mon Sep 17 00:00:00 2001 From: Gursheen Kaur Anand <40693548+GursheenK@users.noreply.github.com> Date: Wed, 20 Mar 2024 19:57:24 +0530 Subject: [PATCH 04/34] chore: resolve conflicts --- erpnext/buying/doctype/purchase_order/purchase_order.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index b57a887d900..8f4b035361a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1275,11 +1275,7 @@ "idx": 105, "is_submittable": 1, "links": [], -<<<<<<< HEAD - "modified": "2023-10-01 20:58:07.851037", -======= "modified": "2024-03-20 16:03:31.611808", ->>>>>>> 1c63983873 (fix: use Text Editor for rendering tax breakup table) "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", @@ -1334,4 +1330,4 @@ "timeline_field": "supplier", "title_field": "supplier_name", "track_changes": 1 -} \ No newline at end of file +} From 37eae8eb4e1ca67a45306f99a08501dadfbf48e9 Mon Sep 17 00:00:00 2001 From: Gursheen Kaur Anand <40693548+GursheenK@users.noreply.github.com> Date: Wed, 20 Mar 2024 19:58:01 +0530 Subject: [PATCH 05/34] chore: resolve conflicts --- .../doctype/supplier_quotation/supplier_quotation.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json index 2d2633feff5..9f89078de67 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json @@ -928,11 +928,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], -<<<<<<< HEAD - "modified": "2023-11-20 11:15:30.083077", -======= "modified": "2024-03-20 16:03:59.069145", ->>>>>>> 1c63983873 (fix: use Text Editor for rendering tax breakup table) "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation", @@ -1000,4 +996,4 @@ "states": [], "timeline_field": "supplier", "title_field": "title" -} \ No newline at end of file +} From 85aeb1f3b175d07d0e20515b92eb3e97ea773b58 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 20 Mar 2024 14:58:46 +0000 Subject: [PATCH 06/34] chore(release): Bumped to Version 15.17.3 ## [15.17.3](https://github.com/frappe/erpnext/compare/v15.17.2...v15.17.3) (2024-03-20) ### Bug Fixes * style for tax breakup ([07bb836](https://github.com/frappe/erpnext/commit/07bb8360d5b34fac1f2b2f90adf2de6f9aff435d)) * use Text Editor for rendering tax breakup table ([64672e6](https://github.com/frappe/erpnext/commit/64672e655af626ea661e275fe5fb1a2c5e26e248)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c368f51972e..7de39d8ebb2 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.17.2" +__version__ = "15.17.3" def get_default_company(user=None): From 0d95acefa20adb3420f68830412ac8dc27b0d4de Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 21 Mar 2024 21:04:03 +0530 Subject: [PATCH 07/34] fix: rate not fetching from the item price (cherry picked from commit d893a465d79b2e301b49b093f05d21d9eb196c9d) (cherry picked from commit fd02060cd28f2714d49280b7b1f80ed9535dba96) --- erpnext/stock/get_item_details.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 85da0348265..a82ce223270 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -821,7 +821,6 @@ def get_price_list_rate(args, item_doc, out=None): ): if args.price_list and args.rate: insert_item_price(args) - return out out.price_list_rate = ( flt(price_list_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate) From 2b80cb99beb9288f4c56c9e3f8ee08724d1b79b1 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 21 Mar 2024 17:30:02 +0000 Subject: [PATCH 08/34] chore(release): Bumped to Version 15.17.4 ## [15.17.4](https://github.com/frappe/erpnext/compare/v15.17.3...v15.17.4) (2024-03-21) ### Bug Fixes * rate not fetching from the item price ([0d95ace](https://github.com/frappe/erpnext/commit/0d95acefa20adb3420f68830412ac8dc27b0d4de)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7de39d8ebb2..e75c74ad17b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.17.3" +__version__ = "15.17.4" def get_default_company(user=None): From 1ed9133bb6d5f534344e946a9ff58ab7d3f79636 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 22 Mar 2024 15:03:38 +0530 Subject: [PATCH 09/34] fix: rate reset to zero (cherry picked from commit 6821baa850e4f820bdd274b5113a34e3fea3daba) (cherry picked from commit 4636ef0a29cf7e60a41d9efd98c8744530f93e9b) --- erpnext/stock/get_item_details.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index a82ce223270..e13d7a354ad 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -822,6 +822,9 @@ def get_price_list_rate(args, item_doc, out=None): if args.price_list and args.rate: insert_item_price(args) + if not price_list_rate: + return out + out.price_list_rate = ( flt(price_list_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate) ) From c39d02fa14c142ad8d2712ac475b281f3d65a1a1 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 22 Mar 2024 10:30:44 +0000 Subject: [PATCH 10/34] chore(release): Bumped to Version 15.17.5 ## [15.17.5](https://github.com/frappe/erpnext/compare/v15.17.4...v15.17.5) (2024-03-22) ### Bug Fixes * rate reset to zero ([1ed9133](https://github.com/frappe/erpnext/commit/1ed9133bb6d5f534344e946a9ff58ab7d3f79636)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e75c74ad17b..2237835b696 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.17.4" +__version__ = "15.17.5" def get_default_company(user=None): From 1753a138e946e7f89ff5f82afb0979507494b68a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 22 Mar 2024 16:11:05 +0530 Subject: [PATCH 11/34] fix: reset update outstanding flag for old records (cherry picked from commit a88bf8419e7c9987d81b7d0c1d05f45be26d65cc) --- erpnext/patches.txt | 2 +- erpnext/patches/v14_0/update_flag_for_return_invoices.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index c024c86c5e5..9fffbae4c8b 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -354,7 +354,7 @@ execute:frappe.db.set_single_value("Buying Settings", "project_update_frequency" erpnext.patches.v14_0.update_total_asset_cost_field erpnext.patches.v14_0.create_accounting_dimensions_in_reconciliation_tool erpnext.patches.v15_0.allow_on_submit_dimensions_for_repostable_doctypes -erpnext.patches.v14_0.update_flag_for_return_invoices +erpnext.patches.v14_0.update_flag_for_return_invoices #2024-03-22 # below migration patch should always run last erpnext.patches.v14_0.migrate_gl_to_payment_ledger erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20 diff --git a/erpnext/patches/v14_0/update_flag_for_return_invoices.py b/erpnext/patches/v14_0/update_flag_for_return_invoices.py index feb43beacf8..bea99575425 100644 --- a/erpnext/patches/v14_0/update_flag_for_return_invoices.py +++ b/erpnext/patches/v14_0/update_flag_for_return_invoices.py @@ -12,6 +12,10 @@ def execute(): creation_date = "2024-01-25" si = qb.DocType("Sales Invoice") + + # unset flag, as migration would have set it for all records, as the field was introduced with default '1' + qb.update(si).set(si.update_outstanding_for_self, False).run() + if cr_notes := ( qb.from_(si) .select(si.name) @@ -37,6 +41,10 @@ def execute(): ).run() pi = qb.DocType("Purchase Invoice") + + # unset flag, as migration would have set it for all records, as the field was introduced with default '1' + qb.update(pi).set(pi.update_outstanding_for_self, False).run() + if dr_notes := ( qb.from_(pi) .select(pi.name) From 0658285a3be88bc78398762268bf5697fca66dcc Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 22 Mar 2024 17:50:51 +0530 Subject: [PATCH 12/34] refactor: hide on print formats (cherry picked from commit fdcdc8a56ea8892f197dd2a45b175d20137953f6) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 2792c18b862..4a3e1758752 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -2171,7 +2171,8 @@ "fieldname": "update_outstanding_for_self", "fieldtype": "Check", "label": "Update Outstanding for Self", - "no_copy": 1 + "no_copy": 1, + "print_hide": 1 } ], "icon": "fa fa-file-text", @@ -2184,7 +2185,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2024-03-20 16:02:52.237732", + "modified": "2024-03-22 17:50:34.395602", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", From 22f39350240ffbf2ac2b5527ba68859137291024 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 25 Mar 2024 02:55:11 +0000 Subject: [PATCH 13/34] chore(release): Bumped to Version 15.17.6 ## [15.17.6](https://github.com/frappe/erpnext/compare/v15.17.5...v15.17.6) (2024-03-25) ### Bug Fixes * reset update outstanding flag for old records ([1753a13](https://github.com/frappe/erpnext/commit/1753a138e946e7f89ff5f82afb0979507494b68a)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 2237835b696..7f536a1c509 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.17.5" +__version__ = "15.17.6" def get_default_company(user=None): From 70ce49e32cddf3184972dc08b45cb48487d111ea Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 27 Mar 2024 03:27:37 +0000 Subject: [PATCH 14/34] chore(release): Bumped to Version 15.18.0 # [15.18.0](https://github.com/frappe/erpnext/compare/v15.17.6...v15.18.0) (2024-03-27) ### Bug Fixes * Add default finance book check in P&L statement ([f087159](https://github.com/frappe/erpnext/commit/f08715972abdf2ba4b72fd5d8de2f48fff209f50)) * Batch No is mandatory while making manufacture entry ([a638c9c](https://github.com/frappe/erpnext/commit/a638c9c8afeacdc3ea54bca47c52100130aea962)) * Book depreciation until the asset disposal date and removed unwanted commits ([2d7ff5d](https://github.com/frappe/erpnext/commit/2d7ff5d4cf48018a83c60c47fe0d381eb5902d7a)) * Cannot read properties of undefined (reading 'rate') ([d287ed5](https://github.com/frappe/erpnext/commit/d287ed5e47c31b790b169872b62bbb90b79c3bfb)) * existing batch from different warehouse not showing in the dropdown ([79d0478](https://github.com/frappe/erpnext/commit/79d047802a8a532b9d24b3d1e99f2a45ef205717)) * incorrect total qty in job card ([68d57c3](https://github.com/frappe/erpnext/commit/68d57c39476ad29bc75aec697b381e56c9d73296)) * item not coming in quick entry ([008894d](https://github.com/frappe/erpnext/commit/008894d32b2038f7bd3ddd0804935e19abf2df16)) * permissions during bulk transaction logs ([6e6ca42](https://github.com/frappe/erpnext/commit/6e6ca42261e0b183aa50553a476d27c9fa600c0f)) * pick list not picked qty less than 1 ([5310ec3](https://github.com/frappe/erpnext/commit/5310ec38ca68d72909f4a0783d90c7a6a99600bb)) * rate not fetching from the item price ([fd02060](https://github.com/frappe/erpnext/commit/fd02060cd28f2714d49280b7b1f80ed9535dba96)) * rate reset to zero ([4636ef0](https://github.com/frappe/erpnext/commit/4636ef0a29cf7e60a41d9efd98c8744530f93e9b)) * remove faulty translation ([#40667](https://github.com/frappe/erpnext/issues/40667)) ([afa930f](https://github.com/frappe/erpnext/commit/afa930ff48fe8672d27d1c0aa2e1d40cb57fd8a6)) * style for tax breakup ([501b09a](https://github.com/frappe/erpnext/commit/501b09a170c94e803ac8f7a682ddd5b6f45e32c9)) * translatability of bom configurator labels ([cf49cec](https://github.com/frappe/erpnext/commit/cf49cec20366fc98491f0987e3891fce93fb1d94)) * Turkish translations ([#40650](https://github.com/frappe/erpnext/issues/40650)) ([17a0876](https://github.com/frappe/erpnext/commit/17a087663bfcefbc491963d031ec78b72905a144)) * use serial/batch fields for subcontracting receipt and in transit stock entry ([9ec24bc](https://github.com/frappe/erpnext/commit/9ec24bcc6c8b1680a4b89dffb3fda072878df933)) * use Text Editor for rendering tax breakup table ([a95bb27](https://github.com/frappe/erpnext/commit/a95bb27c65ad3c57b71ec4ea0b2ef9872e665be4)) * validate gl for previous fiscal year ([4b973b2](https://github.com/frappe/erpnext/commit/4b973b2f861d70ad9ed3a89345d816cf8e882274)) * validation error for the subcontracting receipt ([23ae82d](https://github.com/frappe/erpnext/commit/23ae82d28262363894d75e8e3f61618ca5b4bee6)) * wrong buying amount if delivered and billed qty varies ([c224240](https://github.com/frappe/erpnext/commit/c2242406f42df4dabd298fd5a0291f1084fa3bbe)) ### Features * bisect doctype ([884a18f](https://github.com/frappe/erpnext/commit/884a18f8f1114d2cd565cbaa1e050292aa792745)) * nodes doctype ([bfccfa4](https://github.com/frappe/erpnext/commit/bfccfa4af1e9698bbdfd07dadfbad73a926695b5)) ### Performance Improvements * add in some indexes (backport [#40590](https://github.com/frappe/erpnext/issues/40590)) ([#40605](https://github.com/frappe/erpnext/issues/40605)) ([f66cf7d](https://github.com/frappe/erpnext/commit/f66cf7d838c0008d64a15de5dada4f35e710b6ee)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7f536a1c509..45a0773af79 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.17.6" +__version__ = "15.18.0" def get_default_company(user=None): From 471f1c835cdcb3ccf682cd54cce74ad4b5620821 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 27 Mar 2024 13:29:22 +0530 Subject: [PATCH 15/34] fix: rate changed on changing of the qty (cherry picked from commit cd36a1051f43a35ab4d45ac75db2d3dadd814008) (cherry picked from commit 41b3a59aae49646f0822b92eec738098cc89b69f) --- erpnext/public/js/controllers/transaction.js | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 40c67927e18..53edceee627 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1239,19 +1239,20 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.frm.fields_dict.items.grid.toggle_enable("conversion_factor", ((item.uom != item.stock_uom) && !frappe.meta.get_docfield(cur_frm.fields_dict.items.grid.doctype, "conversion_factor").read_only)? true: false); } - } qty(doc, cdt, cdn) { - let item = frappe.get_doc(cdt, cdn); - // item.pricing_rules = '' - frappe.run_serially([ - () => this.remove_pricing_rule_for_item(item), - () => this.conversion_factor(doc, cdt, cdn, true), - () => this.apply_price_list(item, true), //reapply price list before applying pricing rule - () => this.calculate_stock_uom_rate(doc, cdt, cdn), - () => this.apply_pricing_rule(item, true) - ]); + if (!this.frm.doc.__onload?.load_after_mapping) { + let item = frappe.get_doc(cdt, cdn); + // item.pricing_rules = '' + frappe.run_serially([ + () => this.remove_pricing_rule_for_item(item), + () => this.conversion_factor(doc, cdt, cdn, true), + () => this.apply_price_list(item, true), //reapply price list before applying pricing rule + () => this.calculate_stock_uom_rate(doc, cdt, cdn), + () => this.apply_pricing_rule(item, true) + ]); + } } stock_qty(doc, cdt, cdn) { From ca3827efeabdc00131a020a4e7646f38b8591894 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 27 Mar 2024 08:37:31 +0000 Subject: [PATCH 16/34] chore(release): Bumped to Version 15.18.1 ## [15.18.1](https://github.com/frappe/erpnext/compare/v15.18.0...v15.18.1) (2024-03-27) ### Bug Fixes * rate changed on changing of the qty ([471f1c8](https://github.com/frappe/erpnext/commit/471f1c835cdcb3ccf682cd54cce74ad4b5620821)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 45a0773af79..7a2acfe0602 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.18.0" +__version__ = "15.18.1" def get_default_company(user=None): From efd40772ee479f8e8bc8ab00f942d10f6d140930 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 20 Oct 2023 17:16:54 +0530 Subject: [PATCH 17/34] refactor: gain_loss posting date fields in the allocation table (cherry picked from commit 55dbcee36a2acf4aa41c66147c263a85ef606f81) # Conflicts: # erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json (cherry picked from commit 1fe80c2d02766afff9e30d0451bee03d5a23028c) --- .../payment_reconciliation_allocation.json | 7 +++++++ 1 file changed, 7 insertions(+) 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 a553b982d14..6aaa58aedf7 100644 --- a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json +++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json @@ -158,6 +158,7 @@ "fieldname": "gain_loss_posting_date", "fieldtype": "Date", "label": "Difference Posting Date" +<<<<<<< HEAD }, { "fieldname": "accounting_dimensions_section", @@ -167,12 +168,18 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" +======= +>>>>>>> 55dbcee36a (refactor: gain_loss posting date fields in the allocation table) } ], "is_virtual": 1, "istable": 1, "links": [], +<<<<<<< HEAD "modified": "2023-12-14 13:38:26.104150", +======= + "modified": "2023-10-23 10:44:56.066303", +>>>>>>> 55dbcee36a (refactor: gain_loss posting date fields in the allocation table) "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation Allocation", From 63c3f51ffa78ab211ebc761ebe598fef322f44ca Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 22 Oct 2023 08:59:52 +0530 Subject: [PATCH 18/34] refactor: introduce fields in popup (cherry picked from commit 5323bb7beeb6526d16bcb19fc2f3acd3a95927e6) # Conflicts: # erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js (cherry picked from commit 39571d828edbfe50a689a58006e71f313fd5efdd) --- .../payment_reconciliation.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index e0d142288e8..a5d080760b2 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -254,6 +254,7 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo this.data = []; const dialog = new frappe.ui.Dialog({ title: __("Select Difference Account"), + size: 'extra-large', fields: [ { fieldname: "allocation", @@ -265,6 +266,7 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo get_data: () => { return this.data; }, +<<<<<<< HEAD fields: [ { fieldtype: "Data", @@ -303,6 +305,48 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo read_only: 1, }, ], +======= + fields: [{ + fieldtype:'Data', + fieldname:"docname", + in_list_view: 1, + hidden: 1 + }, { + fieldtype:'Data', + fieldname:"reference_name", + label: __("Voucher No"), + in_list_view: 1, + read_only: 1 + }, { + fieldtype:'Date', + fieldname:"gain_loss_posting_date", + label: __("Posting Date"), + in_list_view: 1, + reqd: 1, + }, { + + fieldtype:'Link', + options: 'Account', + in_list_view: 1, + label: __("Difference Account"), + fieldname: 'difference_account', + reqd: 1, + get_query: () => { + return { + filters: { + company: this.frm.doc.company, + is_group: 0 + } + } + } + }, { + fieldtype:'Currency', + in_list_view: 1, + label: __("Difference Amount"), + fieldname: 'difference_amount', + read_only: 1 + }] +>>>>>>> 5323bb7bee (refactor: introduce fields in popup) }, { fieldtype: "HTML", @@ -312,6 +356,7 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo primary_action: () => { const args = dialog.get_values()["allocation"]; +<<<<<<< HEAD args.forEach((d) => { frappe.model.set_value( "Payment Reconciliation Allocation", @@ -319,6 +364,12 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo "difference_account", d.difference_account ); +======= + args.forEach(d => { + frappe.model.set_value("Payment Reconciliation Allocation", d.docname, + "difference_account", d.difference_account); + +>>>>>>> 5323bb7bee (refactor: introduce fields in popup) }); this.reconcile_payment_entries(); @@ -330,10 +381,18 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo this.frm.doc.allocation.forEach((d) => { if (d.difference_amount) { dialog.fields_dict.allocation.df.data.push({ +<<<<<<< HEAD docname: d.name, reference_name: d.reference_name, difference_amount: d.difference_amount, difference_account: d.difference_account, +======= + 'docname': d.name, + 'reference_name': d.reference_name, + 'difference_amount': d.difference_amount, + 'difference_account': d.difference_account, + 'gain_loss_posting_date': d.gain_loss_posting_date +>>>>>>> 5323bb7bee (refactor: introduce fields in popup) }); } }); From 22d352e87586a10ecfb300103514624ada38f58a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 22 Oct 2023 20:26:45 +0530 Subject: [PATCH 19/34] refactor: pass gain loss posting date to controller (cherry picked from commit 7e600a6494d7f07c6fd2b8f1cc71857801a2573c) # Conflicts: # erpnext/accounts/utils.py (cherry picked from commit 125722ae4150d1d443b402119312b797c765c712) --- .../payment_reconciliation/payment_reconciliation.js | 2 ++ .../payment_reconciliation/payment_reconciliation.py | 2 ++ .../payment_reconciliation_allocation.json | 1 + erpnext/accounts/utils.py | 4 ++++ erpnext/controllers/accounts_controller.py | 6 ++++-- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index a5d080760b2..042a6123ebd 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -368,6 +368,8 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo args.forEach(d => { frappe.model.set_value("Payment Reconciliation Allocation", d.docname, "difference_account", d.difference_account); + frappe.model.set_value("Payment Reconciliation Allocation", d.docname, + "gain_loss_posting_date", d.gain_loss_posting_date); >>>>>>> 5323bb7bee (refactor: introduce fields in popup) }); diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 2c4952a0c66..dcb1a16dba4 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -446,6 +446,7 @@ class PaymentReconciliation(Document): res.difference_amount = self.get_difference_amount(pay, inv, res["allocated_amount"]) res.difference_account = default_exchange_gain_loss_account res.exchange_rate = inv.get("exchange_rate") + res.update({"gain_loss_posting_date": pay.get("posting_date")}) if pay.get("amount") == 0: entries.append(res) @@ -562,6 +563,7 @@ class PaymentReconciliation(Document): "allocated_amount": flt(row.get("allocated_amount")), "difference_amount": flt(row.get("difference_amount")), "difference_account": row.get("difference_account"), + "difference_posting_date": row.get("gain_loss_posting_date"), "cost_center": row.get("cost_center"), } ) 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 6aaa58aedf7..c40d0ce29d3 100644 --- a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json +++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json @@ -19,6 +19,7 @@ "is_advance", "section_break_5", "difference_amount", + "gain_loss_posting_date", "column_break_7", "difference_account", "exchange_rate", diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 0e6c041d24d..c2653237e5a 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -726,7 +726,11 @@ def update_reference_in_payment_entry( payment_entry.set_missing_ref_details(ref_exchange_rate=d.exchange_rate or None) payment_entry.set_amounts() payment_entry.make_exchange_gain_loss_journal( +<<<<<<< HEAD frappe._dict({"difference_posting_date": d.difference_posting_date}), dimensions_dict +======= + frappe._dict({"difference_posting_date": d.difference_posting_date}) +>>>>>>> 7e600a6494 (refactor: pass gain loss posting date to controller) ) if not do_not_save: diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index fe4500a41e5..185ef4c22f0 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1360,7 +1360,9 @@ class AccountsController(TransactionBase): self.name, arg.get("referenced_row"), ): - posting_date = frappe.db.get_value(arg.voucher_type, arg.voucher_no, "posting_date") + posting_date = arg.get("difference_posting_date") or frappe.db.get_value( + arg.voucher_type, arg.voucher_no, "posting_date" + ) je = create_gain_loss_journal( self.company, posting_date, @@ -1444,7 +1446,7 @@ class AccountsController(TransactionBase): je = create_gain_loss_journal( self.company, - self.posting_date, + args.get("difference_posting_date") if args else self.posting_date, self.party_type, self.party, party_account, From ba4d1bc1a454ada7fd26afa65ebb4a3e0f7fe714 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 23 Oct 2023 12:32:10 +0530 Subject: [PATCH 20/34] test: varying posting date for gain loss journal (cherry picked from commit 514d5434a3ae24e2c7839fbd76a115d6c0841513) (cherry picked from commit fd33437d7a9ccb9ac023662654608a979376d4cd) --- .../tests/test_accounts_controller.py | 69 ++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 65b2696e79a..2170628361d 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -7,7 +7,7 @@ import frappe from frappe import qb from frappe.query_builder.functions import Sum from frappe.tests.utils import FrappeTestCase, change_settings -from frappe.utils import add_days, flt, nowdate +from frappe.utils import add_days, flt, getdate, nowdate from erpnext import get_default_cost_center from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -616,6 +616,73 @@ class TestAccountsController(FrappeTestCase): self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_pe, []) + def test_15_gain_loss_on_different_posting_date(self): + # Invoice in Foreign Currency + si = self.create_sales_invoice( + posting_date=add_days(nowdate(), -2), qty=2, conversion_rate=80, rate=1 + ) + # Payment + pe = ( + self.create_payment_entry(posting_date=add_days(nowdate(), -1), amount=2, source_exc_rate=75) + .save() + .submit() + ) + + # There should be outstanding in both currencies + si.reload() + self.assertEqual(si.outstanding_amount, 2) + self.assert_ledger_outstanding(si.doctype, si.name, 160.0, 2.0) + + # Reconcile the remaining amount + pr = frappe.get_doc("Payment Reconciliation") + pr.company = self.company + pr.party_type = "Customer" + pr.party = self.customer + pr.receivable_payable_account = self.debit_usd + pr.get_unreconciled_entries() + self.assertEqual(len(pr.invoices), 1) + self.assertEqual(len(pr.payments), 1) + invoices = [x.as_dict() for x in pr.invoices] + payments = [x.as_dict() for x in pr.payments] + pr.allocate_entries(frappe._dict({"invoices": invoices, "payments": payments})) + pr.allocation[0].gain_loss_posting_date = add_days(nowdate(), 1) + pr.reconcile() + + # Exchange Gain/Loss Journal should've been created. + exc_je_for_si = self.get_journals_for(si.doctype, si.name) + exc_je_for_pe = self.get_journals_for(pe.doctype, pe.name) + self.assertNotEqual(exc_je_for_si, []) + self.assertEqual(len(exc_je_for_si), 1) + self.assertEqual(len(exc_je_for_pe), 1) + self.assertEqual(exc_je_for_si[0], exc_je_for_pe[0]) + + self.assertEqual( + frappe.db.get_value("Journal Entry", exc_je_for_si[0].parent, "posting_date"), + getdate(add_days(nowdate(), 1)), + ) + + self.assertEqual(len(pr.invoices), 0) + self.assertEqual(len(pr.payments), 0) + + # There should be no outstanding + si.reload() + self.assertEqual(si.outstanding_amount, 0) + self.assert_ledger_outstanding(si.doctype, si.name, 0.0, 0.0) + + # Cancel Payment + pe.reload() + pe.cancel() + + si.reload() + self.assertEqual(si.outstanding_amount, 2) + self.assert_ledger_outstanding(si.doctype, si.name, 160.0, 2.0) + + # Exchange Gain/Loss Journal should've been cancelled + exc_je_for_si = self.get_journals_for(si.doctype, si.name) + exc_je_for_pe = self.get_journals_for(pe.doctype, pe.name) + self.assertEqual(exc_je_for_si, []) + self.assertEqual(exc_je_for_pe, []) + def test_20_journal_against_sales_invoice(self): # Invoice in Foreign Currency si = self.create_sales_invoice(qty=1, conversion_rate=80, rate=1) From 0247d5c87fa108594c0738417a28c6264939758d Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 28 Mar 2024 17:18:13 +0530 Subject: [PATCH 21/34] chore: resolve conflicts (cherry picked from commit 565bfa16f2766aa4cbbe194dc0669ec16b5e9109) --- .../payment_reconciliation.js | 76 ++++--------------- .../payment_reconciliation_allocation.json | 7 -- erpnext/accounts/utils.py | 4 - 3 files changed, 15 insertions(+), 72 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index 042a6123ebd..cc99fe7b583 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -254,7 +254,7 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo this.data = []; const dialog = new frappe.ui.Dialog({ title: __("Select Difference Account"), - size: 'extra-large', + size: "extra-large", fields: [ { fieldname: "allocation", @@ -266,7 +266,6 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo get_data: () => { return this.data; }, -<<<<<<< HEAD fields: [ { fieldtype: "Data", @@ -281,6 +280,13 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo in_list_view: 1, read_only: 1, }, + { + fieldtype: "Date", + fieldname: "gain_loss_posting_date", + label: __("Posting Date"), + in_list_view: 1, + reqd: 1, + }, { fieldtype: "Link", options: "Account", @@ -305,48 +311,6 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo read_only: 1, }, ], -======= - fields: [{ - fieldtype:'Data', - fieldname:"docname", - in_list_view: 1, - hidden: 1 - }, { - fieldtype:'Data', - fieldname:"reference_name", - label: __("Voucher No"), - in_list_view: 1, - read_only: 1 - }, { - fieldtype:'Date', - fieldname:"gain_loss_posting_date", - label: __("Posting Date"), - in_list_view: 1, - reqd: 1, - }, { - - fieldtype:'Link', - options: 'Account', - in_list_view: 1, - label: __("Difference Account"), - fieldname: 'difference_account', - reqd: 1, - get_query: () => { - return { - filters: { - company: this.frm.doc.company, - is_group: 0 - } - } - } - }, { - fieldtype:'Currency', - in_list_view: 1, - label: __("Difference Amount"), - fieldname: 'difference_amount', - read_only: 1 - }] ->>>>>>> 5323bb7bee (refactor: introduce fields in popup) }, { fieldtype: "HTML", @@ -356,7 +320,6 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo primary_action: () => { const args = dialog.get_values()["allocation"]; -<<<<<<< HEAD args.forEach((d) => { frappe.model.set_value( "Payment Reconciliation Allocation", @@ -364,14 +327,12 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo "difference_account", d.difference_account ); -======= - args.forEach(d => { - frappe.model.set_value("Payment Reconciliation Allocation", d.docname, - "difference_account", d.difference_account); - frappe.model.set_value("Payment Reconciliation Allocation", d.docname, - "gain_loss_posting_date", d.gain_loss_posting_date); - ->>>>>>> 5323bb7bee (refactor: introduce fields in popup) + frappe.model.set_value( + "Payment Reconciliation Allocation", + d.docname, + "gain_loss_posting_date", + d.gain_loss_posting_date + ); }); this.reconcile_payment_entries(); @@ -383,18 +344,11 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo this.frm.doc.allocation.forEach((d) => { if (d.difference_amount) { dialog.fields_dict.allocation.df.data.push({ -<<<<<<< HEAD docname: d.name, reference_name: d.reference_name, difference_amount: d.difference_amount, difference_account: d.difference_account, -======= - 'docname': d.name, - 'reference_name': d.reference_name, - 'difference_amount': d.difference_amount, - 'difference_account': d.difference_account, - 'gain_loss_posting_date': d.gain_loss_posting_date ->>>>>>> 5323bb7bee (refactor: introduce fields in popup) + gain_loss_posting_date: d.gain_loss_posting_date, }); } }); 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 c40d0ce29d3..3f85b213500 100644 --- a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json +++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json @@ -159,7 +159,6 @@ "fieldname": "gain_loss_posting_date", "fieldtype": "Date", "label": "Difference Posting Date" -<<<<<<< HEAD }, { "fieldname": "accounting_dimensions_section", @@ -169,18 +168,12 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" -======= ->>>>>>> 55dbcee36a (refactor: gain_loss posting date fields in the allocation table) } ], "is_virtual": 1, "istable": 1, "links": [], -<<<<<<< HEAD "modified": "2023-12-14 13:38:26.104150", -======= - "modified": "2023-10-23 10:44:56.066303", ->>>>>>> 55dbcee36a (refactor: gain_loss posting date fields in the allocation table) "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation Allocation", diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index c2653237e5a..0e6c041d24d 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -726,11 +726,7 @@ def update_reference_in_payment_entry( payment_entry.set_missing_ref_details(ref_exchange_rate=d.exchange_rate or None) payment_entry.set_amounts() payment_entry.make_exchange_gain_loss_journal( -<<<<<<< HEAD frappe._dict({"difference_posting_date": d.difference_posting_date}), dimensions_dict -======= - frappe._dict({"difference_posting_date": d.difference_posting_date}) ->>>>>>> 7e600a6494 (refactor: pass gain loss posting date to controller) ) if not do_not_save: From e2196efe1a1217d2795a465adfb9e7c5265274bc Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 28 Mar 2024 13:28:59 +0530 Subject: [PATCH 22/34] fix: use sql to clear comments (cherry picked from commit 1f46c1530e68263ca2b5f9f86f59bb06063cd05e) --- .../transaction_deletion_record.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py index 00fad5f0fa6..5eaabe52b6b 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py @@ -418,17 +418,11 @@ class TransactionDeletionRecord(Document): frappe.delete_doc("Communication", batch, ignore_permissions=True) def delete_comments(self, doctype, reference_doc_names): - comments = frappe.get_all( - "Comment", - filters={"reference_doctype": doctype, "reference_name": ["in", reference_doc_names]}, - ) - comment_names = [c.name for c in comments] - - if not comment_names: - return - - for batch in create_batch(comment_names, self.batch_size): - frappe.delete_doc("Comment", batch, ignore_permissions=True) + if reference_doc_names: + comment = qb.DocType("Comment") + qb.from_(comment).delete().where( + (comment.reference_doctype == doctype) & (comment.reference_name.isin(reference_doc_names)) + ).run() def unlink_attachments(self, doctype, reference_doc_names): files = frappe.get_all( From 2eac2ef69fae71d570eb7dceb6edb6e312fbef36 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 28 Mar 2024 14:55:31 +0530 Subject: [PATCH 23/34] fix: sales / prchase return validation issue (cherry picked from commit 59dc4a96e18357ee52f0f25137e9c824971cc029) (cherry picked from commit 7a21997701b37ad83540289c22e518e210ab72b9) --- .../delivery_note/test_delivery_note.py | 92 +++++++++++++++++++ .../serial_and_batch_bundle.py | 60 ++++++++++-- 2 files changed, 142 insertions(+), 10 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 24544070d3b..c4852d2cf15 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -461,6 +461,98 @@ class TestDeliveryNote(FrappeTestCase): self.assertEqual(return_dn.items[0].incoming_rate, 150) + def test_sales_return_against_serial_batch_bundle(self): + frappe.db.set_single_value( + "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle", 1 + ) + + batch_item = make_item( + "Test Sales Return Against Batch Item", + properties={ + "has_batch_no": 1, + "is_stock_item": 1, + "create_new_batch": 1, + "batch_number_series": "BATCH-TSRABII.#####", + }, + ).name + + serial_item = make_item( + "Test Sales Return Against Serial NO Item", + properties={ + "has_serial_no": 1, + "is_stock_item": 1, + "serial_no_series": "SN-TSRABII.#####", + }, + ).name + + make_stock_entry(item_code=batch_item, target="_Test Warehouse - _TC", qty=5, basic_rate=100) + make_stock_entry(item_code=serial_item, target="_Test Warehouse - _TC", qty=5, basic_rate=100) + + dn = create_delivery_note( + item_code=batch_item, + qty=5, + rate=500, + warehouse="_Test Warehouse - _TC", + expense_account="Cost of Goods Sold - _TC", + cost_center="Main - _TC", + use_serial_batch_fields=0, + do_not_submit=1, + ) + + dn.append( + "items", + { + "item_code": serial_item, + "qty": 5, + "rate": 500, + "warehouse": "_Test Warehouse - _TC", + "expense_account": "Cost of Goods Sold - _TC", + "cost_center": "Main - _TC", + "use_serial_batch_fields": 0, + }, + ) + + dn.save() + for row in dn.items: + self.assertFalse(row.use_serial_batch_fields) + + dn.submit() + dn.reload() + for row in dn.items: + self.assertTrue(row.serial_and_batch_bundle) + self.assertFalse(row.use_serial_batch_fields) + self.assertFalse(row.serial_no) + self.assertFalse(row.batch_no) + + from erpnext.controllers.sales_and_purchase_return import make_return_doc + + return_dn = make_return_doc(dn.doctype, dn.name) + for row in return_dn.items: + row.qty = -2 + row.use_serial_batch_fields = 0 + return_dn.save().submit() + + for row in return_dn.items: + total_qty = frappe.db.get_value( + "Serial and Batch Bundle", row.serial_and_batch_bundle, "total_qty" + ) + + self.assertEqual(total_qty, 2) + + doc = frappe.get_doc("Serial and Batch Bundle", row.serial_and_batch_bundle) + if doc.has_serial_no: + self.assertEqual(len(doc.entries), 2) + + for entry in doc.entries: + if doc.has_batch_no: + self.assertEqual(entry.qty, 2) + else: + self.assertEqual(entry.qty, 1) + + frappe.db.set_single_value( + "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle", 0 + ) + def test_return_single_item_from_bundled_items(self): company = frappe.db.get_value("Warehouse", "Stores - TCP1", "company") diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 58971e8f19d..11018c27f67 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -384,6 +384,9 @@ class SerialandBatchBundle(Document): if self.docstatus == 0: self.set_incoming_rate(save=True, row=row) + if self.docstatus == 0 and parent.get("is_return") and parent.is_new(): + self.reset_qty(row, qty_field=qty_field) + self.calculate_qty_and_amount(save=True) self.validate_quantity(row, qty_field=qty_field) self.set_warranty_expiry_date() @@ -417,7 +420,11 @@ class SerialandBatchBundle(Document): if not (self.voucher_type and self.voucher_no): return - if self.voucher_no and not frappe.db.exists(self.voucher_type, self.voucher_no): + if ( + self.docstatus == 1 + and self.voucher_no + and not frappe.db.exists(self.voucher_type, self.voucher_no) + ): self.throw_error_message(f"The {self.voucher_type} # {self.voucher_no} does not exist") if self.flags.ignore_voucher_validation: @@ -481,24 +488,57 @@ class SerialandBatchBundle(Document): frappe.throw(_(msg), title=_(title), exc=SerialNoExistsInFutureTransactionError) + def reset_qty(self, row, qty_field=None): + qty_field = self.get_qty_field(row, qty_field=qty_field) + qty = abs(row.get(qty_field)) + + idx = None + while qty > 0: + for d in self.entries: + row_qty = abs(d.qty) + if row_qty >= qty: + d.db_set("qty", qty if self.type_of_transaction == "Inward" else qty * -1) + qty = 0 + idx = d.idx + break + else: + qty -= row_qty + idx = d.idx + + if idx and len(self.entries) > idx: + remove_rows = [] + for d in self.entries: + if d.idx > idx: + remove_rows.append(d) + + for d in remove_rows: + self.entries.remove(d) + + self.flags.ignore_links = True + self.save() + def validate_quantity(self, row, qty_field=None): + qty_field = self.get_qty_field(row, qty_field=qty_field) + qty = row.get(qty_field) + if qty_field == "qty" and row.get("stock_qty"): + qty = row.get("stock_qty") + + precision = row.precision + if abs(abs(flt(self.total_qty, precision)) - abs(flt(qty, precision))) > 0.01: + self.throw_error_message( + f"Total quantity {abs(flt(self.total_qty))} in the Serial and Batch Bundle {bold(self.name)} does not match with the quantity {abs(flt(row.get(qty_field)))} for the Item {bold(self.item_code)} in the {self.voucher_type} # {self.voucher_no}" + ) + + def get_qty_field(self, row, qty_field=None) -> str: if not qty_field: qty_field = "qty" - precision = row.precision if row.get("doctype") == "Subcontracting Receipt Supplied Item": qty_field = "consumed_qty" elif row.get("doctype") == "Stock Entry Detail": qty_field = "transfer_qty" - qty = row.get(qty_field) - if qty_field == "qty" and row.get("stock_qty"): - qty = row.get("stock_qty") - - if abs(abs(flt(self.total_qty, precision)) - abs(flt(qty, precision))) > 0.01: - self.throw_error_message( - f"Total quantity {abs(flt(self.total_qty))} in the Serial and Batch Bundle {bold(self.name)} does not match with the quantity {abs(flt(row.get(qty_field)))} for the Item {bold(self.item_code)} in the {self.voucher_type} # {self.voucher_no}" - ) + return qty_field def set_is_outward(self): for row in self.entries: From 6077cd8160304052a221acd641acaba6db4598c4 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 29 Mar 2024 05:41:25 +0000 Subject: [PATCH 24/34] chore(release): Bumped to Version 15.18.2 ## [15.18.2](https://github.com/frappe/erpnext/compare/v15.18.1...v15.18.2) (2024-03-29) ### Bug Fixes * use sql to clear comments ([e2196ef](https://github.com/frappe/erpnext/commit/e2196efe1a1217d2795a465adfb9e7c5265274bc)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7a2acfe0602..c47c67a190a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.18.1" +__version__ = "15.18.2" def get_default_company(user=None): From a8ac196cde89ab173119a294dc8769dc71b8c77b Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 29 Mar 2024 10:27:44 +0530 Subject: [PATCH 25/34] chore: show item name in the validation message (cherry picked from commit d05412f96a02352d1203758a52fb80a8327df45c) (cherry picked from commit 0b4b0874f42b5cf35f75f9006aa21bee47b65f17) --- erpnext/public/js/utils/serial_no_batch_selector.js | 2 +- .../doctype/serial_and_batch_bundle/serial_and_batch_bundle.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 42d37bf493b..1edeca95018 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -421,7 +421,7 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { let { qty, based_on } = this.dialog.get_values(); if (this.item.serial_and_batch_bundle || this.item.rejected_serial_and_batch_bundle) { - if (qty === this.qty) { + if (this.qty && qty === Math.abs(this.qty)) { return; } } diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 58971e8f19d..15d276b696a 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -273,7 +273,8 @@ class SerialandBatchBundle(Document): def validate_negative_batch(self, batch_no, available_qty): if available_qty < 0: - msg = f"""Batch No {bold(batch_no)} has negative stock + msg = f"""Batch No {bold(batch_no)} of an Item {bold(self.item_code)} + has negative stock of quantity {bold(available_qty)} in the warehouse {self.warehouse}""" From 8ab26cd76d37ca524deea236c265e29c8037506b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 29 Mar 2024 19:09:53 +0000 Subject: [PATCH 26/34] chore(release): Bumped to Version 15.18.3 ## [15.18.3](https://github.com/frappe/erpnext/compare/v15.18.2...v15.18.3) (2024-03-29) ### Bug Fixes * sales / prchase return validation issue ([2eac2ef](https://github.com/frappe/erpnext/commit/2eac2ef69fae71d570eb7dceb6edb6e312fbef36)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c47c67a190a..548d5a823d7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.18.2" +__version__ = "15.18.3" def get_default_company(user=None): From f78df8dccb0176b356429cc8d763d7acea73a73e Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 3 Apr 2024 10:32:58 +0000 Subject: [PATCH 27/34] chore(release): Bumped to Version 15.19.0 # [15.19.0](https://github.com/frappe/erpnext/compare/v15.18.3...v15.19.0) (2024-04-03) ### Bug Fixes * added validation if parent id is missing in BOM Creator ([87ce9d8](https://github.com/frappe/erpnext/commit/87ce9d834f05c3e6bf471e6644e4f04ef3828a30)) * barcode not fetched on selection of item ([2b1b51b](https://github.com/frappe/erpnext/commit/2b1b51b5bb3a42bc808d4f035ada9e9475ca1ed7)) * button to select serial / batch bundle in the subcontracting receipt ([d2a6509](https://github.com/frappe/erpnext/commit/d2a6509950af39fedd2a7e70fcad4be26b460e1e)) * cost center shouldn't update debit/credit in Exc gain/loss JV ([71704be](https://github.com/frappe/erpnext/commit/71704beb6f9e15474d5579ccb8cd1d06d7d89f5d)) * do not fetch received items in purchase receipt ([3761e74](https://github.com/frappe/erpnext/commit/3761e74436727fc54376669784940a470b16c351)) * enable list view for the issues on the portal ([b089eda](https://github.com/frappe/erpnext/commit/b089eda8bfbd312a6274107853d32105fc4614f4)) * markdown to text editor set for supplier quotation ([5fb6428](https://github.com/frappe/erpnext/commit/5fb642831c67f3cead934913c6aa135f37c86e24)) * payment_order_status should be no_copy ([2dd697e](https://github.com/frappe/erpnext/commit/2dd697ee7702cc76d9d67ea7786cc0474ec65860)) * Priority not copied from project template ([a3a6bf6](https://github.com/frappe/erpnext/commit/a3a6bf6ae1776669f4b87c814e28cdb48cd29dc4)) * rate changed on changing of the qty ([41b3a59](https://github.com/frappe/erpnext/commit/41b3a59aae49646f0822b92eec738098cc89b69f)) * sales / prchase return validation issue ([7a21997](https://github.com/frappe/erpnext/commit/7a21997701b37ad83540289c22e518e210ab72b9)) * show future payments allocated sales returns is considered as payment ([0561d0a](https://github.com/frappe/erpnext/commit/0561d0a81c646253d4fd165b39906019027d3e87)) * Show Stock Ageing Data filter not working in stock balance report ([2185a29](https://github.com/frappe/erpnext/commit/2185a2955535f3b00f2629ada1b63e6fcfa2ebea)) * Warehouse linked company name in multicompany setup (backport [#40779](https://github.com/frappe/erpnext/issues/40779)) ([#40781](https://github.com/frappe/erpnext/issues/40781)) ([33b6244](https://github.com/frappe/erpnext/commit/33b6244ae66d59b97f2c4b1d889044b2146ac1e9)) ### Features * allow to pick manually qty / batches / serial nos ([5ea11af](https://github.com/frappe/erpnext/commit/5ea11af36b5f5f3e0ada7ecc94800683e053abf1)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 548d5a823d7..a5a30833f53 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.18.3" +__version__ = "15.19.0" def get_default_company(user=None): From 3e7abf5fe57d21beab0ad58984482acda079ff94 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 29 Mar 2024 09:05:35 +0530 Subject: [PATCH 28/34] fix: Receive payment entry from Employee (cherry picked from commit 29e5c6807ebe7c440fd368a3beb896e59c521e0c) (cherry picked from commit 0cee954f84641b2e658726fe40ffb1a34b6ac222) --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 29603f7458b..9f21ee31ff8 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -112,6 +112,9 @@ class PaymentEntry(AccountsController): if self.docstatus > 0 or self.payment_type == "Internal Transfer": return + if self.party_type not in ("Customer", "Supplier"): + return + if not frappe.db.get_value( "Company", self.company, "book_advance_payments_in_separate_party_account" ): From dc0c85a227915174d2e6c37cdb35c88712f8bd9b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 4 Apr 2024 08:57:45 +0000 Subject: [PATCH 29/34] chore(release): Bumped to Version 15.19.1 ## [15.19.1](https://github.com/frappe/erpnext/compare/v15.19.0...v15.19.1) (2024-04-04) ### Bug Fixes * Receive payment entry from Employee ([3e7abf5](https://github.com/frappe/erpnext/commit/3e7abf5fe57d21beab0ad58984482acda079ff94)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a5a30833f53..8ae32fdd555 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.19.0" +__version__ = "15.19.1" def get_default_company(user=None): From f229282754591223e0eb3f2ef9ed1c580cef4da1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 27 Mar 2024 12:24:20 +0530 Subject: [PATCH 30/34] fix: Get pro-rata amount based on correct days (cherry picked from commit 1276855f40328dcea921a3706611f03746487255) --- .../asset_depreciation_schedule.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py index 6e165089334..7fec35eeb09 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py @@ -315,7 +315,6 @@ class AssetDepreciationSchedule(Document): has_wdv_or_dd_non_yearly_pro_rata, number_of_pending_depreciations, ) - if not has_pro_rata or ( n < (cint(final_number_of_depreciations) - 1) or final_number_of_depreciations == 2 ): @@ -340,6 +339,7 @@ class AssetDepreciationSchedule(Document): depreciation_amount, from_date, date_of_disposal, + original_schedule_date=schedule_date, ) if depreciation_amount > 0: @@ -568,14 +568,19 @@ def _get_modified_available_for_use_date(asset_doc, row, wdv_or_dd_non_yearly=Fa def _get_pro_rata_amt( - row, depreciation_amount, from_date, to_date, has_wdv_or_dd_non_yearly_pro_rata=False + row, + depreciation_amount, + from_date, + to_date, + has_wdv_or_dd_non_yearly_pro_rata=False, + original_schedule_date=None, ): days = date_diff(to_date, from_date) months = month_diff(to_date, from_date) if has_wdv_or_dd_non_yearly_pro_rata: - total_days = get_total_days(to_date, 12) + total_days = get_total_days(original_schedule_date or to_date, 12) else: - total_days = get_total_days(to_date, row.frequency_of_depreciation) + total_days = get_total_days(original_schedule_date or to_date, row.frequency_of_depreciation) return (depreciation_amount * flt(days)) / flt(total_days), days, months @@ -583,7 +588,7 @@ def _get_pro_rata_amt( def get_total_days(date, frequency): period_start_date = add_months(date, cint(frequency) * -1) - if is_last_day_of_the_month(date): + if not is_last_day_of_the_month(date): period_start_date = get_last_day(period_start_date) return date_diff(date, period_start_date) @@ -661,7 +666,7 @@ def get_straight_line_or_manual_depr_amount( ), 1, ), - ) + ) + 1 to_date = get_last_day( add_months(row.depreciation_start_date, schedule_idx * row.frequency_of_depreciation) @@ -696,8 +701,7 @@ def get_straight_line_or_manual_depr_amount( add_days( get_last_day(add_months(row.depreciation_start_date, -1 * row.frequency_of_depreciation)), 1 ), - ) - + ) + 1 to_date = get_last_day( add_months(row.depreciation_start_date, schedule_idx * row.frequency_of_depreciation) ) @@ -707,7 +711,6 @@ def get_straight_line_or_manual_depr_amount( ), 1, ) - return daily_depr_amount * (date_diff(to_date, from_date) + 1) else: return ( From e41d23d26c86a0da5b3aefef11437ff563e8546f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 2 Apr 2024 18:28:40 +0530 Subject: [PATCH 31/34] fix: depr amount pro rata and related tests (cherry picked from commit 350d53dbe1c0680d0f29988452eb9e8b2f3decd0) --- erpnext/assets/doctype/asset/test_asset.py | 44 +++++++++++-------- .../asset_depreciation_schedule.py | 39 +++++++++------- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 25d010500f6..254ebf902cc 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -234,7 +234,11 @@ class TestAsset(AssetSetup): asset.precision("gross_purchase_amount"), ) pro_rata_amount, _, _ = _get_pro_rata_amt( - asset.finance_books[0], 9000, get_last_day(add_months(purchase_date, 1)), date + asset.finance_books[0], + 9000, + get_last_day(add_months(purchase_date, 1)), + date, + original_schedule_date=get_last_day(nowdate()), ) pro_rata_amount = flt(pro_rata_amount, asset.precision("gross_purchase_amount")) self.assertEquals( @@ -316,7 +320,11 @@ class TestAsset(AssetSetup): self.assertEquals(first_asset_depr_schedule.status, "Cancelled") pro_rata_amount, _, _ = _get_pro_rata_amt( - asset.finance_books[0], 9000, get_last_day(add_months(purchase_date, 1)), date + asset.finance_books[0], + 9000, + get_last_day(add_months(purchase_date, 1)), + date, + original_schedule_date=get_last_day(nowdate()), ) pro_rata_amount = flt(pro_rata_amount, asset.precision("gross_purchase_amount")) @@ -334,7 +342,6 @@ class TestAsset(AssetSetup): ), ("Debtors - _TC", 25000.0, 0.0), ) - gle = get_gl_entries("Sales Invoice", si.name) self.assertSequenceEqual(gle, expected_gle) @@ -380,7 +387,7 @@ class TestAsset(AssetSetup): self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Sold") - expected_values = [["2023-03-31", 12000, 36000], ["2023-05-23", 1742.47, 37742.47]] + expected_values = [["2023-03-31", 12000, 36000], ["2023-05-23", 1737.7, 37737.7]] second_asset_depr_schedule = get_depr_schedule(asset.name, "Active") @@ -393,7 +400,7 @@ class TestAsset(AssetSetup): expected_gle = ( ( "_Test Accumulated Depreciations - _TC", - 37742.47, + 37737.7, 0.0, ), ( @@ -404,7 +411,7 @@ class TestAsset(AssetSetup): ( "_Test Gain/Loss on Asset Disposal - _TC", 0.0, - 17742.47, + 17737.7, ), ("Debtors - _TC", 40000.0, 0.0), ) @@ -715,25 +722,24 @@ class TestDepreciationMethods(AssetSetup): ) expected_schedules = [ - ["2023-01-31", 1021.98, 1021.98], - ["2023-02-28", 923.08, 1945.06], - ["2023-03-31", 1021.98, 2967.04], - ["2023-04-30", 989.01, 3956.05], - ["2023-05-31", 1021.98, 4978.03], - ["2023-06-30", 989.01, 5967.04], - ["2023-07-31", 1021.98, 6989.02], - ["2023-08-31", 1021.98, 8011.0], - ["2023-09-30", 989.01, 9000.01], - ["2023-10-31", 1021.98, 10021.99], - ["2023-11-30", 989.01, 11011.0], - ["2023-12-31", 989.0, 12000.0], + ["2023-01-31", 1019.18, 1019.18], + ["2023-02-28", 920.55, 1939.73], + ["2023-03-31", 1019.18, 2958.91], + ["2023-04-30", 986.3, 3945.21], + ["2023-05-31", 1019.18, 4964.39], + ["2023-06-30", 986.3, 5950.69], + ["2023-07-31", 1019.18, 6969.87], + ["2023-08-31", 1019.18, 7989.05], + ["2023-09-30", 986.3, 8975.35], + ["2023-10-31", 1019.18, 9994.53], + ["2023-11-30", 986.3, 10980.83], + ["2023-12-31", 1019.17, 12000.0], ] schedules = [ [cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount] for d in get_depr_schedule(asset.name, "Draft") ] - self.assertEqual(schedules, expected_schedules) def test_schedule_for_straight_line_method_for_existing_asset(self): diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py index 7fec35eeb09..5eb7a3f3d7f 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py @@ -581,16 +581,13 @@ def _get_pro_rata_amt( total_days = get_total_days(original_schedule_date or to_date, 12) else: total_days = get_total_days(original_schedule_date or to_date, row.frequency_of_depreciation) - return (depreciation_amount * flt(days)) / flt(total_days), days, months def get_total_days(date, frequency): period_start_date = add_months(date, cint(frequency) * -1) - - if not is_last_day_of_the_month(date): + if is_last_day_of_the_month(date): period_start_date = get_last_day(period_start_date) - return date_diff(date, period_start_date) @@ -686,22 +683,30 @@ def get_straight_line_or_manual_depr_amount( # if the Depreciation Schedule is being prepared for the first time else: if row.daily_prorata_based: - daily_depr_amount = ( + amount = ( flt(asset.gross_purchase_amount) - flt(asset.opening_accumulated_depreciation) - flt(row.expected_value_after_useful_life) - ) / date_diff( - get_last_day( - add_months( - row.depreciation_start_date, - flt(row.total_number_of_depreciations - asset.number_of_depreciations_booked - 1) - * row.frequency_of_depreciation, - ) - ), - add_days( - get_last_day(add_months(row.depreciation_start_date, -1 * row.frequency_of_depreciation)), 1 - ), - ) + 1 + ) + + total_days = ( + date_diff( + get_last_day( + add_months( + row.depreciation_start_date, + flt(row.total_number_of_depreciations - asset.number_of_depreciations_booked - 1) + * row.frequency_of_depreciation, + ) + ), + add_days( + get_last_day(add_months(row.depreciation_start_date, -1 * row.frequency_of_depreciation)), 1 + ), + ) + + 1 + ) + + daily_depr_amount = amount / total_days + to_date = get_last_day( add_months(row.depreciation_start_date, schedule_idx * row.frequency_of_depreciation) ) From 6ddd08d0b05399f111d278aff307dc3bb1ea03e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 Apr 2024 18:28:29 +0530 Subject: [PATCH 32/34] fix:linter issue (cherry picked from commit 8247fd17277d20d71c8139f8ab870e0fbe525c90) --- .../asset_depreciation_schedule/asset_depreciation_schedule.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py index 5eb7a3f3d7f..5b7b9fd6a20 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py @@ -699,7 +699,8 @@ def get_straight_line_or_manual_depr_amount( ) ), add_days( - get_last_day(add_months(row.depreciation_start_date, -1 * row.frequency_of_depreciation)), 1 + get_last_day(add_months(row.depreciation_start_date, -1 * row.frequency_of_depreciation)), + 1, ), ) + 1 From e71f33425c8c01e6d9e1adc0471b0dc5d791a8e3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sun, 7 Apr 2024 15:20:50 +0530 Subject: [PATCH 33/34] fix: pro-rata amount for straight line method (cherry picked from commit 16a5475c0c82c9cfc94675652aead57b2a8586b9) --- .../asset_depreciation_schedule.py | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py index 5b7b9fd6a20..4464ad73cbf 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py @@ -638,32 +638,36 @@ def get_straight_line_or_manual_depr_amount( # if the Depreciation Schedule is being modified after Asset Value Adjustment due to decrease in asset value elif asset.flags.decrease_in_asset_value_due_to_value_adjustment: if row.daily_prorata_based: - daily_depr_amount = ( - flt(row.value_after_depreciation) - flt(row.expected_value_after_useful_life) - ) / date_diff( - get_last_day( - add_months( - row.depreciation_start_date, - flt(row.total_number_of_depreciations - asset.number_of_depreciations_booked - 1) - * row.frequency_of_depreciation, - ) - ), - add_days( + amount = flt(row.value_after_depreciation) - flt(row.expected_value_after_useful_life) + total_days = ( + date_diff( get_last_day( add_months( row.depreciation_start_date, - flt( - row.total_number_of_depreciations - - asset.number_of_depreciations_booked - - number_of_pending_depreciations - - 1 - ) + flt(row.total_number_of_depreciations - asset.number_of_depreciations_booked - 1) * row.frequency_of_depreciation, ) ), - 1, - ), - ) + 1 + add_days( + get_last_day( + add_months( + row.depreciation_start_date, + flt( + row.total_number_of_depreciations + - asset.number_of_depreciations_booked + - number_of_pending_depreciations + - 1 + ) + * row.frequency_of_depreciation, + ) + ), + 1, + ), + ) + + 1 + ) + + daily_depr_amount = amount / total_days to_date = get_last_day( add_months(row.depreciation_start_date, schedule_idx * row.frequency_of_depreciation) From 3566a8adc64051fb3cfb9c62993ae182c5bd0b6c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sun, 7 Apr 2024 10:40:27 +0000 Subject: [PATCH 34/34] chore(release): Bumped to Version 15.19.2 ## [15.19.2](https://github.com/frappe/erpnext/compare/v15.19.1...v15.19.2) (2024-04-07) ### Bug Fixes * depr amount pro rata and related tests ([e41d23d](https://github.com/frappe/erpnext/commit/e41d23d26c86a0da5b3aefef11437ff563e8546f)) * Get pro-rata amount based on correct days ([f229282](https://github.com/frappe/erpnext/commit/f229282754591223e0eb3f2ef9ed1c580cef4da1)) * pro-rata amount for straight line method ([e71f334](https://github.com/frappe/erpnext/commit/e71f33425c8c01e6d9e1adc0471b0dc5d791a8e3)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 8ae32fdd555..07a3df68e88 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.19.1" +__version__ = "15.19.2" def get_default_company(user=None):