fix: make account number length configurable (#23496)

* fix: make account number length configurable

* Update datev.py

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
Raffael Meyer
2020-10-13 11:39:18 +02:00
committed by GitHub
parent 63bbce708d
commit e2b7ac2b0e
2 changed files with 13 additions and 2 deletions

View File

@@ -6,6 +6,7 @@
"engine": "InnoDB",
"field_order": [
"client",
"account_number_length",
"column_break_2",
"client_number",
"section_break_4",
@@ -57,9 +58,16 @@
{
"fieldname": "column_break_6",
"fieldtype": "Column Break"
},
{
"default": "4",
"fieldname": "account_number_length",
"fieldtype": "Int",
"label": "Account Number Length",
"reqd": 1
}
],
"modified": "2020-04-15 12:59:57.786506",
"modified": "2020-10-03 16:52:35.903867",
"modified_by": "Administrator",
"module": "Regional",
"name": "DATEV Settings",

View File

@@ -247,7 +247,7 @@ def get_datev_csv(data, filters):
# M = Start of the fiscal year (Wirtschaftsjahresbeginn)
frappe.utils.formatdate(filters.get("fiscal_year_start"), "yyyyMMdd"),
# N = Length of account numbers (Sachkontenlänge)
"4",
str(filters.get('account_number_length', 4)),
# O = Transaction batch start date (YYYYMMDD)
frappe.utils.formatdate(filters.get('from_date'), "yyyyMMdd"),
# P = Transaction batch end date (YYYYMMDD)
@@ -521,6 +521,9 @@ def download_datev_csv(filters=None):
filters = json.loads(filters)
validate(filters)
filters['account_number_length'] = frappe.get_value('DATEV Settings', filters.get('company'), 'account_number_length')
fiscal_year = get_fiscal_year(date=filters.get('from_date'), company=filters.get('company'))
filters['fiscal_year_start'] = fiscal_year[1]