From 78d7d7148f2443e48b4feb088c70522f62b6040f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 16 Dec 2024 16:14:02 +0530 Subject: [PATCH 1/3] fix: broken CI - always install wkhtmltopdf - remove specific version on mariadb-client (cherry picked from commit eb1e36ca227480d8414b912a88cf440cfe0b7cd3) --- .github/helper/install.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/helper/install.sh b/.github/helper/install.sh index 915a4637999..30389734429 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -6,7 +6,7 @@ cd ~ || exit sudo apt update sudo apt remove mysql-server mysql-client -sudo apt install libcups2-dev redis-server mariadb-client-10.6 +sudo apt install libcups2-dev redis-server mariadb-client pip install frappe-bench @@ -44,13 +44,9 @@ fi install_whktml() { - if [ "$(lsb_release -rs)" = "22.04" ]; then - wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb - sudo apt install /tmp/wkhtmltox.deb - else - echo "Please update this script to support wkhtmltopdf for $(lsb_release -ds)" - exit 1 - fi + wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb + sudo apt install /tmp/wkhtmltox.deb + } install_whktml & wkpid=$! From 158a4803ca2d0645387fc1b1b9040352b2328e9f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:04:40 +0530 Subject: [PATCH 2/3] fix: unsupported operand type (backport #44722) (#44723) fix: unsupported operand type (#44722) (cherry picked from commit 95da0913f6016c0f0c23b99712afa88fa87c74af) Co-authored-by: rohitwaghchaure --- .../serial_and_batch_bundle/serial_and_batch_bundle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index dc2071b9ee0..30538049e6c 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -505,9 +505,9 @@ class SerialandBatchBundle(Document): elif (d.incoming_rate == rate) and d.qty and d.stock_value_difference: continue - d.incoming_rate = rate + d.incoming_rate = flt(rate) if d.qty: - d.stock_value_difference = d.qty * d.incoming_rate + d.stock_value_difference = flt(d.qty) * d.incoming_rate if save: d.db_set( From 8940747161ca368e8ebab8f0eae199a70f09c3cf Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:04:54 +0530 Subject: [PATCH 3/3] fix: delink SABB from cancelled SLEs (backport #44691) (#44719) fix: delink SABB from cancelled SLEs (#44691) (cherry picked from commit 5f539619bc6f6ae713c8b82aba5b580345d47728) Co-authored-by: rohitwaghchaure --- .../pos_invoice_merge_log.py | 36 +++++++++++++++++++ .../serial_and_batch_bundle.py | 2 ++ 2 files changed, 38 insertions(+) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py index 5bb43b3fa72..b9bf145c728 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py @@ -132,6 +132,7 @@ class POSInvoiceMergeLog(Document): self.update_pos_invoices(pos_invoice_docs) self.serial_and_batch_bundle_reference_for_pos_invoice() self.cancel_linked_invoices() + self.delink_serial_and_batch_bundle() def process_merging_into_sales_invoice(self, data): sales_invoice = self.get_new_sales_invoice() @@ -319,6 +320,38 @@ class POSInvoiceMergeLog(Document): for table_name in ["items", "packed_items"]: pos_invoice.set_serial_and_batch_bundle(table_name) + def delink_serial_and_batch_bundle(self): + bundles = self.get_serial_and_batch_bundles() + if not bundles: + return + + sle_table = frappe.qb.DocType("Stock Ledger Entry") + query = ( + frappe.qb.update(sle_table) + .set(sle_table.serial_and_batch_bundle, None) + .where(sle_table.serial_and_batch_bundle.isin(bundles) & sle_table.is_cancelled == 1) + ) + + query.run() + + def get_serial_and_batch_bundles(self): + pos_invoices = [] + for d in self.pos_invoices: + pos_invoices.append(d.pos_invoice) + + if pos_invoices: + return frappe.get_all( + "POS Invoice Item", + filters={ + "docstatus": 1, + "parent": ["in", pos_invoices], + "serial_and_batch_bundle": ["is", "set"], + }, + pluck="serial_and_batch_bundle", + ) + + return [] + def cancel_linked_invoices(self): for si_name in [self.consolidated_invoice, self.consolidated_credit_note]: if not si_name: @@ -503,6 +536,9 @@ def cancel_merge_logs(merge_logs, closing_entry=None): try: for log in merge_logs: merge_log = frappe.get_doc("POS Invoice Merge Log", log) + if merge_log.docstatus == 2: + continue + merge_log.flags.ignore_permissions = True merge_log.cancel() diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 30538049e6c..f96a6760bec 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -519,6 +519,8 @@ class SerialandBatchBundle(Document): if not self.voucher_no or self.voucher_no != row.parent: values_to_set["voucher_no"] = row.parent + self.db_set("is_cancelled", 0) + if self.voucher_type != parent.doctype: values_to_set["voucher_type"] = parent.doctype