feat: make account number length configurable (#23845)

This commit is contained in:
Raffael Meyer 2020-11-15 05:04:05 +01:00 committed by Shivam Mishra
parent 1ea12079da
commit 59be7ff144
3 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,5 @@
{
"actions": [],
"autoname": "field:client",
"creation": "2019-08-13 23:56:34.259906",
"doctype": "DocType",
@ -6,6 +7,7 @@
"engine": "InnoDB",
"field_order": [
"client",
"account_number_length",
"column_break_2",
"client_number",
"section_break_4",
@ -28,8 +30,8 @@
"fieldtype": "Data",
"in_list_view": 1,
"label": "Client ID",
"reqd": 1,
"length": 5
"length": 5,
"reqd": 1
},
{
"fieldname": "consultant",
@ -43,8 +45,8 @@
"fieldtype": "Data",
"in_list_view": 1,
"label": "Consultant ID",
"reqd": 1,
"length": 7
"length": 7,
"reqd": 1
},
{
"fieldname": "column_break_2",
@ -57,9 +59,17 @@
{
"fieldname": "column_break_6",
"fieldtype": "Column Break"
},
{
"default": "4",
"fieldname": "account_number_length",
"fieldtype": "Int",
"label": "Account Number Length",
"reqd": 1
}
],
"modified": "2019-08-14 00:03:26.616460",
"links": [],
"modified": "2020-11-05 17:52:11.674329",
"modified_by": "Administrator",
"module": "Regional",
"name": "DATEV Settings",
@ -104,4 +114,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
}

View File

@ -106,7 +106,7 @@ def get_header(filters, csv_class):
# M = Start of the fiscal year (Wirtschaftsjahresbeginn)
frappe.utils.formatdate(filters.get('fiscal_year_start'), 'yyyyMMdd'),
# N = Length of account numbers (Sachkontenlänge)
datev_settings.get('account_number_length', '4'),
str(filters.get('account_number_length', 4)),
# O = Transaction batch start date (YYYYMMDD)
frappe.utils.formatdate(filters.get('from_date'), 'yyyyMMdd') if csv_class.DATA_CATEGORY == DataCategory.TRANSACTIONS else '',
# P = Transaction batch end date (YYYYMMDD)

View File

@ -340,6 +340,8 @@ def download_datev_csv(filters):
coa = frappe.get_value('Company', company, 'chart_of_accounts')
filters['skr'] = '04' if 'SKR04' in coa else ('03' if 'SKR03' in coa else '')
filters['account_number_length'] = frappe.get_value('DATEV Settings', company, 'account_number_length')
transactions = get_transactions(filters)
account_names = get_account_names(filters)
customers = get_customers(filters)