Merge pull request #36360 from deepeshgarg007/fy_default_dates
fix: Default year start and end dates in reports
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index c19413d..89d6207 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -101,12 +101,6 @@
cur_frm.add_custom_button(__('Return / Debit Note'),
this.make_debit_note, __('Create'));
}
-
- if(!doc.auto_repeat) {
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(doc.doctype, doc.name)
- }, __('Create'))
- }
}
if (doc.outstanding_amount > 0 && !cint(doc.is_return) && !doc.on_hold) {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index dab7fa0..b45bc41 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -163,12 +163,6 @@
cur_frm.cscript.make_maintenance_schedule();
}, __('Create'));
}
-
- if(!doc.auto_repeat) {
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(doc.doctype, doc.name)
- }, __('Create'))
- }
}
// Show buttons only when pos view is active
diff --git a/erpnext/accounts/report/pos_register/pos_register.py b/erpnext/accounts/report/pos_register/pos_register.py
index 9c0aba3..488bb99 100644
--- a/erpnext/accounts/report/pos_register/pos_register.py
+++ b/erpnext/accounts/report/pos_register/pos_register.py
@@ -50,20 +50,20 @@
order_by = "p.posting_date"
select_mop_field, from_sales_invoice_payment, group_by_mop_condition = "", "", ""
if group_by_field == "mode_of_payment":
- select_mop_field = ", sip.mode_of_payment"
+ select_mop_field = ", sip.mode_of_payment, sip.base_amount - IF(sip.type='Cash', p.change_amount, 0) as paid_amount"
from_sales_invoice_payment = ", `tabSales Invoice Payment` sip"
- group_by_mop_condition = "sip.parent = p.name AND ifnull(sip.base_amount, 0) != 0 AND"
+ group_by_mop_condition = "sip.parent = p.name AND ifnull(sip.base_amount - IF(sip.type='Cash', p.change_amount, 0), 0) != 0 AND"
order_by += ", sip.mode_of_payment"
elif group_by_field:
order_by += ", p.{}".format(group_by_field)
+ select_mop_field = ", p.base_paid_amount - p.change_amount as paid_amount "
return frappe.db.sql(
"""
SELECT
p.posting_date, p.name as pos_invoice, p.pos_profile,
- p.owner, p.base_grand_total as grand_total, p.base_paid_amount - p.change_amount as paid_amount,
- p.customer, p.is_return {select_mop_field}
+ p.owner, p.customer, p.is_return, p.base_grand_total as grand_total {select_mop_field}
FROM
`tabPOS Invoice` p {from_sales_invoice_payment}
WHERE
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index db3a60e..ab15704 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -251,12 +251,6 @@
function() { me.make_payment_request() }, __('Create'));
}
- if(!doc.auto_repeat) {
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(doc.doctype, doc.name)
- }, __('Create'))
- }
-
if (doc.docstatus === 1 && !doc.inter_company_order_reference) {
let me = this;
let internal = me.frm.doc.is_internal_supplier;
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index ea55cb2..d18f70a 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -126,12 +126,6 @@
});
}
- if(!doc.auto_repeat) {
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(doc.doctype, doc.name)
- }, __('Create'))
- }
-
cur_frm.page.set_inner_btn_group_as_primary(__('Create'));
}
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index b57a094..fd3f9fa 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -377,12 +377,6 @@
this.frm.add_custom_button(__('Project'), () => this.make_project(), __('Create'));
}
- if(!doc.auto_repeat) {
- this.frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(doc.doctype, doc.name)
- }, __('Create'))
- }
-
if (doc.docstatus === 1 && !doc.inter_company_order_reference) {
let me = this;
let internal = me.frm.doc.is_internal_customer;
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index e96c854..cc67c69 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -73,7 +73,7 @@
return self.route
def on_trash(self):
- NestedSet.on_trash(self)
+ NestedSet.on_trash(self, allow_root_deletion=True)
WebsiteGenerator.on_trash(self)
self.delete_child_item_groups_key()
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index eee7972..7ef1c9b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -235,12 +235,6 @@
__("Status"))
}
erpnext.stock.delivery_note.set_print_hide(doc, dt, dn);
-
- if(doc.docstatus==1 && !doc.is_return && !doc.auto_repeat) {
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(doc.doctype, doc.name)
- }, __('Create'))
- }
}
make_shipment() {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 136553a..2bb479b 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -189,12 +189,6 @@
}
cur_frm.add_custom_button(__('Retention Stock Entry'), this.make_retention_stock_entry, __('Create'));
- if(!this.frm.doc.auto_repeat) {
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(me.frm.doc.doctype, me.frm.doc.name)
- }, __('Create'))
- }
-
cur_frm.page.set_inner_btn_group_as_primary(__('Create'));
}
}