mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 22:19:18 +00:00
Allow draft mode print in online POS
This commit is contained in:
@@ -50,11 +50,11 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.set_online_status();
|
this.set_online_status();
|
||||||
},
|
},
|
||||||
() => this.setup_company(),
|
() => this.setup_company(),
|
||||||
|
|
||||||
() => this.make_new_invoice(),
|
() => this.make_new_invoice(),
|
||||||
() => {
|
() => {
|
||||||
frappe.dom.unfreeze();
|
frappe.dom.unfreeze();
|
||||||
},
|
},
|
||||||
|
() => this.fetch_pos_profile_data(),
|
||||||
() => this.page.set_title(__('Point of Sale'))
|
() => this.page.set_title(__('Point of Sale'))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -471,6 +471,23 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetch_pos_profile_data() {
|
||||||
|
var me = this;
|
||||||
|
me.frm.doc["allow_print_before_pay"] = 0;
|
||||||
|
return new Promise(resolve => {
|
||||||
|
return this.frm.call({
|
||||||
|
method: "erpnext.selling.page.point_of_sale.point_of_sale.fetch_pos_profile_detail",
|
||||||
|
args:{
|
||||||
|
pos_profile : me.frm.doc.pos_profile
|
||||||
|
}
|
||||||
|
}).then((r) => {
|
||||||
|
me.frm.doc["allow_print_before_pay"] = r.message;
|
||||||
|
this.set_form_action();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
prepare_menu() {
|
prepare_menu() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.page.clear_menu();
|
this.page.clear_menu();
|
||||||
@@ -499,19 +516,20 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_form_action() {
|
set_form_action() {
|
||||||
if(this.frm.doc.docstatus !== 1) return;
|
if(this.frm.doc.docstatus == 1 || this.frm.doc.allow_print_before_pay == 1){
|
||||||
|
|
||||||
this.page.set_secondary_action(__("Print"), () => {
|
this.page.set_secondary_action(__("Print"), () => {
|
||||||
this.frm.print_preview.printit(true);
|
this.frm.print_preview.printit(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.page.set_primary_action(__("New"), () => {
|
this.page.set_primary_action(__("New"), () => {
|
||||||
this.make_new_invoice();
|
this.make_new_invoice();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.page.add_menu_item(__("Email"), () => {
|
this.page.add_menu_item(__("Email"), () => {
|
||||||
this.frm.email_doc();
|
this.frm.email_doc();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -124,3 +124,10 @@ def item_group_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
where {condition} and (name like %(txt)s) limit {start}, {page_len}"""
|
where {condition} and (name like %(txt)s) limit {start}, {page_len}"""
|
||||||
.format(condition = cond, start=start, page_len= page_len),
|
.format(condition = cond, start=start, page_len= page_len),
|
||||||
{'txt': '%%%s%%' % txt})
|
{'txt': '%%%s%%' % txt})
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def fetch_pos_profile_detail(pos_profile):
|
||||||
|
doc_detail=frappe.get_doc("POS Profile",pos_profile)
|
||||||
|
print_check=doc_detail.allow_print_before_pay
|
||||||
|
return print_check
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user