[Mod] Refactored the code for fetching allow_print_before_pay check value
This commit is contained in:
parent
d7da89bf5a
commit
32695a938f
@ -297,6 +297,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "allow_print_before_pay",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Allow Print Before Pay ",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@ -4563,7 +4593,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2018-01-11 14:02:48.829906",
|
||||
"modified": "2018-01-09 09:48:00.152026",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
@ -304,6 +304,8 @@ class SalesInvoice(SellingController):
|
||||
self.account_for_change_amount = frappe.db.get_value('Company', self.company, 'default_cash_account')
|
||||
|
||||
if pos:
|
||||
self.allow_print_before_pay = pos.allow_print_before_pay
|
||||
|
||||
if not for_validate and not self.customer:
|
||||
self.customer = pos.customer
|
||||
|
||||
|
@ -51,10 +51,10 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
},
|
||||
() => this.setup_company(),
|
||||
() => this.make_new_invoice(),
|
||||
() => this.set_form_action(),
|
||||
() => {
|
||||
frappe.dom.unfreeze();
|
||||
},
|
||||
() => this.fetch_pos_profile_data(),
|
||||
() => this.page.set_title(__('Point of Sale'))
|
||||
]);
|
||||
}
|
||||
@ -475,23 +475,6 @@ 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() {
|
||||
var me = this;
|
||||
this.page.clear_menu();
|
||||
|
@ -127,10 +127,4 @@ def item_group_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql(""" select distinct name from `tabItem Group`
|
||||
where {condition} and (name like %(txt)s) limit {start}, {page_len}"""
|
||||
.format(condition = cond, start=start, page_len= page_len),
|
||||
{'txt': '%%%s%%' % txt})
|
||||
|
||||
@frappe.whitelist()
|
||||
def fetch_pos_profile_detail(pos_profile):
|
||||
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
|
||||
{'txt': '%%%s%%' % txt})
|
Loading…
x
Reference in New Issue
Block a user