Merge pull request #19390 from 0Pranav/patch-1
fix: setting incorrect field for party bank account
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 928bd5f..5db4cc2 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -127,7 +127,11 @@
"name": "Shipping Rule",
"description": _("Rules for adding shipping costs."),
},
-
+ {
+ "type": "doctype",
+ "name": "Coupon Code",
+ "description": _("Define coupon codes."),
+ }
]
},
{
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 19dea08..2f6b59f 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -280,22 +280,31 @@
"page_len": page_len
}
+ having_clause = "having sum(sle.actual_qty) > 0"
+ if filters.get("is_return"):
+ having_clause = ""
+
if args.get('warehouse'):
- batch_nos = frappe.db.sql("""select sle.batch_no, round(sum(sle.actual_qty),2), sle.stock_uom, concat('MFG-',batch.manufacturing_date), concat('EXP-',batch.expiry_date)
- from `tabStock Ledger Entry` sle
- INNER JOIN `tabBatch` batch on sle.batch_no = batch.name
- where
- batch.disabled = 0
- and sle.item_code = %(item_code)s
- and sle.warehouse = %(warehouse)s
- and (sle.batch_no like %(txt)s
- or batch.manufacturing_date like %(txt)s)
- and batch.docstatus < 2
- {0}
- {match_conditions}
- group by batch_no having sum(sle.actual_qty) > 0
- order by batch.expiry_date, sle.batch_no desc
- limit %(start)s, %(page_len)s""".format(cond, match_conditions=get_match_cond(doctype)), args)
+ batch_nos = frappe.db.sql("""select sle.batch_no, round(sum(sle.actual_qty),2), sle.stock_uom,
+ concat('MFG-',batch.manufacturing_date), concat('EXP-',batch.expiry_date)
+ from `tabStock Ledger Entry` sle
+ INNER JOIN `tabBatch` batch on sle.batch_no = batch.name
+ where
+ batch.disabled = 0
+ and sle.item_code = %(item_code)s
+ and sle.warehouse = %(warehouse)s
+ and (sle.batch_no like %(txt)s
+ or batch.manufacturing_date like %(txt)s)
+ and batch.docstatus < 2
+ {cond}
+ {match_conditions}
+ group by batch_no {having_clause}
+ order by batch.expiry_date, sle.batch_no desc
+ limit %(start)s, %(page_len)s""".format(
+ cond=cond,
+ match_conditions=get_match_cond(doctype),
+ having_clause = having_clause
+ ), args)
return batch_nos
else:
diff --git a/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py b/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
index 5c18985..3d1a88e 100644
--- a/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
+++ b/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
@@ -4,7 +4,7 @@
def execute():
- frappe.reload_doc('desk', 'doctype', 'auto_repeat')
+ frappe.reload_doc('automation', 'doctype', 'auto_repeat')
doctypes_to_rename = {
'accounts': ['Journal Entry', 'Payment Entry', 'Purchase Invoice', 'Sales Invoice'],
@@ -41,4 +41,4 @@
if field in frappe.db.get_table_columns("Subscription"):
fields_to_drop['Subscription'].append(field)
- frappe.model.delete_fields(fields_to_drop, delete=1)
\ No newline at end of file
+ frappe.model.delete_fields(fields_to_drop, delete=1)
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 5a2f3bc..ca492ba 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1653,6 +1653,11 @@
'item_code': item.item_code,
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
}
+
+ if (doc.is_return) {
+ filters["is_return"] = 1;
+ }
+
if (item.warehouse) filters["warehouse"] = item.warehouse;
return {
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index f850bc1..a4c10cf 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -66,7 +66,7 @@
from erpnext.selling.doctype.quotation.quotation import _make_sales_order
sales_order = frappe.get_doc(_make_sales_order(quotation.name, ignore_permissions=True))
- if not cart_settings.allow_items_not_in_stock:
+ if not cint(cart_settings.allow_items_not_in_stock):
for item in sales_order.get("items"):
item.reserved_warehouse, is_stock_item = frappe.db.get_value("Item",
item.item_code, ["website_warehouse", "is_stock_item"])