[fixes] print format listing

This commit is contained in:
Saurabh 2015-12-17 09:48:44 +05:30
parent b109ee96de
commit cb98d9ec5f
4 changed files with 31 additions and 6 deletions

View File

@ -0,0 +1,9 @@
frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){
frappe.call({
method:"erpnext.accounts.doctype.payment_request.payment_request.get_print_format_list",
args: {"ref_doctype": frm.doc.reference_doctype},
callback:function(r){
set_field_options("print_format", r.message["print_format"])
}
})
})

View File

@ -218,7 +218,7 @@
"label": "Print Format",
"length": 0,
"no_copy": 0,
"options": "Standard\nPOS Invoice",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -410,7 +410,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2015-12-16 17:31:37.319394",
"modified": "2015-12-17 09:41:59.801913",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",

View File

@ -7,10 +7,10 @@ import frappe
from frappe.model.document import Document
from frappe.utils import flt, today
from frappe import _
from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_order,
get_payment_entry_against_invoice, get_payment_entry)
from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry
from erpnext.accounts.party import get_party_account
from erpnext.accounts.utils import get_account_currency, get_balance_on
from itertools import chain
class PaymentRequest(Document):
def validate(self):
@ -135,6 +135,8 @@ def make_payment_request(dt, dn, recipient_id=None):
"reference_doctype": dt,
"reference_name": dn
}).insert()
return pr.name
def get_reference_doc_details(dt, dn):
""" return reference doc Sales Order/Sales Invoice"""
@ -155,4 +157,16 @@ def get_amount(ref_doc, dt):
def get_gateway_details():
"""return gateway and payment account of default payment gateway"""
return frappe.db.get_value("Payment Gateway", {"is_default": 1}, ["gateway", "payment_account"])
return frappe.db.get_value("Payment Gateway", {"is_default": 1}, ["gateway", "payment_account"])
@frappe.whitelist()
def get_print_format_list(ref_doctype):
print_format_list = ["Standard"]
print_format_list.extend(list(chain.from_iterable(frappe.db.sql("""select name from `tabPrint Format`
where doc_type=%s""", ref_doctype, as_list=1))))
return {
"print_format": print_format_list
}

View File

@ -299,7 +299,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
"recipient_id": cur_frm.doc.contact_email
},
callback: function(r) {
if(!r.exc){
frappe.msgprint(__("payment Request generated"))
}
}
})
}