Merge pull request #2290 from ankitjavalkarwork/accreport

Bug Fixes
This commit is contained in:
Nabin Hait 2014-10-10 18:11:36 +05:30
commit c0a3cd603b
5 changed files with 36 additions and 6 deletions

View File

@ -76,13 +76,14 @@ class JournalVoucher(AccountsController):
def validate_entries_for_advance(self):
for d in self.get('entries'):
if not d.is_advance and not d.against_voucher and \
not d.against_invoice and not d.against_jv:
if not (d.against_voucher and d.against_invoice and d.against_jv) and d.is_advance in ["", "No"]:
master_type = frappe.db.get_value("Account", d.account, "master_type")
if (master_type == 'Customer' and flt(d.credit) > 0) or \
(master_type == 'Supplier' and flt(d.debit) > 0):
msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this \
is an advance entry.").format(d.idx, d.account))
if d.against_sales_order or d.against_purchase_order:
raise frappe.ValidationError
def validate_against_jv(self):
for d in self.get('entries'):
@ -177,7 +178,7 @@ class JournalVoucher(AccountsController):
def validate_against_order_fields(self, doctype, payment_against_voucher):
for voucher_no, payment_list in payment_against_voucher.items():
voucher_properties = frappe.db.get_value(doctype, voucher_no,
["docstatus", "per_billed", "advance_paid", "grand_total"])
["docstatus", "per_billed", "status", "advance_paid", "grand_total"])
if voucher_properties[0] != 1:
frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no))
@ -185,7 +186,10 @@ class JournalVoucher(AccountsController):
if flt(voucher_properties[1]) >= 100:
frappe.throw(_("{0} {1} is fully billed").format(doctype, voucher_no))
if flt(voucher_properties[3]) < flt(voucher_properties[2]) + flt(sum(payment_list)):
if cstr(voucher_properties[2]) == "Stopped":
frappe.throw(_("{0} {1} is stopped").format(doctype, voucher_no))
if flt(voucher_properties[4]) < flt(voucher_properties[3]) + flt(sum(payment_list)):
frappe.throw(_("Advance paid against {0} {1} cannot be greater \
than Grand Total {2}").format(doctype, voucher_no, voucher_properties[3]))

View File

@ -91,6 +91,7 @@ def get_orders_to_be_billed(party_type, party_name):
where
%s = %s
and docstatus = 1
and ifnull(status, "") != "Stopped"
and ifnull(grand_total, 0) > ifnull(advance_paid, 0)
and ifnull(per_billed, 0) < 100.0
""" % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'),

View File

@ -168,6 +168,27 @@
"reqd": 1,
"search_index": 0
},
{
"fieldname": "shipping_address_name",
"fieldtype": "Link",
"hidden": 1,
"in_filter": 1,
"label": "Shipping Address Name",
"options": "Address",
"permlevel": 0,
"precision": "",
"print_hide": 1
},
{
"fieldname": "shipping_address",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Shipping Address",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "currency_section",
"fieldtype": "Section Break",
@ -1192,7 +1213,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2014-10-08 14:23:05.034326",
"modified": "2014-10-10 16:54:22.284284",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@ -30,7 +30,8 @@ def execute(filters=None):
data = []
for gle in entries:
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date \
or (gle.against_voucher_type == "Purchase Order"):
voucher_details = voucher_detail_map.get(gle.voucher_type, {}).get(gle.voucher_no, {})
invoiced_amount = gle.credit > 0 and gle.credit or 0

View File

@ -79,6 +79,9 @@ class AccountsReceivableReport(object):
return (
# advance
(not gle.against_voucher) or
# against sales order
(gle.against_voucher_type == "Sales Order") or
# sales invoice
(gle.against_voucher==gle.voucher_no and gle.debit > 0) or