Browse Source

refactor: rename checkbox and translations

- rename checkbox and make it
 - added translation text for labels
 - fixes for linter error
develop
ruthra 3 years ago
parent
commit
9ec8841b91
  1. 22
      erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py
  2. 4
      erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py

22
erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py

@ -2,7 +2,7 @@
# License: MIT. See LICENSE
import frappe
from frappe import qb
from frappe import _, qb
from frappe.query_builder import Column, functions
from frappe.utils import add_days, date_diff, flt, get_first_day, get_last_day, rounded
@ -352,11 +352,15 @@ class Deferred_Revenue_and_Expense_Report(object):
def get_columns(self):
columns = []
columns.append({"label": "Name", "fieldname": "name", "fieldtype": "Data", "read_only": 1})
columns.append({"label": _("Name"), "fieldname": "name", "fieldtype": "Data", "read_only": 1})
for period in self.period_list:
columns.append(
{"label": period.label, "fieldname": period.key, "fieldtype": "Currency", "read_only": 1,}
)
{
"label": _(period.label),
"fieldname": period.key,
"fieldtype": "Currency",
"read_only": 1,
})
return columns
def generate_report_data(self):
@ -393,8 +397,7 @@ class Deferred_Revenue_and_Expense_Report(object):
"name": "Actual Posting",
"chartType": "bar",
"values": [x.actual for x in self.period_total],
},
{"name": "Expected", "chartType": "line", "values": [x.total for x in self.period_total],},
}
],
},
"type": "axis-mixed",
@ -403,6 +406,13 @@ class Deferred_Revenue_and_Expense_Report(object):
"barOptions": {"stacked": False, "spaceRatio": 0.5},
}
if self.filters.with_upcoming_postings:
chart["data"]["datasets"].append({
"name": "Expected",
"chartType": "line",
"values": [x.total for x in self.period_total]
})
return chart
def run(self, *args, **kwargs):

4
erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py

@ -1,9 +1,8 @@
import datetime
import unittest
import frappe
from frappe import qb
from frappe.utils import add_months, nowdate
from frappe.utils import nowdate
from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
@ -123,6 +122,7 @@ class TestDeferredRevenueAndExpense(unittest.TestCase):
supplier = create_supplier(
supplier_name="_Test Furniture Supplier", supplier_group="Local", supplier_type="Company"
)
supplier.save()
item = create_item(
"_Test Office Desk",

Loading…
Cancel
Save