Skip to content

Commit

Permalink
Style: PEP 8 / ESLint -- Style Guide (Round 2)
Browse files Browse the repository at this point in the history
comply with PEP 8 style guide
comply with ESLint style guide
convert CRLF (windows) to LF (unix)
  • Loading branch information
jHetzer committed Dec 23, 2019
1 parent 60f18a6 commit d95391c
Show file tree
Hide file tree
Showing 33 changed files with 676 additions and 662 deletions.
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License
Copyright (c) 2019 Jonathan Hetzer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License

Copyright (c) 2019 Jonathan Hetzer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions erpnextfints/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*- # noqa: D104
21 changes: 11 additions & 10 deletions erpnextfints/config/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from __future__ import unicode_literals
from frappe import _

def get_data():
return [
{
"module_name": "ERPNextFinTS",
"color": "#3498db",
"icon": "fa fa-university",
"type": "module",
"label": _("ERPNextFinTS")
}
]

def get_data(): # noqa: D103
return [
{
"module_name": "ERPNextFinTS",
"color": "#3498db",
"icon": "fa fa-university",
"type": "module",
"label": _("ERPNextFinTS")
}
]
10 changes: 5 additions & 5 deletions erpnextfints/config/docs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Configuration for docs
"""
# -*- coding: utf-8 -*-
"""Configuration for docs."""

# source_link = "https://github.com/[org_name]/erpnextfints"
# docs_base_url = "https://[org_name].github.io/erpnextfints"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"

def get_context(context):
context.brand_html = "ERPNextFinTS"

def get_context(context): # noqa: D103
context.brand_html = "ERPNextFinTS"
76 changes: 34 additions & 42 deletions erpnextfints/config/erpnextfints.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
from __future__ import unicode_literals
from frappe import _

def get_data():
return[
{
"label": _("Integrations"),
"icon": "octicon octicon-git-compare",
"items": [
{
"type": "doctype",
"name": "FinTS Import",
"label": _("FinTS Import"),
"description": _("FinTS Import")
},
{
"type": "doctype",
"name": "FinTS Login",
"label": _("FinTS Login"),
"description": _("FinTS Login")
},
{
"type": "doctype",
"name": "FinTS Schedule",
"label": _("FinTS Schedule"),
"description": _("FinTS Schedule")
}
]
},
{
"label": _("Tools"),
"icon": "octicon octicon-git-compare",
"items": [
{
"type": "page",
"name": "bank_account_wizard",
"label": _("Bank Account Wizard"),
"description": _("Create bank accounts for parties")
}
]
}
]
from __future__ import unicode_literals
from frappe import _


def get_data(): # noqa: D103
return[{
"label": _("Integrations"),
"icon": "octicon octicon-git-compare",
"items": [{
"type": "doctype",
"name": "FinTS Import",
"label": _("FinTS Import"),
"description": _("FinTS Import")
}, {
"type": "doctype",
"name": "FinTS Login",
"label": _("FinTS Login"),
"description": _("FinTS Login")
}, {
"type": "doctype",
"name": "FinTS Schedule",
"label": _("FinTS Schedule"),
"description": _("FinTS Schedule")
}]
}, {
"label": _("Tools"),
"icon": "octicon octicon-git-compare",
"items": [{
"type": "page",
"name": "bank_account_wizard",
"label": _("Bank Account Wizard"),
"description": _("Create bank accounts for parties")
}]
}]
1 change: 1 addition & 0 deletions erpnextfints/erpnextfints/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*- # noqa: D104
1 change: 1 addition & 0 deletions erpnextfints/erpnextfints/doctype/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*- # noqa: D104
1 change: 1 addition & 0 deletions erpnextfints/erpnextfints/doctype/fints_import/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*- # noqa: D104
22 changes: 11 additions & 11 deletions erpnextfints/erpnextfints/doctype/fints_import/fints_import.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ frappe.ui.form.on('FinTS Import', {
);
}
},
/*setup: function(frm) {
/* setup: function(frm) {
frm.set_value(
"to_date",
frappe.datetime.add_days(frappe.datetime.nowdate(),-1)
Expand All @@ -32,21 +32,21 @@ frappe.ui.form.on('FinTS Import', {
},
fints_login: function(frm) {
if(frm.doc.fints_login){
frm.save()
frm.save();
}
},
from_date: function(frm) {
if(frm.doc.fints_login){
frm.save()
frm.save();
}
},
to_date: function(frm) {
if(frm.doc.fints_login){
frm.save()
frm.save();
}
},
import_transaction: function(frm){
//frappe.show_progress(frm.docname,1,100,"Connect via FinTS")
// frappe.show_progress(frm.docname,1,100,"Connect via FinTS")
frm.events.call_import_transaction(frm);
/*
if (frm.doc.__unsaved){
Expand All @@ -61,22 +61,22 @@ frappe.ui.form.on('FinTS Import', {

},
call_import_transaction: function(frm){
//frappe.show_progress(frm.docname,1,100,"Connect via FinTS")
// frappe.show_progress(frm.docname,1,100,"Connect via FinTS")
frappe.call({
method:"erpnextfints.utils.client.import_fints_transactions",
args: {
'fints_import': frm.docname,
'fints_login': frm.doc.fints_login,
'user_scope': frm.docname,
},
callback: function(r) {
//console.log(r)
callback: function(/* r */) {
// console.log(r);
frappe.hide_progress();
},
error: function(r) {
console.log(r);
error: function(/* r */) {
// console.log(r);
frappe.hide_progress();
}
})
});
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@ def validate_past(self, date):
return False
else:
return True

def before_save(self):
status = True
if self.from_date is not None:
if not self.validate_past(self.from_date):
status = False
frappe.msgprint(_("'From Date' needs to be in the past"))
if self.to_date is not None:
if get_datetime(self.from_date).date() > get_datetime(self.to_date).date():
from_date = get_datetime(self.from_date).date()
if from_date > get_datetime(self.to_date).date():
status = False
frappe.msgprint(_("'From Date' needs to be further in the past then 'To Date'"))
frappe.msgprint(_(
"'From Date' needs to be further in the past"
" then 'To Date'"))
if self.to_date is not None:
if not self.validate_past(self.to_date):
status = False
frappe.msgprint(_("'To Date' needs to be in the past"))
return status

def validate(self):
if not self.before_save():
frappe.throw(_("Validation of dates failed"))
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# See license.txt
from __future__ import unicode_literals

import frappe
import frappe # noqa: F401
import unittest


class TestFinTSImport(unittest.TestCase):
pass
pass
1 change: 1 addition & 0 deletions erpnextfints/erpnextfints/doctype/fints_login/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*- # noqa: D104
38 changes: 19 additions & 19 deletions erpnextfints/erpnextfints/doctype/fints_login/fints_login.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ frappe.ui.form.on('FinTS Login', {
onload: function(frm) {
erpnextfints.interactive.progressbar(frm);
if(frm.doc.account_iban){
frm.toggle_display("transaction_settings_section",true)
frm.toggle_display("transaction_settings_section",true);
}else{
frm.toggle_display("transaction_settings_section",false)
frm.toggle_display("transaction_settings_section",false);
}
},
setup: function(frm) {
Expand All @@ -26,11 +26,11 @@ frappe.ui.form.on('FinTS Login', {
refresh: function(frm) {
frm.events.enable_received(frm);
frm.events.enable_pay(frm);
//frm.set_df_property("account_nr","options",frm.fields_dict.account_nr.value)
//if(frm.fields_dict.account_nr.df.reqd && )
//frm.toggle_reqd("account_nr",true);
// frm.set_df_property("account_nr","options",frm.fields_dict.account_nr.value)
// if(frm.fields_dict.account_nr.df.reqd && )
// frm.toggle_reqd("account_nr",true);
if(frm.doc.iban_list){
frm.set_df_property("account_iban","options",JSON.parse(frm.doc.iban_list))
frm.set_df_property("account_iban","options",JSON.parse(frm.doc.iban_list));
}
if(!frm.doc.account_iban){
frm.toggle_display("account_iban",false);
Expand All @@ -44,23 +44,23 @@ frappe.ui.form.on('FinTS Login', {
*/
},
enable_received: function(frm){
var field = "default_customer"
var field = "default_customer";
if(frm.doc.enable_received){
frm.toggle_reqd(field,true);
}else{
frm.toggle_reqd(field,false);
}
},
enable_pay: function(frm){
var field = "default_supplier"
var field = "default_supplier";

if(frm.doc.enable_pay){
frm.toggle_reqd(field,true);
}else{
frm.toggle_reqd(field,false);
}
},
/*account_nr: function(frm) {
/* account_nr: function(frm) {
if(frm.doc.account_nr){
frm.save();
}
Expand All @@ -69,7 +69,7 @@ frappe.ui.form.on('FinTS Login', {
if (frm.doc.__unsaved){
frm.save().then(() => {
frm.events.call_get_login_accounts(frm);
})
});
}else{
frm.events.call_get_login_accounts(frm);
frappe.hide_progress();
Expand All @@ -83,23 +83,23 @@ frappe.ui.form.on('FinTS Login', {
'user_scope': frm.doc.name
},
callback: function(r) {
//console.log(r)
frm.toggle_display("account_iban",true)
// console.log(r)
frm.toggle_display("account_iban",true);
frm.set_value("account_iban","");
frm.set_value("failed_connection",0);

var ibanList = r.message.accounts.map(x => x[0]);
frm.set_df_property("account_iban","options",ibanList);
//frm.toggle_reqd("account_nr",true);
//console.log(JSON.stringify(ibanList));
// frm.toggle_reqd("account_nr",true);
// console.log(JSON.stringify(ibanList));
frm.set_value("iban_list", JSON.stringify(ibanList));
frm.toggle_reqd("account_iban",true);
},
error: function(r) {
console.log(r);
error: function(/* r */) {
// console.log(r);
frappe.hide_progress();
frm.set_df_property("account_iban","options","")
frm.toggle_display("account_iban",false)
frm.set_df_property("account_iban","options","");
frm.toggle_display("account_iban",false);

frappe.run_serially([
() => frm.set_value("account_iban",""),
Expand All @@ -108,6 +108,6 @@ frappe.ui.form.on('FinTS Login', {
() => frm.save(),
]);
}
})
});
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# See license.txt
from __future__ import unicode_literals

import frappe
import frappe # noqa: F401
import unittest


class TestFinTSLogin(unittest.TestCase):
pass
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*- # noqa: D104
Loading

0 comments on commit d95391c

Please sign in to comment.