From 310e7c522c3462de84415ea0c0825202819c7020 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 31 Oct 2022 23:21:29 +0530 Subject: [PATCH 01/14] fix: group warehouse filter not working for Batch-wise Balance history report --- .../batch_wise_balance_history.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 8a13300dc83..949452d43ba 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -74,10 +74,21 @@ def get_conditions(filters): else: frappe.throw(_("'To Date' is required")) - for field in ["item_code", "warehouse", "batch_no", "company"]: + for field in ["item_code", "batch_no", "company"]: if filters.get(field): conditions += " and {0} = {1}".format(field, frappe.db.escape(filters.get(field))) + if filters.get("warehouse"): + warehouse_details = frappe.db.get_value( + "Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1 + ) + if warehouse_details: + conditions += ( + " and exists (select name from `tabWarehouse` wh \ + where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)" + % (warehouse_details.lft, warehouse_details.rgt) + ) + return conditions @@ -87,7 +98,7 @@ def get_stock_ledger_entries(filters): return frappe.db.sql( """ select item_code, batch_no, warehouse, posting_date, sum(actual_qty) as actual_qty - from `tabStock Ledger Entry` + from `tabStock Ledger Entry` as sle where is_cancelled = 0 and docstatus < 2 and ifnull(batch_no, '') != '' %s group by voucher_no, batch_no, item_code, warehouse order by item_code, warehouse""" From 9dc0edfb8a71204fc9d6b7806fb63c59f2215a26 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 1 Nov 2022 16:03:32 +0530 Subject: [PATCH 02/14] fix: Do not force eligibilgity of itc for reverse charge --- erpnext/regional/india/taxes.js | 6 ++++++ erpnext/regional/india/utils.py | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/regional/india/taxes.js b/erpnext/regional/india/taxes.js index 88973e36b6a..49af669fc3f 100644 --- a/erpnext/regional/india/taxes.js +++ b/erpnext/regional/india/taxes.js @@ -47,6 +47,12 @@ erpnext.setup_auto_gst_taxation = (doctype) => { } } }); + }, + + reverse_charge: function(frm) { + if (frm.doc.reverse_charge == "Y") { + frm.set_value('eligibility_for_itc', 'ITC on Reverse Charge'); + } } }); } diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index e98093bd820..0b61e7faf9b 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -983,8 +983,6 @@ def validate_reverse_charge_transaction(doc, method): frappe.throw(msg) - doc.eligibility_for_itc = "ITC on Reverse Charge" - def update_itc_availed_fields(doc, method): country = frappe.get_cached_value("Company", doc.company, "country") From b877b0d3a2e47a26534b842931288c6405ee5dc6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 1 Nov 2022 16:56:35 +0530 Subject: [PATCH 03/14] fix: filter return pos in reconciliation tool --- erpnext/accounts/utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index c4fafba2669..b0b217684ea 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -835,10 +835,7 @@ def remove_return_pos_invoices(party_type, party, invoice_list): else: return invoice_list - # remove pos return invoices from invoice_list - for idx, inv in enumerate(invoice_list, 0): - if inv.voucher_no in return_pos: - del invoice_list[idx] + invoice_list = [x for x in invoice_list if x.voucher_no not in return_pos] return invoice_list From 88889579529db4f4222125cab1300b463f535d93 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 1 Nov 2022 19:54:41 +0530 Subject: [PATCH 04/14] fix: Issues while cancel/amending Purchase Invoice with TDS enabled (cherry picked from commit f7c9258770a79aff0b951dc18c0b7c39f794b03f) # Conflicts: # erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py --- .../accounts/doctype/purchase_invoice/purchase_invoice.js | 4 ++++ .../accounts/doctype/purchase_invoice/purchase_invoice.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 6c37e6c9a3c..0208975513b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -569,6 +569,10 @@ frappe.ui.form.on("Purchase Invoice", { erpnext.queries.setup_queries(frm, "Warehouse", function() { return erpnext.queries.warehouse(frm.doc); }); + + if (frm.is_new()) { + frm.clear_table("tax_withheld_vouchers"); + } }, is_subcontracted: function(frm) { diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index a1a18f0becd..865b0ba2337 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -67,6 +67,9 @@ class PurchaseInvoice(BuyingController): supplier_tds = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category") self.set_onload("supplier_tds", supplier_tds) + if self.is_new(): + self.set("tax_withheld_vouchers", []) + def before_save(self): if not self.on_hold: self.release_date = "" @@ -1373,7 +1376,12 @@ class PurchaseInvoice(BuyingController): "GL Entry", "Stock Ledger Entry", "Repost Item Valuation", +<<<<<<< HEAD "Purchase Invoice", +======= + "Payment Ledger Entry", + "Tax Withheld Vouchers", +>>>>>>> f7c9258770 (fix: Issues while cancel/amending Purchase Invoice with TDS enabled) ) self.update_advance_tax_references(cancel=1) From 9b63a1a2e9716113f266f76977bb6a29e56e1703 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 31 Oct 2022 19:58:46 +0530 Subject: [PATCH 05/14] fix: Mode of payment for returns in POS Sales Invoice (cherry picked from commit 06e8e28531e2584fd5499df1c233082657de12b0) --- erpnext/controllers/taxes_and_totals.py | 41 +++++++++++++++---------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 66d4cad8037..ed95f834379 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -890,24 +890,33 @@ class calculate_taxes_and_totals(object): self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc) def set_total_amount_to_default_mop(self, total_amount_to_pay): - default_mode_of_payment = frappe.db.get_value( - "POS Payment Method", - {"parent": self.doc.pos_profile, "default": 1}, - ["mode_of_payment"], - as_dict=1, - ) - - if default_mode_of_payment: - self.doc.payments = [] - self.doc.append( - "payments", - { - "mode_of_payment": default_mode_of_payment.mode_of_payment, - "amount": total_amount_to_pay, - "default": 1, - }, + total_paid_amount = 0 + for payment in self.doc.get("payments"): + total_paid_amount += ( + payment.amount if self.doc.party_account_currency == self.doc.currency else payment.base_amount ) + pending_amount = total_amount_to_pay - total_paid_amount + + if pending_amount > 0: + default_mode_of_payment = frappe.db.get_value( + "POS Payment Method", + {"parent": self.doc.pos_profile, "default": 1}, + ["mode_of_payment"], + as_dict=1, + ) + + if default_mode_of_payment: + self.doc.payments = [] + self.doc.append( + "payments", + { + "mode_of_payment": default_mode_of_payment.mode_of_payment, + "amount": pending_amount, + "default": 1, + }, + ) + def get_itemised_tax_breakup_html(doc): if not doc.taxes: From 12b15347bce86efec8691d688e4c7794d00d3e94 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 1 Nov 2022 20:17:34 +0530 Subject: [PATCH 06/14] chore: Update tests (cherry picked from commit 5b74161195b3b006d47f29de5a97428effca527e) --- erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 1106cf01a2b..79a67b83631 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -916,7 +916,8 @@ class TestSalesInvoice(unittest.TestCase): pos_return.insert() pos_return.submit() - self.assertEqual(pos_return.get("payments")[0].amount, -1000) + self.assertEqual(pos_return.get("payments")[0].amount, -500) + self.assertEqual(pos_return.get("payments")[1].amount, -500) def test_pos_change_amount(self): make_pos_profile( From 4a10454d89400720d3d114a9c285acd6b5a007c2 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 1 Nov 2022 21:30:36 +0530 Subject: [PATCH 07/14] chore: Resolve conflicts --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 865b0ba2337..9616e93a020 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -1376,12 +1376,7 @@ class PurchaseInvoice(BuyingController): "GL Entry", "Stock Ledger Entry", "Repost Item Valuation", -<<<<<<< HEAD - "Purchase Invoice", -======= - "Payment Ledger Entry", "Tax Withheld Vouchers", ->>>>>>> f7c9258770 (fix: Issues while cancel/amending Purchase Invoice with TDS enabled) ) self.update_advance_tax_references(cancel=1) From 601b1e38216af26b2a0dceb3d01424b2beda5220 Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Tue, 1 Nov 2022 10:38:33 +0530 Subject: [PATCH 08/14] fix: use `flt` instead of `cint` in `get_batch_no` (cherry picked from commit 9fb3fb4c836aef1d05e9a8160baf7089cd3bb224) --- erpnext/stock/doctype/batch/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index acf7dfdaa11..58c8b9c8dcb 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -285,7 +285,7 @@ def get_batch_no(item_code, warehouse, qty=1, throw=False, serial_no=None): batches = get_batches(item_code, warehouse, qty, throw, serial_no) for batch in batches: - if cint(qty) <= cint(batch.qty): + if flt(qty) <= flt(batch.qty): batch_no = batch.batch_id break From 1d23c9a9fddca8d64432a2cfafbcd2e0adb81f05 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Mon, 31 Oct 2022 12:41:37 +0530 Subject: [PATCH 09/14] fix: for asset's purchase_date, if bill_date is set, use that instead of posting_date (cherry picked from commit f322c608cf7acbb8c5928f151876a2e5ddc13595) --- erpnext/assets/doctype/asset/asset.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index 153f5c537a2..2cd858c2676 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -384,7 +384,11 @@ frappe.ui.form.on('Asset', { set_values_from_purchase_doc: function(frm, doctype, purchase_doc) { frm.set_value('company', purchase_doc.company); - frm.set_value('purchase_date', purchase_doc.posting_date); + if (purchase_doc.bill_date) { + frm.set_value('purchase_date', purchase_doc.bill_date); + } else { + frm.set_value('purchase_date', purchase_doc.posting_date); + } const item = purchase_doc.items.find(item => item.item_code === frm.doc.item_code); if (!item) { doctype_field = frappe.scrub(doctype) From 76e4bb44f18676655c3de42e39279cd3921560b4 Mon Sep 17 00:00:00 2001 From: Maharshi Patel Date: Fri, 4 Nov 2022 15:29:17 +0530 Subject: [PATCH 10/14] fix: Create POS Opening Entry POS Profile filter. pos_profile_query was variable instead of function. (cherry picked from commit 1328a45f2a244b9fabc4fbc61fa2d073032035c5) --- erpnext/selling/page/point_of_sale/pos_controller.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index 24375d8252d..595b9196e84 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -67,7 +67,7 @@ erpnext.PointOfSale.Controller = class { { fieldtype: 'Link', label: __('POS Profile'), options: 'POS Profile', fieldname: 'pos_profile', reqd: 1, - get_query: () => pos_profile_query, + get_query: () => pos_profile_query(), onchange: () => fetch_pos_payment_methods() }, { @@ -101,9 +101,11 @@ erpnext.PointOfSale.Controller = class { primary_action_label: __('Submit') }); dialog.show(); - const pos_profile_query = { - query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query', - filters: { company: dialog.fields_dict.company.get_value() } + const pos_profile_query = () => { + return { + query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query', + filters: { company: dialog.fields_dict.company.get_value() } + } }; } From 84ee1b86af608c5474e73ca05ccdb5f27447c76b Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 5 Nov 2022 20:51:15 +0530 Subject: [PATCH 11/14] fix: Disable tax included prices for internal transfers (#32794) * fix: Disable tax-included prices for internal transfers (cherry picked from commit 8d30ebb12b5f3791f6159764e96f537743f3a113) --- erpnext/controllers/accounts_controller.py | 15 +++++++++++++++ .../doctype/delivery_note/test_delivery_note.py | 14 ++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 527c9389d8a..b2dea226f4e 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -152,6 +152,7 @@ class AccountsController(TransactionBase): self.validate_inter_company_reference() self.disable_pricing_rule_on_internal_transfer() + self.disable_tax_included_prices_for_internal_transfer() self.set_incoming_rate() if self.meta.get_field("currency"): @@ -395,6 +396,20 @@ class AccountsController(TransactionBase): alert=1, ) + def disable_tax_included_prices_for_internal_transfer(self): + if self.is_internal_transfer(): + tax_updated = False + for tax in self.get("taxes"): + if tax.get("included_in_print_rate"): + tax.included_in_print_rate = 0 + tax_updated = True + + if tax_updated: + frappe.msgprint( + _("Disabled tax included prices since this {} is an internal transfer").format(self.doctype), + alert=1, + ) + def validate_due_date(self): if self.get("is_pos"): return diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 1b9f16814c5..d747383d6a5 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -1050,9 +1050,22 @@ class TestDeliveryNote(FrappeTestCase): do_not_submit=True, ) + dn.append( + "taxes", + { + "charge_type": "On Net Total", + "account_head": "_Test Account Service Tax - _TC", + "description": "Tax 1", + "rate": 14, + "cost_center": "_Test Cost Center - _TC", + "included_in_print_rate": 1, + }, + ) + self.assertEqual(dn.items[0].rate, 500) # haven't saved yet dn.save() self.assertEqual(dn.ignore_pricing_rule, 1) + self.assertEqual(dn.taxes[0].included_in_print_rate, 0) # rate should reset to incoming rate self.assertEqual(dn.items[0].rate, rate) @@ -1063,6 +1076,7 @@ class TestDeliveryNote(FrappeTestCase): dn.save() self.assertEqual(dn.items[0].rate, rate) + self.assertEqual(dn.items[0].net_rate, rate) def test_internal_transfer_precision_gle(self): from erpnext.selling.doctype.customer.test_customer import create_internal_customer From a8bf17e56021ccfc19a2d28d99665e3f122ec849 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Sun, 6 Nov 2022 05:52:33 +0100 Subject: [PATCH 12/14] chore: add german translations (#32846) Mostly for balance sheet (cherry picked from commit d2b6490bcabf3338856cc109ab1cedb275f00e2c) # Conflicts: # erpnext/translations/de.csv --- erpnext/translations/de.csv | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv index 52abb5787b9..eada98fc6d2 100644 --- a/erpnext/translations/de.csv +++ b/erpnext/translations/de.csv @@ -9865,3 +9865,38 @@ Leave Type Allocation,Zuordnung Abwesenheitsarten, From Lead,Aus Lead, From Opportunity,Aus Chance, Publish in Website,Auf Webseite veröffentlichen, +<<<<<<< HEAD +======= +Total Allocated Leave(s),Gesamte zugewiesene Urlaubstage, +Expired Leave(s),Verfallene Urlaubstage, +Used Leave(s),Verbrauchte Urlaubstage, +Leave(s) Pending Approval,Urlaubstage zur Genehmigung ausstehend, +Available Leave(s),Verfügbare Urlaubstage, +Party Specific Item,Parteispezifischer Artikel, +Active Customers,Aktive Kunden, +Annual Sales,Jährlicher Umsatz, +Total Outgoing Bills,Ausgangsrechnungen insgesamt, +Total Incoming Bills,Eingangsrechnungen insgesamt, +Total Incoming Payment,Zahlungseingang insgesamt, +Total Outgoing Payment,Zahlungsausgang insgesamt, +Incoming Bills (Purchase Invoice),Eingehende Rechnungen (Eingangsrechnung), +Outgoing Bills (Sales Invoice),Ausgehende Rechnungen (Ausgangsrechnung), +Accounts Receivable Ageing,Fälligkeit Forderungen, +Accounts Payable Ageing,Fälligkeit Verbindlichkeiten, +Budget Variance,Budgetabweichung, +Based On Value,Basierend auf Wert, +Restrict Items Based On,Artikel einschränken auf Basis von, +Earnings & Deductions,Erträge & Abzüge, +Is Process Loss,Ist Prozessverlust, +Is Finished Item,Ist fertiger Artikel, +Is Scrap Item,Ist Schrott, +Issue a debit note with 0 qty against an existing Sales Invoice,Lastschrift mit Menge 0 gegen eine bestehende Ausgangsrechnung ausstellen, +Show Remarks,Bemerkungen anzeigen, +Website Item,Webseiten-Artikel, +Update Property,Eigenschaft aktualisieren, +Recurring Sales Invoice,Wiederkehrende Ausgangsrechnung, +Total Asset,Aktiva, +Total Liability,Verbindlichkeiten, +Total Equity,Eigenkapital, +Warehouse wise Stock Value,Warenwert nach Lager, +>>>>>>> d2b6490bca (chore: add german translations (#32846)) From 418c13133153d5f7fd369a26282f1048e05b9365 Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Tue, 1 Nov 2022 19:30:06 +0530 Subject: [PATCH 13/14] fix: `Material Consumption` option in case of `Skip Transfer to WIP` in WO (cherry picked from commit 8ea69837348e4333f3b950a82b755076f58b8751) --- .../doctype/work_order/work_order.js | 101 +++++++++--------- 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index a27c42b109e..b1ee3cd7a1b 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -555,66 +555,69 @@ erpnext.work_order = { } } - if(!frm.doc.skip_transfer){ + if (frm.doc.status != 'Stopped') { // If "Material Consumption is check in Manufacturing Settings, allow Material Consumption - if (flt(doc.material_transferred_for_manufacturing) > 0 && frm.doc.status != 'Stopped') { - if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) { - frm.has_finish_btn = true; - - if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) { - // Only show "Material Consumption" when required_qty > consumed_qty - var counter = 0; - var tbl = frm.doc.required_items || []; - var tbl_lenght = tbl.length; - for (var i = 0, len = tbl_lenght; i < len; i++) { - let wo_item_qty = frm.doc.required_items[i].transferred_qty || frm.doc.required_items[i].required_qty; - if (flt(wo_item_qty) > flt(frm.doc.required_items[i].consumed_qty)) { - counter += 1; - } - } - if (counter > 0) { - var consumption_btn = frm.add_custom_button(__('Material Consumption'), function() { - const backflush_raw_materials_based_on = frm.doc.__onload.backflush_raw_materials_based_on; - erpnext.work_order.make_consumption_se(frm, backflush_raw_materials_based_on); - }); - consumption_btn.addClass('btn-primary'); + if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) { + if (flt(doc.material_transferred_for_manufacturing) > 0 || frm.doc.skip_transfer) { + // Only show "Material Consumption" when required_qty > consumed_qty + var counter = 0; + var tbl = frm.doc.required_items || []; + var tbl_lenght = tbl.length; + for (var i = 0, len = tbl_lenght; i < len; i++) { + let wo_item_qty = frm.doc.required_items[i].transferred_qty || frm.doc.required_items[i].required_qty; + if (flt(wo_item_qty) > flt(frm.doc.required_items[i].consumed_qty)) { + counter += 1; } } + if (counter > 0) { + var consumption_btn = frm.add_custom_button(__('Material Consumption'), function() { + const backflush_raw_materials_based_on = frm.doc.__onload.backflush_raw_materials_based_on; + erpnext.work_order.make_consumption_se(frm, backflush_raw_materials_based_on); + }); + consumption_btn.addClass('btn-primary'); + } + } + } + if(!frm.doc.skip_transfer){ + if (flt(doc.material_transferred_for_manufacturing) > 0) { + if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) { + frm.has_finish_btn = true; + + var finish_btn = frm.add_custom_button(__('Finish'), function() { + erpnext.work_order.make_se(frm, 'Manufacture'); + }); + + if(doc.material_transferred_for_manufacturing>=doc.qty) { + // all materials transferred for manufacturing, make this primary + finish_btn.addClass('btn-primary'); + } + } else { + frappe.db.get_doc("Manufacturing Settings").then((doc) => { + let allowance_percentage = doc.overproduction_percentage_for_work_order; + + if (allowance_percentage > 0) { + let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty); + + if ((flt(doc.produced_qty) < allowed_qty)) { + frm.add_custom_button(__('Finish'), function() { + erpnext.work_order.make_se(frm, 'Manufacture'); + }); + } + } + }); + } + } + } else { + if ((flt(doc.produced_qty) < flt(doc.qty))) { var finish_btn = frm.add_custom_button(__('Finish'), function() { erpnext.work_order.make_se(frm, 'Manufacture'); }); - - if(doc.material_transferred_for_manufacturing>=doc.qty) { - // all materials transferred for manufacturing, make this primary - finish_btn.addClass('btn-primary'); - } - } else { - frappe.db.get_doc("Manufacturing Settings").then((doc) => { - let allowance_percentage = doc.overproduction_percentage_for_work_order; - - if (allowance_percentage > 0) { - let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty); - - if ((flt(doc.produced_qty) < allowed_qty)) { - frm.add_custom_button(__('Finish'), function() { - erpnext.work_order.make_se(frm, 'Manufacture'); - }); - } - } - }); + finish_btn.addClass('btn-primary'); } } - } else { - if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') { - var finish_btn = frm.add_custom_button(__('Finish'), function() { - erpnext.work_order.make_se(frm, 'Manufacture'); - }); - finish_btn.addClass('btn-primary'); - } } } - }, calculate_cost: function(doc) { if (doc.operations){ From 550f5f280c079745272376aa957483c92b68a9fc Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Mon, 7 Nov 2022 13:15:38 +0100 Subject: [PATCH 14/14] chore: resolve merge conflicts --- erpnext/translations/de.csv | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv index eada98fc6d2..69780276ce2 100644 --- a/erpnext/translations/de.csv +++ b/erpnext/translations/de.csv @@ -9865,8 +9865,6 @@ Leave Type Allocation,Zuordnung Abwesenheitsarten, From Lead,Aus Lead, From Opportunity,Aus Chance, Publish in Website,Auf Webseite veröffentlichen, -<<<<<<< HEAD -======= Total Allocated Leave(s),Gesamte zugewiesene Urlaubstage, Expired Leave(s),Verfallene Urlaubstage, Used Leave(s),Verbrauchte Urlaubstage, @@ -9899,4 +9897,3 @@ Total Asset,Aktiva, Total Liability,Verbindlichkeiten, Total Equity,Eigenkapital, Warehouse wise Stock Value,Warenwert nach Lager, ->>>>>>> d2b6490bca (chore: add german translations (#32846))