codacy and typo fixes

This commit is contained in:
tunde 2017-08-19 15:01:40 +01:00
parent c7f46218d7
commit fb144303f5
12 changed files with 14 additions and 21 deletions

View File

@ -779,7 +779,7 @@ def get_paid_amount(dt, dn, party_type, party, account, due_date):
dr_or_cr = "credit_in_account_currency - debit_in_account_currency" dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
else: else:
dr_or_cr = "debit_in_account_currency - credit_in_account_currency" dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
paid_amount = frappe.db.sql(""" paid_amount = frappe.db.sql("""
select ifnull(sum({dr_or_cr}), 0) as paid_amount select ifnull(sum({dr_or_cr}), 0) as paid_amount
from `tabGL Entry` from `tabGL Entry`

View File

@ -3,8 +3,8 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class PaymentSchedule(Document): class PaymentSchedule(Document):
pass pass

View File

@ -1,8 +1,2 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Payment Term', {
refresh: function(frm) {
}
});

View File

@ -3,8 +3,8 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class PaymentTerm(Document): class PaymentTerm(Document):
pass pass

View File

@ -2,9 +2,8 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestPaymentTerm(unittest.TestCase): class TestPaymentTerm(unittest.TestCase):
pass pass

View File

@ -3,8 +3,8 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class PaymentTermsTemplate(Document): class PaymentTermsTemplate(Document):
pass pass

View File

@ -2,9 +2,8 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestPaymentTermsTemplate(unittest.TestCase): class TestPaymentTermsTemplate(unittest.TestCase):
pass pass

View File

@ -3,8 +3,8 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class PaymentTermsTemplateDetail(Document): class PaymentTermsTemplateDetail(Document):
pass pass

View File

@ -252,6 +252,7 @@ class TestPricingRule(unittest.TestCase):
self.assertEquals(so.items[0].rate, 100) self.assertEquals(so.items[0].rate, 100)
def test_pricing_rule_with_margin_and_discount(self): def test_pricing_rule_with_margin_and_discount(self):
frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule')
make_pricing_rule(selling=1, margin_type="Percentage", margin_rate_or_amount=10) make_pricing_rule(selling=1, margin_type="Percentage", margin_rate_or_amount=10)
si = create_sales_invoice(do_not_save=True) si = create_sales_invoice(do_not_save=True)
si.items[0].price_list_rate = 1000 si.items[0].price_list_rate = 1000

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, erpnext import frappe, erpnext
import frappe.defaults import frappe.defaults
from frappe.utils import cint, flt, getdate from frappe.utils import cint, flt
from frappe import _, msgprint, throw from frappe import _, msgprint, throw
from erpnext.accounts.party import get_party_account, get_due_date from erpnext.accounts.party import get_party_account, get_due_date
from erpnext.controllers.stock_controller import update_gl_entries_after from erpnext.controllers.stock_controller import update_gl_entries_after

View File

@ -616,7 +616,8 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
}, as_dict=True) }, as_dict=True)
for d in invoice_list: for d in invoice_list:
print d.voucher_no, d.invoice_amount, d.payment_amount due_date = d.due_date or (frappe.db.get_value(d.voucher_type, d.voucher_no,
"posting_date" if party_type=="Employee" else "due_date"))
outstanding_invoices.append(frappe._dict({ outstanding_invoices.append(frappe._dict({
'voucher_no': d.voucher_no, 'voucher_no': d.voucher_no,
'voucher_type': d.voucher_type, 'voucher_type': d.voucher_type,
@ -624,8 +625,7 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
'invoice_amount': flt(d.invoice_amount), 'invoice_amount': flt(d.invoice_amount),
'payment_amount': flt(d.payment_amount), 'payment_amount': flt(d.payment_amount),
'outstanding_amount': flt(d.invoice_amount - d.payment_amount, precision), 'outstanding_amount': flt(d.invoice_amount - d.payment_amount, precision),
'due_date': d.due_date or (frappe.db.get_value(d.voucher_type, d.voucher_no, 'due_date': due_date
"posting_date" if party_type=="Employee" else "due_date")),
})) }))
outstanding_invoices = sorted(outstanding_invoices, key=lambda k: k['due_date'] or getdate(nowdate())) outstanding_invoices = sorted(outstanding_invoices, key=lambda k: k['due_date'] or getdate(nowdate()))

View File

@ -643,7 +643,7 @@ class AccountsController(TransactionBase):
total += flt(d.payment_amount) total += flt(d.payment_amount)
if total != self.grand_total: if total != self.grand_total:
frappe.throw(_("Total Payment Amount in Payment Schdule must be equal to Grand Total")) frappe.throw(_("Total Payment Amount in Payment Schedule must be equal to Grand Total"))
@frappe.whitelist() @frappe.whitelist()
@ -824,7 +824,7 @@ def get_payment_terms(terms_template, posting_date=None, grand_total=None):
terms_doc = frappe.get_doc("Payment Terms Template", terms_template) terms_doc = frappe.get_doc("Payment Terms Template", terms_template)
schedule = [] schedule = []
for i, d in enumerate(terms_doc.get("terms")): for d in terms_doc.get("terms"):
term_details = get_payment_term_details(d, posting_date, grand_total) term_details = get_payment_term_details(d, posting_date, grand_total)
schedule.append(term_details) schedule.append(term_details)