[Mod] point_of_sale.js: Allowed print before pay and saved the invoice before print

[New] test_point_of_sale.js: Test Cases to check the print before pay functionality in Online POS
This commit is contained in:
deepak-mnt 2018-01-06 15:38:39 +05:30 committed by Saurabh
parent 29abe291c9
commit 1ccb0cfa2f
3 changed files with 19 additions and 10 deletions

View File

@ -519,13 +519,20 @@ erpnext.pos.PointOfSale = class PointOfSale {
if(this.frm.doc.docstatus == 1 || this.frm.doc.allow_print_before_pay == 1){
this.page.set_secondary_action(__("Print"), () => {
this.frm.print_preview.printit(true);
if(this.frm.doc.docstatus != 1 ){
this.frm.save();
setTimeout(() => {this.frm.print_preview.printit(true);}, 1700);
}else{
this.frm.print_preview.printit(true);
}
});
}
this.page.set_primary_action(__("New"), () => {
this.make_new_invoice();
});
this.page.set_primary_action(__("New"), () => {
this.make_new_invoice();
});
if (this.frm.doc.docstatus == 1) {
this.page.add_menu_item(__("Email"), () => {
this.frm.email_doc();
});

View File

@ -127,7 +127,6 @@ def item_group_query(doctype, txt, searchfield, start, page_len, filters):
@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
pos_profile_doc = frappe.get_doc("POS Profile",pos_profile)
allow_print_before_pay_check = pos_profile_doc.allow_print_before_pay
return allow_print_before_pay_check

View File

@ -13,6 +13,9 @@ QUnit.test("test:Point of Sales", function(assert) {
() => frappe.timeout(0.2),
() => frappe.click_element(`.cart-items [data-item-code="Test Product 2"]`),
() => frappe.timeout(0.2),
() => frappe.click_element(`.btn-secondary`),
() => frappe.timeout(0.4),
() => assert.ok(!cur_frm.doc.__islocal, "Sales invoice saved"),
() => frappe.click_element(`.number-pad [data-value="Rate"]`),
() => frappe.timeout(0.2),
() => frappe.click_element(`.number-pad [data-value="2"]`),