From 8c7d0d4b85daa7749e5dee1dbe1fc0fcc6f4c158 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 22 Feb 2024 16:08:11 +0530 Subject: [PATCH 1/3] fix: skip max discount validation for rate adjustment (cherry picked from commit 5a3b133d6520661fe28e4c2d73c17ef4eb48be1e) --- erpnext/controllers/selling_controller.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index c9b12f4f723..34abe9f764f 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -31,7 +31,8 @@ class SellingController(StockController): def validate(self): super(SellingController, self).validate() self.validate_items() - self.validate_max_discount() + if not self.get("is_debit_note"): + self.validate_max_discount() self.validate_selling_price() self.set_qty_as_per_stock_uom() self.set_po_nos(for_validate=True) From 882cf98288103ad6ec731a4cfc58357471337287 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 22 Feb 2024 16:24:42 +0530 Subject: [PATCH 2/3] fix: skip SO & DN validation for debit note (cherry picked from commit e2d16955dd6de197ef621e5f8fb3159f5a9bfaaa) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 288acd9f792..730c47569fa 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -90,7 +90,7 @@ class SalesInvoice(SellingController): super(SalesInvoice, self).validate() self.validate_auto_set_posting_time() - if not self.is_pos: + if not (self.is_pos or self.is_debit_note): self.so_dn_required() self.set_tax_withholding() From e289aef1b4a6a0ab4827214422486f16efd7d4cd Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Tue, 27 Feb 2024 09:59:08 +0530 Subject: [PATCH 3/3] fix: linting issue --- .../doctype/stock_reconciliation/stock_reconciliation.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 44c2d85b4cc..878af0e22ca 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -702,10 +702,7 @@ class StockReconciliation(StockController): if allow_negative_stock: return True - if any( - (d.batch_no and flt(d.qty) == flt(d.current_qty)) - for d in self.items - ): + if any((d.batch_no and flt(d.qty) == flt(d.current_qty)) for d in self.items): allow_negative_stock = True return allow_negative_stock