Merge pull request #3479 from nabinhait/develop

[fix][report] Payment period based on invoice date
This commit is contained in:
Nabin Hait 2015-06-16 15:29:14 +05:30
commit 0ee543e932
2 changed files with 14 additions and 7 deletions

View File

@ -65,8 +65,7 @@ class SalesInvoice(SellingController):
self.set_against_income_account() self.set_against_income_account()
self.validate_c_form() self.validate_c_form()
self.validate_time_logs_are_submitted() self.validate_time_logs_are_submitted()
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "items")
"items")
def on_submit(self): def on_submit(self):
super(SalesInvoice, self).on_submit() super(SalesInvoice, self).on_submit()

View File

@ -9,8 +9,9 @@ from frappe.utils import flt
def execute(filters=None): def execute(filters=None):
if not filters: filters = {} if not filters: filters = {}
validate_filters(filters)
columns = get_columns() columns = get_columns(filters)
entries = get_entries(filters) entries = get_entries(filters)
invoice_posting_date_map = get_invoice_posting_date_map(filters) invoice_posting_date_map = get_invoice_posting_date_map(filters)
against_date = "" against_date = ""
@ -37,10 +38,17 @@ def execute(filters=None):
return columns, data return columns, data
def get_columns(): def validate_filters(filters):
if (filters.get("payment_type") == "Incoming" and filters.get("party_type") == "Supplier") or \
(filters.get("payment_type") == "Outgoing" and filters.get("party_type") == "Customer"):
frappe.throw(_("{0} payment entries can not be filtered by {1}")\
.format(filters.payment_type, filters.party_type))
def get_columns(filters):
return [_("Journal Entry") + ":Link/Journal Entry:140", return [_("Journal Entry") + ":Link/Journal Entry:140",
_("Party Type") + ":Link/DocType:100", _("Party") + ":Dynamic Link/party_type:140", _("Party Type") + ":Link/DocType:100", _("Party") + ":Dynamic Link/Party Type:140",
_("Posting Date") + ":Date:100", _("Against Invoice") + ":Link/Purchase Invoice:130", _("Posting Date") + ":Date:100",
_("Against Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == "Outgoing" else ":Link/Sales Invoice:130"),
_("Against Invoice Posting Date") + ":Date:130", _("Debit") + ":Currency:120", _("Credit") + ":Currency:120", _("Against Invoice Posting Date") + ":Date:130", _("Debit") + ":Currency:120", _("Credit") + ":Currency:120",
_("Reference No") + "::100", _("Reference Date") + ":Date:100", _("Remarks") + "::150", _("Age") +":Int:40", _("Reference No") + "::100", _("Reference Date") + ":Date:100", _("Remarks") + "::150", _("Age") +":Int:40",
"0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", _("90-Above") + ":Currency:100" "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", _("90-Above") + ":Currency:100"