From 3648f3816f95b2aa4ac4425eea3cc51f63b2151d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 30 Oct 2024 09:55:19 +0000 Subject: [PATCH 01/27] chore(release): Bumped to Version 15.40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [15.40.0](https://github.com/frappe/erpnext/compare/v15.39.6...v15.40.0) (2024-10-30) ### Bug Fixes * add company filter for project ([33fa1e4](https://github.com/frappe/erpnext/commit/33fa1e45ad27e41654335e65ca579a3099c5519d)) * add parenttype clause to invoice tax query in sales_register report ([603d2cf](https://github.com/frappe/erpnext/commit/603d2cf77dd8ca6bae612dc9b406a37416c3fb72)) * backport translations from develop ([#43849](https://github.com/frappe/erpnext/issues/43849)) ([11dd196](https://github.com/frappe/erpnext/commit/11dd1968c78ea1608edd8850854f7dcd4f998648)) * basic rate not editable in Stock Entry Detail (backport [#43837](https://github.com/frappe/erpnext/issues/43837)) ([#43838](https://github.com/frappe/erpnext/issues/43838)) ([20478b6](https://github.com/frappe/erpnext/commit/20478b632f82bd9d44bed28e37359b2dd2c7d989)) * better implementation, handle missing purchase order ([41db040](https://github.com/frappe/erpnext/commit/41db040a60c88afb8d61b52327227ad282488c3b)) * Calculate gross margin on update of project costing from invoices (backport [#43876](https://github.com/frappe/erpnext/issues/43876)) ([#43900](https://github.com/frappe/erpnext/issues/43900)) ([93d0db2](https://github.com/frappe/erpnext/commit/93d0db29100735cca01228ccf943a5abeb772bf9)) * calculate tds with net amount when invoice exceeds single threshold amount (backport [#43869](https://github.com/frappe/erpnext/issues/43869)) ([#43920](https://github.com/frappe/erpnext/issues/43920)) ([9a52661](https://github.com/frappe/erpnext/commit/9a526611e020a4bd1cbbbd56b1db67367d5b9fc6)) * cannot create opp from lead without prospect ([4dcaf42](https://github.com/frappe/erpnext/commit/4dcaf42bc5a78c5a707c82161f80e05e9ad99369)) * consider gle based on balances in company currency ([#43805](https://github.com/frappe/erpnext/issues/43805)) ([2fb4417](https://github.com/frappe/erpnext/commit/2fb441763a74bd4c5233e77f39611ee0c95b7efa)) * consider opening asset values while calculating asset depreciation rate ([1af2326](https://github.com/frappe/erpnext/commit/1af2326a52e969013745a390d2dbbcc54733512f)) * correct garbage value on Razorpay Payments Page ([2c21df2](https://github.com/frappe/erpnext/commit/2c21df2ad96f4eb2fee044ecd9b4828a3dad0ee3)) * do not check for payment terms details for return invoices. ([9a5604c](https://github.com/frappe/erpnext/commit/9a5604c5bb4f2c8d99fa59bdfb9bc16565aa6ffa)) * do not copy serial numbers from DN to SI (backport [#43885](https://github.com/frappe/erpnext/issues/43885)) ([#43893](https://github.com/frappe/erpnext/issues/43893)) ([d06831e](https://github.com/frappe/erpnext/commit/d06831ea9404852bcf730b6b17de6059ff5b1227)) * do not set payment terms for return invoices ([a826a89](https://github.com/frappe/erpnext/commit/a826a894f4d9ef2be1c59c4e97f0ceb475b569b4)) * find first PCV to consider opening entries ([8218ca9](https://github.com/frappe/erpnext/commit/8218ca990c1c1da4210935eefc7cd1138724d6bc)) * Handle None value for item description in customer portal invoice view (backport [#43823](https://github.com/frappe/erpnext/issues/43823)) ([#43889](https://github.com/frappe/erpnext/issues/43889)) ([8a72845](https://github.com/frappe/erpnext/commit/8a72845ee6fa7f954e6915272ea722f487907171)) * hide payment terms for return and paid purchase invoices ([29aa5d6](https://github.com/frappe/erpnext/commit/29aa5d64683d8af8864996c4f09214c17b58905d)) * incorrect value of available_qty_for_consumption in subcontracti… (backport [#43836](https://github.com/frappe/erpnext/issues/43836)) ([#43861](https://github.com/frappe/erpnext/issues/43861)) ([cd4746a](https://github.com/frappe/erpnext/commit/cd4746ad2a1cac13c97a798a07bb4abee322f29f)) * map doc from purchase order ([58a3ef7](https://github.com/frappe/erpnext/commit/58a3ef7aa6b5d446460bb25ba7cb0188cbdab66b)) * Patch for reposting account closing balance (backport [#43905](https://github.com/frappe/erpnext/issues/43905)) ([#43910](https://github.com/frappe/erpnext/issues/43910)) ([ab16207](https://github.com/frappe/erpnext/commit/ab162070a6dd08bc2a7217242dc5085d190b60ff)) * post account closing balance against pcv closing account (backport [#43887](https://github.com/frappe/erpnext/issues/43887)) ([#43898](https://github.com/frappe/erpnext/issues/43898)) ([e22d0a3](https://github.com/frappe/erpnext/commit/e22d0a3406932956598ac4e7024cdee68bf713d8)) * purchase return validation issue (backport [#43871](https://github.com/frappe/erpnext/issues/43871)) (backport [#43874](https://github.com/frappe/erpnext/issues/43874)) ([#43879](https://github.com/frappe/erpnext/issues/43879)) ([db3be41](https://github.com/frappe/erpnext/commit/db3be4195c3690e835355f0154bc29b602301ab8)) * recalculate outstanding after save on checkout for POS Invoice ([63668eb](https://github.com/frappe/erpnext/commit/63668eb855252cd2b0c39356c21660871463eae5)) * remarks field in payment reconciliation ([8707090](https://github.com/frappe/erpnext/commit/870709079b0434d810b792d17c93863c9dc008fb)) * **RFQ:** make strings translatable (backport [#43843](https://github.com/frappe/erpnext/issues/43843)) ([#43848](https://github.com/frappe/erpnext/issues/43848)) ([07aaef2](https://github.com/frappe/erpnext/commit/07aaef2af2413ff6c39b85514659d572096a6c73)) * rounding issue of required qty in subcontracting order ([#43908](https://github.com/frappe/erpnext/issues/43908)) ([9ac87bd](https://github.com/frappe/erpnext/commit/9ac87bd3b1547ba1d0c70cbacf26addbd4a3f637)) * scrub "-" from fieldname in accounting dimension ([c702826](https://github.com/frappe/erpnext/commit/c70282663c69955d49ce41c772056cfe02bae975)) * set bill_no before `against_voucher` gets concatenated ([81297ce](https://github.com/frappe/erpnext/commit/81297ce1683ec413a8f9b2fe153124452b7d1883)) * set default warehouse for pos invoice ([b80a5f2](https://github.com/frappe/erpnext/commit/b80a5f27a904be30572742ec446feea335a20a28)) * set proper currency format ([9f97018](https://github.com/frappe/erpnext/commit/9f970189feb9193fb80ac9564bb6d23bd3d05f66)) * Unnecessary validation for non deferred sales invoices ([#43816](https://github.com/frappe/erpnext/issues/43816)) ([bf4fb53](https://github.com/frappe/erpnext/commit/bf4fb53575be594e2e13e0c53cd4218fe4215ac5)) * use period closing voucher object to call get_account_closing_ba… (backport [#43880](https://github.com/frappe/erpnext/issues/43880)) ([#43883](https://github.com/frappe/erpnext/issues/43883)) ([8bfc212](https://github.com/frappe/erpnext/commit/8bfc212e262654ee9397fc435e2f08ccd286a520)) * validate fieldname ([b21abf4](https://github.com/frappe/erpnext/commit/b21abf4d9056496f016c9aedf0182bb8dff7688d)) * work order finish button not showing (backport [#43875](https://github.com/frappe/erpnext/issues/43875)) (backport [#43877](https://github.com/frappe/erpnext/issues/43877)) ([#43904](https://github.com/frappe/erpnext/issues/43904)) ([7189dab](https://github.com/frappe/erpnext/commit/7189daba193127350d74f5397147ab27a5525f60)) ### Features * add party name in payment request ([935f2e1](https://github.com/frappe/erpnext/commit/935f2e11e859002548c26061319ab29678ef85ed)) ### Performance Improvements * performance optimizations for accounting reports by refactoring account closing balance and period closing voucher ([#43798](https://github.com/frappe/erpnext/issues/43798)) ([ced76ca](https://github.com/frappe/erpnext/commit/ced76ca5c0b2e66e13781353ed71f1d95368bf87)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b05af8dad95..1bf4cf4a827 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.39.6" +__version__ = "15.40.0" def get_default_company(user=None): From 9ccdb987d9deb844a1126fba1e33c55367484631 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 6 Nov 2024 05:21:49 +0000 Subject: [PATCH 02/27] chore(release): Bumped to Version 15.41.0 # [15.41.0](https://github.com/frappe/erpnext/compare/v15.40.0...v15.41.0) (2024-11-06) ### Bug Fixes * add precision validation ([b665e4e](https://github.com/frappe/erpnext/commit/b665e4e24ad9105d82af30b7190a50e720c8636f)) * deleting SO/PO will remove its advance payment ledger entry ([d84a3c4](https://github.com/frappe/erpnext/commit/d84a3c4f29df46156d94cef8ad195eaf59424e06)) * map reference number while reversing journal ([10d8cc9](https://github.com/frappe/erpnext/commit/10d8cc9d66054864afd232ac7377eed4c6f1272a)) * **return:** set default return warehouse ([e730b8c](https://github.com/frappe/erpnext/commit/e730b8c6e4e38d241f522108519767e4db4cc048)) * SO link on PO and add in missing dashboard references on both ([9f7afda](https://github.com/frappe/erpnext/commit/9f7afda4db26e9695c8ab45433d1c0885f076417)) * validation trigger (backport [#43926](https://github.com/frappe/erpnext/issues/43926)) ([#43943](https://github.com/frappe/erpnext/issues/43943)) ([a689830](https://github.com/frappe/erpnext/commit/a689830bff72e85c940e4fc3a897edaeaa2b2c38)) * valuation rate for sales / purchase return for serial / batch nos (backport [#43925](https://github.com/frappe/erpnext/issues/43925)) ([#43942](https://github.com/frappe/erpnext/issues/43942)) ([ce42d84](https://github.com/frappe/erpnext/commit/ce42d847b3c98f29f82ecc165dfa7a371a916399)) ### Features * advance payment ledger doctype ([b343334](https://github.com/frappe/erpnext/commit/b343334f694b79a92faabbba03984dca086ca8c0)) * remove Payroll Entry from Bank Account dashboard (backport [#43931](https://github.com/frappe/erpnext/issues/43931)) ([#43933](https://github.com/frappe/erpnext/issues/43933)) ([4a749ce](https://github.com/frappe/erpnext/commit/4a749cec72c060f98662191f3dcaf801496d0ab9)) ### Performance Improvements * avoid reposting of entries created after stock reco (backport [#43950](https://github.com/frappe/erpnext/issues/43950)) ([#43961](https://github.com/frappe/erpnext/issues/43961)) ([7ad664d](https://github.com/frappe/erpnext/commit/7ad664d89a3383f2005d938cefffb0a798b204a2)) * too many writes error during reposting (backport [#43978](https://github.com/frappe/erpnext/issues/43978)) ([#43983](https://github.com/frappe/erpnext/issues/43983)) ([a38819c](https://github.com/frappe/erpnext/commit/a38819cbd5cef2cc8615cdbd34f5d735378d2dd1)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1bf4cf4a827..38ea1800995 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.40.0" +__version__ = "15.41.0" def get_default_company(user=None): From 4819535a526d265f1a9da21dbf83fda7bb7bc6bc Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 7 Nov 2024 12:44:29 +0000 Subject: [PATCH 03/27] chore(release): Bumped to Version 15.41.1 ## [15.41.1](https://github.com/frappe/erpnext/compare/v15.41.0...v15.41.1) (2024-11-07) ### Bug Fixes * ensure list has items ([633997b](https://github.com/frappe/erpnext/commit/633997b1b0c2c2bfa96ac7697093f18d3d5d56ae)) * error when saving POS merge log ([#43989](https://github.com/frappe/erpnext/issues/43989)) ([c3e61ae](https://github.com/frappe/erpnext/commit/c3e61aebd27ad1afb3939b4ee6aa7b143a781432)) * removed single quotes from deferred revenue ([#43985](https://github.com/frappe/erpnext/issues/43985)) ([20033ee](https://github.com/frappe/erpnext/commit/20033eef9b53b96abefcaaeb5d967cc56d8aae1b)) * task showing limit in customer portal (backport [#44003](https://github.com/frappe/erpnext/issues/44003)) ([#44005](https://github.com/frappe/erpnext/issues/44005)) ([47a8fc2](https://github.com/frappe/erpnext/commit/47a8fc28dfc670c5257d80e4f2ff10304adc7334)) * Update `dimension_filter_map` query ([318830c](https://github.com/frappe/erpnext/commit/318830c57d0568bfea951aab7f43a7eafffca2a8)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 38ea1800995..94615249d02 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.41.0" +__version__ = "15.41.1" def get_default_company(user=None): From f5610e29bed1b1bcc456e0354ad3deabfd28f2e7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 8 Nov 2024 13:02:23 +0530 Subject: [PATCH 04/27] Release v15.41.2 (#44037) * fix: improved the conditions for determining voucher subtypes (cherry picked from commit 00eee161904b5deb01ba80b6a3629bd7e2dd613f) * fix: patch (cherry picked from commit d76cc210860651377262371359b65e4f7ea9abb7) # Conflicts: # erpnext/patches.txt * test: test voucher subtype for sales invoice (cherry picked from commit ad6cc352f189449484e8560dc4a4c87ff8c0f894) * chore: resolve conflict * fix: NoneType while updating ordered_qty in SO for removed items (cherry picked from commit 442cdd7ce49ccbaff855bfac71f3222bc83b7d49) * refactor: add "margin_type" and "margin_rate_or_amount" to no copy (cherry picked from commit 70f090c1ec3be1b904b19801b47dac16ed4a8775) * fix: item not set in the batch quick entry form (backport #44028) (#44031) fix: item not set in the batch quick entry form (#44028) (cherry picked from commit 0399ccc51ea9d0f48f1221dda0761603d1cea22d) Co-authored-by: rohitwaghchaure * fix: calculate percentage received and delivered considering over-receipt and over-delivery (backport #43870) (#44030) fix: calculate percentage received and delivered considering over-receipt and over-delivery (#43870) (cherry picked from commit adba1168c1bf28911b9664934d2e84bbae906dec) Co-authored-by: Nabin Hait * fix: sort by ascending to get the first period closing voucher (backport #44029) (#44035) fix: sort by ascending to get the first period closing voucher (#44029) (cherry picked from commit 42dcdcde1a7a982f376f3ddd6969f825b42203e0) Co-authored-by: Venkatesh <47534423+venkat102@users.noreply.github.com> --------- Co-authored-by: ljain112 Co-authored-by: Smit Vora Co-authored-by: ruthra kumar Co-authored-by: bhaveshkumar.j Co-authored-by: Ravindu Nethmina <117300601+NethminaHiker360@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: rohitwaghchaure Co-authored-by: Venkatesh <47534423+venkat102@users.noreply.github.com> --- .../period_closing_voucher.py | 2 +- .../sales_invoice/test_sales_invoice.py | 19 +++++++ .../doctype/purchase_order/purchase_order.py | 8 ++- erpnext/controllers/accounts_controller.py | 6 +- erpnext/patches.txt | 3 +- .../update_sub_voucher_type_in_gl_entries.py | 57 +++++++++++++++++++ erpnext/public/js/controllers/transaction.js | 51 ++++++++++------- .../doctype/sales_order/sales_order.py | 4 +- 8 files changed, 120 insertions(+), 30 deletions(-) create mode 100644 erpnext/patches/v15_0/update_sub_voucher_type_in_gl_entries.py diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index 2a9b624a47a..1d4ee25241e 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -417,7 +417,7 @@ class PeriodClosingVoucher(AccountsController): "Period Closing Voucher", {"company": self.company, "docstatus": 1}, "name", - order_by="period_end_date", + order_by="period_end_date asc", ) if not first_pcv or first_pcv == self.name: diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index d05da0dbf19..db6fd41e439 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -4005,6 +4005,25 @@ class TestSalesInvoice(FrappeTestCase): si.submit() self.assertEqual(si.remarks, f"Against Customer Order Test PO dated {format_date(nowdate())}") + def test_gl_voucher_subtype(self): + si = create_sales_invoice() + gl_entries = frappe.get_all( + "GL Entry", + filters={"voucher_type": "Sales Invoice", "voucher_no": si.name}, + pluck="voucher_subtype", + ) + + self.assertTrue(all([x == "Sales Invoice" for x in gl_entries])) + + si = create_sales_invoice(is_return=1, qty=-1) + gl_entries = frappe.get_all( + "GL Entry", + filters={"voucher_type": "Sales Invoice", "voucher_no": si.name}, + pluck="voucher_subtype", + ) + + self.assertTrue(all([x == "Credit Note" for x in gl_entries])) + def set_advance_flag(company, flag, default_account): frappe.db.set_value( diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index c03c896c29f..6ba9cb69f9f 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -581,7 +581,7 @@ class PurchaseOrder(BuyingController): def update_receiving_percentage(self): total_qty, received_qty = 0.0, 0.0 for item in self.items: - received_qty += item.received_qty + received_qty += min(item.received_qty, item.qty) total_qty += item.qty if total_qty: self.db_set("per_received", flt(received_qty / total_qty) * 100, update_modified=False) @@ -625,9 +625,11 @@ class PurchaseOrder(BuyingController): if not self.is_against_so(): return for item in removed_items: - prev_ordered_qty = frappe.get_cached_value( - "Sales Order Item", item.get("sales_order_item"), "ordered_qty" + prev_ordered_qty = ( + frappe.get_cached_value("Sales Order Item", item.get("sales_order_item"), "ordered_qty") + or 0.0 ) + frappe.db.set_value( "Sales Order Item", item.get("sales_order_item"), "ordered_qty", prev_ordered_qty - item.qty ) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index e47e9917149..b14cf428c53 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1096,9 +1096,11 @@ class AccountsController(TransactionBase): return "Purchase Return" elif self.doctype == "Delivery Note" and self.is_return: return "Sales Return" - elif (self.doctype == "Sales Invoice" and self.is_return) or self.doctype == "Purchase Invoice": + elif self.doctype == "Sales Invoice" and self.is_return: return "Credit Note" - elif (self.doctype == "Purchase Invoice" and self.is_return) or self.doctype == "Sales Invoice": + elif self.doctype == "Sales Invoice" and self.is_debit_note: + return "Debit Note" + elif self.doctype == "Purchase Invoice" and self.is_return: return "Debit Note" return self.doctype diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 64c74f9d645..ab416d9d6c3 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -315,7 +315,7 @@ erpnext.patches.v15_0.update_asset_value_for_manual_depr_entries erpnext.patches.v15_0.update_gpa_and_ndb_for_assdeprsch erpnext.patches.v14_0.create_accounting_dimensions_for_closing_balance erpnext.patches.v14_0.set_period_start_end_date_in_pcv -erpnext.patches.v14_0.update_closing_balances #29-10-2024 +erpnext.patches.v14_0.update_closing_balances #08-11-2024 execute:frappe.db.set_single_value("Accounts Settings", "merge_similar_account_heads", 0) erpnext.patches.v14_0.update_reference_type_in_journal_entry_accounts erpnext.patches.v14_0.update_subscription_details @@ -381,3 +381,4 @@ erpnext.patches.v15_0.set_standard_stock_entry_type erpnext.patches.v15_0.link_purchase_item_to_asset_doc erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter erpnext.patches.v15_0.update_task_assignee_email_field_in_asset_maintenance_log +erpnext.patches.v15_0.update_sub_voucher_type_in_gl_entries diff --git a/erpnext/patches/v15_0/update_sub_voucher_type_in_gl_entries.py b/erpnext/patches/v15_0/update_sub_voucher_type_in_gl_entries.py new file mode 100644 index 00000000000..7160a6ba87d --- /dev/null +++ b/erpnext/patches/v15_0/update_sub_voucher_type_in_gl_entries.py @@ -0,0 +1,57 @@ +import frappe + + +def execute(): + update_purchase_invoices() + update_sales_invoices() + update_sales_debit_notes() + + +def update_purchase_invoices(): + invoices = frappe.get_all( + "Purchase Invoice", + filters={"docstatus": 1, "is_return": 0}, + pluck="name", + ) + + if not invoices: + return + + update_gl_entry(doctype="Purchase Invoice", invoices=invoices, value="Purchase Invoice") + + +def update_sales_invoices(): + invoices = frappe.get_all( + "Sales Invoice", + filters={"docstatus": 1, "is_return": 0, "is_debit_note": 0}, + pluck="name", + ) + if not invoices: + return + + update_gl_entry(doctype="Sales Invoice", invoices=invoices, value="Sales Invoice") + + +def update_sales_debit_notes(): + invoices = frappe.get_all( + "Sales Invoice", + filters={"docstatus": 1, "is_debit_note": 1}, + pluck="name", + ) + + if not invoices: + return + + update_gl_entry(doctype="Sales Invoice", invoices=invoices, value="Debit Note") + + +def update_gl_entry(doctype, invoices, value): + gl_entry = frappe.qb.DocType("GL Entry") + ( + frappe.qb.update(gl_entry) + .set("voucher_subtype", value) + .where(gl_entry.voucher_subtype.isnotnull()) + .where(gl_entry.voucher_no.isin(invoices)) + .where(gl_entry.voucher_type == doctype) + .run() + ) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index adb72818fe8..1773586ac48 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -289,28 +289,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } ]); } - - if(this.frm.fields_dict['items'].grid.get_field('serial_and_batch_bundle')) { - let sbb_field = this.frm.get_docfield('items', 'serial_and_batch_bundle'); - if (sbb_field) { - sbb_field.get_route_options_for_new_doc = (row) => { - return { - 'item_code': row.doc.item_code, - } - }; - } - } - - if(this.frm.fields_dict['items'].grid.get_field('batch_no')) { - let batch_no_field = this.frm.get_docfield('items', 'batch_no'); - if (batch_no_field) { - batch_no_field.get_route_options_for_new_doc = function(row) { - return { - 'item': row.doc.item_code - } - }; - } - } } is_return() { @@ -409,6 +387,35 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.setup_quality_inspection(); this.validate_has_items(); erpnext.utils.view_serial_batch_nos(this.frm); + this.set_route_options_for_new_doc(); + } + + set_route_options_for_new_doc() { + // While creating the batch from the link field, copy item from line item to batch form + + if(this.frm.fields_dict['items'].grid.get_field('batch_no')) { + let batch_no_field = this.frm.get_docfield('items', 'batch_no'); + if (batch_no_field) { + batch_no_field.get_route_options_for_new_doc = function(row) { + return { + 'item': row.doc.item_code + } + }; + } + } + + // While creating the SABB from the link field, copy item, doctype from line item to SABB form + if(this.frm.fields_dict['items'].grid.get_field('serial_and_batch_bundle')) { + let sbb_field = this.frm.get_docfield('items', 'serial_and_batch_bundle'); + if (sbb_field) { + sbb_field.get_route_options_for_new_doc = (row) => { + return { + "item_code": row.doc.item_code, + "voucher_type": this.frm.doc.doctype, + } + }; + } + } } scan_barcode() { diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index a87c1352471..62262b41021 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -584,7 +584,7 @@ class SalesOrder(SellingController): item_delivered_qty = item_delivered_qty[0][0] if item_delivered_qty else 0 item.db_set("delivered_qty", flt(item_delivered_qty), update_modified=False) - delivered_qty += item.delivered_qty + delivered_qty += min(item.delivered_qty, item.qty) tot_qty += item.qty if tot_qty != 0: @@ -1347,6 +1347,8 @@ def make_purchase_order_for_default_supplier(source_name, selected_items=None, t "discount_percentage", "discount_amount", "pricing_rules", + "margin_type", + "margin_rate_or_amount", ], "postprocess": update_item, "condition": lambda doc: doc.ordered_qty < doc.stock_qty From 7c78e0025d37e081fe809459803b307492a477d2 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 13 Nov 2024 15:02:57 +0000 Subject: [PATCH 05/27] chore(release): Bumped to Version 15.42.0 # [15.42.0](https://github.com/frappe/erpnext/compare/v15.41.2...v15.42.0) (2024-11-13) ### Bug Fixes * add default height to POS item card selector (backport [#44071](https://github.com/frappe/erpnext/issues/44071)) ([#44075](https://github.com/frappe/erpnext/issues/44075)) ([65ec7c5](https://github.com/frappe/erpnext/commit/65ec7c56041612c17dce79def87ce31ee503f391)) * add field conversion_factor when include_uom is settled ([#43701](https://github.com/frappe/erpnext/issues/43701)) ([f387a8f](https://github.com/frappe/erpnext/commit/f387a8fcebbd5958e50a010b05c0c53d9d98328d)) * better gls for purchases with tax witholding ([#42743](https://github.com/frappe/erpnext/issues/42743)) ([705a26a](https://github.com/frappe/erpnext/commit/705a26a2fa5d1dc20c07dd4150771529c707e820)) * bind this object explicitly on callback event function ([3423d3c](https://github.com/frappe/erpnext/commit/3423d3c13d3da909cdb1e165d04107b9bccee5d6)) * calculate percentage received and delivered considering over-receipt and over-delivery (backport [#43870](https://github.com/frappe/erpnext/issues/43870)) ([#44030](https://github.com/frappe/erpnext/issues/44030)) ([5958d0c](https://github.com/frappe/erpnext/commit/5958d0c2570aa7ae3e0e86e1afdbef89758318f1)) * Cannot read properties of undefined (reading 'work_order_closed') (backport [#44117](https://github.com/frappe/erpnext/issues/44117)) ([#44122](https://github.com/frappe/erpnext/issues/44122)) ([c1983a4](https://github.com/frappe/erpnext/commit/c1983a48469dc3c961c4653e3e20191ee73dee2d)) * consider service item cost in the RM cost of the BOM (backport [#43962](https://github.com/frappe/erpnext/issues/43962)) ([#44111](https://github.com/frappe/erpnext/issues/44111)) ([6e83fec](https://github.com/frappe/erpnext/commit/6e83fec5ca5286bd36b150e1b5660d0e71c3d270)) * Drop Shipping address based on customer shopping address ([8af005c](https://github.com/frappe/erpnext/commit/8af005cef0c84a572fdb1e35928de5c228db610b)) * duplicate items and outdated item price in POS (backport [#42978](https://github.com/frappe/erpnext/issues/42978)) ([#44038](https://github.com/frappe/erpnext/issues/44038)) ([4cde77d](https://github.com/frappe/erpnext/commit/4cde77d8d8f4a6f833e4f28d7cd6f08ac0005474)) * exception on register reports when filtered on cost center ([be07421](https://github.com/frappe/erpnext/commit/be07421ab77b43681dffc7e038630b01ecc61984)) * improved the conditions for determining voucher subtypes ([58ca4a2](https://github.com/frappe/erpnext/commit/58ca4a2b99a694ea891e1b3cfd949f799edacafb)) * incorrect produced qty in Production Plan Summary (backport [#44112](https://github.com/frappe/erpnext/issues/44112)) ([#44113](https://github.com/frappe/erpnext/issues/44113)) ([bce7acf](https://github.com/frappe/erpnext/commit/bce7acf9ccae317eafe2be77dc06440e3c44edd9)) * item mapping from modal to batch form ([#44090](https://github.com/frappe/erpnext/issues/44090)) ([9ac54f6](https://github.com/frappe/erpnext/commit/9ac54f694c27323baca073f6d790497d1c056507)) * item not set in the batch quick entry form (backport [#44028](https://github.com/frappe/erpnext/issues/44028)) ([#44031](https://github.com/frappe/erpnext/issues/44031)) ([6dcd015](https://github.com/frappe/erpnext/commit/6dcd015a39be3d5985482f8899da7dc670c52576)) * Negative stock validation against inventory dimension (backport [#43834](https://github.com/frappe/erpnext/issues/43834)) ([#43846](https://github.com/frappe/erpnext/issues/43846)) ([b314f38](https://github.com/frappe/erpnext/commit/b314f3839bfd19f81eac6d712a343d837fd4cb0f)) * NoneType while updating ordered_qty in SO for removed items ([978a007](https://github.com/frappe/erpnext/commit/978a0078d8f2e93878b883643c94d327deb5fd06)) * not able to cancel DN (backport [#44108](https://github.com/frappe/erpnext/issues/44108)) ([#44109](https://github.com/frappe/erpnext/issues/44109)) ([290bdde](https://github.com/frappe/erpnext/commit/290bddea7777d73a3a31c18a255be8d8a39f3793)) * not able to reconcile expired batches ([#44012](https://github.com/frappe/erpnext/issues/44012)) ([4ba07a4](https://github.com/frappe/erpnext/commit/4ba07a40eb45f6d75c1d6e0775104b998f6cf537)) * patch ([107d53b](https://github.com/frappe/erpnext/commit/107d53b3582ccdac3f237745efba4eca5a14a328)) * populate payment schedule from payment terms (backport [#44082](https://github.com/frappe/erpnext/issues/44082)) ([#44083](https://github.com/frappe/erpnext/issues/44083)) ([363f151](https://github.com/frappe/erpnext/commit/363f15124eaa857d112b04ae7429b11360015215)) * purchase receipt creation from SCR ([#44095](https://github.com/frappe/erpnext/issues/44095)) ([e3d7468](https://github.com/frappe/erpnext/commit/e3d74684d53218d383f2338415f4493fa2a34263)) * slow reposting due to SABB update ([3e29ae8](https://github.com/frappe/erpnext/commit/3e29ae85345fc8c3ec0851987804f3886852097f)) * sort by ascending to get the first period closing voucher (backport [#44029](https://github.com/frappe/erpnext/issues/44029)) ([#44035](https://github.com/frappe/erpnext/issues/44035)) ([56f25ae](https://github.com/frappe/erpnext/commit/56f25ae0657e941f865fb3a224dea3767c8c3ecb)) * task path (backport [#44073](https://github.com/frappe/erpnext/issues/44073)) ([#44078](https://github.com/frappe/erpnext/issues/44078)) ([34b5639](https://github.com/frappe/erpnext/commit/34b5639d1c3a260f527ae02e2dc5ce05efd73e1c)) * tyeerror while saving pick list ([7d09832](https://github.com/frappe/erpnext/commit/7d098328d0bc6e74aca03e505f3c31d845c38d9b)) * update payment amount for partial pos return ([61559be](https://github.com/frappe/erpnext/commit/61559be8a46f410370c199140fbf261a559ce17e)) * update per_billed value in Purchase Receipt while creating Debit Note ([#43977](https://github.com/frappe/erpnext/issues/43977)) ([a833dd6](https://github.com/frappe/erpnext/commit/a833dd67f35d12ea60ff5103eea89c5156975cea)) * when company is created with other company template Chart of Account the Create Taxe Template failed ([#42755](https://github.com/frappe/erpnext/issues/42755)) ([e6894b9](https://github.com/frappe/erpnext/commit/e6894b949c9058ac0141d57dd4b6a5527c656f62)) ### Features * Add item group filtering for search results ([2754793](https://github.com/frappe/erpnext/commit/2754793ff9d5164b97607f4a977bda8a67313c61)) * add template taxe for charts of account France - Plan Comptable General avec code ([#42757](https://github.com/frappe/erpnext/issues/42757)) ([865786e](https://github.com/frappe/erpnext/commit/865786e0b67fb35d2423b4cf281dd76cdca3bd51)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 94615249d02..83fb70c9e8f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.41.1" +__version__ = "15.42.0" def get_default_company(user=None): From ccf99cf98524a37e6111818d1d3d32a30866d19a Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 20 Nov 2024 08:41:13 +0000 Subject: [PATCH 06/27] chore(release): Bumped to Version 15.43.0 # [15.43.0](https://github.com/frappe/erpnext/compare/v15.42.0...v15.43.0) (2024-11-20) ### Bug Fixes * added disable_rounded_total field ([c98a0cc](https://github.com/frappe/erpnext/commit/c98a0ccd1dc5007941544ca49e0c2ad68d050323)) * added test cases ([234741f](https://github.com/frappe/erpnext/commit/234741f35f6575e8f61d3a22d00774b203254f8a)) * apply posting date sorting to invoices in Payment Reconciliation similar to payments ([41c8cfa](https://github.com/frappe/erpnext/commit/41c8cfac733104c69c1f30b921c667031c146024)) * broken apply on other item pricing rule ([5d6451f](https://github.com/frappe/erpnext/commit/5d6451fca7de3a9deba0df0a8568dc98f8c1936f)) * broken UI on currency exchange ([f460391](https://github.com/frappe/erpnext/commit/f4603910e4d4c11ca7cc48d8a44af5a35c98395d)) * bulk update invoice remarks during site upgrade ([cc07402](https://github.com/frappe/erpnext/commit/cc07402b5e5f2acdb5d4626a38108799cdd09f68)), closes [#43634](https://github.com/frappe/erpnext/issues/43634) * check if pricing rule matches with coupon code ([#44104](https://github.com/frappe/erpnext/issues/44104)) ([6089661](https://github.com/frappe/erpnext/commit/608966158aa81a4e71d31afec019c8913f89926a)) * correctly set 'cannot_add_rows' property on allocations table field ([c59a778](https://github.com/frappe/erpnext/commit/c59a7785039cdedc62c3321706799a35892ee7b3)) * disable conversion to user tz for sales order calender ([83b9680](https://github.com/frappe/erpnext/commit/83b9680318700fab2f60f7f81f1e96125ad78f56)) * Get Entries not showing accounts with no gain or loss in Exchange Rate Revaluation issue ([1fe5342](https://github.com/frappe/erpnext/commit/1fe534290dcea0c689c48530b8a765c9111b71f6)) * linters ([381101f](https://github.com/frappe/erpnext/commit/381101f55235e2aa49e2b8229b4250eb3ea2474a)) * non group pos warehouse ([4335659](https://github.com/frappe/erpnext/commit/4335659905e3c430c221941a4657b9e60af36e60)) * payment reco for jv with negative dr or cr amount ([7483839](https://github.com/frappe/erpnext/commit/74838394183432a4aa2cf839e844aa1735727e35)) * remove trailing whitespace ([5bd633b](https://github.com/frappe/erpnext/commit/5bd633b40f86d46ebc3bce68e0dc65c88489d81e)) * remove validate_name_in_customer function ([6bff9d3](https://github.com/frappe/erpnext/commit/6bff9d39e312dc5a5f157def06cbfaa8b5a54fa6)) * set conversion factor before applying price list ([5848de7](https://github.com/frappe/erpnext/commit/5848de76ea3049cf3b25c88cc0a510f7712945c5)) * set debit in transaction currency in GL Entry ([c0d3f8c](https://github.com/frappe/erpnext/commit/c0d3f8cbbe347f7326b4acead396e28daec01fc0)) * set default party type in Payment Entry ([08f6cee](https://github.com/frappe/erpnext/commit/08f6ceeb5001d5e9159c7a9c0134467121298da0)) * **setup:** Fix typo in COA setup ([7abcfca](https://github.com/frappe/erpnext/commit/7abcfca1cb1ec5d71126f5e9c9fd93bb51f65f17)) * stock ledger variance report filter options (backport [#44137](https://github.com/frappe/erpnext/issues/44137)) ([#44150](https://github.com/frappe/erpnext/issues/44150)) ([b6fe1f5](https://github.com/frappe/erpnext/commit/b6fe1f5842671421de52e015c968d2740aaad79e)) * update project cost from timesheet (backport [#44211](https://github.com/frappe/erpnext/issues/44211)) ([#44212](https://github.com/frappe/erpnext/issues/44212)) ([ad0c655](https://github.com/frappe/erpnext/commit/ad0c65500a70c5dd13e245dd41037fdfa5ac34ea)) * validate sales team to ensure all sales person are enabled ([f3c3f17](https://github.com/frappe/erpnext/commit/f3c3f170a7d385aa971063d53de2650d6b3b6557)) * validation for serial no (backport [#44133](https://github.com/frappe/erpnext/issues/44133)) ([#44151](https://github.com/frappe/erpnext/issues/44151)) ([725d107](https://github.com/frappe/erpnext/commit/725d107288675867dd14571b84945f00d4def45e)) ### Features * inventory dimension for rejected materials (backport [#44156](https://github.com/frappe/erpnext/issues/44156)) ([#44165](https://github.com/frappe/erpnext/issues/44165)) ([d61f696](https://github.com/frappe/erpnext/commit/d61f696f85084bfec858a32c4d819f021e0a6bae)) * new DocTypes "Code List" and "Common Code" (backport [#43425](https://github.com/frappe/erpnext/issues/43425)) ([#44173](https://github.com/frappe/erpnext/issues/44173)) ([b130e20](https://github.com/frappe/erpnext/commit/b130e2065b5998ef42b754442fda9c5bf4cf60d9)) * round off for opening entries ([8e6249d](https://github.com/frappe/erpnext/commit/8e6249d361bb36a4fd1ef0cfa7333265bb8933d5)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 83fb70c9e8f..3ab0bf95207 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.42.0" +__version__ = "15.43.0" def get_default_company(user=None): From b047425a6f9d3d3827226acce488f87e413c2aad Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:51:33 +0530 Subject: [PATCH 07/27] fix: no permission to read Doctype (backport #44256) (#44258) fix: no permission to read Doctype (#44256) (cherry picked from commit 57293aa18a2d34b66b35dc346ec84c259c6d6c11) Co-authored-by: rohitwaghchaure (cherry picked from commit 8b15a965dd0ffea82c1d55a2893a79cf1fd243bb) --- .../report/serial_and_batch_summary/serial_and_batch_summary.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/stock/report/serial_and_batch_summary/serial_and_batch_summary.py b/erpnext/stock/report/serial_and_batch_summary/serial_and_batch_summary.py index 15d9a12bc65..486828af1cc 100644 --- a/erpnext/stock/report/serial_and_batch_summary/serial_and_batch_summary.py +++ b/erpnext/stock/report/serial_and_batch_summary/serial_and_batch_summary.py @@ -106,8 +106,6 @@ def get_columns(filters, data): { "label": _("Voucher Type"), "fieldname": "voucher_type", - "fieldtype": "Link", - "options": "DocType", "width": 120, }, { From e0060f8ffea85a694c782cfb14da9c0d6f5ab7bb Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 21 Nov 2024 09:44:42 +0000 Subject: [PATCH 08/27] chore(release): Bumped to Version 15.43.1 ## [15.43.1](https://github.com/frappe/erpnext/compare/v15.43.0...v15.43.1) (2024-11-21) ### Bug Fixes * no permission to read Doctype (backport [#44256](https://github.com/frappe/erpnext/issues/44256)) ([#44258](https://github.com/frappe/erpnext/issues/44258)) ([b047425](https://github.com/frappe/erpnext/commit/b047425a6f9d3d3827226acce488f87e413c2aad)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 3ab0bf95207..b2c3e75f87c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.43.0" +__version__ = "15.43.1" def get_default_company(user=None): From 52e1551c234b03d7fc4f7da65761ea4c1c2a2ed0 Mon Sep 17 00:00:00 2001 From: venkat102 Date: Mon, 18 Nov 2024 15:42:01 +0530 Subject: [PATCH 09/27] fix: include current invoice amount when tax_on_excess_amount is checked (cherry picked from commit b74f2896cdfc0571d352930d5d84737d0211cff3) --- .../tax_withholding_category/tax_withholding_category.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py index 46a0916c79f..69c7eb1153c 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -568,7 +568,7 @@ def get_tds_amount(ldc, parties, inv, tax_details, vouchers): if (cumulative_threshold and supp_credit_amt >= cumulative_threshold) and cint( tax_details.tax_on_excess_amount ): - supp_credit_amt = net_total - cumulative_threshold + supp_credit_amt = net_total + tax_withholding_net_total - cumulative_threshold if ldc and is_valid_certificate(ldc, inv.get("posting_date") or inv.get("transaction_date"), 0): tds_amount = get_lower_deduction_amount( From 2d284de4264b708c569ab2739f5ec5b06e87ebaa Mon Sep 17 00:00:00 2001 From: venkat102 Date: Mon, 18 Nov 2024 15:48:39 +0530 Subject: [PATCH 10/27] test: add unit test for tax on excess amount (cherry picked from commit 4820273595be0f49f021685931f34972c39f1f70) --- .../test_tax_withholding_category.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 2b7ae5fd689..f9f34380d55 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -167,6 +167,45 @@ class TestTaxWithholdingCategory(FrappeTestCase): for d in reversed(invoices): d.cancel() + def test_cumulative_threshold_with_tax_on_excess_amount(self): + invoices = [] + frappe.db.set_value("Supplier", "Test TDS Supplier3", "tax_withholding_category", "New TDS Category") + + # Invoice with tax and without exceeding single and cumulative thresholds + for _ in range(2): + pi = create_purchase_invoice(supplier="Test TDS Supplier3", rate=10000, do_not_save=True) + pi.apply_tds = 1 + pi.append( + "taxes", + { + "category": "Total", + "charge_type": "Actual", + "account_head": "_Test Account VAT - _TC", + "cost_center": "Main - _TC", + "tax_amount": 500, + "description": "Test", + "add_deduct_tax": "Add", + }, + ) + pi.save() + pi.submit() + invoices.append(pi) + + # Third Invoice exceeds single threshold and not exceeding cumulative threshold + pi1 = create_purchase_invoice(supplier="Test TDS Supplier3", rate=20000) + pi1.apply_tds = 1 + pi1.save() + pi1.submit() + invoices.append(pi1) + + # Cumulative threshold is 10,000 + # Threshold calculation should be only on the third invoice + self.assertTrue(len(pi1.taxes) > 0) + self.assertEqual(pi1.taxes[0].tax_amount, 1000) + + for d in reversed(invoices): + d.cancel() + def test_cumulative_threshold_tcs(self): frappe.db.set_value( "Customer", "Test TCS Customer", "tax_withholding_category", "Cumulative Threshold TCS" From 81f1f1f1bbc7c8947776981873dd8b8794aa4d1b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 22 Nov 2024 06:00:44 +0000 Subject: [PATCH 11/27] chore(release): Bumped to Version 15.43.2 ## [15.43.2](https://github.com/frappe/erpnext/compare/v15.43.1...v15.43.2) (2024-11-22) ### Bug Fixes * include current invoice amount when tax_on_excess_amount is checked ([52e1551](https://github.com/frappe/erpnext/commit/52e1551c234b03d7fc4f7da65761ea4c1c2a2ed0)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b2c3e75f87c..9c78c0a1e2c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.43.1" +__version__ = "15.43.2" def get_default_company(user=None): From 5f752e29f9e07300c21a63c69024befb837da1fc Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 18 Nov 2024 17:59:55 +0530 Subject: [PATCH 12/27] fix: patch (#44191) (cherry picked from commit 495528a758019ae2ba51d44649227c4d9cb889af) (cherry picked from commit 8b02402f6295296e9465d813996c90e08ffa889e) --- .../patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py b/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py index c0d715063a8..2441075de30 100644 --- a/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py +++ b/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py @@ -38,7 +38,7 @@ def execute(): data = frappe.db.sql( """ SELECT - name, item_code, warehouse, voucher_type, voucher_no, posting_date, posting_time, company + name, item_code, warehouse, voucher_type, voucher_no, posting_date, posting_time, company, creation FROM `tabStock Ledger Entry` WHERE @@ -67,6 +67,7 @@ def execute(): "voucher_type": d.voucher_type, "voucher_no": d.voucher_no, "sle_id": d.name, + "creation": d.creation, }, allow_negative_stock=True, ) From 17e00b397f3761e3d937d06cf1e05f927da123d1 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 22 Nov 2024 09:19:30 +0000 Subject: [PATCH 13/27] chore(release): Bumped to Version 15.43.3 ## [15.43.3](https://github.com/frappe/erpnext/compare/v15.43.2...v15.43.3) (2024-11-22) ### Bug Fixes * patch ([#44191](https://github.com/frappe/erpnext/issues/44191)) ([5f752e2](https://github.com/frappe/erpnext/commit/5f752e29f9e07300c21a63c69024befb837da1fc)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 9c78c0a1e2c..babb8246bdb 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.43.2" +__version__ = "15.43.3" def get_default_company(user=None): From 294ded20300f2aa3b08bf9bd8e59a20397b68235 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 27 Nov 2024 16:01:32 +0000 Subject: [PATCH 14/27] chore(release): Bumped to Version 15.44.0 # [15.44.0](https://github.com/frappe/erpnext/compare/v15.43.3...v15.44.0) (2024-11-27) ### Bug Fixes * correct placeholder index in message ([a523c14](https://github.com/frappe/erpnext/commit/a523c14fd574f3e22d90aef3b73d98f7953625d4)) * add company dynamic filters in number cards ([db21def](https://github.com/frappe/erpnext/commit/db21def58b21938dd3b2fc51fd0d432a97202665)) * added Stock UOM field for RM in work order (backport [#44185](https://github.com/frappe/erpnext/issues/44185)) ([#44237](https://github.com/frappe/erpnext/issues/44237)) ([d4f0512](https://github.com/frappe/erpnext/commit/d4f0512a10550914b2aad1795fe8692658aab67a)) * added validation for quality inspection (backport [#44351](https://github.com/frappe/erpnext/issues/44351)) ([#44357](https://github.com/frappe/erpnext/issues/44357)) ([89bd4eb](https://github.com/frappe/erpnext/commit/89bd4eba46894efba5cfe9bc3411448d41366807)) * billed qty and received amount in PO analysis report (backport [#44349](https://github.com/frappe/erpnext/issues/44349)) ([#44354](https://github.com/frappe/erpnext/issues/44354)) ([ea0f24a](https://github.com/frappe/erpnext/commit/ea0f24aa573e66d289be4af567405e072eb73968)) * check difference with company currency ([d6ef438](https://github.com/frappe/erpnext/commit/d6ef43858cee5b3a05a306588c258eb1d41b7031)) * filter item with search fields ([d073b00](https://github.com/frappe/erpnext/commit/d073b005a8579e48266d1265ccf542f625ac595b)) * filter with item group only if it is mentioned in pos profile ([a439862](https://github.com/frappe/erpnext/commit/a4398626f66bae98b520d75f72e9d00222789174)) * Get submitted documents in validate_for_closed_fiscal_year ([af74a3c](https://github.com/frappe/erpnext/commit/af74a3c32fb5ec83439ed3417706aa3d1a0deefd)) * gp for return invoice ([f4518ca](https://github.com/frappe/erpnext/commit/f4518cac9a3ae9b4a018b24f3ea29ec525e2236a)) * include current invoice amount when tax_on_excess_amount is checked ([0ffeb9f](https://github.com/frappe/erpnext/commit/0ffeb9f6adbc581ecc9a0403c2680079213f9d93)) * Increase quantity by `1 UOM` when adding an item from the selector in POS ([0d38028](https://github.com/frappe/erpnext/commit/0d3802873b62dae8c346a9e256ebaa04050acff6)) * initially closing amt should be equal to expected amt ([3f57777](https://github.com/frappe/erpnext/commit/3f577779be3c8a2140ffb24947252c15b848a008)) * make free qty round on large transaction qty ([4856a96](https://github.com/frappe/erpnext/commit/4856a9633e2e6cd46cf001799f01c7d290514b6a)) * no permission to read Doctype (backport [#44256](https://github.com/frappe/erpnext/issues/44256)) ([#44258](https://github.com/frappe/erpnext/issues/44258)) ([8b15a96](https://github.com/frappe/erpnext/commit/8b15a965dd0ffea82c1d55a2893a79cf1fd243bb)) * not able to fetch batch item price ([97f2341](https://github.com/frappe/erpnext/commit/97f2341b98ea0cdb84cbf7dbaebdd32b208824b6)) * patch ([#44191](https://github.com/frappe/erpnext/issues/44191)) ([8b02402](https://github.com/frappe/erpnext/commit/8b02402f6295296e9465d813996c90e08ffa889e)) * reduce paid amount from grand total ([d0d97c2](https://github.com/frappe/erpnext/commit/d0d97c26a05ab961f88ece2609698ff37f3a5273)) * remove field precision in SO and PO for percentage fields ([860350a](https://github.com/frappe/erpnext/commit/860350a5b329a49d078f70f22c38a0a1a4ca2032)) * remove irrelavent filters ([7423d7d](https://github.com/frappe/erpnext/commit/7423d7d3372aecb0b6003e67313322061bdea673)) * set debit transaction currency in gl entry ([a2612d5](https://github.com/frappe/erpnext/commit/a2612d5f36eaeee10231b27b5c4bfea2c79208da)) * set outstanding amount while creating payment request for invoices ([8d8027d](https://github.com/frappe/erpnext/commit/8d8027d4233f9181a34ee00b33ff15da2cae2da4)) * set price_list_currency only if it exists ([8cd455b](https://github.com/frappe/erpnext/commit/8cd455b050c9687bc1c5cb91dd6360035cea4f30)) * Show available stock qty in `stock_uom` instead of `uom` ([49dad1a](https://github.com/frappe/erpnext/commit/49dad1a456bd22d154deafbfc5b27930721b2240)) * show cc on the email ([67809c7](https://github.com/frappe/erpnext/commit/67809c781a9088b381c51c0c997737e47a8c14df)) * test case ([66af7f4](https://github.com/frappe/erpnext/commit/66af7f4a14e58029f80aa87b62a056c04be60969)) * toggle debit credit amounts for transaction currency too; minor refactor ([7f8334f](https://github.com/frappe/erpnext/commit/7f8334f29a83a6e85fe32dcc9a2247c90046acee)) * unify company address query in sales transactions (backport [#44361](https://github.com/frappe/erpnext/issues/44361)) ([#44365](https://github.com/frappe/erpnext/issues/44365)) ([7e61aca](https://github.com/frappe/erpnext/commit/7e61aca512c18adca6f8eb5b2300287898e8f3e4)) * update gross profit for returned invoices ([ca56709](https://github.com/frappe/erpnext/commit/ca56709295002f86c0b936a75ed250415784ea06)) * use field precision instead of hardcoded precision in so and po ([cde1906](https://github.com/frappe/erpnext/commit/cde19066fe6b42aca5cae6971805973ac18a01dd)) ### Features * available qty at company in sales transactions (backport [#44260](https://github.com/frappe/erpnext/issues/44260)) ([#44325](https://github.com/frappe/erpnext/issues/44325)) ([20d0e95](https://github.com/frappe/erpnext/commit/20d0e95d7c3de85e0a0364dd9e7954f3aa6dbeee)) * provision to disable item attribute (backport [#44358](https://github.com/frappe/erpnext/issues/44358)) ([#44370](https://github.com/frappe/erpnext/issues/44370)) ([ef882de](https://github.com/frappe/erpnext/commit/ef882de509b43c5e7ef1cfd2e08f942df18df17b)) * Show Aggregate Value from Subsidiary Companies ([0469b0d](https://github.com/frappe/erpnext/commit/0469b0d1ecca4b5d13232d3ba5a7f4275a582da4)) ### Reverts * use `+ flt(value)` instead of direct increment ([b65e16a](https://github.com/frappe/erpnext/commit/b65e16a91b71ca7e674c04d08c2a01a8a0fb1079)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index babb8246bdb..82b86724482 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.43.3" +__version__ = "15.44.0" def get_default_company(user=None): From 1d158d58f62087691b8c0f5673f18f9bb21a5e7c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 4 Dec 2024 04:38:06 +0000 Subject: [PATCH 15/27] chore(release): Bumped to Version 15.45.0 # [15.45.0](https://github.com/frappe/erpnext/compare/v15.44.0...v15.45.0) (2024-12-04) ### Bug Fixes * Add filter for `outstanding_amount` to fetch open PRs ([5999a8e](https://github.com/frappe/erpnext/commit/5999a8e24f908dc84bce88969bdb192c03c2cd08)) * Add translation for showing mandatory fields in error msg ([0e1f5ff](https://github.com/frappe/erpnext/commit/0e1f5ff391b7a6f277149e5a14203f4cde7fac6c)) * added fieldname to avoid fieldname to translate ([17c2734](https://github.com/frappe/erpnext/commit/17c2734042ed0ed2f226ff2adb1ef70dfd63cfd9)) * Added translation for `Account` column ([eb4a485](https://github.com/frappe/erpnext/commit/eb4a485df6e0953c1552549ffda74caea644ed60)) * adjusted incoming rate for zero rated item in purchase receipt ([435280d](https://github.com/frappe/erpnext/commit/435280d626e542f64e7265733f6dd478339ffcc5)) * always set sales incoming rate for internal transfers ([05795af](https://github.com/frappe/erpnext/commit/05795af4716990fb4e3c104dbf4a6721fb7f7afa)) * calculate submitted payment entry as paid amount ([ebdacc0](https://github.com/frappe/erpnext/commit/ebdacc094c47aa334282b5f75cc194e6c25d48ad)) * correct buying amount for product bundel ([f165e17](https://github.com/frappe/erpnext/commit/f165e1732b2160cf6cc65ca52ee2ce0d2a833667)) * Dashboard for `Payment Request` ([0d67c62](https://github.com/frappe/erpnext/commit/0d67c62f43758d453bc59ea0595046f48afa78ab)) * Data Should be Computed in Backend to Maintain Consistent Behaviour ([#44195](https://github.com/frappe/erpnext/issues/44195)) ([8ab9fc7](https://github.com/frappe/erpnext/commit/8ab9fc7f55b7759033f540cd275630a30ace8e5b)) * do not validate stock during inward (backport [#44417](https://github.com/frappe/erpnext/issues/44417)) ([#44427](https://github.com/frappe/erpnext/issues/44427)) ([e607795](https://github.com/frappe/erpnext/commit/e607795baed7544bcaedac031ed595b3a34eec4d)) * handle multi currency in common party journal entry ([c8e2c9a](https://github.com/frappe/erpnext/commit/c8e2c9aa2535b35a9c2a803762ef26a55ef804e2)) * incorrect Gross Margin on project (backport [#44461](https://github.com/frappe/erpnext/issues/44461)) ([#44468](https://github.com/frappe/erpnext/issues/44468)) ([0a9c92f](https://github.com/frappe/erpnext/commit/0a9c92fce940ed74dbd1b22ecfbebfc6612ba61a)) * IndexError in Asset Depreciation Ledger when query result is empty ([c3bc724](https://github.com/frappe/erpnext/commit/c3bc724523aab30585554e24f7e3907ae48f6ea2)) * link cash flow rows and fix summary linking ([633be8d](https://github.com/frappe/erpnext/commit/633be8d06bcbba0a7b08ba3e9172f67a7562343b)) * move validate_total_debit_and_credit from validate to on_submit in Journal Entry ([63de576](https://github.com/frappe/erpnext/commit/63de576be61ec2ec30c79cec055b4c8afa2dfd07)) * number format in the message (backport [#44435](https://github.com/frappe/erpnext/issues/44435)) ([#44438](https://github.com/frappe/erpnext/issues/44438)) ([579d8e2](https://github.com/frappe/erpnext/commit/579d8e293eb898b0bae0da31ca53b8aa46955884)) * precision calculation causing 0.1 discrepancy (backport [#44431](https://github.com/frappe/erpnext/issues/44431)) ([#44436](https://github.com/frappe/erpnext/issues/44436)) ([0d41c23](https://github.com/frappe/erpnext/commit/0d41c23383961a332802de46c2919981e8250a3c)) * remove queries ([ea57f2b](https://github.com/frappe/erpnext/commit/ea57f2b2921f5fb6b06a0be1bac0cac4ddaf248a)) * SABB print for packed items (backport [#44413](https://github.com/frappe/erpnext/issues/44413)) ([#44428](https://github.com/frappe/erpnext/issues/44428)) ([0e39aa3](https://github.com/frappe/erpnext/commit/0e39aa349eda503339299acae94009c6e54b54cb)) * set correct unallocated amount in Payment Entry ([#43958](https://github.com/frappe/erpnext/issues/43958)) ([ae93f7f](https://github.com/frappe/erpnext/commit/ae93f7f967e2b4da1c76552a794bce118827b57f)) * show "Send SMS" only when enabled (backport [#43941](https://github.com/frappe/erpnext/issues/43941)) ([#43970](https://github.com/frappe/erpnext/issues/43970)) ([0fbc60a](https://github.com/frappe/erpnext/commit/0fbc60a20e0958d93c935446f0271d9ee626ecb5)) * source warehouse not set in required items of WO (backport [#44426](https://github.com/frappe/erpnext/issues/44426)) ([#44434](https://github.com/frappe/erpnext/issues/44434)) ([c81b5e3](https://github.com/frappe/erpnext/commit/c81b5e3d9cb8acb6d15b294bb0545f713ba5748d)) * Translate `Party Account` column label ([fdda864](https://github.com/frappe/erpnext/commit/fdda86455a93a25bb2216893da69cc8efe9a07d2)) * typeerror on transaction.js ([173d60f](https://github.com/frappe/erpnext/commit/173d60fb7d9aaab62e7bcd7e1e6ae5ec5f261518)) ### Features * add Company Contact Person in selling transactions (backport [#44362](https://github.com/frappe/erpnext/issues/44362)) ([#44398](https://github.com/frappe/erpnext/issues/44398)) ([70b5b08](https://github.com/frappe/erpnext/commit/70b5b08d588ea4e9132f2ab51846a16d4da04241)) * **Dunning:** separate tab "Address & Contact" ([#44363](https://github.com/frappe/erpnext/issues/44363)) ([e0cb5f9](https://github.com/frappe/erpnext/commit/e0cb5f9ba8dc8a5b23af958b5c988b3499ed4853)) ### Performance Improvements * cache product bundle items at document level ([#44440](https://github.com/frappe/erpnext/issues/44440)) ([1f97979](https://github.com/frappe/erpnext/commit/1f9797905973ef8adc74867adc3a1f052cf5e83b)) * reduce queries during transaction save ([48059a7](https://github.com/frappe/erpnext/commit/48059a7c74422fa2c462aabb041fb642b01a9ae2)) ### Reverts * remove default `Payment Request` indicator color ([9c4b581](https://github.com/frappe/erpnext/commit/9c4b5814a65b9bed086326aa11538f5a9db99938)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 82b86724482..faee116955b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.44.0" +__version__ = "15.45.0" def get_default_company(user=None): From 3c50cfef4e432f039979f8d389a240b95da39e09 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:01:04 +0530 Subject: [PATCH 16/27] fix: variant qty while making work order from BOM (backport #44548) (#44551) fix: variant qty while making work order from BOM (#44548) (cherry picked from commit 1571dff3ef4c89c91e155967c0a187e8f855fe28) Co-authored-by: rohitwaghchaure (cherry picked from commit 63b1df38a81877168ea71047c9b29db144c4d8a9) --- erpnext/manufacturing/doctype/bom/bom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 6267ee4d029..5cfd170ab13 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -364,7 +364,7 @@ frappe.ui.form.on("BOM", { dialog.fields_dict.items.df.data.push({ item_code: d.item_code, variant_item_code: "", - qty: d.qty, + qty: (d.qty / frm.doc.quantity) * (dialog.fields_dict.qty.value || 1), source_warehouse: d.source_warehouse, operation: d.operation, }); From 27b63beb18c4a67a8043d8cfd5c0635427b47cec Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:50:49 +0530 Subject: [PATCH 17/27] fix: BOM name issue (backport #44575) (#44579) fix: BOM name issue (#44575) fix: bom name issue (cherry picked from commit b7a3c6b6ca902138007daff2343abe14f91157f7) Co-authored-by: rohitwaghchaure (cherry picked from commit 03ae9e27be5acca32d3e15f8434a3f6062dc8c30) --- erpnext/manufacturing/doctype/bom/bom.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index c3105b8e9ec..f8523c88933 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -176,9 +176,14 @@ class BOM(WebsiteGenerator): search_key = f"{self.doctype}-{self.item}%" existing_boms = frappe.get_all( - "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" + "BOM", filters={"name": search_key, "amended_from": ["is", "not set"]}, pluck="name" ) + if not existing_boms: + existing_boms = frappe.get_all( + "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" + ) + if existing_boms: index = self.get_next_version_index(existing_boms) else: From 2a2d8da6286f0db21f2c9498f5eda730a86edb5a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 22:35:37 +0530 Subject: [PATCH 18/27] fix: BOM for variant items (backport #44580) (#44584) fix: BOM for variant items (#44580) (cherry picked from commit 93e9517f5d6b023cba91d93cb77340691dd24ac0) Co-authored-by: rohitwaghchaure (cherry picked from commit 0b268279cfbe720917bd73ff952771e1eaae05b4) --- erpnext/manufacturing/doctype/bom/bom.js | 56 ++++++++++++------- .../doctype/work_order/work_order.py | 18 +++++- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 6267ee4d029..63c114970ea 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -182,25 +182,30 @@ frappe.ui.form.on("BOM", { }, make_work_order(frm) { - frm.events.setup_variant_prompt(frm, "Work Order", (frm, item, data, variant_items) => { - frappe.call({ - method: "erpnext.manufacturing.doctype.work_order.work_order.make_work_order", - args: { - bom_no: frm.doc.name, - item: item, - qty: data.qty || 0.0, - project: frm.doc.project, - variant_items: variant_items, - }, - freeze: true, - callback(r) { - if (r.message) { - let doc = frappe.model.sync(r.message)[0]; - frappe.set_route("Form", doc.doctype, doc.name); - } - }, - }); - }); + frm.events.setup_variant_prompt( + frm, + "Work Order", + (frm, item, data, variant_items, use_multi_level_bom) => { + frappe.call({ + method: "erpnext.manufacturing.doctype.work_order.work_order.make_work_order", + args: { + bom_no: frm.doc.name, + item: item, + qty: data.qty || 0.0, + project: frm.doc.project, + variant_items: variant_items, + use_multi_level_bom: use_multi_level_bom, + }, + freeze: true, + callback(r) { + if (r.message) { + let doc = frappe.model.sync(r.message)[0]; + frappe.set_route("Form", doc.doctype, doc.name); + } + }, + }); + } + ); }, make_variant_bom(frm) { @@ -248,6 +253,13 @@ frappe.ui.form.on("BOM", { }; }, }); + + fields.push({ + fieldtype: "Check", + label: __("Use Multi-Level BOM"), + fieldname: "use_multi_level_bom", + default: 1, + }); } if (!skip_qty_field) { @@ -285,6 +297,7 @@ frappe.ui.form.on("BOM", { fieldname: "items", fieldtype: "Table", label: __("Raw Materials"), + depends_on: "eval:!doc.use_multi_level_bom", fields: [ { fieldname: "item_code", @@ -347,14 +360,15 @@ frappe.ui.form.on("BOM", { (data) => { let item = data.item || frm.doc.item; let variant_items = data.items || []; + let use_multi_level_bom = data.use_multi_level_bom || 0; variant_items.forEach((d) => { - if (!d.variant_item_code) { + if (!d.variant_item_code && !use_multi_level_bom) { frappe.throw(__("Select variant item code for the template item {0}", [d.item_code])); } }); - callback(frm, item, data, variant_items); + callback(frm, item, data, variant_items, use_multi_level_bom); }, __(title), __("Create") diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 1d0df26800d..e5219d7cb3e 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -1299,7 +1299,7 @@ def get_item_details(item, project=None, skip_bom_info=False, throw=True): @frappe.whitelist() -def make_work_order(bom_no, item, qty=0, project=None, variant_items=None): +def make_work_order(bom_no, item, qty=0, project=None, variant_items=None, use_multi_level_bom=None): if not frappe.has_permission("Work Order", "write"): frappe.throw(_("Not permitted"), frappe.PermissionError) @@ -1309,12 +1309,13 @@ def make_work_order(bom_no, item, qty=0, project=None, variant_items=None): wo_doc.production_item = item wo_doc.update(item_details) wo_doc.bom_no = bom_no + wo_doc.use_multi_level_bom = cint(use_multi_level_bom) if flt(qty) > 0: wo_doc.qty = flt(qty) wo_doc.get_items_and_operations_from_bom() - if variant_items: + if variant_items and not wo_doc.use_multi_level_bom: add_variant_item(variant_items, wo_doc, bom_no, "required_items") return wo_doc @@ -1358,7 +1359,18 @@ def add_variant_item(variant_items, wo_doc, bom_no, table_name="items"): args["amount"] = flt(args.get("required_qty")) * flt(args.get("rate")) args["uom"] = item_data.stock_uom - wo_doc.append(table_name, args) + + existing_row = get_template_rm_item(wo_doc, item.get("item_code")) + if existing_row: + existing_row.update(args) + else: + wo_doc.append(table_name, args) + + +def get_template_rm_item(wo_doc, item_code): + for row in wo_doc.required_items: + if row.item_code == item_code: + return row @frappe.whitelist() From 408a09233bfae90082a06ab21cf38ceaf7a9c7cb Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:58:34 +0530 Subject: [PATCH 19/27] fix: BOM name issue (backport #44586) (#44589) fix: BOM name issue (#44586) (cherry picked from commit d871e21a40943b3e9d52e2dd7233a128fa0f0ff6) Co-authored-by: rohitwaghchaure (cherry picked from commit a5cc30741703857556efe0f201a7bb91231eee0b) # Conflicts: # erpnext/manufacturing/doctype/bom/bom.py --- erpnext/manufacturing/doctype/bom/bom.js | 7 ++++++ erpnext/manufacturing/doctype/bom/bom.py | 28 ++++++++++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 6267ee4d029..92e4715590b 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -250,6 +250,13 @@ frappe.ui.form.on("BOM", { }); } + fields.push({ + fieldtype: "Check", + label: __("Use Multi-Level BOM"), + fieldname: "use_multi_level_bom", + default: 1, + }); + if (!skip_qty_field) { fields.push({ fieldtype: "Float", diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index c3105b8e9ec..41ea6f80f10 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -179,10 +179,14 @@ class BOM(WebsiteGenerator): "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" ) +<<<<<<< HEAD if existing_boms: index = self.get_next_version_index(existing_boms) else: index = 1 +======= + index = self.get_index_for_bom(existing_boms) +>>>>>>> a5cc307417 (fix: BOM name issue (backport #44586) (#44589)) prefix = self.doctype suffix = "%.3i" % index # convert index to string (1 -> "001") @@ -200,21 +204,23 @@ class BOM(WebsiteGenerator): name = f"{prefix}-{truncated_item_name}-{suffix}" if frappe.db.exists("BOM", name): - conflicting_bom = frappe.get_doc("BOM", name) + existing_boms = frappe.get_all( + "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" + ) - if conflicting_bom.item != self.item: - msg = _("A BOM with name {0} already exists for item {1}.").format( - frappe.bold(name), frappe.bold(conflicting_bom.item) - ) - - frappe.throw( - _("{0}{1} Did you rename the item? Please contact Administrator / Tech support").format( - msg, "
" - ) - ) + index = self.get_index_for_bom(existing_boms) + suffix = "%.3i" % index + name = f"{prefix}-{self.item}-{suffix}" self.name = name + def get_index_for_bom(self, existing_boms): + index = 1 + if existing_boms: + index = self.get_next_version_index(existing_boms) + + return index + @staticmethod def get_next_version_index(existing_boms: list[str]) -> int: # split by "/" and "-" From 3b57767d367ac4b54042b0ff73c038395f223520 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sat, 7 Dec 2024 07:35:56 +0000 Subject: [PATCH 20/27] chore(release): Bumped to Version 15.45.1 ## [15.45.1](https://github.com/frappe/erpnext/compare/v15.45.0...v15.45.1) (2024-12-07) ### Bug Fixes * BOM for variant items (backport [#44580](https://github.com/frappe/erpnext/issues/44580)) ([#44584](https://github.com/frappe/erpnext/issues/44584)) ([2a2d8da](https://github.com/frappe/erpnext/commit/2a2d8da6286f0db21f2c9498f5eda730a86edb5a)) * BOM name issue (backport [#44575](https://github.com/frappe/erpnext/issues/44575)) ([#44579](https://github.com/frappe/erpnext/issues/44579)) ([27b63be](https://github.com/frappe/erpnext/commit/27b63beb18c4a67a8043d8cfd5c0635427b47cec)) * variant qty while making work order from BOM (backport [#44548](https://github.com/frappe/erpnext/issues/44548)) ([#44551](https://github.com/frappe/erpnext/issues/44551)) ([3c50cfe](https://github.com/frappe/erpnext/commit/3c50cfef4e432f039979f8d389a240b95da39e09)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index faee116955b..c0a4cea763c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.45.0" +__version__ = "15.45.1" def get_default_company(user=None): From a204abcaa59f0502110536fa1cb9e8268dde7b1b Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Sat, 7 Dec 2024 13:10:40 +0530 Subject: [PATCH 21/27] chore: fix conflicts --- erpnext/manufacturing/doctype/bom/bom.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 41ea6f80f10..480a98f8916 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -179,14 +179,7 @@ class BOM(WebsiteGenerator): "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" ) -<<<<<<< HEAD - if existing_boms: - index = self.get_next_version_index(existing_boms) - else: - index = 1 -======= index = self.get_index_for_bom(existing_boms) ->>>>>>> a5cc307417 (fix: BOM name issue (backport #44586) (#44589)) prefix = self.doctype suffix = "%.3i" % index # convert index to string (1 -> "001") From 0cd495a128015d14add5a66c619d6880af5dd465 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sat, 7 Dec 2024 08:18:12 +0000 Subject: [PATCH 22/27] chore(release): Bumped to Version 15.45.2 ## [15.45.2](https://github.com/frappe/erpnext/compare/v15.45.1...v15.45.2) (2024-12-07) ### Bug Fixes * BOM name issue (backport [#44586](https://github.com/frappe/erpnext/issues/44586)) ([#44589](https://github.com/frappe/erpnext/issues/44589)) ([408a092](https://github.com/frappe/erpnext/commit/408a09233bfae90082a06ab21cf38ceaf7a9c7cb)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c0a4cea763c..6eedda1f463 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.45.1" +__version__ = "15.45.2" def get_default_company(user=None): From 11fc560a88a66308d927c104d87c28ae5226a7ad Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sun, 8 Dec 2024 14:44:19 +0530 Subject: [PATCH 23/27] fix: duplicate buttons --- erpnext/manufacturing/doctype/bom/bom.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 9d862e0bbdf..36ada87111a 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -253,13 +253,6 @@ frappe.ui.form.on("BOM", { }; }, }); - - fields.push({ - fieldtype: "Check", - label: __("Use Multi-Level BOM"), - fieldname: "use_multi_level_bom", - default: 1, - }); } fields.push({ From 6f80af0355ef1b26434b111e122b523487dd57c7 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sun, 8 Dec 2024 09:23:09 +0000 Subject: [PATCH 24/27] chore(release): Bumped to Version 15.45.3 ## [15.45.3](https://github.com/frappe/erpnext/compare/v15.45.2...v15.45.3) (2024-12-08) ### Bug Fixes * duplicate buttons ([11fc560](https://github.com/frappe/erpnext/commit/11fc560a88a66308d927c104d87c28ae5226a7ad)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 6eedda1f463..cf0568e6cc6 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.45.2" +__version__ = "15.45.3" def get_default_company(user=None): From 971e474640de208d023d3a69979613395cb9d387 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 16:06:41 +0530 Subject: [PATCH 25/27] fix: BOM has not attr required items (backport #44598) (#44600) fix: BOM has not attr required items (#44598) (cherry picked from commit 42d238da1425b5c8a72308c2522a9336d4ea89fb) Co-authored-by: rohitwaghchaure (cherry picked from commit 608eaaa482507cd5724e4b05ee0dc99e0b6f5004) --- erpnext/manufacturing/doctype/bom/bom.js | 28 +++++++++++++++---- .../doctype/work_order/work_order.py | 4 ++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 36ada87111a..3a0bcf6b47e 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -255,12 +255,14 @@ frappe.ui.form.on("BOM", { }); } - fields.push({ - fieldtype: "Check", - label: __("Use Multi-Level BOM"), - fieldname: "use_multi_level_bom", - default: 1, - }); + if (!skip_qty_field) { + fields.push({ + fieldtype: "Check", + label: __("Use Multi-Level BOM"), + fieldname: "use_multi_level_bom", + default: 1, + }); + } if (!skip_qty_field) { fields.push({ @@ -306,6 +308,13 @@ frappe.ui.form.on("BOM", { fieldtype: "Link", in_list_view: 1, reqd: 1, + get_query() { + return { + filters: { + has_variants: 1, + }, + }; + }, }, { fieldname: "variant_item_code", @@ -326,6 +335,13 @@ frappe.ui.form.on("BOM", { }, }; }, + change() { + let doc = this.doc; + if (!doc.qty) { + doc.qty = 1.0; + this.grid.set_value("qty", 1.0, doc); + } + }, }, { fieldname: "qty", diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index e5219d7cb3e..9af3403ffa3 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -1360,7 +1360,9 @@ def add_variant_item(variant_items, wo_doc, bom_no, table_name="items"): args["amount"] = flt(args.get("required_qty")) * flt(args.get("rate")) args["uom"] = item_data.stock_uom - existing_row = get_template_rm_item(wo_doc, item.get("item_code")) + existing_row = ( + get_template_rm_item(wo_doc, item.get("item_code")) if table_name == "required_items" else None + ) if existing_row: existing_row.update(args) else: From 3c8abe41e799043db43cfcad7d9c49439521ccbc Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sun, 8 Dec 2024 11:01:12 +0000 Subject: [PATCH 26/27] chore(release): Bumped to Version 15.45.4 ## [15.45.4](https://github.com/frappe/erpnext/compare/v15.45.3...v15.45.4) (2024-12-08) ### Bug Fixes * BOM has not attr required items (backport [#44598](https://github.com/frappe/erpnext/issues/44598)) ([#44600](https://github.com/frappe/erpnext/issues/44600)) ([971e474](https://github.com/frappe/erpnext/commit/971e474640de208d023d3a69979613395cb9d387)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index cf0568e6cc6..bb8bf11b7ea 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.45.3" +__version__ = "15.45.4" def get_default_company(user=None): From 815c6b423497f59d0bafa58483ca6b63b432a56b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:57:09 +0530 Subject: [PATCH 27/27] chore: Ignore stock validation for non stock invoices (backport #44549) (#44554) chore: Ignore stock validation for non stock invoices (#44549) * chore: Ignore stock validation for non stock invoices * chore: Ignore stock validation for non stock invoices (cherry picked from commit 1ac292285e217c77d2c9f9ce37e4c018c2f5e849) Co-authored-by: Deepesh Garg (cherry picked from commit 06ac21dd856a5b6ecfb37ccf20c3d83fa4d79c05) --- erpnext/controllers/sales_and_purchase_return.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index 7f9a5a35a73..696d404d16d 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -24,6 +24,10 @@ def validate_return(doc): if doc.return_against: validate_return_against(doc) + + if doc.doctype in ("Sales Invoice", "Purchase Invoice") and not doc.update_stock: + return + validate_returned_items(doc)