codacy review

This commit is contained in:
tundebabzy 2018-03-02 12:27:12 +01:00
parent 9e863b9572
commit e13570f343
14 changed files with 52 additions and 83 deletions

View File

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

View File

@ -3,7 +3,6 @@
# 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 Subscriber(Document): class Subscriber(Document):

View File

@ -3,7 +3,6 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestSubscriber(unittest.TestCase): class TestSubscriber(unittest.TestCase):

View File

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

View File

@ -3,7 +3,6 @@
# 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 SubscriptionInvoice(Document): class SubscriptionInvoice(Document):

View File

@ -3,7 +3,6 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestSubscriptionInvoice(unittest.TestCase): class TestSubscriptionInvoice(unittest.TestCase):

View File

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

View File

@ -3,7 +3,6 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestSubscriptionPlan(unittest.TestCase): class TestSubscriptionPlan(unittest.TestCase):

View File

@ -3,7 +3,6 @@
# 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 SubscriptionPlanDetail(Document): class SubscriptionPlanDetail(Document):

View File

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

View File

@ -3,7 +3,6 @@
# 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 SubscriptionSettings(Document): class SubscriptionSettings(Document):

View File

@ -3,7 +3,6 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestSubscriptionSettings(unittest.TestCase): class TestSubscriptionSettings(unittest.TestCase):

View File

@ -30,7 +30,6 @@ class Subscriptions(Document):
def set_current_invoice_start(self, date=None): def set_current_invoice_start(self, date=None):
""" """
This sets the date of the beginning of the current billing period. This sets the date of the beginning of the current billing period.
If the `date` parameter is not given , it will be automatically set as today's If the `date` parameter is not given , it will be automatically set as today's
date. date.
""" """
@ -276,8 +275,7 @@ class Subscriptions(Document):
if self.additional_discount_amount: if self.additional_discount_amount:
invoice.additional_discount_amount = self.additional_discount_amount invoice.additional_discount_amount = self.additional_discount_amount
if (self.additional_discount_percentage or self.additional_discount_amount) \ if not self.apply_additional_discount and (self.additional_discount_percentage or self.additional_discount_amount):
and not self.apply_additional_discount:
self.apply_additional_discount = 'Grand Total' self.apply_additional_discount = 'Grand Total'
invoice.save() invoice.save()

View File

@ -10,8 +10,7 @@ from erpnext.accounts.doctype.subscriptions.subscriptions import get_prorata_fac
from frappe.utils.data import nowdate, add_days, add_to_date, add_months, date_diff from frappe.utils.data import nowdate, add_days, add_to_date, add_months, date_diff
class TestSubscriptions(unittest.TestCase): def create_plan():
def create_plan(self):
if not frappe.db.exists('Subscription Plan', '_Test Plan Name'): if not frappe.db.exists('Subscription Plan', '_Test Plan Name'):
plan = frappe.new_doc('Subscription Plan') plan = frappe.new_doc('Subscription Plan')
plan.plan_name = '_Test Plan Name' plan.plan_name = '_Test Plan Name'
@ -39,16 +38,20 @@ class TestSubscriptions(unittest.TestCase):
plan.billing_interval_count = 14 plan.billing_interval_count = 14
plan.insert() plan.insert()
def create_subscriber(self):
def create_subscriber():
if not frappe.db.exists('Subscriber', '_Test Customer'): if not frappe.db.exists('Subscriber', '_Test Customer'):
subscriber = frappe.new_doc('Subscriber') subscriber = frappe.new_doc('Subscriber')
subscriber.subscriber_name = '_Test Customer' subscriber.subscriber_name = '_Test Customer'
subscriber.customer = '_Test Customer' subscriber.customer = '_Test Customer'
subscriber.insert() subscriber.insert()
class TestSubscriptions(unittest.TestCase):
def setUp(self): def setUp(self):
self.create_plan() create_plan()
self.create_subscriber() create_subscriber()
def test_create_subscription_with_trial_with_correct_period(self): def test_create_subscription_with_trial_with_correct_period(self):
subscription = frappe.new_doc('Subscriptions') subscription = frappe.new_doc('Subscriptions')