mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
[fix] pos default payment #3631
This commit is contained in:
@@ -401,7 +401,7 @@ erpnext.pos.PointOfSale = Class.extend({
|
|||||||
|
|
||||||
this.with_modes_of_payment(function() {
|
this.with_modes_of_payment(function() {
|
||||||
// prefer cash payment!
|
// prefer cash payment!
|
||||||
var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment :
|
var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment :
|
||||||
me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined;
|
me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined;
|
||||||
|
|
||||||
// show payment wizard
|
// show payment wizard
|
||||||
@@ -450,8 +450,7 @@ erpnext.pos.PointOfSale = Class.extend({
|
|||||||
|
|
||||||
if (is_cash && !dialog.get_value("change")) {
|
if (is_cash && !dialog.get_value("change")) {
|
||||||
// set to nearest 5
|
// set to nearest 5
|
||||||
var paid_amount = 5 * Math.ceil(dialog.get_value("total_amount") / 5);
|
dialog.set_value("paid_amount", dialog.get_value("total_amount"));
|
||||||
dialog.set_value("paid_amount", paid_amount);
|
|
||||||
dialog.get_input("paid_amount").trigger("change");
|
dialog.get_input("paid_amount").trigger("change");
|
||||||
}
|
}
|
||||||
}).trigger("change");
|
}).trigger("change");
|
||||||
@@ -487,6 +486,12 @@ erpnext.pos.PointOfSale = Class.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
erpnext.pos.make_pos_btn = function(frm) {
|
erpnext.pos.make_pos_btn = function(frm) {
|
||||||
|
frm.page.add_menu_item(__("{0} View", [frm.page.current_view_name === "pos" ? "Form" : "Point-of-Sale"]), function() {
|
||||||
|
erpnext.pos.toggle(frm);
|
||||||
|
});
|
||||||
|
|
||||||
|
if(frm.pos_btn) return;
|
||||||
|
|
||||||
// Show POS button only if it is enabled from features setup
|
// Show POS button only if it is enabled from features setup
|
||||||
if (cint(sys_defaults.fs_pos_view)!==1 || frm.doctype==="Material Request") {
|
if (cint(sys_defaults.fs_pos_view)!==1 || frm.doctype==="Material Request") {
|
||||||
return;
|
return;
|
||||||
@@ -494,7 +499,8 @@ erpnext.pos.make_pos_btn = function(frm) {
|
|||||||
|
|
||||||
if(!frm.pos_btn) {
|
if(!frm.pos_btn) {
|
||||||
frm.pos_btn = frm.page.add_action_icon("icon-th", function() {
|
frm.pos_btn = frm.page.add_action_icon("icon-th", function() {
|
||||||
erpnext.pos.toggle(frm) });
|
erpnext.pos.toggle(frm);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(erpnext.open_as_pos && frm.page.current_view_name !== "pos") {
|
if(erpnext.open_as_pos && frm.page.current_view_name !== "pos") {
|
||||||
|
|||||||
Reference in New Issue
Block a user