feat: disable auto setting grand total to default mode of payment (#45591)
(cherry picked from commit f0a6399056)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
"ignore_pricing_rule",
|
"ignore_pricing_rule",
|
||||||
"allow_rate_change",
|
"allow_rate_change",
|
||||||
"allow_discount_change",
|
"allow_discount_change",
|
||||||
|
"disable_grand_total_to_default_mop",
|
||||||
"section_break_23",
|
"section_break_23",
|
||||||
"item_groups",
|
"item_groups",
|
||||||
"column_break_25",
|
"column_break_25",
|
||||||
@@ -382,6 +383,12 @@
|
|||||||
"fieldname": "print_receipt_on_order_complete",
|
"fieldname": "print_receipt_on_order_complete",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Print Receipt on Order Complete"
|
"label": "Print Receipt on Order Complete"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "disable_grand_total_to_default_mop",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Disable auto setting Grand Total to default Payment Mode"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@@ -409,7 +416,7 @@
|
|||||||
"link_fieldname": "pos_profile"
|
"link_fieldname": "pos_profile"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2025-01-01 11:07:03.161950",
|
"modified": "2025-01-29 13:12:30.796630",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "POS Profile",
|
"name": "POS Profile",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class POSProfile(Document):
|
|||||||
currency: DF.Link
|
currency: DF.Link
|
||||||
customer: DF.Link | None
|
customer: DF.Link | None
|
||||||
customer_groups: DF.Table[POSCustomerGroup]
|
customer_groups: DF.Table[POSCustomerGroup]
|
||||||
|
disable_grand_total_to_default_mop: DF.Check
|
||||||
disable_rounded_total: DF.Check
|
disable_rounded_total: DF.Check
|
||||||
disabled: DF.Check
|
disabled: DF.Check
|
||||||
expense_account: DF.Link | None
|
expense_account: DF.Link | None
|
||||||
|
|||||||
@@ -894,10 +894,16 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
this.frm.refresh_fields();
|
this.frm.refresh_fields();
|
||||||
}
|
}
|
||||||
|
|
||||||
set_default_payment(total_amount_to_pay, update_paid_amount) {
|
async set_default_payment(total_amount_to_pay, update_paid_amount) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var payment_status = true;
|
var payment_status = true;
|
||||||
if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)) {
|
if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)) {
|
||||||
|
let r = await frappe.db.get_value("POS Profile", this.frm.doc.pos_profile, "disable_grand_total_to_default_mop");
|
||||||
|
|
||||||
|
if (r.message.disable_grand_total_to_default_mop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$.each(this.frm.doc['payments'] || [], function(index, data) {
|
$.each(this.frm.doc['payments'] || [], function(index, data) {
|
||||||
if(data.default && payment_status && total_amount_to_pay > 0) {
|
if(data.default && payment_status && total_amount_to_pay > 0) {
|
||||||
let base_amount, amount;
|
let base_amount, amount;
|
||||||
|
|||||||
@@ -340,11 +340,19 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
|
|
||||||
render_payment_section() {
|
async render_payment_section() {
|
||||||
this.render_payment_mode_dom();
|
this.render_payment_mode_dom();
|
||||||
this.make_invoice_fields_control();
|
this.make_invoice_fields_control();
|
||||||
this.update_totals_section();
|
this.update_totals_section();
|
||||||
this.focus_on_default_mop();
|
let r = await frappe.db.get_value(
|
||||||
|
"POS Profile",
|
||||||
|
this.frm.doc.pos_profile,
|
||||||
|
"disable_grand_total_to_default_mop"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!r.message.disable_grand_total_to_default_mop) {
|
||||||
|
this.focus_on_default_mop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
after_render() {
|
after_render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user