feat: create payment order from payment entry
This commit is contained in:
parent
ac1ce5d205
commit
f5a1bea189
@ -967,3 +967,23 @@ def get_party_and_account_balance(company, date, paid_from=None, paid_to=None, p
|
|||||||
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center),
|
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center),
|
||||||
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center)
|
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def make_payment_order(source_name, target_doc=None):
|
||||||
|
def set_missing_values(source, target):
|
||||||
|
target.append('references', {
|
||||||
|
'amount': source.base_paid_amount,
|
||||||
|
'supplier': source.party,
|
||||||
|
'payment_request': source_name,
|
||||||
|
'mode_of_payment': source.mode_of_payment,
|
||||||
|
'bank_account': source.bank_account,
|
||||||
|
'account': source.account
|
||||||
|
})
|
||||||
|
|
||||||
|
doclist = get_mapped_doc("Payment Request", source_name, {
|
||||||
|
"Payment Request": {
|
||||||
|
"doctype": "Payment Order",
|
||||||
|
}
|
||||||
|
}, target_doc, set_missing_values)
|
||||||
|
|
||||||
|
return doclist
|
||||||
|
@ -7,6 +7,9 @@ frappe.ui.form.on('Payment Order', {
|
|||||||
frm.add_custom_button(__('Payment Request'), function() {
|
frm.add_custom_button(__('Payment Request'), function() {
|
||||||
frm.trigger("get_from_payment_request");
|
frm.trigger("get_from_payment_request");
|
||||||
}, __("Get from"));
|
}, __("Get from"));
|
||||||
|
frm.add_custom_button(__('Payment Entry'), function() {
|
||||||
|
frm.trigger("get_from_payment_entry");
|
||||||
|
}, __("Get from"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// payment Entry
|
// payment Entry
|
||||||
@ -18,6 +21,22 @@ frappe.ui.form.on('Payment Order', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get_from_payment_entry: function(frm) {
|
||||||
|
erpnext.utils.map_current_doc({
|
||||||
|
method: "erpnext.accounts.doctype.payment_entry.payment_entry.make_payment_order",
|
||||||
|
source_doctype: "Payment Entry",
|
||||||
|
target: frm,
|
||||||
|
date_field: "posting_date",
|
||||||
|
setters: {
|
||||||
|
party: frm.doc.supplier || ""
|
||||||
|
},
|
||||||
|
get_query_filters: {
|
||||||
|
bank: frm.doc.bank,
|
||||||
|
docstatus: 1,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
get_from_payment_request: function(frm) {
|
get_from_payment_request: function(frm) {
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.accounts.doctype.payment_request.payment_request.make_payment_order",
|
method: "erpnext.accounts.doctype.payment_request.payment_request.make_payment_order",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user