fix: added Show Remarks checkbox in AR & AP reports (#27374)

This commit is contained in:
Anuja Pawar 2021-09-09 11:57:29 +05:30 committed by GitHub
parent 295020451f
commit 3576668638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 39 deletions

View File

@ -4,7 +4,7 @@
frappe.query_reports["Accounts Payable"] = { frappe.query_reports["Accounts Payable"] = {
"filters": [ "filters": [
{ {
"fieldname":"company", "fieldname": "company",
"label": __("Company"), "label": __("Company"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
@ -12,19 +12,19 @@ frappe.query_reports["Accounts Payable"] = {
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company")
}, },
{ {
"fieldname":"report_date", "fieldname": "report_date",
"label": __("Posting Date"), "label": __("Posting Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": frappe.datetime.get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"finance_book", "fieldname": "finance_book",
"label": __("Finance Book"), "label": __("Finance Book"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Finance Book" "options": "Finance Book"
}, },
{ {
"fieldname":"cost_center", "fieldname": "cost_center",
"label": __("Cost Center"), "label": __("Cost Center"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Cost Center", "options": "Cost Center",
@ -38,7 +38,7 @@ frappe.query_reports["Accounts Payable"] = {
} }
}, },
{ {
"fieldname":"supplier", "fieldname": "supplier",
"label": __("Supplier"), "label": __("Supplier"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Supplier", "options": "Supplier",
@ -54,48 +54,48 @@ frappe.query_reports["Accounts Payable"] = {
} }
}, },
{ {
"fieldname":"ageing_based_on", "fieldname": "ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date\nDue Date\nSupplier Invoice Date', "options": 'Posting Date\nDue Date\nSupplier Invoice Date',
"default": "Due Date" "default": "Due Date"
}, },
{ {
"fieldname":"range1", "fieldname": "range1",
"label": __("Ageing Range 1"), "label": __("Ageing Range 1"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "30", "default": "30",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"range2", "fieldname": "range2",
"label": __("Ageing Range 2"), "label": __("Ageing Range 2"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "60", "default": "60",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"range3", "fieldname": "range3",
"label": __("Ageing Range 3"), "label": __("Ageing Range 3"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "90", "default": "90",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"range4", "fieldname": "range4",
"label": __("Ageing Range 4"), "label": __("Ageing Range 4"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "120", "default": "120",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"payment_terms_template", "fieldname": "payment_terms_template",
"label": __("Payment Terms Template"), "label": __("Payment Terms Template"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Payment Terms Template" "options": "Payment Terms Template"
}, },
{ {
"fieldname":"supplier_group", "fieldname": "supplier_group",
"label": __("Supplier Group"), "label": __("Supplier Group"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Supplier Group" "options": "Supplier Group"
@ -106,12 +106,17 @@ frappe.query_reports["Accounts Payable"] = {
"fieldtype": "Check" "fieldtype": "Check"
}, },
{ {
"fieldname":"based_on_payment_terms", "fieldname": "based_on_payment_terms",
"label": __("Based On Payment Terms"), "label": __("Based On Payment Terms"),
"fieldtype": "Check", "fieldtype": "Check",
}, },
{ {
"fieldname":"tax_id", "fieldname": "show_remarks",
"label": __("Show Remarks"),
"fieldtype": "Check",
},
{
"fieldname": "tax_id",
"label": __("Tax Id"), "label": __("Tax Id"),
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1 "hidden": 1

View File

@ -4,7 +4,7 @@
frappe.query_reports["Accounts Receivable"] = { frappe.query_reports["Accounts Receivable"] = {
"filters": [ "filters": [
{ {
"fieldname":"company", "fieldname": "company",
"label": __("Company"), "label": __("Company"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
@ -12,19 +12,19 @@ frappe.query_reports["Accounts Receivable"] = {
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company")
}, },
{ {
"fieldname":"report_date", "fieldname": "report_date",
"label": __("Posting Date"), "label": __("Posting Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": frappe.datetime.get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"finance_book", "fieldname": "finance_book",
"label": __("Finance Book"), "label": __("Finance Book"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Finance Book" "options": "Finance Book"
}, },
{ {
"fieldname":"cost_center", "fieldname": "cost_center",
"label": __("Cost Center"), "label": __("Cost Center"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Cost Center", "options": "Cost Center",
@ -38,7 +38,7 @@ frappe.query_reports["Accounts Receivable"] = {
} }
}, },
{ {
"fieldname":"customer", "fieldname": "customer",
"label": __("Customer"), "label": __("Customer"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Customer", "options": "Customer",
@ -67,66 +67,66 @@ frappe.query_reports["Accounts Receivable"] = {
} }
}, },
{ {
"fieldname":"ageing_based_on", "fieldname": "ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date\nDue Date', "options": 'Posting Date\nDue Date',
"default": "Due Date" "default": "Due Date"
}, },
{ {
"fieldname":"range1", "fieldname": "range1",
"label": __("Ageing Range 1"), "label": __("Ageing Range 1"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "30", "default": "30",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"range2", "fieldname": "range2",
"label": __("Ageing Range 2"), "label": __("Ageing Range 2"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "60", "default": "60",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"range3", "fieldname": "range3",
"label": __("Ageing Range 3"), "label": __("Ageing Range 3"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "90", "default": "90",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"range4", "fieldname": "range4",
"label": __("Ageing Range 4"), "label": __("Ageing Range 4"),
"fieldtype": "Int", "fieldtype": "Int",
"default": "120", "default": "120",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname":"customer_group", "fieldname": "customer_group",
"label": __("Customer Group"), "label": __("Customer Group"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Customer Group" "options": "Customer Group"
}, },
{ {
"fieldname":"payment_terms_template", "fieldname": "payment_terms_template",
"label": __("Payment Terms Template"), "label": __("Payment Terms Template"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Payment Terms Template" "options": "Payment Terms Template"
}, },
{ {
"fieldname":"sales_partner", "fieldname": "sales_partner",
"label": __("Sales Partner"), "label": __("Sales Partner"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Sales Partner" "options": "Sales Partner"
}, },
{ {
"fieldname":"sales_person", "fieldname": "sales_person",
"label": __("Sales Person"), "label": __("Sales Person"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Sales Person" "options": "Sales Person"
}, },
{ {
"fieldname":"territory", "fieldname": "territory",
"label": __("Territory"), "label": __("Territory"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Territory" "options": "Territory"
@ -137,45 +137,50 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldtype": "Check" "fieldtype": "Check"
}, },
{ {
"fieldname":"based_on_payment_terms", "fieldname": "based_on_payment_terms",
"label": __("Based On Payment Terms"), "label": __("Based On Payment Terms"),
"fieldtype": "Check", "fieldtype": "Check",
}, },
{ {
"fieldname":"show_future_payments", "fieldname": "show_future_payments",
"label": __("Show Future Payments"), "label": __("Show Future Payments"),
"fieldtype": "Check", "fieldtype": "Check",
}, },
{ {
"fieldname":"show_delivery_notes", "fieldname": "show_delivery_notes",
"label": __("Show Linked Delivery Notes"), "label": __("Show Linked Delivery Notes"),
"fieldtype": "Check", "fieldtype": "Check",
}, },
{ {
"fieldname":"show_sales_person", "fieldname": "show_sales_person",
"label": __("Show Sales Person"), "label": __("Show Sales Person"),
"fieldtype": "Check", "fieldtype": "Check",
}, },
{ {
"fieldname":"tax_id", "fieldname": "show_remarks",
"label": __("Show Remarks"),
"fieldtype": "Check",
},
{
"fieldname": "tax_id",
"label": __("Tax Id"), "label": __("Tax Id"),
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1 "hidden": 1
}, },
{ {
"fieldname":"customer_name", "fieldname": "customer_name",
"label": __("Customer Name"), "label": __("Customer Name"),
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1 "hidden": 1
}, },
{ {
"fieldname":"payment_terms", "fieldname": "payment_terms",
"label": __("Payment Tems"), "label": __("Payment Tems"),
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1 "hidden": 1
}, },
{ {
"fieldname":"credit_limit", "fieldname": "credit_limit",
"label": __("Credit Limit"), "label": __("Credit Limit"),
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1 "hidden": 1

View File

@ -106,6 +106,7 @@ class ReceivablePayableReport(object):
party = gle.party, party = gle.party,
posting_date = gle.posting_date, posting_date = gle.posting_date,
account_currency = gle.account_currency, account_currency = gle.account_currency,
remarks = gle.remarks if self.filters.get("show_remarks") else None,
invoiced = 0.0, invoiced = 0.0,
paid = 0.0, paid = 0.0,
credit_note = 0.0, credit_note = 0.0,
@ -583,10 +584,12 @@ class ReceivablePayableReport(object):
else: else:
select_fields = "debit, credit" select_fields = "debit, credit"
remarks = ", remarks" if self.filters.get("show_remarks") else ""
self.gl_entries = frappe.db.sql(""" self.gl_entries = frappe.db.sql("""
select select
name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center, name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center,
against_voucher_type, against_voucher, account_currency, {0} against_voucher_type, against_voucher, account_currency, {0} {remarks}
from from
`tabGL Entry` `tabGL Entry`
where where
@ -595,7 +598,7 @@ class ReceivablePayableReport(object):
and party_type=%s and party_type=%s
and (party is not null and party != '') and (party is not null and party != '')
{1} {2} {3}""" {1} {2} {3}"""
.format(select_fields, date_condition, conditions, order_by), values, as_dict=True) .format(select_fields, date_condition, conditions, order_by, remarks=remarks), values, as_dict=True)
def get_sales_invoices_or_customers_based_on_sales_person(self): def get_sales_invoices_or_customers_based_on_sales_person(self):
if self.filters.get("sales_person"): if self.filters.get("sales_person"):
@ -754,6 +757,10 @@ class ReceivablePayableReport(object):
self.add_column(label=_('Voucher Type'), fieldname='voucher_type', fieldtype='Data') self.add_column(label=_('Voucher Type'), fieldname='voucher_type', fieldtype='Data')
self.add_column(label=_('Voucher No'), fieldname='voucher_no', fieldtype='Dynamic Link', self.add_column(label=_('Voucher No'), fieldname='voucher_no', fieldtype='Dynamic Link',
options='voucher_type', width=180) options='voucher_type', width=180)
if self.filters.show_remarks:
self.add_column(label=_('Remarks'), fieldname='remarks', fieldtype='Text', width=200),
self.add_column(label='Due Date', fieldtype='Date') self.add_column(label='Due Date', fieldtype='Date')
if self.party_type == "Supplier": if self.party_type == "Supplier":