Get outstanding invoices on payment entry

This commit is contained in:
Nabin Hait 2017-12-15 17:31:53 +05:30
parent b9ca91a832
commit 2afcff1852
2 changed files with 44 additions and 34 deletions

View File

@ -508,13 +508,18 @@ def get_outstanding_reference_documents(args):
# Get negative outstanding sales /purchase invoices # Get negative outstanding sales /purchase invoices
negative_outstanding_invoices = [] negative_outstanding_invoices = []
if args.get("party_type") not in ["Student", "Employee"]: if args.get("party_type") not in ["Student", "Employee"] and not args.get("voucher_no"):
negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"), negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"),
args.get("party"), args.get("party_account"), party_account_currency, company_currency) args.get("party"), args.get("party_account"), party_account_currency, company_currency)
# Get positive outstanding sales /purchase invoices/ Fees # Get positive outstanding sales /purchase invoices/ Fees
condition = ""
if args.get("voucher_type") and args.get("voucher_no"):
condition = " and voucher_type='{0}' and voucher_no='{1}'"\
.format(frappe.db.escape(args["voucher_type"]), frappe.db.escape(args["voucher_no"]))
outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"), outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"),
args.get("party_account")) args.get("party_account"), condition=condition)
for d in outstanding_invoices: for d in outstanding_invoices:
d["exchange_rate"] = 1 d["exchange_rate"] = 1
@ -803,8 +808,13 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
}) })
else: else:
args = { args = {
'party_account': party_account, 'company': pe.company, 'party_type': pe.party_type, 'party_account': party_account,
'party': pe.party, 'posting_date': pe.posting_date 'company': pe.company,
'party_type': pe.party_type,
'party': pe.party,
'posting_date': pe.posting_date,
'voucher_type': dt,
'voucher_no': dn
} }
references = get_outstanding_reference_documents(args=args) references = get_outstanding_reference_documents(args=args)

View File

@ -357,34 +357,6 @@
"unique": 0, "unique": 0,
"width": "100px" "width": "100px"
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -419,6 +391,34 @@
"unique": 0, "unique": 0,
"width": "100px" "width": "100px"
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -898,8 +898,8 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-10-25 17:18:59.974778", "modified": "2017-12-15 16:29:18.902085",
"modified_by": "Administrator", "modified_by": "nabinhait@gmail.com",
"module": "Stock", "module": "Stock",
"name": "Material Request Item", "name": "Material Request Item",
"owner": "Administrator", "owner": "Administrator",