Payment Entry minor improvements

This commit is contained in:
Nabin Hait 2016-07-04 16:16:24 +05:30
parent 1d797f717b
commit e4bbb696ab
4 changed files with 43 additions and 45 deletions

View File

@ -848,32 +848,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "difference_amount",
"fieldname": "write_off_difference_amount",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Difference Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -976,6 +950,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "difference_amount",
"fieldname": "write_off_difference_amount",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Difference Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -1372,7 +1372,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-07-01 17:14:17.562924",
"modified": "2016-07-04 15:00:53.731584",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",

View File

@ -194,7 +194,7 @@ class PaymentEntry(AccountsController):
""", (self.party_account, self.party, d.reference_name), as_dict=True)
if not je_accounts:
frappe.throw(_("Row #{0}: Journal Entry {0} does not have account {1} or already matched against another voucher")
frappe.throw(_("Row #{0}: Journal Entry {1} does not have account {2} or already matched against another voucher")
.format(d.idx, d.reference_name, self.party_account))
else:
dr_or_cr = "debit" if self.payment_type == "Receive" else "credit"
@ -270,6 +270,7 @@ class PaymentEntry(AccountsController):
def validate_payment_against_negative_invoice(self):
if ((self.payment_type=="Pay" and self.party_type=="Customer")
or (self.payment_type=="Receive" and self.party_type=="Supplier")):
total_negative_outstanding = sum([abs(flt(d.outstanding_amount))
for d in self.get("references") if flt(d.outstanding_amount) < 0])
@ -535,6 +536,7 @@ def get_party_details(company, party_type, party, date):
@frappe.whitelist()
def get_account_details(account, date):
frappe.has_permission('Payment Entry', throw=True)
return frappe._dict({
"account_currency": get_account_currency(account),
"account_balance": get_balance_on(account, date),

View File

@ -434,15 +434,13 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
payment_dr_or_cr = "payment_gl_entry.debit_in_account_currency - payment_gl_entry.credit_in_account_currency"
invoice_list = frappe.db.sql("""select
voucher_no, voucher_type, posting_date,
ifnull(sum({dr_or_cr}), 0) as invoice_amount,
invoice_list = frappe.db.sql("""
select
voucher_no, voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount,
(
select
ifnull(sum({payment_dr_or_cr}), 0)
select ifnull(sum({payment_dr_or_cr}), 0)
from `tabGL Entry` payment_gl_entry
where
payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
where payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
and payment_gl_entry.against_voucher = invoice_gl_entry.voucher_no
and payment_gl_entry.party_type = invoice_gl_entry.party_type
and payment_gl_entry.party = invoice_gl_entry.party
@ -452,10 +450,8 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
from
`tabGL Entry` invoice_gl_entry
where
party_type = %(party_type)s
and party = %(party)s
and account = %(account)s
and {dr_or_cr} > 0
party_type = %(party_type)s and party = %(party)s
and account = %(account)s and {dr_or_cr} > 0
{condition}
and ((voucher_type = 'Journal Entry'
and (against_voucher = '' or against_voucher is null))

View File

@ -21,10 +21,15 @@ def get_data():
"name": "Payment Request",
"description": _("Payment Request")
},
{
"type": "doctype",
"name": "Payment Entry",
"description": _("Bank/Cash transactions against party or for internal transfer")
},
{
"type": "report",
"name": "Accounts Receivable",
"doctype": "Sales Invoice",
"doctype": "Sales Invoice",
"is_query_report": True
},
{
@ -44,11 +49,6 @@ def get_data():
"name": "Company",
"description": _("Company (not Customer or Supplier) master.")
},
{
"type": "doctype",
"name": "Payment Entry",
"description": _("Payment entries against party or for internal transfer")
},
{
"type": "doctype",
"name": "Journal Entry",