feat(DATEV): against account for opening entries (#35941)
* fix: add missing german translations * feat(DATEV): against account for opening entries Allow to specify a separate temporary against account for opening entries * feat(DATEV Settings): validate account no. length * style: format with black * style: format with black * test: new settings field, rename filter
This commit is contained in:
@@ -14,7 +14,8 @@
|
|||||||
"section_break_4",
|
"section_break_4",
|
||||||
"account_number_length",
|
"account_number_length",
|
||||||
"column_break_6",
|
"column_break_6",
|
||||||
"temporary_against_account_number"
|
"temporary_against_account_number",
|
||||||
|
"opening_against_account_number"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -70,14 +71,23 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_in_quick_entry": 1,
|
"allow_in_quick_entry": 1,
|
||||||
|
"default": "9999",
|
||||||
|
"description": "Will be used as against account for all normal ledger entries",
|
||||||
"fieldname": "temporary_against_account_number",
|
"fieldname": "temporary_against_account_number",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Temporary Against Account Number",
|
"label": "Temporary Against Account Number",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "9000",
|
||||||
|
"description": "Will be used as against account for opening ledger entries",
|
||||||
|
"fieldname": "opening_against_account_number",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Opening Against Account Number"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-11-19 19:00:09.088816",
|
"modified": "2023-06-30 00:56:59.556731",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Regional",
|
"module": "Regional",
|
||||||
"name": "DATEV Settings",
|
"name": "DATEV Settings",
|
||||||
|
|||||||
@@ -1,10 +1,26 @@
|
|||||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from frappe import _, throw
|
||||||
# import frappe
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
class DATEVSettings(Document):
|
class DATEVSettings(Document):
|
||||||
pass
|
def validate(self):
|
||||||
|
if (
|
||||||
|
self.temporary_against_account_number
|
||||||
|
and len(self.temporary_against_account_number) != self.account_number_length
|
||||||
|
):
|
||||||
|
throw(
|
||||||
|
_("Temporary Against Account Number must be {0} digits long").format(
|
||||||
|
self.account_number_length
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (
|
||||||
|
self.opening_against_account_number
|
||||||
|
and len(self.opening_against_account_number) != self.account_number_length
|
||||||
|
):
|
||||||
|
throw(
|
||||||
|
_("Opening Against Account Number must be {0} digits long").format(self.account_number_length)
|
||||||
|
)
|
||||||
|
|||||||
@@ -132,8 +132,12 @@ def execute(filters=None):
|
|||||||
"""Entry point for frappe."""
|
"""Entry point for frappe."""
|
||||||
data = []
|
data = []
|
||||||
if filters and validate(filters):
|
if filters and validate(filters):
|
||||||
fn = "temporary_against_account_number"
|
temp, opening = frappe.get_value(
|
||||||
filters[fn] = frappe.get_value("DATEV Settings", filters.get("company"), fn)
|
"DATEV Settings",
|
||||||
|
filters.get("company"),
|
||||||
|
["temporary_against_account_number", "opening_against_account_number"],
|
||||||
|
)
|
||||||
|
filters.update({"against_account": temp, "opening_account": opening or temp})
|
||||||
data = get_transactions(filters, as_dict=0)
|
data = get_transactions(filters, as_dict=0)
|
||||||
|
|
||||||
return COLUMNS, data
|
return COLUMNS, data
|
||||||
@@ -315,7 +319,7 @@ def run_query(filters, extra_fields, extra_joins, extra_filters, as_dict=1):
|
|||||||
acc.account_number as 'Konto',
|
acc.account_number as 'Konto',
|
||||||
|
|
||||||
/* against number or, if empty, party against number */
|
/* against number or, if empty, party against number */
|
||||||
%(temporary_against_account_number)s as 'Gegenkonto (ohne BU-Schlüssel)',
|
CASE gl.is_opening when 'Yes' then %(opening_account)s else %(against_account)s end as 'Gegenkonto (ohne BU-Schlüssel)',
|
||||||
|
|
||||||
'' as 'BU-Schlüssel',
|
'' as 'BU-Schlüssel',
|
||||||
|
|
||||||
@@ -530,18 +534,22 @@ def download_datev_csv(filters):
|
|||||||
filters = json.loads(filters)
|
filters = json.loads(filters)
|
||||||
|
|
||||||
validate(filters)
|
validate(filters)
|
||||||
|
|
||||||
company = filters.get("company")
|
company = filters.get("company")
|
||||||
|
|
||||||
fiscal_year = get_fiscal_year(date=filters.get("from_date"), company=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", 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 "")
|
|
||||||
|
|
||||||
datev_settings = frappe.get_doc("DATEV Settings", company)
|
datev_settings = frappe.get_doc("DATEV Settings", company)
|
||||||
filters["account_number_length"] = datev_settings.account_number_length
|
|
||||||
filters["temporary_against_account_number"] = datev_settings.temporary_against_account_number
|
filters.update(
|
||||||
|
{
|
||||||
|
"fiscal_year_start": fiscal_year[1],
|
||||||
|
"skr": "04" if "SKR04" in coa else ("03" if "SKR03" in coa else ""),
|
||||||
|
"account_number_length": datev_settings.account_number_length,
|
||||||
|
"against_account": datev_settings.temporary_against_account_number,
|
||||||
|
"opening_account": datev_settings.opening_against_account_number
|
||||||
|
or datev_settings.temporary_against_account_number,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
transactions = get_transactions(filters)
|
transactions = get_transactions(filters)
|
||||||
account_names = get_account_names(filters)
|
account_names = get_account_names(filters)
|
||||||
|
|||||||
@@ -139,7 +139,9 @@ def make_datev_settings(company):
|
|||||||
"client": company.name,
|
"client": company.name,
|
||||||
"client_number": "12345",
|
"client_number": "12345",
|
||||||
"consultant_number": "67890",
|
"consultant_number": "67890",
|
||||||
|
"account_number_length": 4,
|
||||||
"temporary_against_account_number": "9999",
|
"temporary_against_account_number": "9999",
|
||||||
|
"opening_against_account_number": "9000",
|
||||||
}
|
}
|
||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
@@ -152,7 +154,8 @@ class TestDatev(TestCase):
|
|||||||
"company": self.company.name,
|
"company": self.company.name,
|
||||||
"from_date": today(),
|
"from_date": today(),
|
||||||
"to_date": today(),
|
"to_date": today(),
|
||||||
"temporary_against_account_number": "9999",
|
"against_account": "9999",
|
||||||
|
"opening_account": "9000",
|
||||||
}
|
}
|
||||||
|
|
||||||
make_datev_settings(self.company)
|
make_datev_settings(self.company)
|
||||||
|
|||||||
@@ -9896,3 +9896,11 @@ Total Equity,Eigenkapital,
|
|||||||
Warehouse wise Stock Value,Warenwert nach Lager,
|
Warehouse wise Stock Value,Warenwert nach Lager,
|
||||||
Discount Validity,Frist für den Rabatt,
|
Discount Validity,Frist für den Rabatt,
|
||||||
Discount Validity Based On,Frist für den Rabatt berechnet sich nach,
|
Discount Validity Based On,Frist für den Rabatt berechnet sich nach,
|
||||||
|
Account Number Length,Kontonummer Länge,
|
||||||
|
Temporary Against Account Number,Temporäre Gegenkontonummer,
|
||||||
|
Change DATEV Settings,DATEV-Einstellungen ändern,
|
||||||
|
Opening Against Account Number,Gegenkontonummer für Eröffnungsbuchungen,
|
||||||
|
Will be used as against account for all normal ledger entries,Wird als Gegenkonto für alle normalen Buchungen verwendet,
|
||||||
|
Will be used as against account for opening ledger entries,Wird als Gegenkonto für alle Eröffnungsbuchungen verwendet,
|
||||||
|
Temporary Against Account Number must be {0} digits long,Temporäre Gegenkontonummer muss {0} Ziffern lang sein,
|
||||||
|
Opening Against Account Number must be {0} digits long,Gegenkontonummer für Eröffnungsbuchungen muss {0} Ziffern lang sein,
|
||||||
|
|||||||
|
Can't render this file because it is too large.
|
Reference in New Issue
Block a user