mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
set POS Invoice format only if its enabled (#15326)
This commit is contained in:
@@ -12,7 +12,7 @@ from erpnext.setup.utils import get_exchange_rate
|
|||||||
from erpnext.stock.get_item_details import get_pos_profile
|
from erpnext.stock.get_item_details import get_pos_profile
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.core.doctype.communication.email import make
|
from frappe.core.doctype.communication.email import make
|
||||||
from frappe.utils import nowdate
|
from frappe.utils import nowdate, cint
|
||||||
|
|
||||||
from six import string_types, iteritems
|
from six import string_types, iteritems
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ def make_email_queue(email_queue):
|
|||||||
name = frappe.db.get_value('Sales Invoice', {'offline_pos_name': key}, 'name')
|
name = frappe.db.get_value('Sales Invoice', {'offline_pos_name': key}, 'name')
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
sender = frappe.session.user
|
sender = frappe.session.user
|
||||||
print_format = "POS Invoice"
|
print_format = "POS Invoice" if not cint(frappe.db.get_value('Print Format', 'POS Invoice', 'disabled')) else None
|
||||||
attachments = [frappe.attach_print('Sales Invoice', name, print_format=print_format)]
|
attachments = [frappe.attach_print('Sales Invoice', name, print_format=print_format)]
|
||||||
|
|
||||||
make(subject=data.get('subject'), content=data.get('content'), recipients=data.get('recipients'),
|
make(subject=data.get('subject'), content=data.get('content'), recipients=data.get('recipients'),
|
||||||
|
|||||||
@@ -289,9 +289,13 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
super(SalesInvoice, self).set_missing_values(for_validate)
|
super(SalesInvoice, self).set_missing_values(for_validate)
|
||||||
|
|
||||||
|
print_format = pos.get("print_format_for_online")
|
||||||
|
if not print_format and not cint(frappe.db.get_value('Print Format', 'POS Invoice', 'disabled')):
|
||||||
|
print_format = 'POS Invoice'
|
||||||
|
|
||||||
if pos:
|
if pos:
|
||||||
return {
|
return {
|
||||||
"print_format": pos.get("print_format_for_online"),
|
"print_format": print_format,
|
||||||
"allow_edit_rate": pos.get("allow_user_to_edit_rate"),
|
"allow_edit_rate": pos.get("allow_user_to_edit_rate"),
|
||||||
"allow_edit_discount": pos.get("allow_user_to_edit_discount")
|
"allow_edit_discount": pos.get("allow_user_to_edit_discount")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.frm.cscript.calculate_taxes_and_totals();
|
this.frm.cscript.calculate_taxes_and_totals();
|
||||||
|
|
||||||
if (r.message) {
|
if (r.message) {
|
||||||
this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice';
|
this.frm.meta.default_print_format = r.message.print_format || "";
|
||||||
this.frm.allow_edit_rate = r.message.allow_edit_rate;
|
this.frm.allow_edit_rate = r.message.allow_edit_rate;
|
||||||
this.frm.allow_edit_discount = r.message.allow_edit_discount;
|
this.frm.allow_edit_discount = r.message.allow_edit_discount;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user