Merge branch 'develop' into purchase-invoice-payment-terms
This commit is contained in:
commit
9a3e1f6f83
@ -43,7 +43,7 @@
|
||||
{
|
||||
"hidden": 0,
|
||||
"label": "Bank Statement",
|
||||
"links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Transaction Entry\",\n \"name\": \"Bank Statement Transaction Entry\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Settings\",\n \"name\": \"Bank Statement Settings\",\n \"type\": \"doctype\"\n }\n]"
|
||||
"links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Clearance\",\n \"name\": \"Bank Clearance\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Reconciliation\",\n \"name\": \"bank-reconciliation\",\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Reconciliation Statement\",\n \"name\": \"Bank Reconciliation Statement\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Bank Statement Transaction Entry\",\n \"name\": \"Bank Statement Transaction Entry\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Settings\",\n \"name\": \"Bank Statement Settings\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
@ -98,7 +98,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Accounting",
|
||||
"modified": "2020-10-08 20:31:46.022470",
|
||||
"modified": "2020-11-06 13:05:58.650150",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounting",
|
||||
@ -108,7 +108,7 @@
|
||||
"pin_to_top": 0,
|
||||
"shortcuts": [
|
||||
{
|
||||
"label": "Chart of Accounts",
|
||||
"label": "Chart Of Accounts",
|
||||
"link_to": "Account",
|
||||
"type": "DocType"
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ def get_header(filters, csv_class):
|
||||
# L = Tax client number (Mandantennummer)
|
||||
datev_settings.get('client_number', '00000'),
|
||||
# M = Start of the fiscal year (Wirtschaftsjahresbeginn)
|
||||
frappe.utils.formatdate(frappe.defaults.get_user_default('year_start_date'), 'yyyyMMdd'),
|
||||
frappe.utils.formatdate(filters.get('fiscal_year_start'), 'yyyyMMdd'),
|
||||
# N = Length of account numbers (Sachkontenlänge)
|
||||
datev_settings.get('account_number_length', '4'),
|
||||
# O = Transaction batch start date (YYYYMMDD)
|
||||
|
@ -13,6 +13,7 @@ import json
|
||||
import frappe
|
||||
from frappe import _
|
||||
from six import string_types
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from erpnext.regional.germany.utils.datev.datev_csv import download_csv_files_as_zip, get_datev_csv
|
||||
from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames
|
||||
|
||||
@ -98,21 +99,33 @@ def execute(filters=None):
|
||||
|
||||
def validate(filters):
|
||||
"""Make sure all mandatory filters and settings are present."""
|
||||
if not filters.get('company'):
|
||||
company = filters.get('company')
|
||||
if not company:
|
||||
frappe.throw(_('<b>Company</b> is a mandatory filter.'))
|
||||
|
||||
if not filters.get('from_date'):
|
||||
from_date = filters.get('from_date')
|
||||
if not from_date:
|
||||
frappe.throw(_('<b>From Date</b> is a mandatory filter.'))
|
||||
|
||||
if not filters.get('to_date'):
|
||||
to_date = filters.get('to_date')
|
||||
if not to_date:
|
||||
frappe.throw(_('<b>To Date</b> is a mandatory filter.'))
|
||||
|
||||
validate_fiscal_year(from_date, to_date, company)
|
||||
|
||||
try:
|
||||
frappe.get_doc('DATEV Settings', filters.get('company'))
|
||||
except frappe.DoesNotExistError:
|
||||
frappe.throw(_('Please create <b>DATEV Settings</b> for Company <b>{}</b>.').format(filters.get('company')))
|
||||
|
||||
|
||||
def validate_fiscal_year(from_date, to_date, company):
|
||||
from_fiscal_year = get_fiscal_year(date=from_date, company=company)
|
||||
to_fiscal_year = get_fiscal_year(date=to_date, company=company)
|
||||
if from_fiscal_year != to_fiscal_year:
|
||||
frappe.throw(_('Dates {} and {} are not in the same fiscal year.').format(from_date, to_date))
|
||||
|
||||
|
||||
def get_transactions(filters, as_dict=1):
|
||||
"""
|
||||
Get a list of accounting entries.
|
||||
@ -317,9 +330,13 @@ def download_datev_csv(filters):
|
||||
filters = json.loads(filters)
|
||||
|
||||
validate(filters)
|
||||
company = filters.get('company')
|
||||
|
||||
fiscal_year = get_fiscal_year(date=filters.get('from_date'), company=company)
|
||||
filters['fiscal_year_start'] = fiscal_year[1]
|
||||
|
||||
# set chart of accounts used
|
||||
coa = frappe.get_value('Company', filters.get('company'), 'chart_of_accounts')
|
||||
coa = frappe.get_value('Company', company, 'chart_of_accounts')
|
||||
filters['skr'] = '04' if 'SKR04' in coa else ('03' if 'SKR03' in coa else '')
|
||||
|
||||
transactions = get_transactions(filters)
|
||||
|
Loading…
x
Reference in New Issue
Block a user