From 3b4f481ca4723565614f098f5d4daeb7d1afd889 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 1 Apr 2019 17:56:49 +0530 Subject: [PATCH 01/59] fix: Make Customer and lead field dynamic --- .../selling/doctype/quotation/quotation.js | 43 +++-- .../selling/doctype/quotation/quotation.json | 151 ++++++++++++------ 2 files changed, 132 insertions(+), 62 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 6f7bfb3febf..7d5118cff21 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -8,7 +8,16 @@ frappe.ui.form.on('Quotation', { setup: function(frm) { frm.custom_make_buttons = { 'Sales Order': 'Make Sales Order' - } + }, + + frm.set_query("quotation_to", function() { + return{ + "filters": { + "name": ["in", ["Customer", "Lead"]], + } + } + }); + }, refresh: function(frm) { @@ -97,24 +106,30 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ }, - quotation_to: function() { - var me = this; - if (this.frm.doc.quotation_to == "Lead") { - this.frm.set_value("customer", null); - this.frm.set_value("contact_person", null); - } else if (this.frm.doc.quotation_to == "Customer") { - this.frm.set_value("lead", null); + quotation_to: function(frm) { + this.set_dynamic_field_label(); + this.toggle_reqd_lead_customer(); + }, + + set_dynamic_field_label: function(){ + if (this.frm.doc.quotation_to == "Customer") + { + this.frm.set_df_property("customer_lead", "label", "Customer"); } - this.toggle_reqd_lead_customer(); + if (this.frm.doc.quotation_to == "Lead") + { + this.frm.set_df_property("customer_lead", "label", "Lead"); + + this.frm.fields_dict.customer_lead.get_query = function() { + return{ query: "erpnext.controllers.queries.lead_query" } + } + } }, toggle_reqd_lead_customer: function() { var me = this; - this.frm.toggle_reqd("lead", this.frm.doc.quotation_to == "Lead"); - this.frm.toggle_reqd("customer", this.frm.doc.quotation_to == "Customer"); - // to overwrite the customer_filter trigger from queries.js this.frm.set_query('customer_address', erpnext.queries.address_query); this.frm.set_query('shipping_address_name', erpnext.queries.address_query); @@ -163,10 +178,6 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ cur_frm.script_manager.make(erpnext.selling.QuotationController); -cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.lead_query" } -} - cur_frm.cscript['Make Sales Order'] = function() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.quotation.quotation.make_sales_order", diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 6cc09933e8e..6ff33bdb621 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -20,6 +20,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "customer_section", "fieldtype": "Section Break", "hidden": 0, @@ -53,6 +54,7 @@ "collapsible": 0, "columns": 0, "default": "{customer_name}", + "fetch_if_empty": 0, "fieldname": "title", "fieldtype": "Data", "hidden": 1, @@ -86,6 +88,7 @@ "collapsible": 0, "columns": 0, "default": "", + "fetch_if_empty": 0, "fieldname": "naming_series", "fieldtype": "Select", "hidden": 0, @@ -121,8 +124,9 @@ "collapsible": 0, "columns": 0, "default": "Customer", + "fetch_if_empty": 0, "fieldname": "quotation_to", - "fieldtype": "Select", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -135,7 +139,7 @@ "no_copy": 0, "oldfieldname": "quotation_to", "oldfieldtype": "Select", - "options": "\nLead\nCustomer", + "options": "DocType", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, @@ -155,9 +159,10 @@ "bold": 1, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.quotation_to == \"Customer\"", - "fieldname": "customer", - "fieldtype": "Link", + "depends_on": "", + "fetch_if_empty": 0, + "fieldname": "customer_lead", + "fieldtype": "Dynamic Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -165,59 +170,24 @@ "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 1, - "label": "Customer", + "label": "", "length": 0, "no_copy": 0, "oldfieldname": "customer", "oldfieldtype": "Link", - "options": "Customer", + "options": "quotation_to", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 1, "set_only_once": 0, "translatable": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.quotation_to == \"Lead\"", - "fieldname": "lead", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Lead", - "length": 0, - "no_copy": 0, - "oldfieldname": "lead", - "oldfieldtype": "Link", - "options": "Lead", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -226,6 +196,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "customer.customer_name", + "fetch_if_empty": 0, "fieldname": "customer_name", "fieldtype": "Data", "hidden": 1, @@ -258,6 +229,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break1", "fieldtype": "Column Break", "hidden": 0, @@ -290,6 +262,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amended_from", "fieldtype": "Link", "hidden": 0, @@ -326,6 +299,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "company", "fieldtype": "Link", "hidden": 0, @@ -362,6 +336,7 @@ "collapsible": 0, "columns": 0, "default": "Today", + "fetch_if_empty": 0, "fieldname": "transaction_date", "fieldtype": "Date", "hidden": 0, @@ -396,6 +371,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "valid_till", "fieldtype": "Date", "hidden": 0, @@ -429,6 +405,7 @@ "collapsible": 0, "columns": 0, "default": "Sales", + "fetch_if_empty": 0, "fieldname": "order_type", "fieldtype": "Select", "hidden": 0, @@ -465,6 +442,7 @@ "collapsible_depends_on": "", "columns": 0, "depends_on": "eval:(doc.customer || doc.lead)", + "fetch_if_empty": 0, "fieldname": "contact_section", "fieldtype": "Section Break", "hidden": 0, @@ -497,6 +475,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "customer_address", "fieldtype": "Link", "hidden": 0, @@ -529,6 +508,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "address_display", "fieldtype": "Small Text", "hidden": 0, @@ -563,6 +543,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.customer", + "fetch_if_empty": 0, "fieldname": "contact_person", "fieldtype": "Link", "hidden": 0, @@ -597,6 +578,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "contact_display", "fieldtype": "Small Text", "hidden": 0, @@ -628,6 +610,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "contact_mobile", "fieldtype": "Small Text", "hidden": 0, @@ -659,6 +642,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "contact_email", "fieldtype": "Data", "hidden": 1, @@ -692,6 +676,7 @@ "collapsible": 0, "columns": 0, "depends_on": "customer", + "fetch_if_empty": 0, "fieldname": "col_break98", "fieldtype": "Column Break", "hidden": 0, @@ -723,6 +708,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "shipping_address_name", "fieldtype": "Link", "hidden": 0, @@ -755,6 +741,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "shipping_address", "fieldtype": "Small Text", "hidden": 0, @@ -788,6 +775,7 @@ "columns": 0, "depends_on": "customer", "description": "", + "fetch_if_empty": 0, "fieldname": "customer_group", "fieldtype": "Link", "hidden": 1, @@ -823,6 +811,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "territory", "fieldtype": "Link", "hidden": 0, @@ -855,6 +844,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "currency_and_price_list", "fieldtype": "Section Break", "hidden": 0, @@ -887,6 +877,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "currency", "fieldtype": "Link", "hidden": 0, @@ -923,6 +914,7 @@ "collapsible": 0, "columns": 0, "description": "Rate at which customer's currency is converted to company's base currency", + "fetch_if_empty": 0, "fieldname": "conversion_rate", "fieldtype": "Float", "hidden": 0, @@ -958,6 +950,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break2", "fieldtype": "Column Break", "hidden": 0, @@ -989,6 +982,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "selling_price_list", "fieldtype": "Link", "hidden": 0, @@ -1024,6 +1018,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "price_list_currency", "fieldtype": "Link", "hidden": 0, @@ -1057,6 +1052,7 @@ "collapsible": 0, "columns": 0, "description": "Rate at which Price list currency is converted to company's base currency", + "fetch_if_empty": 0, "fieldname": "plc_conversion_rate", "fieldtype": "Float", "hidden": 0, @@ -1089,6 +1085,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "ignore_pricing_rule", "fieldtype": "Check", "hidden": 0, @@ -1120,6 +1117,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "items_section", "fieldtype": "Section Break", "hidden": 0, @@ -1153,6 +1151,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "items", "fieldtype": "Table", "hidden": 0, @@ -1188,6 +1187,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sec_break23", "fieldtype": "Section Break", "hidden": 0, @@ -1218,6 +1218,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_qty", "fieldtype": "Float", "hidden": 0, @@ -1250,6 +1251,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_total", "fieldtype": "Currency", "hidden": 0, @@ -1283,6 +1285,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_total", "fieldtype": "Currency", "hidden": 0, @@ -1318,6 +1321,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_28", "fieldtype": "Column Break", "hidden": 0, @@ -1348,6 +1352,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total", "fieldtype": "Currency", "hidden": 0, @@ -1381,6 +1386,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "net_total", "fieldtype": "Currency", "hidden": 0, @@ -1413,6 +1419,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_net_weight", "fieldtype": "Float", "hidden": 0, @@ -1445,6 +1452,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "taxes_section", "fieldtype": "Section Break", "hidden": 0, @@ -1478,6 +1486,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "taxes_and_charges", "fieldtype": "Link", "hidden": 0, @@ -1512,6 +1521,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_34", "fieldtype": "Column Break", "hidden": 0, @@ -1542,6 +1552,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "shipping_rule", "fieldtype": "Link", "hidden": 0, @@ -1575,6 +1586,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_36", "fieldtype": "Section Break", "hidden": 0, @@ -1605,6 +1617,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "taxes", "fieldtype": "Table", "hidden": 0, @@ -1639,6 +1652,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sec_tax_breakup", "fieldtype": "Section Break", "hidden": 0, @@ -1671,6 +1685,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "other_charges_calculation", "fieldtype": "Text", "hidden": 0, @@ -1703,6 +1718,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_39", "fieldtype": "Section Break", "hidden": 0, @@ -1733,6 +1749,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_total_taxes_and_charges", "fieldtype": "Currency", "hidden": 0, @@ -1767,6 +1784,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_42", "fieldtype": "Column Break", "hidden": 0, @@ -1797,6 +1815,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_taxes_and_charges", "fieldtype": "Currency", "hidden": 0, @@ -1830,6 +1849,7 @@ "collapsible": 1, "collapsible_depends_on": "discount_amount", "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_44", "fieldtype": "Section Break", "hidden": 0, @@ -1863,6 +1883,7 @@ "collapsible": 0, "columns": 0, "default": "Grand Total", + "fetch_if_empty": 0, "fieldname": "apply_discount_on", "fieldtype": "Select", "hidden": 0, @@ -1896,6 +1917,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_discount_amount", "fieldtype": "Currency", "hidden": 0, @@ -1929,6 +1951,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_46", "fieldtype": "Column Break", "hidden": 0, @@ -1960,6 +1983,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "additional_discount_percentage", "fieldtype": "Float", "hidden": 0, @@ -1992,6 +2016,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "discount_amount", "fieldtype": "Currency", "hidden": 0, @@ -2024,6 +2049,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "totals", "fieldtype": "Section Break", "hidden": 0, @@ -2057,6 +2083,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_grand_total", "fieldtype": "Currency", "hidden": 0, @@ -2092,6 +2119,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_rounding_adjustment", "fieldtype": "Currency", "hidden": 0, @@ -2126,6 +2154,7 @@ "collapsible": 0, "columns": 0, "description": "In Words will be visible once you save the Quotation.", + "fetch_if_empty": 0, "fieldname": "base_in_words", "fieldtype": "Data", "hidden": 0, @@ -2160,6 +2189,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_rounded_total", "fieldtype": "Currency", "hidden": 0, @@ -2195,6 +2225,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break3", "fieldtype": "Column Break", "hidden": 0, @@ -2227,6 +2258,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "grand_total", "fieldtype": "Currency", "hidden": 0, @@ -2262,6 +2294,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rounding_adjustment", "fieldtype": "Currency", "hidden": 0, @@ -2295,6 +2328,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rounded_total", "fieldtype": "Currency", "hidden": 0, @@ -2330,6 +2364,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "in_words", "fieldtype": "Data", "hidden": 0, @@ -2366,6 +2401,7 @@ "collapsible_depends_on": "", "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "payment_schedule_section", "fieldtype": "Section Break", "hidden": 0, @@ -2398,6 +2434,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "payment_terms_template", "fieldtype": "Link", "hidden": 0, @@ -2431,6 +2468,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "payment_schedule", "fieldtype": "Table", "hidden": 0, @@ -2465,6 +2503,7 @@ "collapsible": 1, "collapsible_depends_on": "terms", "columns": 0, + "fetch_if_empty": 0, "fieldname": "terms_section_break", "fieldtype": "Section Break", "hidden": 0, @@ -2498,6 +2537,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "tc_name", "fieldtype": "Link", "hidden": 0, @@ -2532,6 +2572,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "terms", "fieldtype": "Text Editor", "hidden": 0, @@ -2565,6 +2606,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "print_settings", "fieldtype": "Section Break", "hidden": 0, @@ -2597,6 +2639,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "letter_head", "fieldtype": "Link", "hidden": 0, @@ -2631,6 +2674,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "group_same_items", "fieldtype": "Check", "hidden": 0, @@ -2663,6 +2707,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_73", "fieldtype": "Column Break", "hidden": 0, @@ -2694,6 +2739,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "select_print_heading", "fieldtype": "Link", "hidden": 0, @@ -2728,6 +2774,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "language", "fieldtype": "Data", "hidden": 0, @@ -2760,6 +2807,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "subscription_section", "fieldtype": "Section Break", "hidden": 0, @@ -2792,6 +2840,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "auto_repeat", "fieldtype": "Link", "hidden": 0, @@ -2826,6 +2875,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval: doc.auto_repeat", + "fetch_if_empty": 0, "fieldname": "update_auto_repeat_reference", "fieldtype": "Button", "hidden": 0, @@ -2858,6 +2908,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "more_info", "fieldtype": "Section Break", "hidden": 0, @@ -2891,6 +2942,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "campaign", "fieldtype": "Link", "hidden": 0, @@ -2925,6 +2977,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "source", "fieldtype": "Link", "hidden": 0, @@ -2960,6 +3013,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.status===\"Lost\"", + "fetch_if_empty": 0, "fieldname": "order_lost_reason", "fieldtype": "Small Text", "hidden": 0, @@ -2993,6 +3047,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break4", "fieldtype": "Column Break", "hidden": 0, @@ -3026,6 +3081,7 @@ "collapsible": 0, "columns": 0, "default": "Draft", + "fetch_if_empty": 0, "fieldname": "status", "fieldtype": "Select", "hidden": 0, @@ -3060,6 +3116,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "enq_det", "fieldtype": "Text", "hidden": 1, @@ -3093,6 +3150,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "supplier_quotation", "fieldtype": "Link", "hidden": 0, @@ -3126,6 +3184,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "opportunity", "fieldtype": "Link", "hidden": 0, @@ -3165,7 +3224,7 @@ "istable": 0, "max_attachments": 1, "menu_index": 0, - "modified": "2019-01-07 16:51:55.604845", + "modified": "2019-04-01 17:21:09.462834", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", @@ -3331,11 +3390,11 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 1, - "search_fields": "status,transaction_date,customer,lead,order_type", + "search_fields": "status,transaction_date,customer_lead,order_type", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", - "timeline_field": "customer", + "timeline_field": "customer_lead", "title_field": "title", "track_changes": 0, "track_seen": 0, From 6ba48c58e8ad6b6859fbed82ff7a6f1f57584796 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 1 Apr 2019 19:08:59 +0530 Subject: [PATCH 02/59] fix: Server side handling of quotation to and get_query fix --- .../selling/doctype/quotation/quotation.js | 8 +++---- .../selling/doctype/quotation/quotation.py | 22 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 7d5118cff21..dcd20917796 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -26,6 +26,8 @@ frappe.ui.form.on('Quotation', { quotation_to: function(frm) { frm.trigger("set_label"); + frm.trigger("set_dynamic_field_label"); + frm.trigger("toggle_reqd_lead_customer"); }, set_label: function(frm) { @@ -106,15 +108,11 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ }, - quotation_to: function(frm) { - this.set_dynamic_field_label(); - this.toggle_reqd_lead_customer(); - }, - set_dynamic_field_label: function(){ if (this.frm.doc.quotation_to == "Customer") { this.frm.set_df_property("customer_lead", "label", "Customer"); + this.frm.fields_dict.customer_lead.get_query = null; } if (this.frm.doc.quotation_to == "Lead") diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 729256068be..cea2b356c0d 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -28,11 +28,11 @@ class Quotation(SellingController): self.update_opportunity() self.validate_order_type() self.validate_uom_is_integer("stock_uom", "qty") - self.validate_quotation_to() + # self.validate_quotation_to() self.validate_valid_till() if self.items: self.with_items = 1 - + def validate_valid_till(self): if self.valid_till and self.valid_till < self.transaction_date: frappe.throw(_("Valid till date cannot be before transaction date")) @@ -43,16 +43,16 @@ class Quotation(SellingController): def validate_order_type(self): super(Quotation, self).validate_order_type() - def validate_quotation_to(self): - if self.customer: - self.quotation_to = "Customer" - self.lead = None - elif self.lead: - self.quotation_to = "Lead" + # def validate_quotation_to(self): + # if self.customer: + # self.quotation_to = "Customer" + # self.lead = None + # elif self.lead: + # self.quotation_to = "Lead" def update_lead(self): - if self.lead: - frappe.get_doc("Lead", self.lead).set_status(update=True) + if self.quotation_to == "Lead": + frappe.get_doc("Lead", self.customer_lead).set_status(update=True) def update_opportunity(self): for opportunity in list(set([d.prevdoc_docname for d in self.get("items")])): @@ -209,7 +209,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): } }, target_doc, set_missing_values, ignore_permissions=ignore_permissions) - return doclist + return doclist def _make_customer(source_name, ignore_permissions=False): quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type", "customer"]) From a65af7a2f5c3e9122a00225cf090d9969ac1b746 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 1 Apr 2019 22:18:10 +0530 Subject: [PATCH 03/59] fix: Quotation Query fix in lead.py --- erpnext/crm/doctype/lead/lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 29ca71bd88e..d45c105ab8e 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -93,7 +93,7 @@ class Lead(SellingController): def has_quotation(self): return frappe.db.get_value("Quotation", { - "lead": self.name, + "customer_lead": self.name, "docstatus": 1, "status": ["!=", "Lost"] From ff994924812f5e909655aa975bc0acb3e0ed7501 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 1 Apr 2019 23:07:36 +0530 Subject: [PATCH 04/59] fix: Removed redundant code --- erpnext/selling/doctype/quotation/quotation.js | 12 ++++++------ erpnext/selling/doctype/quotation/quotation.py | 8 -------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index dcd20917796..6be55756c45 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -39,16 +39,16 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ onload: function(doc, dt, dn) { var me = this; this._super(doc, dt, dn); - if(doc.customer && !doc.quotation_to) - doc.quotation_to = "Customer"; - else if(doc.lead && !doc.quotation_to) - doc.quotation_to = "Lead"; + // if(doc.customer && !doc.quotation_to) + // doc.quotation_to = "Customer"; + // else if(doc.lead && !doc.quotation_to) + // doc.quotation_to = "Lead"; }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); - doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead'; - frappe.dynamic_link = {doc: this.frm.doc, fieldname: doctype.toLowerCase(), doctype: doctype} + // doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead'; + // frappe.dynamic_link = {doc: this.frm.doc, fieldname: doctype.toLowerCase(), doctype: doctype} var me = this; diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index cea2b356c0d..2a04ca68126 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -28,7 +28,6 @@ class Quotation(SellingController): self.update_opportunity() self.validate_order_type() self.validate_uom_is_integer("stock_uom", "qty") - # self.validate_quotation_to() self.validate_valid_till() if self.items: self.with_items = 1 @@ -43,13 +42,6 @@ class Quotation(SellingController): def validate_order_type(self): super(Quotation, self).validate_order_type() - # def validate_quotation_to(self): - # if self.customer: - # self.quotation_to = "Customer" - # self.lead = None - # elif self.lead: - # self.quotation_to = "Lead" - def update_lead(self): if self.quotation_to == "Lead": frappe.get_doc("Lead", self.customer_lead).set_status(update=True) From 163899443687476a014d2288bcf413374f464712 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 2 Apr 2019 10:15:59 +0530 Subject: [PATCH 05/59] fix: Patch to move customer and lead --- erpnext/patches.txt | 3 ++- .../v11_1/move_customer_lead_to_dynamic_column.py | 10 ++++++++++ erpnext/selling/doctype/quotation/quotation.js | 7 +------ erpnext/selling/doctype/quotation/quotation.json | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9dcb285a0a3..e2929ca2ed9 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -589,4 +589,5 @@ erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019 erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019 erpnext.patches.v11_1.make_job_card_time_logs -erpnext.patches.v11_1.set_variant_based_on \ No newline at end of file +erpnext.patches.v11_1.set_variant_based_on +erpnext.patches.v11_1.move_customer_lead_to_dynamic_column diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py new file mode 100644 index 00000000000..305a4b01f9d --- /dev/null +++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py @@ -0,0 +1,10 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + + frappe.db.dql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) + frappe.db.dql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 6be55756c45..195101ed6b4 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -39,16 +39,10 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ onload: function(doc, dt, dn) { var me = this; this._super(doc, dt, dn); - // if(doc.customer && !doc.quotation_to) - // doc.quotation_to = "Customer"; - // else if(doc.lead && !doc.quotation_to) - // doc.quotation_to = "Lead"; }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); - // doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead'; - // frappe.dynamic_link = {doc: this.frm.doc, fieldname: doctype.toLowerCase(), doctype: doctype} var me = this; @@ -129,6 +123,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ var me = this; // to overwrite the customer_filter trigger from queries.js + this.frm.toggle_reqd("customer_lead", this.frm.doc.quotation_to); this.frm.set_query('customer_address', erpnext.queries.address_query); this.frm.set_query('shipping_address_name', erpnext.queries.address_query); }, diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 6ff33bdb621..83de49e2ab5 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -182,7 +182,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 1, "set_only_once": 0, "translatable": 0, @@ -3224,7 +3224,7 @@ "istable": 0, "max_attachments": 1, "menu_index": 0, - "modified": "2019-04-01 17:21:09.462834", + "modified": "2019-04-02 10:06:27.850280", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", From e889a587243f8b4f70e4c77d698a012e44c569d7 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 2 Apr 2019 18:22:06 +0530 Subject: [PATCH 06/59] fix: Patch typo fix and set label in refresh --- erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py | 4 ++-- erpnext/selling/doctype/quotation/quotation.js | 2 +- erpnext/selling/doctype/quotation/quotation.json | 4 ++-- erpnext/selling/doctype/quotation/quotation.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py index 305a4b01f9d..23e91c7ebc7 100644 --- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py +++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py @@ -6,5 +6,5 @@ import frappe def execute(): - frappe.db.dql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) - frappe.db.dql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) \ No newline at end of file + frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) + frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 195101ed6b4..cf8788963cc 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -22,11 +22,11 @@ frappe.ui.form.on('Quotation', { refresh: function(frm) { frm.trigger("set_label"); + frm.trigger("set_dynamic_field_label"); }, quotation_to: function(frm) { frm.trigger("set_label"); - frm.trigger("set_dynamic_field_label"); frm.trigger("toggle_reqd_lead_customer"); }, diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 83de49e2ab5..87a8aab3cfc 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -170,7 +170,7 @@ "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 1, - "label": "", + "label": "Customer/Lead", "length": 0, "no_copy": 0, "oldfieldname": "customer", @@ -3224,7 +3224,7 @@ "istable": 0, "max_attachments": 1, "menu_index": 0, - "modified": "2019-04-02 10:06:27.850280", + "modified": "2019-04-02 10:18:58.506125", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 2a04ca68126..c1529bb322b 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -43,7 +43,7 @@ class Quotation(SellingController): super(Quotation, self).validate_order_type() def update_lead(self): - if self.quotation_to == "Lead": + if self.quotation_to == "Lead" and self.customer_lead: frappe.get_doc("Lead", self.customer_lead).set_status(update=True) def update_opportunity(self): From 3987b4b714b1749542726748bf6c6b4dcf999205 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 3 Apr 2019 08:53:03 +0530 Subject: [PATCH 07/59] fix: Test case fixes in quotation for dynamic column --- erpnext/crm/doctype/opportunity/opportunity.py | 4 ++-- erpnext/selling/doctype/customer/customer.py | 5 ++--- erpnext/selling/doctype/quotation/quotation.py | 2 +- erpnext/selling/doctype/quotation/test_quotation.py | 10 +++++----- erpnext/shopping_cart/test_shopping_cart.py | 9 ++++----- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index e8da4e6436b..102d7378287 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -218,8 +218,8 @@ def make_quotation(source_name, target_doc=None): quotation = frappe.get_doc(target) company_currency = frappe.get_cached_value('Company', quotation.company, "default_currency") - party_account_currency = get_party_account_currency("Customer", quotation.customer, - quotation.company) if quotation.customer else company_currency + party_account_currency = get_party_account_currency("Customer", quotation.customer_lead, + quotation.company) if quotation.customer_lead else company_currency quotation.currency = party_account_currency or company_currency diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 2970d7a5e82..139d76157e7 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -104,9 +104,8 @@ class Customer(TransactionBase): if self.lead_name: frappe.db.set_value('Lead', self.lead_name, 'status', 'Converted', update_modified=False) - for doctype in ('Opportunity', 'Quotation'): - for d in frappe.get_all(doctype, {'lead': self.lead_name}): - frappe.db.set_value(doctype, d.name, 'customer', self.name, update_modified=False) + for d in frappe.get_all('Opportunity', {'lead': self.lead_name}): + frappe.db.set_value('Opportunity', d.name, 'customer', self.name, update_modified=False) def create_lead_address_contact(self): if self.lead_name: diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index c1529bb322b..524a7a6039b 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -204,7 +204,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): return doclist def _make_customer(source_name, ignore_permissions=False): - quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type", "customer"]) + quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "customer_lead"]) if quotation and quotation[0] and not quotation[2]: lead_name = quotation[0] customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name}, diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 78fb0c14042..124c7922a80 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -203,15 +203,15 @@ class TestQuotation(unittest.TestCase): test_records = frappe.get_test_records('Quotation') -def get_quotation_dict(customer=None, item_code=None): - if not customer: - customer = '_Test Customer' +def get_quotation_dict(customer_lead=None, item_code=None): + if not customer_lead: + customer_lead = '_Test Customer' if not item_code: item_code = '_Test Item' return { 'doctype': 'Quotation', - 'customer': customer, + 'customer_lead': customer_lead, 'items': [ { 'item_code': item_code, @@ -229,7 +229,7 @@ def make_quotation(**args): qo.transaction_date = args.transaction_date qo.company = args.company or "_Test Company" - qo.customer = args.customer or "_Test Customer" + qo.customer_lead = args.customer_lead or "_Test Customer" qo.currency = args.currency or "INR" if args.selling_price_list: qo.selling_price_list = args.selling_price_list diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index 7d6b41ef5fc..d1124a662b6 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -33,7 +33,7 @@ class TestShoppingCart(unittest.TestCase): self.assertEqual(quotation.quotation_to, "Customer") self.assertEqual(quotation.contact_person, frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com"))) - self.assertEqual(quotation.lead, None) + self.assertEqual(quotation.customer_lead, None) self.assertEqual(quotation.contact_email, frappe.session.user) return quotation @@ -44,8 +44,7 @@ class TestShoppingCart(unittest.TestCase): # test if quotation with customer is fetched quotation = _get_cart_quotation() self.assertEqual(quotation.quotation_to, "Customer") - self.assertEqual(quotation.customer, "_Test Customer") - self.assertEqual(quotation.lead, None) + self.assertEqual(quotation.customer_lead, "_Test Customer") self.assertEqual(quotation.contact_email, frappe.session.user) return quotation @@ -107,7 +106,7 @@ class TestShoppingCart(unittest.TestCase): from erpnext.accounts.party import set_taxes - tax_rule_master = set_taxes(quotation.customer, "Customer", \ + tax_rule_master = set_taxes(quotation.customer_lead, "Customer", \ quotation.transaction_date, quotation.company, None, None, \ quotation.customer_address, quotation.shipping_address_name, 1) self.assertEqual(quotation.taxes_and_charges, tax_rule_master) @@ -122,7 +121,7 @@ class TestShoppingCart(unittest.TestCase): "doctype": "Quotation", "quotation_to": "Customer", "order_type": "Shopping Cart", - "customer": get_party(frappe.session.user).name, + "customer_lead": get_party(frappe.session.user).name, "docstatus": 0, "contact_email": frappe.session.user, "selling_price_list": "_Test Price List Rest of the World", From e2fc03e5613ea8c8b08b2d94efc4c817363fee6e Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 3 Apr 2019 10:50:09 +0530 Subject: [PATCH 08/59] fix: Cart test fixes --- erpnext/selling/doctype/quotation/quotation.py | 4 ++-- erpnext/shopping_cart/cart.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 524a7a6039b..dabb12bca42 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -205,8 +205,8 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): def _make_customer(source_name, ignore_permissions=False): quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "customer_lead"]) - if quotation and quotation[0] and not quotation[2]: - lead_name = quotation[0] + if quotation and quotation[1]: + lead_name = quotation[1] customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name}, ["name", "customer_name"], as_dict=True) if not customer_name: diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index cc3205c7d70..691b960d05a 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -192,7 +192,7 @@ def _get_cart_quotation(party=None): party = get_party() quotation = frappe.get_all("Quotation", fields=["name"], filters= - {party.doctype.lower(): party.name, "order_type": "Shopping Cart", "docstatus": 0}, + {"customer_lead": party.name, "order_type": "Shopping Cart", "docstatus": 0}, order_by="modified desc", limit_page_length=1) if quotation: From f094662f5e07a860fe0130462cfadb77d80256a0 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 8 Apr 2019 12:28:50 +0530 Subject: [PATCH 09/59] fix:Test record fixes --- .../move_customer_lead_to_dynamic_column.py | 2 +- .../doctype/quotation/test_records.json | 48 +++++++++---------- erpnext/shopping_cart/cart.py | 10 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py index 23e91c7ebc7..345b4ac714a 100644 --- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py +++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py @@ -5,6 +5,6 @@ from __future__ import unicode_literals import frappe def execute(): - + frappe.reload_doctype("Quotation") frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json index 7a9d3eb1e25..03acea35cfa 100644 --- a/erpnext/selling/doctype/quotation/test_records.json +++ b/erpnext/selling/doctype/quotation/test_records.json @@ -1,36 +1,36 @@ [ { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer": "_Test Customer", - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer", - "doctype": "Quotation", - "base_grand_total": 1000.0, - "grand_total": 1000.0, - "order_type": "Sales", - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer_lead": "_Test Customer", + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer", + "doctype": "Quotation", + "base_grand_total": 1000.0, + "grand_total": 1000.0, + "order_type": "Sales", + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", "items": [ { - "base_amount": 1000.0, - "base_rate": 100.0, - "description": "CPU", - "doctype": "Quotation Item", - "item_code": "_Test Item Home Desktop 100", - "item_name": "CPU", - "parentfield": "items", - "qty": 10.0, + "base_amount": 1000.0, + "base_rate": 100.0, + "description": "CPU", + "doctype": "Quotation Item", + "item_code": "_Test Item Home Desktop 100", + "item_name": "CPU", + "parentfield": "items", + "qty": 10.0, "rate": 100.0, "uom": "_Test UOM 1", "stock_uom": "_Test UOM 1", "conversion_factor": 1.0 } - ], - "quotation_to": "Customer", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory", + ], + "quotation_to": "Customer", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory", "transaction_date": "2013-02-21", "valid_till": "2013-03-21" } diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 691b960d05a..a3ad5a04ea5 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -207,7 +207,7 @@ def _get_cart_quotation(party=None): "status": "Draft", "docstatus": 0, "__islocal": 1, - (party.doctype.lower()): party.name + "customer_lead": party.name }) qdoc.contact_person = frappe.db.get_value("Contact", {"email_id": frappe.session.user}) @@ -287,9 +287,9 @@ def _set_price_list(quotation, cart_settings): # check if customer price list exists selling_price_list = None - if quotation.customer: + if quotation.customer_lead: from erpnext.accounts.party import get_default_price_list - selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.customer)) + selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.customer_lead)) # else check for territory based price list if not selling_price_list: @@ -301,9 +301,9 @@ def set_taxes(quotation, cart_settings): """set taxes based on billing territory""" from erpnext.accounts.party import set_taxes - customer_group = frappe.db.get_value("Customer", quotation.customer, "customer_group") + customer_group = frappe.db.get_value("Customer", quotation.customer_lead, "customer_group") - quotation.taxes_and_charges = set_taxes(quotation.customer, "Customer", \ + quotation.taxes_and_charges = set_taxes(quotation.customer_lead, "Customer", \ quotation.transaction_date, quotation.company, customer_group, None, \ quotation.customer_address, quotation.shipping_address_name, 1) # From 7f7a1b48ed1b2db6629169a9d82e0ea98fe56496 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 8 Apr 2019 21:53:05 +0530 Subject: [PATCH 10/59] fix: Test case fixes inquotation --- erpnext/selling/doctype/quotation/quotation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index dabb12bca42..8feb3b9d5f4 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -122,8 +122,8 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False): def set_missing_values(source, target): if customer: - target.customer = customer.name - target.customer_name = customer.customer_name + target.customer = customer + target.customer_name = customer target.ignore_pricing_rule = 1 target.flags.ignore_permissions = ignore_permissions target.run_method("set_missing_values") @@ -169,8 +169,8 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): def set_missing_values(source, target): if customer: - target.customer = customer.name - target.customer_name = customer.customer_name + target.customer = customer + target.customer_name = customer target.ignore_pricing_rule = 1 target.flags.ignore_permissions = ignore_permissions target.run_method("set_missing_values") @@ -204,8 +204,8 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): return doclist def _make_customer(source_name, ignore_permissions=False): - quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "customer_lead"]) - if quotation and quotation[1]: + quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "customer_lead", "customer_name"]) + if quotation and quotation[1] and not quotation[2]: lead_name = quotation[1] customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name}, ["name", "customer_name"], as_dict=True) @@ -234,3 +234,5 @@ def _make_customer(source_name, ignore_permissions=False): frappe.throw(_("Please create Customer from Lead {0}").format(lead_name)) else: return customer_name + else: + return quotation[2] From 4f0a4a1a2dc5452eb6c3c26afc856201607f0fa6 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 10 Apr 2019 16:04:22 +0530 Subject: [PATCH 11/59] fix: Customer dashboard fixes --- erpnext/selling/doctype/customer/customer_dashboard.py | 3 +++ erpnext/selling/doctype/quotation/quotation.py | 10 +++++----- erpnext/shopping_cart/test_shopping_cart.py | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer_dashboard.py b/erpnext/selling/doctype/customer/customer_dashboard.py index f2f430a61e2..b7175c9675d 100644 --- a/erpnext/selling/doctype/customer/customer_dashboard.py +++ b/erpnext/selling/doctype/customer/customer_dashboard.py @@ -6,6 +6,9 @@ def get_data(): 'heatmap': True, 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), 'fieldname': 'customer', + 'non_standard_fieldnames': { + 'Quotation': 'customer_lead' + }, 'transactions': [ { 'label': _('Pre Sales'), diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 8feb3b9d5f4..e99b635af9b 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -122,8 +122,8 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False): def set_missing_values(source, target): if customer: - target.customer = customer - target.customer_name = customer + target.customer = customer.name + target.customer_name = customer.customer_name target.ignore_pricing_rule = 1 target.flags.ignore_permissions = ignore_permissions target.run_method("set_missing_values") @@ -169,8 +169,8 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): def set_missing_values(source, target): if customer: - target.customer = customer - target.customer_name = customer + target.customer = customer.name + target.customer_name = customer.customer_name target.ignore_pricing_rule = 1 target.flags.ignore_permissions = ignore_permissions target.run_method("set_missing_values") @@ -235,4 +235,4 @@ def _make_customer(source_name, ignore_permissions=False): else: return customer_name else: - return quotation[2] + return frappe.get_doc("Customer",quotation[2]) diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index d1124a662b6..adf57b85cdf 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -33,7 +33,6 @@ class TestShoppingCart(unittest.TestCase): self.assertEqual(quotation.quotation_to, "Customer") self.assertEqual(quotation.contact_person, frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com"))) - self.assertEqual(quotation.customer_lead, None) self.assertEqual(quotation.contact_email, frappe.session.user) return quotation From af4d588f648f4c16e2228ad25fd4fc20ad6aa06b Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sun, 14 Apr 2019 22:30:49 +0530 Subject: [PATCH 12/59] fix: Make customer and lead dynamic_link in opportunity --- erpnext/crm/doctype/lead/lead.py | 2 +- .../crm/doctype/opportunity/opportunity.js | 70 ++++++++----- .../crm/doctype/opportunity/opportunity.json | 99 ++++++++++--------- .../crm/doctype/opportunity/opportunity.py | 45 ++++----- .../doctype/opportunity/test_opportunity.py | 24 ++--- .../crm/doctype/opportunity/test_records.json | 4 +- .../move_customer_lead_to_dynamic_column.py | 6 +- erpnext/selling/doctype/customer/customer.py | 4 +- .../doctype/customer/customer_dashboard.py | 3 +- .../selling/doctype/quotation/quotation.js | 1 + 10 files changed, 144 insertions(+), 114 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index d45c105ab8e..d4460823b47 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -89,7 +89,7 @@ class Lead(SellingController): return frappe.db.get_value("Customer", {"lead_name": self.name}) def has_opportunity(self): - return frappe.db.get_value("Opportunity", {"lead": self.name, "status": ["!=", "Lost"]}) + return frappe.db.get_value("Opportunity", {"customer_lead": self.name, "status": ["!=", "Lost"]}) def has_quotation(self): return frappe.db.get_value("Quotation", { diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index abe560ba5ee..26975c552e2 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -9,16 +9,24 @@ frappe.ui.form.on("Opportunity", { frm.custom_make_buttons = { 'Quotation': 'Quotation', 'Supplier Quotation': 'Supplier Quotation' - } - }, - customer: function(frm) { - frm.trigger('set_contact_link'); - erpnext.utils.get_party_details(frm); - }, + }, - lead: function(frm) { - frm.trigger('set_contact_link'); + frm.set_query("opportunity_from", function() { + return{ + "filters": { + "name": ["in", ["Customer", "Lead"]], + } + } + }); }, + // customer: function(frm) { + // frm.trigger('set_contact_link'); + // erpnext.utils.get_party_details(frm); + // }, + + // lead: function(frm) { + // frm.trigger('set_contact_link'); + // }, with_items: function(frm) { frm.trigger('toggle_mandatory'); @@ -30,16 +38,17 @@ frappe.ui.form.on("Opportunity", { contact_person: erpnext.utils.get_contact_details, - enquiry_from: function(frm) { - frm.toggle_reqd("lead", frm.doc.enquiry_from==="Lead"); - frm.toggle_reqd("customer", frm.doc.enquiry_from==="Customer"); + opportunity_from: function(frm) { + frm.toggle_reqd("customer_lead", frm.doc.opportunity_from); + frm.trigger("set_dynamic_field_label"); }, refresh: function(frm) { var doc = frm.doc; - frm.events.enquiry_from(frm); - frm.trigger('set_contact_link'); + // frm.events.enquiry_from(frm); + // frm.trigger('set_contact_link'); frm.trigger('toggle_mandatory'); + frm.trigger("set_dynamic_field_label"); erpnext.toggle_naming_series(); if(!doc.__islocal && doc.status!=="Lost") { @@ -74,11 +83,22 @@ frappe.ui.form.on("Opportunity", { } }, - set_contact_link: function(frm) { - if(frm.doc.customer) { - frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'} - } else if(frm.doc.lead) { - frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'} + // set_contact_link: function(frm) { + // if(frm.doc.customer) { + // frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'} + // } else if(frm.doc.lead) { + // frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'} + // } + // }, + set_dynamic_field_label: function(frm){ + if (frm.doc.opportunity_from == "Customer") + { + frm.set_df_property("customer_lead", "label", "Customer"); + } + + if (frm.doc.opportunity_from == "Lead") + { + frm.set_df_property("customer_lead", "label", "Lead"); } }, @@ -97,10 +117,10 @@ frappe.ui.form.on("Opportunity", { // TODO commonify this code erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ onload: function() { - if(!this.frm.doc.enquiry_from && this.frm.doc.customer) - this.frm.doc.enquiry_from = "Customer"; - if(!this.frm.doc.enquiry_from && this.frm.doc.lead) - this.frm.doc.enquiry_from = "Lead"; + // if(!this.frm.doc.enquiry_from && this.frm.doc.customer) + // this.frm.doc.enquiry_from = "Customer"; + // if(!this.frm.doc.enquiry_from && this.frm.doc.lead) + // this.frm.doc.enquiry_from = "Lead"; if(!this.frm.doc.status) set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Open' }); @@ -148,7 +168,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ $.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm})); cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { - if(doc.enquiry_from == 'Lead' && doc.lead) + if(doc.opportunity_from == 'Lead' && doc.lead) cur_frm.cscript.lead(doc, cdt, cdn); } @@ -171,10 +191,10 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { } cur_frm.cscript.lead = function(doc, cdt, cdn) { - cur_frm.toggle_display("contact_info", doc.customer || doc.lead); + cur_frm.toggle_display("contact_info", doc.customer_lead); erpnext.utils.map_current_doc({ method: "erpnext.crm.doctype.lead.lead.make_opportunity", - source_name: cur_frm.doc.lead, + source_name: cur_frm.doc.customer_lead, frm: cur_frm }); } diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index fc86842e01f..7e23a3c12bd 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -21,6 +21,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "from_section", "fieldtype": "Section Break", "hidden": 0, @@ -54,6 +55,7 @@ "collapsible": 0, "columns": 0, "default": "", + "fetch_if_empty": 0, "fieldname": "naming_series", "fieldtype": "Select", "hidden": 0, @@ -88,8 +90,9 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "enquiry_from", - "fieldtype": "Select", + "fetch_if_empty": 0, + "fieldname": "opportunity_from", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -102,7 +105,7 @@ "no_copy": 0, "oldfieldname": "enquiry_from", "oldfieldtype": "Select", - "options": "\nLead\nCustomer", + "options": "DocType", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, @@ -122,9 +125,10 @@ "bold": 1, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.enquiry_from===\"Customer\"", - "fieldname": "customer", - "fieldtype": "Link", + "depends_on": "", + "fetch_if_empty": 0, + "fieldname": "customer_lead", + "fieldtype": "Dynamic Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -132,47 +136,12 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 1, - "label": "Customer", + "label": "Customer/Lead", "length": 0, "no_copy": 0, "oldfieldname": "customer", "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.enquiry_from===\"Lead\"", - "fieldname": "lead", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Lead", - "length": 0, - "no_copy": 0, - "oldfieldname": "lead", - "oldfieldtype": "Link", - "options": "Lead", + "options": "opportunity_from", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, @@ -193,6 +162,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "customer_name", "fieldtype": "Data", "hidden": 0, @@ -224,6 +194,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break0", "fieldtype": "Column Break", "hidden": 0, @@ -256,6 +227,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "title", "fieldtype": "Data", "hidden": 1, @@ -289,6 +261,7 @@ "collapsible": 0, "columns": 0, "default": "Sales", + "fetch_if_empty": 0, "fieldname": "opportunity_type", "fieldtype": "Link", "hidden": 0, @@ -324,6 +297,7 @@ "collapsible": 0, "columns": 0, "default": "Open", + "fetch_if_empty": 0, "fieldname": "status", "fieldtype": "Select", "hidden": 0, @@ -359,6 +333,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.status===\"Lost\"", + "fetch_if_empty": 0, "fieldname": "order_lost_reason", "fieldtype": "Small Text", "hidden": 0, @@ -390,6 +365,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "mins_to_first_response", "fieldtype": "Float", "hidden": 0, @@ -423,6 +399,7 @@ "collapsible": 1, "collapsible_depends_on": "contact_by", "columns": 0, + "fetch_if_empty": 0, "fieldname": "next_contact", "fieldtype": "Section Break", "hidden": 0, @@ -456,6 +433,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "contact_by", "fieldtype": "Link", "hidden": 0, @@ -492,6 +470,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "contact_date", "fieldtype": "Datetime", "hidden": 0, @@ -525,6 +504,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break2", "fieldtype": "Column Break", "hidden": 0, @@ -557,6 +537,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "to_discuss", "fieldtype": "Small Text", "hidden": 0, @@ -590,6 +571,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_14", "fieldtype": "Section Break", "hidden": 0, @@ -622,6 +604,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "currency", "fieldtype": "Link", "hidden": 0, @@ -655,6 +638,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "opportunity_amount", "fieldtype": "Currency", "hidden": 0, @@ -687,6 +671,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "with_items", "fieldtype": "Check", "hidden": 0, @@ -719,6 +704,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_17", "fieldtype": "Column Break", "hidden": 0, @@ -751,6 +737,7 @@ "collapsible": 0, "columns": 0, "default": "Prospecting", + "fetch_if_empty": 0, "fieldname": "sales_stage", "fieldtype": "Link", "hidden": 0, @@ -785,6 +772,7 @@ "collapsible": 0, "columns": 0, "default": "100", + "fetch_if_empty": 0, "fieldname": "probability", "fieldtype": "Percent", "hidden": 0, @@ -818,6 +806,7 @@ "collapsible": 0, "columns": 0, "depends_on": "with_items", + "fetch_if_empty": 0, "fieldname": "items_section", "fieldtype": "Section Break", "hidden": 0, @@ -852,6 +841,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "items", "fieldtype": "Table", "hidden": 0, @@ -888,6 +878,7 @@ "collapsible_depends_on": "next_contact_by", "columns": 0, "depends_on": "eval:doc.lead || doc.customer", + "fetch_if_empty": 0, "fieldname": "contact_info", "fieldtype": "Section Break", "hidden": 0, @@ -921,6 +912,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.customer || doc.lead", + "fetch_if_empty": 0, "fieldname": "customer_address", "fieldtype": "Link", "hidden": 0, @@ -953,6 +945,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "address_display", "fieldtype": "Small Text", "hidden": 1, @@ -988,6 +981,7 @@ "columns": 0, "depends_on": "customer", "description": "", + "fetch_if_empty": 0, "fieldname": "territory", "fieldtype": "Link", "hidden": 0, @@ -1022,6 +1016,7 @@ "columns": 0, "depends_on": "customer", "description": "", + "fetch_if_empty": 0, "fieldname": "customer_group", "fieldtype": "Link", "hidden": 0, @@ -1056,6 +1051,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break3", "fieldtype": "Column Break", "hidden": 0, @@ -1087,6 +1083,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.lead || doc.customer", + "fetch_if_empty": 0, "fieldname": "contact_person", "fieldtype": "Link", "hidden": 0, @@ -1120,6 +1117,7 @@ "collapsible": 0, "columns": 0, "depends_on": "customer", + "fetch_if_empty": 0, "fieldname": "contact_display", "fieldtype": "Small Text", "hidden": 0, @@ -1152,6 +1150,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.lead || doc.customer", + "fetch_if_empty": 0, "fieldname": "contact_email", "fieldtype": "Data", "hidden": 0, @@ -1184,6 +1183,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.lead || doc.customer", + "fetch_if_empty": 0, "fieldname": "contact_mobile", "fieldtype": "Small Text", "hidden": 0, @@ -1216,6 +1216,7 @@ "collapsible": 1, "collapsible_depends_on": "", "columns": 0, + "fetch_if_empty": 0, "fieldname": "more_info", "fieldtype": "Section Break", "hidden": 0, @@ -1249,6 +1250,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "source", "fieldtype": "Link", "hidden": 0, @@ -1285,6 +1287,7 @@ "columns": 0, "depends_on": "eval: doc.source==\"Campaign\"", "description": "Enter name of campaign if source of enquiry is campaign", + "fetch_if_empty": 0, "fieldname": "campaign", "fieldtype": "Link", "hidden": 0, @@ -1319,6 +1322,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break1", "fieldtype": "Column Break", "hidden": 0, @@ -1351,6 +1355,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "company", "fieldtype": "Link", "hidden": 0, @@ -1386,6 +1391,7 @@ "collapsible": 0, "columns": 0, "default": "Today", + "fetch_if_empty": 0, "fieldname": "transaction_date", "fieldtype": "Date", "hidden": 0, @@ -1420,6 +1426,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amended_from", "fieldtype": "Link", "hidden": 0, @@ -1460,7 +1467,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-10-01 09:28:43.990999", + "modified": "2019-04-14 21:00:16.007097", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", @@ -1508,11 +1515,11 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 0, - "search_fields": "status,transaction_date,customer,lead,opportunity_type,territory,company", + "search_fields": "status,transaction_date,customer_lead,opportunity_type,territory,company", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", - "timeline_field": "customer", + "timeline_field": "customer_lead", "title_field": "title", "track_changes": 0, "track_seen": 1, diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 102d7378287..55fdbf577bd 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -15,8 +15,8 @@ sender_field = "contact_email" class Opportunity(TransactionBase): def after_insert(self): - if self.lead: - frappe.get_doc("Lead", self.lead).set_status(update=True) + if self.opportunity_from == "Lead": + frappe.get_doc("Lead", self.customer_lead).set_status(update=True) def validate(self): self._prev = frappe._dict({ @@ -28,7 +28,7 @@ class Opportunity(TransactionBase): self.make_new_lead_if_required() - if not self.enquiry_from: + if not self.opportunity_from: frappe.throw(_("Opportunity From field is mandatory")) self.validate_item_details() @@ -44,7 +44,7 @@ class Opportunity(TransactionBase): def make_new_lead_if_required(self): """Set lead against new opportunity""" - if not (self.lead or self.customer) and self.contact_email: + if not self.customer_lead and self.contact_email: # check if customer is already created agains the self.contact_email customer = frappe.db.sql("""select distinct `tabDynamic Link`.link_name as customer @@ -60,8 +60,8 @@ class Opportunity(TransactionBase): `tabDynamic Link`.link_doctype='Customer' """.format(self.contact_email), as_dict=True) if customer and customer[0].customer: - self.customer = customer[0].customer - self.enquiry_from = "Customer" + self.customer_lead = customer[0].customer + self.opportunity_from = "Customer" return lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email}) @@ -88,8 +88,8 @@ class Opportunity(TransactionBase): lead.insert(ignore_permissions=True) lead_name = lead.name - self.enquiry_from = "Lead" - self.lead = lead_name + self.opportunity_from = "Lead" + self.customer_lead = lead_name def declare_enquiry_lost(self,arg): if not self.has_active_quotation(): @@ -136,10 +136,10 @@ class Opportunity(TransactionBase): return True def validate_cust_name(self): - if self.customer: - self.customer_name = frappe.db.get_value("Customer", self.customer, "customer_name") - elif self.lead: - lead_name, company_name = frappe.db.get_value("Lead", self.lead, ["lead_name", "company_name"]) + if self.customer_lead and self.opportunity_from == 'Customer': + self.customer_name = frappe.db.get_value("Customer", self.customer_lead, "customer_name") + elif self.customer_lead and self.opportunity_from == 'Lead': + lead_name, company_name = frappe.db.get_value("Lead", self.customer_lead, ["lead_name", "company_name"]) self.customer_name = company_name or lead_name def on_update(self): @@ -152,16 +152,16 @@ class Opportunity(TransactionBase): opts.description = "" opts.contact_date = self.contact_date - if self.customer: + if self.customer_lead and self.opportunity_from == 'Customer': if self.contact_person: opts.description = 'Contact '+cstr(self.contact_person) else: - opts.description = 'Contact customer '+cstr(self.customer) - elif self.lead: + opts.description = 'Contact customer '+cstr(self.customer_lead) + elif self.customer_lead and self.opportunity_from == 'Lead': if self.contact_display: opts.description = 'Contact '+cstr(self.contact_display) else: - opts.description = 'Contact lead '+cstr(self.lead) + opts.description = 'Contact lead '+cstr(self.customer_lead) opts.subject = opts.description opts.description += '. By : ' + cstr(self.contact_by) @@ -187,16 +187,13 @@ class Opportunity(TransactionBase): if not d.get(key): d.set(key, item.get(key)) def validate_lead_cust(self): - if self.enquiry_from == 'Lead': - if not self.lead: + if self.opportunity_from == 'Lead': + if not self.customer_lead: frappe.throw(_("Lead must be set if Opportunity is made from Lead")) - else: - self.customer = None - elif self.enquiry_from == 'Customer': - if not self.customer: + elif self.opportunity_from == 'Customer': + if not self.customer_lead: msgprint(_("Customer is mandatory if 'Opportunity From' is selected as Customer"), raise_exception=1) - else: - self.lead = None + @frappe.whitelist() def get_item_details(item_code): diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index ef2945b41f9..1fc18bae24b 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -37,13 +37,13 @@ class TestOpportunity(unittest.TestCase): # new lead should be created against the new.opportunity@example.com opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) - self.assertTrue(opp_doc.lead) - self.assertEqual(opp_doc.enquiry_from, "Lead") - self.assertEqual(frappe.db.get_value("Lead", opp_doc.lead, "email_id"), + self.assertTrue(opp_doc.customer_lead) + self.assertEqual(opp_doc.opportunity_from, "Lead") + self.assertEqual(frappe.db.get_value("Lead", opp_doc.customer_lead, "email_id"), 'new.opportunity@example.com') # create new customer and create new contact against 'new.opportunity@example.com' - customer = make_customer(opp_doc.lead).insert(ignore_permissions=True) + customer = make_customer(opp_doc.customer_lead).insert(ignore_permissions=True) frappe.get_doc({ "doctype": "Contact", "email_id": "new.opportunity@example.com", @@ -55,9 +55,9 @@ class TestOpportunity(unittest.TestCase): }).insert(ignore_permissions=True) opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) - self.assertTrue(opp_doc.customer) - self.assertEqual(opp_doc.enquiry_from, "Customer") - self.assertEqual(opp_doc.customer, customer.name) + self.assertTrue(opp_doc.customer_lead) + self.assertEqual(opp_doc.opportunity_from, "Customer") + self.assertEqual(opp_doc.customer_lead, customer.name) def make_opportunity(**args): args = frappe._dict(args) @@ -65,17 +65,17 @@ def make_opportunity(**args): opp_doc = frappe.get_doc({ "doctype": "Opportunity", "company": args.company or "_Test Company", - "enquiry_from": args.enquiry_from or "Customer", + "opportunity_from": args.opportunity_from or "Customer", "opportunity_type": "Sales", "with_items": args.with_items or 0, "transaction_date": today() }) - if opp_doc.enquiry_from == 'Customer': - opp_doc.customer = args.customer or "_Test Customer" + if opp_doc.opportunity_from == 'Customer': + opp_doc.customer_lead= args.customer or "_Test Customer" - if opp_doc.enquiry_from == 'Lead': - opp_doc.customer = args.lead or "_T-Lead-00001" + if opp_doc.opportunity_from == 'Lead': + opp_doc.customer_lead = args.lead or "_T-Lead-00001" if args.with_items: opp_doc.append('items', { diff --git a/erpnext/crm/doctype/opportunity/test_records.json b/erpnext/crm/doctype/opportunity/test_records.json index 84dfea515a0..afabb764a1f 100644 --- a/erpnext/crm/doctype/opportunity/test_records.json +++ b/erpnext/crm/doctype/opportunity/test_records.json @@ -2,9 +2,9 @@ { "doctype": "Opportunity", "name": "_Test Opportunity 1", - "enquiry_from": "Lead", + "opportunity_from": "Lead", "enquiry_type": "Sales", - "lead": "_T-Lead-00001", + "customer_lead": "_T-Lead-00001", "transaction_date": "2013-12-12", "items": [{ "item_name": "Test Item", diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py index 345b4ac714a..33eb713cc51 100644 --- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py +++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py @@ -7,4 +7,8 @@ import frappe def execute(): frappe.reload_doctype("Quotation") frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) - frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) \ No newline at end of file + frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) + + frappe.reload_doctype("Opportunity") + frappe.db.sql(""" UPDATE `tabOpportunity` set customer_lead = lead WHERE opportunity_from = 'Lead' """) + frappe.db.sql(""" UPDATE `tabOpportunity` set customer_lead = customer WHERE opportunity_from = 'Customer' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 139d76157e7..968b6faed39 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -104,8 +104,8 @@ class Customer(TransactionBase): if self.lead_name: frappe.db.set_value('Lead', self.lead_name, 'status', 'Converted', update_modified=False) - for d in frappe.get_all('Opportunity', {'lead': self.lead_name}): - frappe.db.set_value('Opportunity', d.name, 'customer', self.name, update_modified=False) + for d in frappe.get_all('Opportunity', {'customer_lead': self.lead_name}): + frappe.db.set_value('Opportunity', d.name, 'customer_lead', self.name, update_modified=False) def create_lead_address_contact(self): if self.lead_name: diff --git a/erpnext/selling/doctype/customer/customer_dashboard.py b/erpnext/selling/doctype/customer/customer_dashboard.py index b7175c9675d..f8dbbd6d4ec 100644 --- a/erpnext/selling/doctype/customer/customer_dashboard.py +++ b/erpnext/selling/doctype/customer/customer_dashboard.py @@ -7,7 +7,8 @@ def get_data(): 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), 'fieldname': 'customer', 'non_standard_fieldnames': { - 'Quotation': 'customer_lead' + 'Quotation': 'customer_lead', + 'Opportunity': 'customer_lead' }, 'transactions': [ { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index cf8788963cc..5455caa069b 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -28,6 +28,7 @@ frappe.ui.form.on('Quotation', { quotation_to: function(frm) { frm.trigger("set_label"); frm.trigger("toggle_reqd_lead_customer"); + frm.trigger("set_dynamic_field_label"); }, set_label: function(frm) { From e8883e20cd9d4e3146fa0f56096412d417db435d Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sun, 14 Apr 2019 22:39:58 +0530 Subject: [PATCH 13/59] fix: Remove comments and unused code --- .../crm/doctype/opportunity/opportunity.js | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 26975c552e2..e70745e8f51 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -19,14 +19,6 @@ frappe.ui.form.on("Opportunity", { } }); }, - // customer: function(frm) { - // frm.trigger('set_contact_link'); - // erpnext.utils.get_party_details(frm); - // }, - - // lead: function(frm) { - // frm.trigger('set_contact_link'); - // }, with_items: function(frm) { frm.trigger('toggle_mandatory'); @@ -46,7 +38,6 @@ frappe.ui.form.on("Opportunity", { refresh: function(frm) { var doc = frm.doc; // frm.events.enquiry_from(frm); - // frm.trigger('set_contact_link'); frm.trigger('toggle_mandatory'); frm.trigger("set_dynamic_field_label"); erpnext.toggle_naming_series(); @@ -83,13 +74,6 @@ frappe.ui.form.on("Opportunity", { } }, - // set_contact_link: function(frm) { - // if(frm.doc.customer) { - // frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'} - // } else if(frm.doc.lead) { - // frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'} - // } - // }, set_dynamic_field_label: function(frm){ if (frm.doc.opportunity_from == "Customer") { @@ -117,10 +101,6 @@ frappe.ui.form.on("Opportunity", { // TODO commonify this code erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ onload: function() { - // if(!this.frm.doc.enquiry_from && this.frm.doc.customer) - // this.frm.doc.enquiry_from = "Customer"; - // if(!this.frm.doc.enquiry_from && this.frm.doc.lead) - // this.frm.doc.enquiry_from = "Lead"; if(!this.frm.doc.status) set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Open' }); @@ -168,7 +148,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ $.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm})); cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { - if(doc.opportunity_from == 'Lead' && doc.lead) + if(doc.opportunity_from == 'Lead' && doc.customer_lead) cur_frm.cscript.lead(doc, cdt, cdn); } From f0ee3d26a7820901bb667b928130582884216ae8 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 15 Apr 2019 19:20:59 +0530 Subject: [PATCH 14/59] fix: Styling and indentation fixes --- .../crm/doctype/opportunity/opportunity.py | 2 +- .../doctype/quotation/test_records.json | 70 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 55fdbf577bd..72851d98fcc 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -44,7 +44,7 @@ class Opportunity(TransactionBase): def make_new_lead_if_required(self): """Set lead against new opportunity""" - if not self.customer_lead and self.contact_email: + if not self.customer_lead and self.contact_email: #nosec # check if customer is already created agains the self.contact_email customer = frappe.db.sql("""select distinct `tabDynamic Link`.link_name as customer diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json index 03acea35cfa..e18798926ba 100644 --- a/erpnext/selling/doctype/quotation/test_records.json +++ b/erpnext/selling/doctype/quotation/test_records.json @@ -1,37 +1,37 @@ [ - { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer_lead": "_Test Customer", - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer", - "doctype": "Quotation", - "base_grand_total": 1000.0, - "grand_total": 1000.0, - "order_type": "Sales", - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", - "items": [ - { - "base_amount": 1000.0, - "base_rate": 100.0, - "description": "CPU", - "doctype": "Quotation Item", - "item_code": "_Test Item Home Desktop 100", - "item_name": "CPU", - "parentfield": "items", - "qty": 10.0, - "rate": 100.0, - "uom": "_Test UOM 1", - "stock_uom": "_Test UOM 1", - "conversion_factor": 1.0 - } - ], - "quotation_to": "Customer", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory", - "transaction_date": "2013-02-21", - "valid_till": "2013-03-21" - } + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer_lead": "_Test Customer", + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer", + "doctype": "Quotation", + "base_grand_total": 1000.0, + "grand_total": 1000.0, + "order_type": "Sales", + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "items": [ + { + "base_amount": 1000.0, + "base_rate": 100.0, + "description": "CPU", + "doctype": "Quotation Item", + "item_code": "_Test Item Home Desktop 100", + "item_name": "CPU", + "parentfield": "items", + "qty": 10.0, + "rate": 100.0, + "uom": "_Test UOM 1", + "stock_uom": "_Test UOM 1", + "conversion_factor": 1.0 + } + ], + "quotation_to": "Customer", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory", + "transaction_date": "2013-02-21", + "valid_till": "2013-03-21" + } ] \ No newline at end of file From d333d2e6ebfcc6def9961d6e7fb82b3e6d0897eb Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 16 Apr 2019 08:53:29 +0530 Subject: [PATCH 15/59] fix: Change enquiry_from to opportunity_from in multiple files --- erpnext/crm/doctype/opportunity/opportunity.js | 3 +-- erpnext/crm/doctype/opportunity/opportunity.py | 4 ++-- erpnext/crm/doctype/opportunity/opportunity_list.js | 2 +- erpnext/crm/doctype/opportunity/test_opportunity.js | 2 +- .../crm/report/lead_conversion_time/lead_conversion_time.py | 2 +- erpnext/demo/user/sales.py | 2 +- erpnext/hub_node/legacy.py | 2 +- erpnext/setup/setup_wizard/operations/sample_data.py | 2 +- erpnext/templates/utils.py | 2 +- 9 files changed, 10 insertions(+), 11 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index e70745e8f51..1afea839507 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -37,9 +37,8 @@ frappe.ui.form.on("Opportunity", { refresh: function(frm) { var doc = frm.doc; - // frm.events.enquiry_from(frm); + frm.events.opportunity_from(frm); frm.trigger('toggle_mandatory'); - frm.trigger("set_dynamic_field_label"); erpnext.toggle_naming_series(); if(!doc.__islocal && doc.status!=="Lost") { diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 72851d98fcc..8d7479fd896 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -44,7 +44,7 @@ class Opportunity(TransactionBase): def make_new_lead_if_required(self): """Set lead against new opportunity""" - if not self.customer_lead and self.contact_email: #nosec + if (not self.get("customer_lead")) and self.contact_email: # check if customer is already created agains the self.contact_email customer = frappe.db.sql("""select distinct `tabDynamic Link`.link_name as customer @@ -242,7 +242,7 @@ def make_quotation(source_name, target_doc=None): "Opportunity": { "doctype": "Quotation", "field_map": { - "enquiry_from": "quotation_to", + "opportunity_from": "quotation_to", "opportunity_type": "order_type", "name": "enq_no", } diff --git a/erpnext/crm/doctype/opportunity/opportunity_list.js b/erpnext/crm/doctype/opportunity/opportunity_list.js index 0dbbf8add1c..9712fb04c56 100644 --- a/erpnext/crm/doctype/opportunity/opportunity_list.js +++ b/erpnext/crm/doctype/opportunity/opportunity_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Opportunity'] = { - add_fields: ["customer_name", "opportunity_type", "enquiry_from", "status"], + add_fields: ["customer_name", "opportunity_type", "opportunity_from", "status"], get_indicator: function(doc) { var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status]; if(doc.status=="Quotation") { diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.js b/erpnext/crm/doctype/opportunity/test_opportunity.js index f2b04f86474..45b97ddc4d1 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.js +++ b/erpnext/crm/doctype/opportunity/test_opportunity.js @@ -6,7 +6,7 @@ QUnit.test("test: opportunity", function (assert) { () => frappe.timeout(1), () => frappe.click_button('New'), () => frappe.timeout(1), - () => cur_frm.set_value('enquiry_from', 'Customer'), + () => cur_frm.set_value('opportunity_from', 'Customer'), () => cur_frm.set_value('customer', 'Test Customer 1'), // check items diff --git a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py index d9ee30ec1ae..d91b9c5607d 100644 --- a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py +++ b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py @@ -66,7 +66,7 @@ def get_columns(): def get_communication_details(filters): communication_count = None communication_list = [] - opportunities = frappe.db.get_values('Opportunity', {'enquiry_from': 'Lead'},\ + opportunities = frappe.db.get_values('Opportunity', {'opportunity_from': 'Lead'},\ ['name', 'customer_name', 'lead', 'contact_email'], as_dict=1) for d in opportunities: diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py index 69ba9007a61..3809c1f0924 100644 --- a/erpnext/demo/user/sales.py +++ b/erpnext/demo/user/sales.py @@ -56,7 +56,7 @@ def work(domain="Manufacturing"): def make_opportunity(domain): b = frappe.get_doc({ "doctype": "Opportunity", - "enquiry_from": "Customer", + "opportunity_from": "Customer", "customer": get_random("Customer"), "opportunity_type": "Sales", "with_items": 1, diff --git a/erpnext/hub_node/legacy.py b/erpnext/hub_node/legacy.py index 9daee2752fa..95ada76a6a5 100644 --- a/erpnext/hub_node/legacy.py +++ b/erpnext/hub_node/legacy.py @@ -28,7 +28,7 @@ def make_opportunity(buyer_name, email_id): lead.save(ignore_permissions=True) o = frappe.new_doc("Opportunity") - o.enquiry_from = "Lead" + o.opportunity_from = "Lead" o.lead = frappe.get_all("Lead", filters={"email_id": email_id}, fields = ["name"])[0]["name"] o.save(ignore_permissions=True) diff --git a/erpnext/setup/setup_wizard/operations/sample_data.py b/erpnext/setup/setup_wizard/operations/sample_data.py index 3f787347393..e21c9bd1089 100644 --- a/erpnext/setup/setup_wizard/operations/sample_data.py +++ b/erpnext/setup/setup_wizard/operations/sample_data.py @@ -33,7 +33,7 @@ def make_sample_data(domains, make_dependent = False): def make_opportunity(items, customer): b = frappe.get_doc({ "doctype": "Opportunity", - "enquiry_from": "Customer", + "opportunity_from": "Customer", "customer": customer, "opportunity_type": _("Sales"), "with_items": 1 diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py index cb44fd30d22..97e2a7f7235 100644 --- a/erpnext/templates/utils.py +++ b/erpnext/templates/utils.py @@ -28,7 +28,7 @@ def send_message(subject="Website Query", message="", sender="", status="Open"): opportunity = frappe.get_doc(dict( doctype ='Opportunity', - enquiry_from = 'Customer' if customer else 'Lead', + opportunity_from = 'Customer' if customer else 'Lead', status = 'Open', title = subject, contact_email = sender, From 28fe73640b629aefe8b3b88d10288610ed36fab6 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 16 Apr 2019 15:21:51 +0530 Subject: [PATCH 16/59] fix: Dynamic link fixes in quotation and opportunity --- erpnext/crm/doctype/opportunity/opportunity.js | 15 +++++++++++++++ erpnext/selling/doctype/quotation/quotation.js | 2 ++ 2 files changed, 17 insertions(+) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 1afea839507..655427ea08b 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -20,6 +20,13 @@ frappe.ui.form.on("Opportunity", { }); }, + customer_lead: function(frm) { + if (frm.doc.opportunity_from == "Customer") { + frm.trigger('set_contact_link'); + erpnext.utils.get_party_details(frm); + } + }, + with_items: function(frm) { frm.trigger('toggle_mandatory'); }, @@ -73,6 +80,14 @@ frappe.ui.form.on("Opportunity", { } }, + set_contact_link: function(frm) { + if(frm.doc.opportunity_from == "Customer" && frm.doc.customer_lead) { + frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'} + } else if(frm.doc.opportunity_from == "Lead" && frm.doc.customer_lead) { + frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'} + } + }, + set_dynamic_field_label: function(frm){ if (frm.doc.opportunity_from == "Customer") { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 5455caa069b..257f9919c88 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -44,6 +44,8 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); + doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead'; + frappe.dynamic_link = {doc: this.frm.doc, fieldname: doctype.toLowerCase(), doctype: doctype} var me = this; From fba8bfc0d0422c87193a38614bc5b331d266b3ef Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Thu, 18 Apr 2019 21:27:22 +0200 Subject: [PATCH 17/59] feat(accounts): add German CoA with numbers --- .../verified/de_kontenplan_SKR04.json | 7 +- ..._kontenplan_SKR04_with_account_number.json | 3615 +++++++++++++++++ 2 files changed, 3618 insertions(+), 4 deletions(-) create mode 100644 erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04.json b/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04.json index e29ad827bf5..7fa67081341 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04.json +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04.json @@ -1,6 +1,6 @@ { "country_code": "de", - "name": "Germany - Kontenplan SKR04", + "name": "SKR04 ohne Kontonummern", "tree": { "Bilanz - Aktiva": { "Anlageverm\u00f6gen": { @@ -1383,8 +1383,7 @@ "Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 1": { "Diskontertr\u00e4ge": {}, "Diskontertr\u00e4ge aus verbundenen Unternehmen": {}, - "Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {}, - "Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {}, + "Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {}, "Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 2": {}, "Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge aus verbundenen Unternehmen": {}, "Sonstige Zinsertr\u00e4ge": {}, @@ -1703,4 +1702,4 @@ "root_type": "Asset" } } -} \ No newline at end of file +} diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json b/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json new file mode 100644 index 00000000000..b0f06911cd3 --- /dev/null +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json @@ -0,0 +1,3615 @@ +{ + "country_code": "de", + "name": "SKR04 mit Kontonummern", + "tree": { + "Aktiva": { + "root_type": "Asset", + "A - Anlageverm\u00f6gen": { + "account_type": "Fixed Asset", + "is_group": 1, + "I - Immaterielle VG": { + "is_group": 1, + "1 - Selbst geschaffene gewerbliche Schutzrechte und \u00e4hnliche Rechte und Werte": { + "is_group": 1 + }, + "2 - entgeltlich erworbene Konzessionen, gewerbl. Schutzrechte und \u00e4hnl. Rechte und Werte sowie Lizenzen an solchen": { + "is_group": 1, + "Entgeltlich erworbene Konzessionen, gewerbl. Schutzrechte und \u00e4hnl. Rechte und Werte sowie Lizenzen an solchen": { + "account_number": "0100" + }, + "Konzessionen ": { + "account_number": "0110" + }, + "Gewerbliche Schutzrechte ": { + "account_number": "0120" + }, + "\u00c4hnliche Rechte und Werte": { + "account_number": "0130" + }, + "EDV-Software": { + "account_number": "0135" + }, + "Lizenzen an gewerblichen Schutzrechten und \u00e4hnl. Rechten und Werten": { + "account_number": "0140" + }, + "Selbst geschaffene immaterielle VG": { + "account_number": "0143", + "account_type": "Fixed Asset" + }, + "Lizenzen und Franchisevertr\u00e4ge": { + "account_number": "0145" + }, + "Konzessionen und gewerbliche Schutzrechte": { + "account_number": "0146" + }, + "Rezepte, Verfahren, Prototypen": { + "account_number": "0147" + }, + "Immaterielle VG in Entwicklung": { + "account_number": "0148" + }, + "Geleistete Anz. auf immaterielle VG": { + "account_number": "0170" + } + }, + "3 - Gesch\u00e4fts- oder Firmenwert": { + "is_group": 1, + "Gesch\u00e4fts- oder Firmenwert ": { + "account_number": "0150" + }, + "Anz. auf Gesch\u00e4fts- oder Firmenwert": { + "account_number": "0179" + } + }, + "4 - geleistete Anz.": { + "is_group": 1, + "Geleistete Anz. auf Vorr\u00e4te": { + "account_number": "1180" + }, + "Geleistete Anz., 7 % Vorsteuer": { + "account_number": "1181" + }, + "Geleistete Anz., 16 % Vorsteuer": { + "account_number": "1184" + }, + "Geleistete Anz., 15 % Vorsteuer": { + "account_number": "1185" + }, + "Geleistete Anz., 19 % Vorsteuer": { + "account_number": "1186" + } + } + }, + "II - Sachanlagen": { + "1 - Grundst\u00fccke, grundst\u00fccksgleiche Rechte und Bauten einschl. der Bauten auf fremden Grundst\u00fccken": { + "is_group": 1, + "Grundst\u00fccke, grundst\u00fccksgleiche Rechte und Bauten einschl. der Bauten auf fremden Grundst\u00fccken": { + "account_number": "0200", + "account_type": "Fixed Asset" + }, + "Grundst\u00fccksgleiche Rechte ohne Bauten": { + "account_number": "0210" + }, + "Unbebaute Grundst\u00fccke": { + "account_number": "0215" + }, + "Grundst\u00fccksgleiche Rechte (Erbbaurecht, Dauerwohnrecht)": { + "account_number": "0220" + }, + "Grundst\u00fccke mit Substanzverzehr": { + "account_number": "0225" + }, + "Grundst\u00fccksanteil h\u00e4usliches Arbeitszimmer": { + "account_number": "0229" + }, + "Bauten auf eigenen Grundst\u00fccken und grundst\u00fccksgleichen Rechten": { + "account_number": "0230" + }, + "Grundst\u00fcckswerte eigener bebauter Grundst\u00fccke": { + "account_number": "0235" + }, + "Gesch\u00e4ftsbauten": { + "account_number": "0240" + }, + "Fabrikbauten ": { + "account_number": "0250" + }, + "Andere Bauten": { + "account_number": "0260" + }, + "Garagen": { + "account_number": "0270" + }, + "Au\u00dfenanlagen f. Gesch\u00e4fts-, Fabrik- und andere Bauten": { + "account_number": "0280" + }, + "Hof- und Wegebefestigungen": { + "account_number": "0285" + }, + "Einrichtungen f. Gesch\u00e4fts-, Fabrik- und andere Bauten": { + "account_number": "0290" + }, + "Wohnbauten ": { + "account_number": "0300" + }, + "Au\u00dfenanlagen ": { + "account_number": "0310" + }, + "Einrichtungen f. Wohnbauten ": { + "account_number": "0320" + }, + "Geb\u00e4udeanteil h\u00e4usliches Arbeitszimmer": { + "account_number": "0329" + }, + "Bauten auf fremden Grundst\u00fccken": { + "account_number": "0330" + }, + "Einrichtungen f. Gesch\u00e4fts-, Fabrik-, Wohn- und andere Bauten": { + "account_number": "0398" + } + }, + "2 - technische Anlagen und Maschinen": { + "is_group": 1, + "Technische Anlagen und Maschinen": { + "account_number": "0400", + "account_type": "Fixed Asset" + }, + "Technische Anlagen": { + "account_number": "0420" + }, + "Maschinen": { + "account_number": "0440" + }, + "Transportanlagen und \u00c4hnliches ": { + "account_number": "0450" + }, + "Betriebsvorrichtungen": { + "account_number": "0470" + }, + "Wertberichtigung Technische Anlagen und Maschinen": { + "account_number": "0409", + "account_type": "Accumulated Depreciation" + } + }, + "3 - andere Anlagen, Betriebs- und Gesch\u00e4ftsausstattung": { + "is_group": 1, + "Andere Anlagen, Betriebs- und Gesch\u00e4ftsausstattung": { + "account_number": "0500", + "account_type": "Fixed Asset" + }, + "Andere Anlagen": { + "account_number": "0510" + }, + "Pkw": { + "account_number": "0520" + }, + "Lkw": { + "account_number": "0540" + }, + "Sonstige Transportmittel": { + "account_number": "0560" + }, + "Werkzeuge": { + "account_number": "0620" + }, + "Betriebsausstattung": { + "account_number": "0630" + }, + "Gesch\u00e4ftsausstattung": { + "account_number": "0635" + }, + "Ladeneinrichtung": { + "account_number": "0640" + }, + "B\u00fcroeinrichtung": { + "account_number": "0650" + }, + "Ger\u00fcst- und Schalungsmaterial": { + "account_number": "0660" + }, + "Geringwertige Wirtschaftsg\u00fcter": { + "account_number": "0670" + }, + "Wirtschaftsg\u00fcter gr\u00f6\u00dfer 150 bis 1000 Euro (Sammelposten)": { + "account_number": "0675" + }, + "Einbauten in fremde Grundst\u00fccke": { + "account_number": "0680" + }, + "Sonstige Betriebs- und Gesch\u00e4ftsausstattung": { + "account_number": "0690" + } + }, + "4 - geleistete Anz. und Anlagen im Bau": { + "is_group": 1, + "Geleistete Anz. und Anlagen im Bau": { + "account_number": "0700", + "account_type": "Capital Work in Progress" + }, + "Anz. auf Grundst\u00fcckeund grundst\u00fccksgleiche Rechte ohne Bauten ": { + "account_number": "0705" + }, + "Gesch\u00e4fts-, Fabrik- und andere Bauten im Bau auf eigenen Grundst\u00fccken": { + "account_number": "0710" + }, + "Anz. auf Gesch\u00e4fts-, Fabrik- und andere Bauten auf eigenen Grundst. und grundst\u00fccksgleichen Rechten ": { + "account_number": "0720" + }, + "Wohnbauten im Bau": { + "account_number": "0725" + }, + "Anz. auf Wohnbauten auf eigenen Grundst\u00fccken und grundst\u00fccksgleichen Rechten": { + "account_number": "0735" + }, + "Gesch\u00e4fts-, Fabrik- und andere Bauten im Bau auf fremden Grundst\u00fccken": { + "account_number": "0740" + }, + "Anz. auf Gesch\u00e4fts-, Fabrik- und andere Bauten auf fremden Grundst\u00fccken ": { + "account_number": "0750" + }, + "Anz. auf Wohnbauten auf fremden Grundst\u00fccken": { + "account_number": "0765" + }, + "Technische Anlagen und Maschinen im Bau": { + "account_number": "0770" + }, + "Anz. auf technische Anlagen und Maschinen": { + "account_number": "0780" + }, + "Andere Anlagen, Betriebs- und Gesch\u00e4ftsausstattung im Bau": { + "account_number": "0785" + }, + "Andere Anlagen, Betriebs- und Gesch\u00e4ftsausstattung": { + "account_number": "0795" + } + }, + "is_group": 1 + }, + "III - Finanzanlagen": { + "1 - Anteile an verbundenen Unternehmen": { + "is_group": 1, + "Anteile an verbundenen Unternehmen": { + "account_number": "0800" + }, + "Anteile an verbundenen Unternehmen, Personengesellschaften": { + "account_number": "0803" + }, + "Anteile an verbundenen Unternehmen, Kapitalgesellschaften": { + "account_number": "0804" + }, + "Anteile an herrschender oder mehrheitlich beteiligter Gesellschaft, Personengesellschaft": { + "account_number": "0805" + }, + "Anteile an herrschender oder mehrheitlich beteiligter Gesellschaft, Kapitalgesellschaften": { + "account_number": "0808" + }, + "Anteile an herrschender oder mit Mehrheit beteiligter Gesellschaft": { + "account_number": "0809" + } + }, + "2 - Ausleihungen an verb. Unternehmen": { + "is_group": 1, + "Ausleihungen an verb. Unternehmen": { + "account_number": "0880" + }, + "Ausleihungen an Unternehmen, mit denen ein Beteiligungsverh. besteht, Personengesellschaften": { + "account_number": "0883" + }, + "Ausleihungen an Unternehmen, mit denen ein Beteiligungsverh. besteht, Kapitalgesellschaften": { + "account_number": "0885" + } + }, + "3 - Beteiligungen": { + "is_group": 1, + "Beteiligungen": { + "account_number": "0820" + }, + "Typisch stille Beteiligungen": { + "account_number": "0830" + }, + "Atypisch stille Beteiligungen": { + "account_number": "0840" + }, + "Beteiligungen an Kapitalgesellschaften": { + "account_number": "0850" + }, + "Beteiligungen an Personengesellschaften": { + "account_number": "0860" + } + }, + "4 - Ausleihungen an Unternehmen, mit denen ein Beteiligungsverh. besteht": { + "is_group": 1 + }, + "5 - Wertpapiere des Anlageverm\u00f6gens": { + "is_group": 1, + "Wertpapiere des Anlageverm\u00f6gens": { + "account_number": "0900" + }, + "Wertpapiere mit Gewinnbeteiligungsanspr\u00fcchen, die dem Teileink\u00fcnfteverfahren unterliegen": { + "account_number": "0910" + }, + "Festverzinsliche Wertpapiere": { + "account_number": "0920" + }, + "Genossenschaftsanteile zum langfristigen Verbleib": { + "account_number": "0980" + }, + "R\u00fcckdeckungsanspr\u00fcche aus Lebensversicherungen zum langfristigen Verbleib": { + "account_number": "0990" + } + }, + "6 - sonstige Ausleihungen": { + "is_group": 1, + "Sonstige Ausleihungen": { + "account_number": "0930" + }, + "Darlehen": { + "account_number": "0940" + }, + "Ausleihungen an stille Gesellschafter": { + "account_number": "0964" + } + }, + "is_group": 1 + } + }, + "B - Umlaufverm\u00f6gen": { + "I - Vorr\u00e4te": { + "1 - Roh-, Hilfs- und Betriebsstoffe": { + "is_group": 1, + "Roh-, Hilfs- und Betriebsstoffe (Bestand)": { + "account_number": "1000", + "account_type": "Stock" + } + }, + "2 - unfertige Erzeugnisse, unfertige Leistungen": { + "is_group": 1, + "Unfertige Erzeugnisse, unfertige Leistungen (Bestand)": { + "account_number": "1040", + "account_type": "Stock" + }, + "Unfertige Erzeugnisse (Bestand)": { + "account_number": "1050" + }, + "Unfertige Leistungen": { + "account_number": "1080" + }, + "In Ausf\u00fchrung befindliche Bauauftr\u00e4ge": { + "account_number": "1090" + }, + "In Arbeit befindliche Auftr\u00e4ge": { + "account_number": "1095" + } + }, + "3 - fertige Erzeugnisse und Waren": { + "is_group": 1, + "Fertige Erzeugnisse und Waren (Bestand)": { + "account_number": "1100", + "account_type": "Stock" + }, + "Fertige Erzeugnisse (Bestand)": { + "account_number": "1110" + }, + "Waren (Bestand)": { + "account_number": "1140" + }, + "Erhaltene Anz. auf Bestellungen (von Vorr\u00e4ten offen abgesetzt)": { + "account_number": "1190" + } + }, + "is_group": 1 + }, + "II - Forderungen und sonstige VG": { + "account_type": "Receivable", + "1 - Forderungen aus Lieferungen und Leistungen": { + "account_type": "Receivable", + "is_group": 1, + "Bewertungskorrektur zu Forderungen aus Lieferungen und Leistungen": { + "account_number": "9960" + }, + "Forderungen aus Lieferungen und Leistungen": { + "account_number": "1200", + "account_type": "Receivable" + }, + "Forderungen aus Lieferungen und Leistungen ohne Kontokorrent": { + "account_number": "1210" + }, + "Forderungen aus Lieferungen und Leistungen ohne Kontokorrent(b. 1 J.)": { + "account_number": "1221" + }, + "Forderungen aus Lieferungen und Leistungen ohne Kontokorrent (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1225" + }, + "Wechsel aus Lieferungen und Leistungen, bundesbankf\u00e4hig": { + "account_number": "1235" + }, + "Zweifelhafte Forderungen (Gruppe)": { + "is_group": 1, + "Zweifelhafte Forderungen": { + "account_number": "1240" + }, + "Zweifelhafte Forderungen (b. 1 J.)": { + "account_number": "1241" + }, + "Zweifelhafte Forderungen (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1245" + }, + "Einzelwertberichtigungen auf Forderungen mit einer (b. 1 J.)": { + "account_number": "1248" + }, + "Einzelwertberichtigung auf Forderungen mit einer (mehr als 1 J.)": { + "account_number": "1247" + }, + "Pauschalwertberichtigung auf Forderungen mit einer (mehr als 1 J.)": { + "account_number": "1249" + } + }, + "Gegenkonto zu sonstigen VGn bei Buchung \u00fcber Debitorenkonto": { + "account_number": "1258" + }, + "Gegenkonto 1221-1229,1240-1245,1250-1257, 1270-1279, 1290-1297 bei Aufteilung Debitorenkonto": { + "account_number": "1259" + } + }, + "2 - Forderungen gg. verb. Unternehmen": { + "account_type": "Receivable", + "is_group": 1, + "Forderungen gg. verb. Unternehmen": { + "account_number": "1260" + }, + "Forderungen gg. verb. Unternehmen (b. 1 J.)": { + "account_number": "1261" + }, + "Forderungen gg. verb. Unternehmen (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1265" + }, + "Besitzwechsel gg. verb. Unternehmen": { + "account_number": "1266" + }, + "Besitzwechsel gg. verb. Unternehmen (b. 1 J.)": { + "account_number": "1267" + }, + "Besitzwechsel gg. verb. Unternehmen (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1268" + }, + "Besitzwechsel gg. verb. Unternehmen, bundesbankf\u00e4hig": { + "account_number": "1269" + }, + "Forderungen aus Lieferungen und Leistungen gg. verb. Unternehmen (Gruppe)": { + "is_group": 1, + "Forderungen aus Lieferungen und Leistungen gg. verb. Unternehmen": { + "account_number": "1270" + }, + "Forderungen aus Lieferungen und Leistungen gg. verb. Unternehmen (b. 1 J.)": { + "account_number": "1271" + }, + "Forderungen aus Lieferungen und Leistungen gg. verb. Unternehmen (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1275" + }, + "Wertberichtigungen auf Forderungen mit einer (b. 1 J.) gg. verb. Unternehmen": { + "account_number": "1276" + }, + "Wertberichtigungen auf Forderungen mit einer (mehr als 1 J.) gg. verbundene Unternehmen": { + "account_number": "1277" + } + } + }, + "3 - Forderungen gg. Unt., mit denen ein Beteiligungsverh. besteht": { + "account_type": "Receivable", + "is_group": 1, + "Forderungen gg. Unt., mit denen ein Beteiligungsverh. besteht": { + "account_number": "1280" + }, + "Forderungen gg. Unt., mit denen ein Beteiligungsverh. besteht (b. 1 J.)": { + "account_number": "1281" + }, + "Forderungen gg. Unt., mit denen ein Beteiligungsverh. besteht (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1285" + }, + "Besitzwechsel gg. Unt., mit denen ein Beteiligungsverh. besteht": { + "account_number": "1286" + }, + "Besitzwechsel gg. Unt., mit denen ein Beteiligungsverh. besteht (b. 1 J.)": { + "account_number": "1287" + }, + "Besitzwechsel gg. Unt., mit denen ein Beteiligungsverh. besteht (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1288" + }, + "Besitzwechsel gg. Unt., mit denen ein Beteiligungsverh. besteht, bundesbankf\u00e4hig": { + "account_number": "1289" + }, + "Forderungen aus LuL gg. Unt., mit denen ein Beteiligungsverh. besteht": { + "account_number": "1290" + }, + "Forderungen aus LuL gg. Unt., mit denen ein Beteiligungsverh. besteht (b. 1 J.)": { + "account_number": "1291" + }, + "Forderungen aus LuL gg. Unt., mit denen ein Beteiligungsverh. besteht (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1295" + }, + "Wertberichtigungen auf Ford. (b. 1 J.) gg. Unt., mit denen ein Beteiligungsverh. besteht": { + "account_number": "1296" + }, + "Wertberichtigungen auf Ford. (mehr als 1 J.) gg. Unt., mit denen ein Beteiligungsverh. besteht": { + "account_number": "1297" + } + }, + "4 - sonstige VG": { + "account_type": "Receivable", + "is_group": 1, + "Bewertungskorrektur zu sonstigen VGn": { + "account_number": "9965" + }, + "Verrechnungskonto geleistete Anz. bei Buchung \u00fcber Kreditorenkonto": { + "account_number": "3695" + }, + "Sonstige VG": { + "account_number": "1300" + }, + "Sonstige VG (b. 1 J.)": { + "account_number": "1301" + }, + "Sonstige VG (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1305" + }, + "Forderungen gg. typisch stille Gesellschafter": { + "account_number": "1337" + }, + "Forderungen gg. typisch stille Gesellschafter - Restlaufzeit bis1 Jahr": { + "account_number": "1338" + }, + "Forderungen gg. typisch stille Gesellschafter (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1339" + }, + "Forderungen gg. Personal aus Lohn- und Gehaltsabrechnung (Gruppe)": { + "is_group": 1, + "Forderungen gg. Personal aus Lohn- und Gehaltsabrechnung": { + "account_number": "1340" + }, + "Forderungen gg. Personal aus Lohn- und Gehaltsabrechnung (b. 1 J.)": { + "account_number": "1341" + }, + "Forderungen gg. Personal aus Lohn- und Gehaltsabrechnung (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1345" + } + }, + "Kautionen (Gruppe)": { + "is_group": 1, + "Kautionen": { + "account_number": "1350" + }, + "Kautionen (b. 1 J.)": { + "account_number": "1351" + }, + "Kautionen (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1355" + } + }, + "Darlehen (Gruppe)": { + "Darlehen": { + "account_number": "1360" + }, + "Darlehen (b. 1 J.)": { + "account_number": "1361" + }, + "Darlehen (gr\u00f6\u00dfer 1 J.)": { + "account_number": "1365" + } + }, + "Forderungen gg. Krankenkassen aus Aufwendungsausgleichsgesetz": { + "account_number": "1369" + }, + "Durchlaufende Posten": { + "account_number": "1370" + }, + "Fremdgeld": { + "account_number": "1374" + }, + "Agenturwarenabrechnung": { + "account_number": "1375" + }, + "Nachtr\u00e4glich abziehbare Vorsteuer, \u00a7 15a Abs. 2 UStG": { + "account_number": "1376" + }, + "Zur\u00fcckzuzahlende Vorsteuer, \u00a7 15a Abs. 2 UStG": { + "account_number": "1377" + }, + "Anspr\u00fcche aus R\u00fcckdeckungsversicherungen": { + "account_number": "1378" + }, + "Verm\u00f6gensgegenst. zur Saldierung mit Pensionsr\u00fcckst. und \u00e4hnl. Verplicht. zum langfristigen Verbleib": { + "account_number": "1381" + }, + "Verm\u00f6gensgegenst. zur Erf\u00fcllung von mit der Altersvers. vergleichb. langfristigen Verplicht.": { + "account_number": "1382" + }, + "Verm\u00f6gensgegenst. zur Saldierung mit der Altersvers. vergleichb. langfristigen Verplicht.": { + "account_number": "1383" + }, + "GmbH-Anteile zum kurzfr. Verbleib": { + "account_number": "1390" + }, + "Forderungen gg. Arbeitsgemeinschaften": { + "account_number": "1391" + }, + "Genussrechte": { + "account_number": "1393" + }, + "Einzahlungsanspr\u00fcche zu Nebenleistungen oder Zuzahlungen": { + "account_number": "1394" + }, + "Genossenschaftsanteile zum kurzfr. Verbleib": { + "account_number": "1395" + }, + "Nachtr\u00e4glich abziehbare Vorsteuer, \u00a7 15a Abs. 1 UStG, bewegliche Wirtschaftsg\u00fcter": { + "account_number": "1396" + }, + "Zur\u00fcckzuzahlende Vorsteuer, \u00a7 15a Abs. 1 UStG, bewegliche Wirtschaftsg\u00fcter": { + "account_number": "1397" + }, + "Nachtr\u00e4glich abziehbare Vorsteuer gem. \u00a7 15a Abs. 1 UStG, unbewegliche Wirtschaftsg\u00fcter": { + "account_number": "1398" + }, + "Zur\u00fcckzuzahlende Vorsteuer gem. \u00a7 15a Abs. 1 UStG, unbewegliche Wirtschaftsg\u00fcter": { + "account_number": "1399" + }, + "Abziehbare Vorsteuer (Gruppe)": { + "is_group": 1, + "Abziehbare Vorsteuer": { + "account_number": "1400" + }, + "Abziehbare Vorsteuer 7 %": { + "account_number": "1401" + }, + "Abziehbare Vorsteuer aus innergem. Erwerb": { + "account_number": "1402" + }, + "Abziehbare Vorsteuer aus innergem. Erwerb 19%": { + "account_number": "1404" + }, + "Abziehbare Vorsteuer 19 %": { + "account_number": "1406" + }, + "Abziehbare Vorsteuer nach \u00a7 13b UStG 19 %": { + "account_number": "1407" + }, + "Abziehbare Vorsteuer nach \u00a7 13b UStG": { + "account_number": "1408" + }, + "Abziehbare Vorsteuer aus der Auslagerung von Gegenst\u00e4nden aus dem Umsatzsteuerlager": { + "account_number": "1431" + }, + "Abziehbare Vorsteuer aus innergem. Erwerb von Neufahrzeugen von Lieferanten ohne Ust-ID": { + "account_number": "1432" + } + }, + "Aufzuteilende Vorsteuer (Gruppe)": { + "is_group": 1, + "Aufzuteilende Vorsteuer": { + "account_number": "1410" + }, + "Aufzuteilende Vorsteuer 7 %": { + "account_number": "1411" + }, + "Aufzuteilende Vorsteuer aus innergem. Erwerb": { + "account_number": "1412" + }, + "Aufzuteilende Vorsteuer aus innergem. Erwerb 19 %": { + "account_number": "1413" + }, + "Aufzuteilende Vorsteuer 19 %": { + "account_number": "1416" + }, + "Aufzuteilende Vorsteuer nach \u00a7\u00a7 13a/13b UStG": { + "account_number": "1417" + }, + "Aufzuteilende Vorsteuer nach \u00a7\u00a7 13a/13b UStG 19 %": { + "account_number": "1419" + } + }, + "Umsatzsteuerforderungen (Gruppe)": { + "is_group": 1, + "Umsatzsteuerforderungen": { + "account_number": "1420" + }, + "Umsatzsteuerforderungen laufendes Jahr": { + "account_number": "1421" + }, + "Umsatzsteuerforderungen Vorjahr": { + "account_number": "1422" + }, + "Umsatzsteuerforderungen fr\u00fchere Jahre": { + "account_number": "1425" + }, + "Forderungen aus entrichteten Verbrauchsteuern": { + "account_number": "1427" + } + }, + "Bezahlte Einfuhrumsatzsteuer": { + "account_number": "1433" + }, + "Vorsteuer im Folgejahr abziehbar": { + "account_number": "1434" + }, + "Forderungen aus Gewerbesteuer\u00fcberzahlungen": { + "account_number": "1435" + }, + "Vorsteuer aus Erwerb als letzter Abnehmer innerh. eines Dreiecksgesch.s": { + "account_number": "1436" + }, + "Steuererstattungsanspr\u00fcche gg. anderen L\u00e4ndern": { + "account_number": "1440" + }, + "Forderungen an das Finanzamt aus abgef\u00fchrtem Bauabzugsbetrag": { + "account_number": "1456" + }, + "Forderungen gg. Bundesagentur f. Arbeit": { + "account_number": "1457" + }, + "Geldtransit": { + "account_number": "1460" + }, + "Vorsteuer nach allgemeinen Durchschnittss\u00e4tzen UStVA Kz. 63": { + "account_number": "1484" + }, + "Verrechnungskonto Ist-Versteuerung": { + "account_number": "1490" + }, + "Verrechnungskonto erhaltene Anz. bei Buchung \u00fcber Debitorenkonto": { + "account_number": "1495" + }, + "\u00dcberleitungskonto Kostenstellen": { + "account_number": "1498" + } + }, + "is_group": 1 + }, + "III - Wertpapiere": { + "is_group": 1, + "2 - sonstige Wertpapiere": { + "is_group": 1, + "Sonstige Wertpapiere": { + "account_number": "1510" + } + }, + "Finanzwechsel": { + "account_number": "1520" + }, + "Andere Wertpapiere mit unwesentlichen Wertschwankungen im Sinne Textziffer 18 DRS 2": { + "account_number": "1525" + }, + "Wertpapieranlagen i. R. d. kurzfr. Finanzdisposition": { + "account_number": "1530" + }, + "Schecks": { + "account_number": "1550" + }, + "Anteile an verbundenen Unternehmen (Umlaufverm\u00f6gen)": { + "account_number": "1500" + } + }, + "IV - Kassenbestand, Bundesbankguthaben, Guthaben bei Kreditinstituten und Schecks": { + "is_group": 1, + "Bewertungskorrektur zu Guthaben bei Kreditinstituten": { + "account_number": "9962" + }, + "Kasse (Gruppe)": { + "is_group": 1, + "Kasse": { + "account_number": "1600", + "account_type": "Cash" + }, + "Nebenkasse 1": { + "account_number": "1610", + "account_type": "Cash" + }, + "Nebenkasse 2": { + "account_number": "1620", + "account_type": "Cash" + } + }, + "Postbank (Gruppe)": { + "is_group": 1, + "Postbank": { + "account_number": "1700" + }, + "Postbank 1 (Gruppe)": { + "is_group": 1, + "Postbank 1": { + "account_number": "1710" + } + }, + "Postbank 2 (Gruppe)": { + "is_group": 1, + "Postbank 2": { + "account_number": "1720" + } + }, + "Postbank 3 (Gruppe)": { + "is_group": 1, + "Postbank 3": { + "account_number": "1730" + } + } + }, + "LZB-Guthaben": { + "account_number": "1780" + }, + "Bundesbankguthaben": { + "account_number": "1790" + }, + "Bank (Gruppe)": { + "is_group": 1, + "Bank": { + "account_number": "1800", + "account_type": "Bank" + }, + "Bank 1": { + "account_number": "1810", + "account_type": "Bank" + }, + "Bank 2": { + "account_number": "1820", + "account_type": "Bank" + }, + "Bank 3": { + "account_number": "1830" + }, + "Bank 4": { + "account_number": "1840" + }, + "Bank 5": { + "account_number": "1850" + }, + "Finanzmittelanlagen i. R. d. kurzfr. Finanzdisposition (nicht im Finanzmittelfonds enthalten)": { + "account_number": "1890" + }, + "Verb. gg. Kreditinstituten (nicht im Finanzmittelfonds enthalten)": { + "account_number": "1895" + } + } + }, + "is_group": 1 + }, + "C - Rechnungsabgrenzungsposten": { + "is_group": 1, + "Aktive Rechnungsabgrenzung": { + "account_number": "1900" + }, + "Als Aufwand ber\u00fccksichtigte Z\u00f6lle und Verbrauchsteuern auf Vorr\u00e4te": { + "account_number": "1920" + }, + "Als Aufwand ber\u00fccksichtigte Umsatzsteuer auf Anz.": { + "account_number": "1930" + }, + "Damnum/Disagio": { + "account_number": "1940" + } + }, + "D - Aktive latente Steuern": { + "is_group": 1, + "Aktive latente Steuern": { + "account_type": "Tax", + "account_number": "1950" + } + }, + "E - Aktiver Unterschiedsbetrag aus der Verm\u00f6gensverrechnung": { + "is_group": 1 + }, + "is_group": 1 + }, + "Passiva": { + "root_type": "Liability", + "A - Eigenkapital": { + "account_type": "Equity", + "is_group": 1, + "I - Gezeichnetes Kapital": { + "account_type": "Equity", + "is_group": 1 + }, + "II - Kapitalr\u00fccklage": { + "account_type": "Equity", + "is_group": 1 + }, + "III - Gewinnr\u00fccklagen": { + "account_type": "Equity", + "1 - gesetzliche R\u00fccklage": { + "account_type": "Equity", + "is_group": 1 + }, + "2 - R\u00fccklage f. Anteile an einem herrschenden oder mehrheitlich beteiligten Unternehmen": { + "account_type": "Equity", + "is_group": 1 + }, + "3 - satzungsm\u00e4\u00dfige R\u00fccklagen": { + "account_type": "Equity", + "is_group": 1 + }, + "4 - andere Gewinnr\u00fccklagen": { + "account_type": "Equity", + "is_group": 1, + "Gewinnr\u00fccklagen aus den \u00dcbergangsvorschriften BilMoG": { + "is_group": 1, + "Gewinnr\u00fccklagen (BilMoG)": { + "account_number": "2963" + }, + "Gewinnr\u00fccklagen aus Zuschreibung Sachanlageverm\u00f6gen (BilMoG)": { + "account_number": "2964" + }, + "Gewinnr\u00fccklagen aus Zuschreibung Finanzanlageverm\u00f6gen (BilMoG)": { + "account_number": "2965" + }, + "Gewinnr\u00fccklagen aus Aufl\u00f6sung der Sonderposten mit R\u00fccklageanteil (BilMoG)": { + "account_number": "2966" + } + }, + "Latente Steuern (Gewinnr\u00fccklage Haben) aus erfolgsneutralen Verrechnungen": { + "account_number": "2967" + }, + "Latente Steuern (Gewinnr\u00fccklage Soll) aus erfolgsneutralen Verrechnungen": { + "account_number": "2968" + }, + "Rechnungsabgrenzungsposten (Gewinnr\u00fccklage Soll) aus erfolgsneutralen Verrechnungen": { + "account_number": "2969" + } + }, + "is_group": 1 + }, + "IV - Gewinnvortrag/Verlustvortrag": { + "account_type": "Equity", + "is_group": 1 + }, + "V - Jahres\u00fcberschu\u00df/Jahresfehlbetrag": { + "account_type": "Equity", + "is_group": 1 + }, + "Einlagen stiller Gesellschafter": { + "account_number": "9295" + } + }, + "B - R\u00fcckstellungen": { + "is_group": 1, + "1 - R\u00fcckstellungen f. Pensionen und \u00e4hnliche Verplicht.": { + "is_group": 1, + "R\u00fcckstellungen f. Pensionen und \u00e4hnliche Verplicht.": { + "account_number": "3000" + }, + "R\u00fcckstellungen f. Pensionen und \u00e4hnliche Verplicht. (Saldierung mit langfristigen VG)": { + "account_number": "3009" + }, + "R\u00fcckstellungen f. Direktzusagen": { + "account_number": "3010" + }, + "R\u00fcckstellungen f. ZuschussVerplicht. f. Pensionskassen und Lebensversicherungen": { + "account_number": "3011" + } + }, + "2 - Steuerr\u00fcckstellungen": { + "is_group": 1, + "Steuerr\u00fcckstellungen": { + "account_number": "3020" + }, + "Gewerbesteuerr\u00fcckstellung": { + "account_number": "3030" + }, + "Gewerbesteuerr\u00fcckstellung, \u00a7 4 Abs. 5b EStG": { + "account_number": "3035" + }, + "R\u00fcckstellung f. latente Steuern": { + "account_number": "3060" + }, + "Sonstige R\u00fcckstellungen": { + "account_number": "3070" + }, + "R\u00fcckstellungen f. Personalkosten": { + "account_number": "3074" + }, + "R\u00fcckstellungen f. unterlassene Aufwendungen f. Instandhaltung, Nachholung in den ersten drei Monaten": { + "account_number": "3075" + }, + "R\u00fcckstellungen f. mit der Altersvers. vergleichb. langfr. Verplicht. zum langfr. Verbleib": { + "account_number": "3076" + }, + "R\u00fcckst. f. mit der Altersvers. vergleichb. langfr. Verplicht. (Saldierung mit langfristigen VG)": { + "account_number": "3077" + } + }, + "3 - sonstige R\u00fcckstellungen": { + "is_group": 1, + "Sonderposten mit R\u00fccklageanteil, steuerfreie R\u00fccklagen (Gruppe)": { + "is_group": 1, + "Sonderposten mit R\u00fccklageanteil, steuerfreie R\u00fccklagen": { + "account_number": "2980" + }, + "Sonderposten mit R\u00fccklageanteil nach \u00a7 6b EStG": { + "account_number": "2981" + }, + "Sonderposten mit R\u00fccklageanteil nach EStR R 6.6": { + "account_number": "2982" + }, + "R\u00fccklage f. Zusch\u00fcsse": { + "account_number": "2988" + }, + "Sonderposten mit R\u00fccklageanteil nach \u00a7 52 Abs.16 EStG": { + "account_number": "2989" + }, + "Sonderposten mit R\u00fccklageanteil, Sonderabschreibungen": { + "account_number": "2990" + }, + "Sonderposten mit R\u00fccklageanteil nach \u00a7 7g Abs. 2 EStG n. F.": { + "account_number": "2993" + }, + "Ausgleichsposten bei Entnahmen \u00a7 4g EStG": { + "account_number": "2995" + }, + "Sonderposten mit R\u00fccklageanteil nach \u00a7 7g Abs. 1 EStG a. F. / \u00a7 7g Abs. 5 EStG n. F.": { + "account_number": "2997" + }, + "Sonderposten mit R\u00fccklageanteil nach \u00a7 7g Abs. 3 und 7 EStG a. F.": { + "account_number": "2998" + }, + "Sonderposten f. Zusch\u00fcsse und Zulagen": { + "account_number": "2999" + }, + "R\u00fcckstellungen f. Abraum- und Abfallbeseitigung": { + "account_number": "3085" + }, + "R\u00fcckstellungen f. Gew\u00e4hrleistungen": { + "account_number": "3090" + }, + "R\u00fcckstellungen f. drohende Verluste aus schwebenden Gesch\u00e4ften": { + "account_number": "3092" + }, + "R\u00fcckstellungen f. Abschluss- und Pr\u00fcfungskosten": { + "account_number": "3095" + }, + "R\u00fcckstellungen zur Erf\u00fcllung der Aufbewahrungspflichten": { + "account_number": "3096" + }, + "Aufwandsr\u00fcckstellungen gem\u00e4\u00df \u00a7 249 Abs. 2 HGB a. F.": { + "account_number": "3098" + }, + "R\u00fcckstellungen f. Umweltschutz": { + "account_number": "3099" + } + } + } + }, + "C - Verb.": { + "account_type": "Payable", + "1 - Anleihen": { + "is_group": 1, + "account_type": "Payable", + "davon konvertibel": { + "account_type": "Payable", + "is_group": 1, + "Anleihen, konvertibel": { + "account_number": "3120" + }, + "Anleihen, konvertibel (b. 1 J.)": { + "account_number": "3121" + }, + "Anleihen, konvertibel (1-5 J.)": { + "account_number": "3125" + }, + "Anleihen, konvertibel (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3130" + } + }, + "Anleihen, nicht konvertibel": { + "account_number": "3100" + }, + "Anleihen, nicht konvertibel (b. 1 J.)": { + "account_number": "3101" + }, + "Anleihen, nicht konvertibel (1-5 J.)": { + "account_number": "3105" + }, + "Anleihen, nicht konvertibel (gr\u00f6\u00dfer 5 J.) (Gruppe)": { + "is_group": 1, + "Anleihen, nicht konvertibel (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3110" + } + } + }, + "2 - Verb. gg. Kreditinstituten": { + "account_type": "Payable", + "is_group": 1, + "Bewertungskorrektur zu Verb. gg. Kreditinstituten": { + "account_number": "9963" + }, + "Verb. gg. Kreditinstituten (Gruppe)": { + "is_group": 1, + "Verb. gg. Kreditinstituten": { + "account_number": "3150" + }, + "Verb. gg. Kreditinstituten (b. 1 J.)": { + "account_number": "3151" + }, + "Verb. gg. Kreditinstituten (1-5 J.)": { + "account_number": "3160" + }, + "Verb. gg. Kreditinstituten (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3170" + } + }, + "Verb. gg. Kreditinstituten aus Teilzahlungsvertr\u00e4gen (Gruppe)": { + "is_group": 1, + "Verb. gg. Kreditinstituten aus Teilzahlungsvertr\u00e4gen": { + "account_number": "3180" + }, + "Verb. gg. Kreditinstituten aus Teilzahlungsvertr\u00e4gen (b. 1 J.)": { + "account_number": "3181" + }, + "Verb. gg. Kreditinstituten aus Teilzahlungsvertr\u00e4gen (1-5 J.)": { + "account_number": "3190" + }, + "Verb. gg. Kreditinstituten aus Teilzahlungsvertr\u00e4gen (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3200" + } + } + }, + "3 - erhaltene Anz. auf Bestellungen": { + "account_type": "Payable", + "is_group": 1, + "Erhaltene, versteuerte Anz. 7 % USt (Verb.)": { + "account_number": "3260", + "account_type": "Receivable" + }, + "Erhaltene, versteuerte Anz. 16 % USt (Verb.)": { + "account_number": "3270" + }, + "Erhaltene, versteuerte Anz. 15 % USt (Verb.)": { + "account_number": "3271" + }, + "Erhaltene, versteuerte Anz. 19 % USt (Verb.)": { + "account_number": "3272", + "account_type": "Receivable" + }, + "Erhaltene Anz. (Gruppe)": { + "is_group": 1, + "Erhaltene Anz. (b. 1 J.)": { + "account_number": "3280", + "account_type": "Receivable" + }, + "Erhaltene Anz. (1-5 J.)": { + "account_number": "3284", + "account_type": "Receivable" + }, + "Erhaltene Anz. (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3285", + "account_type": "Receivable" + } + }, + "Erhaltene Anz. auf Bestellungen (Verb.)": { + "account_number": "3250", + "account_type": "Receivable" + } + }, + "4 - Verb. aus Lieferungen und Leistungen": { + "account_type": "Payable", + "is_group": 1, + "Bewertungskorrektur zu Verb. aus Lieferungen und Leistungen": { + "account_number": "9964" + }, + "Verb. aus Lieferungen und Leistungen": { + "account_number": "3300", + "account_type": "Payable" + }, + "Verb. aus Lieferungen und Leistungen ohne Kontokorrent": { + "account_number": "3310" + }, + "Verb. aus Lieferungen und Leistungen ohne Kontokorrent (b. 1 J.)": { + "account_number": "3335" + }, + "Verb. aus Lieferungen und Leistungen ohne Kontokorrent (1-5 J.)": { + "account_number": "3337" + }, + "Verb. aus Lieferungen und Leistungen ohne Kontokorrent (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3338" + } + }, + "5 - Verb. aus der Annahme gezogener Wechsel und der Ausstellung eigener Wechsel": { + "account_type": "Payable", + "is_group": 1, + "Verb. aus der Annahme gezogener Wechsel und aus der Ausstellung eigener Wechsel": { + "account_number": "3350" + }, + "Verb. aus der Annahme gezogener Wechsel und aus der Ausstellung eigener Wechsel (b. 1 J.)": { + "account_number": "3351" + }, + "Verb. aus der Annahme gezogener Wechsel und aus der Ausstellung eigner Wechsel (1-5 J.)": { + "account_number": "3380" + }, + "Verb. aus der Annahme gezogener Wechsel und der Ausstellung eigener Wechsel (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3390" + } + }, + "6 - Verb. gg. verbundenen Unternehmen": { + "account_type": "Payable", + "is_group": 1, + "Verb. gg. verbundenen Unternehmen": { + "account_number": "3400" + }, + "Verb. gg. verbundenen Unternehmen (b. 1 J.)": { + "account_number": "3401" + }, + "Verb. gg. verbundenen Unternehmen (1-5 J.)": { + "account_number": "3405" + }, + "Verb. gg. verbundenen Unternehmen (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3410" + }, + "Verb. aus LuL gg. verbundenen Unternehmen": { + "account_number": "3420" + }, + "Verb. aus LuL gg. verbundenen Unternehmen (b. 1 J.)": { + "account_number": "3421" + }, + "Verb. aus LuL gg. verbundenen Unternehmen (1-5 J.)": { + "account_number": "3425" + }, + "Verb. aus LuL gg. verbundenen Unternehmen (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3430" + } + }, + "7 - Verb. gg. Unternehmen, mit denen ein Beteiligungsverh. besteht": { + "account_type": "Payable", + "is_group": 1, + "Verb. gg. Unternehmen, mit denen ein Beteiligungsverh. besteht": { + "account_number": "3450" + }, + "Verb. gg. Unternehmen, mit denen ein Beteiligungsverh. besteht (b. 1 J.)": { + "account_number": "3451" + }, + "Verb. gg. Unternehmen, mit denen ein Beteiligungsverh. besteht (1-5 J.)": { + "account_number": "3455" + }, + "Verb. gg. Unternehmen, mit denen ein Beteiligungsverh. besteht (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3460" + }, + "Verb. aus LuL gg. Unternehmen, mit denen ein Beteiligungsverh. besteht": { + "account_number": "3470" + }, + "Verb. aus LuL gg. Unternehmen, mit denen ein Beteiligungsverh. besteht (b. 1 J.)": { + "account_number": "3471" + }, + "Verb. aus LuL gg. Unternehmen, mit denen ein Beteiligungsverh. besteht (1-5 J.)": { + "account_number": "3475" + }, + "Verb. aus LuL gg. Unternehmen, mit denen ein Beteiligungsverh. besteht (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3480" + } + }, + "8 - sonstige Verb.": { + "account_type": "Payable", + "is_group": 1, + "davon aus Steuern": { + "account_type": "Payable", + "is_group": 1, + "Verb. aus Steuern und Abgaben": { + "account_number": "3700", + "account_type": "Payable" + }, + "Verb. aus Steuern und Abgaben (b. 1 J.)": { + "account_number": "3701" + }, + "Verb. aus Steuern und Abgaben (1-5 J.)": { + "account_number": "3710" + }, + "Verb. aus Steuern und Abgaben (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3715" + }, + "Verb. aus Lohn- und Kirchensteuer": { + "account_number": "3730" + }, + "Verb. aus Einbehaltungen (KapESt und Solz auf KapESt) f. offene Aussch\u00fcttungen": { + "account_number": "3760" + }, + "Verb. f. Verbrauchsteuern": { + "account_number": "3761" + } + }, + "Gewinnverf\u00fcgungskonto stille Gesellschafter": { + "account_number": "3620" + }, + "Sonstige Verrechnungskonten (Interimskonten)": { + "account_number": "3630" + }, + "Kreditkartenabrechnung": { + "account_number": "3610" + }, + "Verb. gg. Arbeitsgemeinschaften": { + "account_number": "3611" + }, + "Bewertungskorrektur zu sonstigen Verb.": { + "account_number": "9961" + }, + "Verb. gg. stillen Gesellschaftern": { + "account_number": "3655" + }, + "Verb. gg. stillen Gesellschaftern (b. 1 J.)": { + "account_number": "3656" + }, + "Verb. gg. stillen Gesellschaftern (1-5 J.)": { + "account_number": "3657" + }, + "Verb. gg. stillen Gesellschaftern (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3658" + }, + "davon i. R. d. sozialen Sicherheit": { + "account_type": "Payable", + "is_group": 1, + "Verb. i. R. d. sozialen Sicherheit": { + "account_number": "3740" + }, + "Verb. i. R. d. sozialen Sicherheit (b. 1 J.)": { + "account_number": "3741" + }, + "Verb. i. R. d. sozialen Sicherheit (1-5 J.)": { + "account_number": "3750" + }, + "Verb. i. R. d. sozialen Sicherheit (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3755" + }, + "Voraussichtliche Beitragsschuld gg. den Sozialversicherungstr\u00e4gern": { + "account_number": "3759" + } + }, + "Verb. aus Lohn und Gehalt (Gruppe)": { + "is_group": 1, + "Verb. aus Lohn und Gehalt": { + "account_number": "3720" + }, + "Verb. f. Einbehaltungen von Arbeitnehmern": { + "account_number": "3725" + }, + "Verb. an das Finanzamt aus abzuf\u00fchrendem Bauabzugsbetrag": { + "account_number": "3726" + } + }, + "Verb. aus Verm\u00f6gensbildung": { + "account_number": "3770" + }, + "Verb. aus Verm\u00f6gensbildung (b. 1 J.)": { + "account_number": "3771" + }, + "Verb. aus Verm\u00f6gensbildung (1-5 J.)": { + "account_number": "3780" + }, + "Verb. aus Verm\u00f6gensbildung (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3785" + }, + "Ausgegebene Geschenkgutscheine": { + "account_number": "3786" + }, + "Sonstige Verb.": { + "account_number": "3500", + "account_type": "Payable" + }, + "Sonstige Verb. (b. 1 J.)": { + "account_number": "3501" + }, + "Sonstige Verb. (1-5 J.)": { + "account_number": "3504" + }, + "Sonstige Verb. (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3507" + }, + "Darlehen typisch stiller Gesellschafter (Gruppe)": { + "is_group": 1, + "Darlehen typisch stiller Gesellschafter": { + "account_number": "3520" + }, + "Darlehen typisch stiller Gesellschafter (b. 1 J.)": { + "account_number": "3521" + }, + "Darlehen typisch stiller Gesellschafter (1-5 J.)": { + "account_number": "3524" + }, + "Darlehen typisch stiller Gesellschafter (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3527" + } + }, + "Darlehen atypisch stiller Gesellschafter (Gruppe)": { + "is_group": 1, + "Darlehen atypisch stiller Gesellschafter": { + "account_number": "3530" + }, + "Darlehen atypisch stiller Gesellschafter (b. 1 J.)": { + "account_number": "3531" + }, + "Darlehen atypisch stiller Gesellschafter (1-5 J.)": { + "account_number": "3534" + }, + "Darlehen atypisch stiller Gesellschafter (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3537" + } + }, + "Partiarische Darlehen (Gruppe)": { + "is_group": 1, + "Partiarische Darlehen": { + "account_number": "3540" + }, + "Partiarische Darlehen (b. 1 J.)": { + "account_number": "3541" + }, + "Partiarische Darlehen (1-5 J.)": { + "account_number": "3544" + }, + "Partiarische Darlehen (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3547" + } + }, + "Erhaltene Kautionen (Gruppe)": { + "is_group": 1, + "Erhaltene Kautionen": { + "account_number": "3550" + }, + "Erhaltene Kautionen (b. 1 J.)": { + "account_number": "3551" + }, + "Erhaltene Kautionen (1-5 J.)": { + "account_number": "3554" + }, + "Erhaltene Kautionen (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3557" + } + }, + "Darlehen (1-5 J.)": { + "account_number": "3564" + }, + "Darlehen (gr\u00f6\u00dfer 5 J.)": { + "account_number": "3567" + }, + "Lohn- und Gehaltsverrechnungskonto": { + "account_number": "3790" + }, + "Umsatzsteuer (Gruppe)": { + "account_type": "Tax", + "is_group": 1, + "Umsatzsteuer": { + "account_number": "3800", + "account_type": "Tax" + }, + "Umsatzsteuer 7 %": { + "account_number": "3801", + "account_type": "Tax" + }, + "Umsatzsteuer aus innergem. Erwerb": { + "account_number": "3802" + }, + "Umsatzsteuer aus innergem. Erwerb 19 %": { + "account_number": "3804" + }, + "Umsatzsteuer 19 %": { + "account_number": "3806", + "account_type": "Tax" + }, + "Umsatzsteuer aus im Inland steuerpfl. EU-Lieferungen": { + "account_number": "3807" + }, + "Umsatzsteuer aus im Inland steuerpfl. EU-Lieferungen 19 %": { + "account_number": "3808" + }, + "Umsatzsteuer aus innergem. Erwerb ohne Vorsteuerabzug": { + "account_number": "3809" + }, + "Umsatzsteuer nicht f\u00e4llig (Gruppe)": { + "is_group": 1, + "Umsatzsteuer nicht f\u00e4llig": { + "account_number": "3810" + }, + "Umsatzsteuer nicht f\u00e4llig 7 %": { + "account_number": "3811" + }, + "Umsatzsteuer nicht f\u00e4llig aus im Inland steuerpfl. EU-Lieferungen": { + "account_number": "3812" + }, + "Umsatzsteuer nicht f\u00e4llig aus im Inland steuerpfl. EU-Lieferungen 19 %": { + "account_number": "3814" + }, + "Umsatzsteuer nicht f\u00e4llig 19 %": { + "account_number": "3816" + }, + "Umsatzsteuer aus im anderen EU-Land steuerpfl. Lieferungen": { + "account_number": "3817" + }, + "Umsatzsteuer aus im anderen EU-Land steuerpfl. sonstigen Leistungen/Werklieferungen": { + "account_number": "3818" + }, + "Umsatzsteuer aus Erwerb als letzter Abnehmer innerh. eines Dreiecksgesch.s": { + "account_number": "3819" + } + }, + "Umsatzsteuer-Vorauszahlungen": { + "account_number": "3820", + "account_type": "Tax" + }, + "Umsatzsteuer-Vorauszahlung 1/11": { + "account_number": "3830" + }, + "Nachsteuer, UStVA Kz. 65": { + "account_number": "3832" + }, + "Umsatzsteuer aus innergem. Erwerb von Neufahrzeugen von Lieferanten ohne Ust-ID": { + "account_number": "3834" + }, + "Umsatzsteuer nach \u00a7 13b UStG": { + "account_number": "3835" + }, + "Umsatzsteuer nach \u00a7 13b UStG 19 %": { + "account_number": "3837" + }, + "Umsatzsteuer aus der Auslagerung von Gegenst\u00e4nden aus einem Umsatzsteuerlager": { + "account_number": "3839" + }, + "Einfuhrumsatzsteuer aufgeschoben bis": { + "account_number": "3850" + }, + "In Rechnung unrichtig oder unberechtigtausgewiesene Steuerbetr\u00e4ge, UStVA Kz. 69": { + "account_number": "3852" + }, + "Steuerzahlungen an andere L\u00e4nder": { + "account_number": "3854" + } + } + }, + "is_group": 1 + }, + "E - Passive latente Steuern": { + "is_group": 1, + "Passive latente Steuern": { + "account_number": "3065" + } + }, + "D - Rechnungsabgrenzungsposten": { + "is_group": 1, + "Passive Rechnungsabgrenzung": { + "account_number": "3900" + } + }, + "is_group": 1 + }, + "1 - Umsatzerl\u00f6se": { + "root_type": "Income", + "is_group": 1, + "Steuerfreie Ums\u00e4tze \u00a7 4 Nr. 8 ff UStG (Gruppe)": { + "is_group": 1, + "Steuerfreie Ums\u00e4tze \u00a7 4 Nr. 8 ff UStG": { + "account_number": "4100" + }, + "Steuerfreie Ums\u00e4tze nach \u00a7 4 Nr. 12 UStG (Vermietung und Verpachtung)": { + "account_number": "4105" + }, + "Sonstige steuerfreie Ums\u00e4tze Inland": { + "account_number": "4110" + }, + "Steuerfreie Ums\u00e4tze \u00a7 4 Nr. 1a UStG (Gruppe)": { + "is_group": 1, + "Steuerfreie Ums\u00e4tze \u00a7 4 Nr. 1a UStG": { + "account_number": "4120" + }, + "Steuerfreie Innergemeinschaftliche Lieferungen \u00a7 4 Nr. 1b UStG": { + "account_number": "4125" + } + }, + "Lieferungen des ersten Abnehmers bei innergem. Dreiecksgesch.en \u00a7 25b Abs. 2 UStG (Gruppe)": { + "is_group": 1, + "Lieferungen des ersten Abnehmers bei innergem. Dreiecksgesch.en \u00a7 25b Abs. 2 UStG": { + "account_number": "4130" + }, + "Steuerfreie innergem. Lieferungen von Neufahrzeugen an Abnehmer ohne Ust-ID": { + "account_number": "4135" + }, + "Umsatzerl\u00f6se nach \u00a7\u00a7 25 und 25a UStG 19% USt": { + "account_number": "4136" + }, + "Umsatzerl\u00f6se nach \u00a7\u00a7 25 und 25a UStG ohne USt": { + "account_number": "4138" + }, + "Umsatzerl\u00f6se aus Reiseleistungen \u00a7 25 Abs. 2 UStG, steuerfrei": { + "account_number": "4139" + } + }, + "Steuerfreie Ums\u00e4tze Offshore usw.": { + "account_number": "4140" + }, + "Sonstige steuerfreie Ums\u00e4tze (z. B. \u00a7 4 Nr. 2-7 UStG)": { + "account_number": "4150" + }, + "Steuerfreie Ums\u00e4tze ohne Vorsteuerabzug zum Gesamtumsatz geh\u00f6rend": { + "account_number": "4160" + }, + "Erl\u00f6se, die mit den Durchschnittss\u00e4tzen des \u00a7 24 UStG versteuert werden": { + "account_number": "4180" + }, + "Erl\u00f6se aus Kleinunternehmer i. S. d. \u00a7 19 Abs. 1 UStG": { + "account_number": "4185", + "account_type": "Income Account" + }, + "Erl\u00f6se aus Geldspielautomaten 19 % USt": { + "account_number": "4186" + } + }, + "Erl\u00f6se": { + "account_number": "4200", + "account_type": "Income Account" + }, + "Erl\u00f6se 7 % USt": { + "account_number": "4300", + "account_type": "Income Account" + }, + "Erl\u00f6se aus im Inland steuerpfl. EU-Lieferungen 7 % USt": { + "account_number": "4310" + }, + "Erl\u00f6se aus im Inland steuerpfl. EU-Lieferungen 19 % USt": { + "account_number": "4315" + }, + "Erl\u00f6se aus im anderen EU-Land steuerpfl. Lieferungen": { + "account_number": "4320" + }, + "Erl\u00f6se aus im Inland steuerpfl. EU-Lieferungen 16 % USt": { + "account_number": "4330" + }, + "Erl\u00f6se aus Lieferungen von Mobilfunkger./Schaltkr., f. die der Leistungsempf. die Ust. schuldet": { + "account_number": "4335" + }, + "Erl\u00f6se aus im anderen EU-Land steuerpfl. sonst. Leistungen, f. die der Leistungsempf. die Ust. schuldet": { + "account_number": "4336" + }, + "Erl\u00f6se aus Leistungen, f. die der Leistungsempf. die Ust. nach \u00a7 13b UStG schuldet": { + "account_number": "4337" + }, + "Erl\u00f6se aus im Drittland steuerbaren Leistungen, im Inland nicht steuerbare Ums\u00e4tze": { + "account_number": "4338" + }, + "Erl\u00f6se aus im anderen EU-Land steuerbaren Leistungen, im Inland nicht steuerbare Ums\u00e4tze": { + "account_number": "4339" + }, + "Erl\u00f6se 16 % USt (Gruppe)": { + "is_group": 1, + "Erl\u00f6se 16 % USt": { + "account_number": "4340" + } + }, + "Erl\u00f6se 19 % USt (Gruppe)": { + "is_group": 1, + "Erl\u00f6se 19 % USt": { + "account_number": "4400", + "account_type": "Income Account" + } + }, + "Erl\u00f6sschm\u00e4lerungen (Gruppe)": { + "is_group": 1, + "Erl\u00f6sschm\u00e4lerungen": { + "account_number": "4700" + }, + "Erl\u00f6sschm\u00e4lerungen aus steuerfreien Ums\u00e4tzen \u00a7 4 Nr. 1a UStG": { + "account_number": "4705" + }, + "Erl\u00f6sschm\u00e4lerungen 7 % USt": { + "account_number": "4710" + }, + "Erl\u00f6sschm\u00e4lerungen 19 % USt": { + "account_number": "4720" + }, + "Erl\u00f6sschm\u00e4lerungen 16 % USt": { + "account_number": "4723" + }, + "Erl\u00f6sschm\u00e4lerungen aus steuerfreien innergem. Lieferungen": { + "account_number": "4724" + }, + "Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 7 % USt": { + "account_number": "4725" + }, + "Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 19 % USt": { + "account_number": "4726" + }, + "Erl\u00f6sschm\u00e4lerungen aus im anderen EU-Land steuerpfl. Lieferungen": { + "account_number": "4727" + }, + "Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 16 % USt": { + "account_number": "4729" + }, + "Gew\u00e4hrte Skonti (Gruppe)": { + "is_group": 1, + "Gew. Skonti": { + "account_number": "4730" + }, + "Gew. Skonti 7 % USt": { + "account_number": "4731" + }, + "Gew. Skonti 19 % USt": { + "account_number": "4736" + }, + "Gew. Skonti aus Lieferungen von Mobilfunkger./Schaltkr., f. die der Leistungsempf. die Ust. schuldet": { + "account_number": "4738" + }, + "Gew. Skonti aus Leistungen, f. die der Leistungsempf. die Umsatzsteuer nach \u00a7 13b UStG schuldet": { + "account_number": "4741" + }, + "Gew. Skonti aus Erl\u00f6sen aus im anderen EU-Land steuerpfl. Leistungen, f. die der Leistungsempf. die Ust. schuldet": { + "account_number": "4742" + }, + "Gew. Skonti aus steuerfreien innergem. Lieferungen \u00a7 4 Nr. 1b UStG": { + "account_number": "4743" + }, + "Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen": { + "account_number": "4745" + }, + "Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen 7% USt": { + "account_number": "4746" + }, + "Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen 19% USt": { + "account_number": "4748" + } + }, + "Gew\u00e4hrte Boni 7 % USt": { + "account_number": "4750" + }, + "Gew\u00e4hrte Boni 19 % USt": { + "account_number": "4760" + }, + "Gew\u00e4hrte Boni": { + "account_number": "4769" + }, + "Gew\u00e4hrte Rabatte": { + "account_number": "4770" + }, + "Gew\u00e4hrte Rabatte 7 % USt": { + "account_number": "4780" + }, + "Gew\u00e4hrte Rabatte 19 % USt": { + "account_number": "4790" + } + }, + "Grundst\u00fccksertr\u00e4ge (Gruppe)": { + "is_group": 1, + "Grundst\u00fccksertr\u00e4ge": { + "account_number": "4860" + }, + "Erl\u00f6se aus Vermietung und Verpachtung, umsatzsteuerfrei \u00a7 4 Nr. 12 UStG": { + "account_number": "4861" + }, + "Erl\u00f6se aus Vermietung und Verpachtung 19% USt": { + "account_number": "4862" + } + }, + "Sonstige Ertr\u00e4ge aus Provisionen, Lizenzen und Patenten (Gruppe)": { + "is_group": 1, + "Sonstige Ertr\u00e4ge aus Provisionen, Lizenzen und Patenten": { + "account_number": "4570" + }, + "Sonstige Ertr\u00e4ge aus Provisionen, Lizenzen und Patenten, steuerfrei \u00a7 4 Nr. 8ff UStG": { + "account_number": "4574" + }, + "Sonstige Ertr\u00e4ge aus Provisionen, Lizenzen und Patenten, steuerfrei \u00a7 4 Nr. 5 UStG": { + "account_number": "4575" + }, + "Sonstige Ertr\u00e4ge aus Provisionen, Lizenzen und Patenten 7% USt": { + "account_number": "4576" + }, + "Sonstige Ertr\u00e4ge aus Provisionen, Lizenzen und Patenten 19% USt": { + "account_number": "4579" + } + }, + "Provisionsums\u00e4tze (Gruppe)": { + "is_group": 1, + "Provisionsums\u00e4tze": { + "account_number": "4560" + }, + "Provisionsums\u00e4tze, steuerfrei \u00a7 4Nr. 8ff UStG": { + "account_number": "4564" + }, + "Provisionsums\u00e4tze, steuerfrei \u00a7 4 Nr. 5 UStG": { + "account_number": "4565" + }, + "Provisionsums\u00e4tze 7% USt": { + "account_number": "4566" + }, + "Provisionsums\u00e4tze 19 % Ust": { + "account_number": "4569" + } + }, + "Erl\u00f6se Abfallverwertung": { + "account_number": "4510" + }, + "Erl\u00f6se Leergut": { + "account_number": "4520" + } + }, + "2 - Herstellungskosten der zur Erzielung der Umsatzerl\u00f6se erbrachten Leistungen": { + "root_type": "Expense", + "is_group": 1, + "Herstellungskosten": { + "account_number": "6990", + "account_type": "Cost of Goods Sold" + }, + "Aufwendungen f. Roh-, Hilfs- und Betriebsstoffe und f. bezogene Waren": { + "account_number": "5000", + "account_type": "Expense Account" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe (Gruppe)": { + "is_group": 1, + "Einkauf Roh-, Hilfs- und Betriebsstoffe": { + "account_number": "5100", + "account_type": "Expense Account" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": { + "account_number": "5110" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": { + "account_number": "5130" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe, innergem. Erwerb 7% Vorst. u. 7% Ust.": { + "account_number": "5160" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe, innergem. Erwerb 19% Vorst. u. 19% Ust.": { + "account_number": "5162" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe, innergem. Erwerb ohne Vorsteuer und 7% Umsatzsteuer": { + "account_number": "5166" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe, innergem. Erwerb ohne Vorsteuer und 19% Umsatzsteuer": { + "account_number": "5167" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe 5,5% Vorsteuer": { + "account_number": "5170" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe 10,7% Vorsteuer": { + "account_number": "5171" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe aus einem USt-Lager \u00a7 13a UStG 7% Vorst. und 7% Ust.": { + "account_number": "5175" + }, + "Einkauf Roh-, Hilfs- und Betriebsstoffe aus einem USt-Lager \u00a7 13a UStG 19% Vorst. und 19% Ust.": { + "account_number": "5176" + }, + "Erwerb Roh-, Hilfs- und Betriebsstoffe als letzter Abnehmer innerh. Dreiecksgesch. 19% Vorst. und 19% Ust.": { + "account_number": "5189" + }, + "Energiestoffe (Fertigung) (Gruppe)": { + "is_group": 1, + "Energiestoffe (Fertigung)": { + "account_number": "5190" + }, + "Energiestoffe (Fertigung)7% Vorsteuer": { + "account_number": "5191" + }, + "Energiestoffe (Fertigung)19% Vorsteuer": { + "account_number": "5192" + } + } + }, + "Wareneingang (Gruppe)": { + "is_group": 1, + "Wareneingang": { + "account_number": "5200" + }, + "Wareneingang 7 % Vorsteuer": { + "account_number": "5300" + }, + "Wareneingang 19 % Vorsteuer": { + "account_number": "5400" + }, + "Wareneingang 5,5 % Vorsteuer": { + "account_number": "5505" + }, + "Wareneingang 10,7 % Vorsteuer": { + "account_number": "5540" + }, + "Steuerfreier innergem. Erwerb": { + "account_number": "5550" + }, + "Wareneingang im Drittland steuerbar": { + "account_number": "5551" + }, + "Erwerb 1. Abnehmer innerh. eines Dreieckgesch\u00e4ftes": { + "account_number": "5552" + }, + "Erwerb Waren als letzter Abnehmer innerh. Dreiecksgesch. 19% Vorst. u. 19% Ust.": { + "account_number": "5553" + }, + "Wareneingang im anderen EU-Land steuerbar": { + "account_number": "5558" + }, + "Steuerfreie Einfuhren": { + "account_number": "5559" + }, + "Waren aus einem Umsatzsteuerlager, \u00a7 13a UStG 7% Vorst. u. 7% Ust.": { + "account_number": "5560" + }, + "Waren aus einem Umsatzsteuerlager, \u00a7 13a UStG 19% Vorst. u. 19% Ust.": { + "account_number": "5565" + } + }, + "innergem. Erwerb 7% Vorst. u. 7% Ust.": { + "account_number": "5420" + }, + "innergem. Erwerb 19 % Vorsteuer 19 % Umsatzsteuer": { + "account_number": "5425" + }, + "innergem. Erwerb ohne Vorst. und 7% Ust.": { + "account_number": "5430" + }, + "innergem. Erwerb ohne Vorsteuer und 19 % Umsatzsteuer": { + "account_number": "5435" + }, + "innergem. Erwerb von Neufahrzeugen von Lieferanten ohne Ust-ID 19 % Vorst. und 19 % Ust.": { + "account_number": "5440" + }, + "Nicht abziehbare Vorsteuer (Gruppe)": { + "is_group": 1, + "Nicht abziehbare Vorsteuer": { + "account_number": "5600" + }, + "Nicht abziehbare Vorsteuer 7 % (Gruppe)": { + "is_group": 1, + "Nicht abziehbare Vorsteuer 7 %": { + "account_number": "5610" + } + }, + "Nicht abziehbare Vorsteuer 19 % (Gruppe)": { + "is_group": 1, + "Nicht abziehbare Vorsteuer 19 %": { + "account_number": "5660" + } + } + }, + "Nachl\u00e4sse (Gruppe)": { + "is_group": 1, + "Nachl\u00e4sse": { + "account_number": "5700" + }, + "Nachl\u00e4sse aus Einkauf Roh-, Hilfs- und Betriebsstoffe": { + "account_number": "5701" + }, + "Nachl\u00e4sse 7 % Vorsteuer": { + "account_number": "5710" + }, + "Nachl\u00e4sse aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": { + "account_number": "5714" + }, + "Nachl\u00e4sse aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": { + "account_number": "5715" + }, + "Nachl\u00e4sse aus Einkauf Roh-, Hilfs- und Betriebsstoffe, innergem. Erwerb 7% Vorst. u. 7% Ust.": { + "account_number": "5717" + }, + "Nachl\u00e4sse aus Einkauf Roh-, Hilfs- und Betriebsstoffe, innergem. Erwerb 19% Vorst. u. 19% Ust.": { + "account_number": "5718" + }, + "Nachl\u00e4sse 19 % Vorsteuer": { + "account_number": "5720" + }, + "Nachl\u00e4sse 16 % Vorsteuer": { + "account_number": "5722" + }, + "Nachl\u00e4sse 15 % Vorsteuer": { + "account_number": "5723" + }, + "Nachl\u00e4sse aus innergem. Erwerb 7% Vorst. u. 7% Ust.": { + "account_number": "5724" + }, + "Nachl\u00e4sse aus innergem. Erwerb 19% Vorst. u. 19% Ust.": { + "account_number": "5725" + }, + "Nachl\u00e4sse aus innergem. Erwerb 16 % Vorsteuer und 16 % Umsatzsteuer": { + "account_number": "5726" + }, + "Nachl\u00e4sse aus innergem. Erwerb 15 % Vorsteuer und 15 % Umsatzsteuer": { + "account_number": "5727" + }, + "Erhaltene Skonti (Gruppe)": { + "is_group": 1, + "Erh. Skonti": { + "account_number": "5730" + }, + "Erh. Skonti 7 % Vorsteuer": { + "account_number": "5731" + }, + "Erh. Skonti aus Einkauf Roh-, Hilfs- und Betriebsstoffe": { + "account_number": "5733" + }, + "Erh. Skonti aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": { + "account_number": "5734" + }, + "Erh. Skonti 19 % Vorsteuer": { + "account_number": "5736" + }, + "Erh. Skonti aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": { + "account_number": "5738" + }, + "Erh. Skonti aus Einkauf Roh-, Hilfs- und Betriebsstoffe aus steuerpfl. innergem. Erwerb 19% Vorst. u. 19% Ust.": { + "account_number": "5741" + }, + "Erh. Skonti aus Einkauf Roh-, Hilfs- und Betriebsstoffe aus steuerpfl. innergem. Erwerb 7% Vorst. u. 7% Ust.": { + "account_number": "5743" + }, + "Erh. Skonti aus steuerpflichtigem innergem. Erwerb": { + "account_number": "5745" + }, + "Erh. Skonti aus steuerpflichtigem innergem. Erwerb 7% Vorst. u. 7% Ust.": { + "account_number": "5746" + }, + "Erh. Skonti aus steuerpflichtigem innergem. Erwerb 19% Vorst. u. 19% Ust.": { + "account_number": "5748" + }, + "Erh. Skonti aus Erwerb Roh-,Hilfs-,Betriebsstoff letzter Abn.innerh.Dreiecksg. 19% Vorst. und 19% Ust.": { + "account_number": "5792" + }, + "Erh. Skonti aus Erwerb Waren als letzter Abnehmer innerh. Dreiecksgesch. 19% Vorst. u. 19% Ust.": { + "account_number": "5793" + } + }, + "Erhaltene Boni (Gruppe)": { + "is_group": 1, + "Erhaltene Boni 7 % Vorsteuer": { + "account_number": "5750" + }, + "Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe": { + "account_number": "5753" + }, + "Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": { + "account_number": "5754" + }, + "Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": { + "account_number": "5755" + }, + "Erhaltene Boni 19 % Vorsteuer": { + "account_number": "5760" + }, + "Erhaltene Boni": { + "account_number": "5769" + } + }, + "Erhaltene Rabatte (Gruppe)": { + "is_group": 1, + "Erhaltene Rabatte": { + "account_number": "5770" + }, + "Erhaltene Rabatte 7 % Vorsteuer": { + "account_number": "5780" + }, + "Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe": { + "account_number": "5783" + }, + "Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": { + "account_number": "5784" + }, + "Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": { + "account_number": "5785" + }, + "Erhaltene Rabatte 19 % Vorsteuer": { + "account_number": "5790" + } + } + }, + "Bezugsnebenkosten (Gruppe)": { + "is_group": 1, + "Bezugsnebenkosten": { + "account_number": "5800" + }, + "Leergut": { + "account_number": "5820" + }, + "Z\u00f6lle und Einfuhrabgaben": { + "account_number": "5840" + }, + "Verrechnete Stoffkosten (Gegenkonto 5000-99) oder (4000-99)": { + "account_number": "5860" + } + }, + "Fremdleistungen (Gruppe)": { + "is_group": 1, + "Fremdleistungen": { + "account_number": "5900", + "account_type": "Expense Account" + }, + "Fremdleistungen 19% Vorsteuer": { + "account_number": "5906" + }, + "Fremdleistungen ohne Vorsteuer": { + "account_number": "5909" + }, + "Bauleistungen eines im Inland ans\u00e4ssigen Unternehmers 7% Vorst. u. 7% Ust.": { + "account_number": "5910" + }, + "Sonstige Leistungen eines im anderen EU-Land ans\u00e4ssigen Unternehmers 7% Vorst. u. 7% Ust.": { + "account_number": "5913" + }, + "Leistungen eines im Ausland ans\u00e4ssigen Unternehmers 7% Vorst. u. 7% Ust.": { + "account_number": "5915" + }, + "Bauleistungen eines im Inland ans\u00e4ssigen Unternehmers 19% Vorst. u. 19% Ust.": { + "account_number": "5920" + }, + "Sonstige Leistungen eines im anderen EU-Land ans\u00e4ssigen Unternehmers 19% Vorst. u. 19% Ust.": { + "account_number": "5923" + }, + "Leistungen eines im Ausland ans\u00e4ssigen Unternehmers 19% Vorst. u. 19% Ust.": { + "account_number": "5925" + }, + "Bauleistungen eines im Inland ans\u00e4ssigen Unternehmers ohne Vorst. und 7% Ust.": { + "account_number": "5930" + }, + "Sonstige Leistungen eines im anderen EU-Land ans\u00e4ssigen Unternehmers ohne Vorst. und 7% Ust.": { + "account_number": "5933" + }, + "Leistungen eines im Ausland ans\u00e4ssigen Unternehmers ohne Vorst. und 7% Ust.": { + "account_number": "5935" + }, + "Bauleistungen eines im Inland ans\u00e4ssigen Unternehmers ohne Vorsteuer und 19 % Umsatzsteuer": { + "account_number": "5940" + }, + "Sonstige Leistungen eines im anderen EU-Land ans\u00e4ssigen Unternehmers ohne Vorsteuer und 19 % Umsatzsteuer": { + "account_number": "5943" + }, + "Leistungen eines im Ausland ans\u00e4ssigen Unternehmers ohne Vorsteuer und 19 % Umsatzsteuer": { + "account_number": "5945" + }, + "Erhaltene Skonti aus Leistungen, f. die als Leistungsempf. die Steuer geschuldet wird (Gruppe)": { + "is_group": 1, + "Erh. Skonti aus Leistungen, f. die als Leistungsempf. die Steuer nach \u00a7 13b UStG geschuldet wird": { + "account_number": "5950" + }, + "Erh. Skonti aus Leistungen,f. die als Leistungsempf. die Steuer geschuldet wird 19 % Vorst. und 19 % Ust.": { + "account_number": "5951" + }, + "Erh. Skonti aus Leistungen, f. die als Leistungsempf. die Steuer geschuldet wird ohne Vorst. aber mit Uts.": { + "account_number": "5953" + }, + "Erh. Skonti aus Leistungen, f. die als Leistungsempf. die Steuer geschuldet wird ohne Vorst., mit 19 % Ust.": { + "account_number": "5954" + } + }, + "Leistungen nach \u00a7 13b UStG mit Vorsteuerabzug": { + "account_number": "5960" + }, + "Leistungen nach \u00a7 13b UStG ohne Vorsteuerabzug": { + "account_number": "5965" + } + }, + "L\u00f6hne und Geh\u00e4lter (Gruppe)": { + "is_group": 1, + "L\u00f6hne und Geh\u00e4lter": { + "account_number": "6000", + "account_type": "Expense Account" + }, + "L\u00f6hne": { + "account_number": "6010" + }, + "Geh\u00e4lter": { + "account_number": "6020" + }, + "Tantiemen": { + "account_number": "6026" + }, + "Aushilfsl\u00f6hne": { + "account_number": "6030" + }, + "L\u00f6hne f. Minijobs": { + "account_number": "6035" + }, + "Pauschale Steuern und Abgaben f. Sachzuwendungen und Dienstleistungen an Arbeitnehmer": { + "account_number": "6039" + }, + "Pauschale Steuer f. Aushilfen": { + "account_number": "6040" + }, + "Bedienungsgelder": { + "account_number": "6045" + }, + "Ehegattengehalt": { + "account_number": "6050" + }, + "Freiwillige soziale Aufwendungen lohnsteuerpflichtig": { + "account_number": "6060" + }, + "Pauschale Steuer auf sonstige Bez\u00fcge (z. B. Fahrtkostenzusch\u00fcsse)": { + "account_number": "6069" + }, + "Krankengeldzusch\u00fcsse": { + "account_number": "6070" + }, + "Sachzuwendungen und Dienstleistungen an Arbeitnehmer": { + "account_number": "6072" + }, + "Zusch\u00fcsse der Agenturen f. Arbeit (Haben)": { + "account_number": "6075" + }, + "Verm\u00f6genswirksame Leistungen": { + "account_number": "6080" + }, + "Fahrtkostenerstattung - Wohnung/Arbeitsst\u00e4tte": { + "account_number": "6090" + } + }, + "Soziale Abgaben und Aufwendungen f. Altersvers. und f. Unterst\u00fctzung (Gruppe)": { + "is_group": 1, + "Soziale Abgaben und Aufwendungen f. Altersvers. und f. Unterst\u00fctzung": { + "account_number": "6100", + "account_type": "Expense Account" + }, + "Gesetzliche soziale Aufwendungen": { + "account_number": "6110", + "account_type": "Expense Account" + }, + "Beitr\u00e4ge zur Berufsgenossenschaft": { + "account_number": "6120", + "account_type": "Expense Account" + }, + "Freiwillige soziale Aufwendungen lohnsteuerfrei": { + "account_number": "6130" + }, + "Aufwendungen f. Altersvers.": { + "account_number": "6150" + }, + "Aufwendungen f. Unterst\u00fctzung": { + "account_number": "6160" + }, + "Sonstige soziale Abgaben": { + "account_number": "6170" + } + }, + "Abschreibungen auf Sachanlagen (Gruppe)": { + "is_group": 1, + "Abschreibungen auf Sachanlagen (ohne AfA auf Kfz und Geb\u00e4ude)": { + "account_number": "6220", + "account_type": "Depreciation" + }, + "Abschreibungen auf Geb\u00e4ude": { + "account_number": "6221", + "account_type": "Depreciation" + }, + "Abschreibungen auf Kfz": { + "account_number": "6222", + "account_type": "Depreciation" + }, + "Abschreibungen auf Geb\u00e4udeanteil des h\u00e4uslichen Arbeitszimmers": { + "account_number": "6223" + } + }, + "Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf Sachanlagen (Gruppe)": { + "is_group": 1, + "Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf Sachanlagen": { + "account_number": "6230" + }, + "Absetzung f. au\u00dfergew\u00f6hnliche technische und wirtschaftliche Abnutzung der Geb\u00e4ude": { + "account_number": "6231" + }, + "Absetzung f. au\u00dfergew\u00f6hnliche technische und wirtschaftliche Abnutzung des Kfz": { + "account_number": "6232" + }, + "Absetzung f. au\u00dfergew\u00f6hnliche technische und wirtschaftliche Abnutzung sonstiger Wirtschaftsg\u00fcter": { + "account_number": "6233" + } + }, + "Abschreibungen auf Sachanlagen auf Grund steuerlicher Sondervorschriften (Gruppe)": { + "is_group": 1, + "Abschreibungen auf Sachanlagen auf Grund steuerlicher Sondervorschriften": { + "account_number": "6240" + }, + "Sonderabschreibungen nach \u00a7 7g Abs. 1 und 2 EStG a. F./\u00a7 7g Abs. 5 EStG n. F.(ohne Kfz)": { + "account_number": "6241" + }, + "Sonderabschreibungen nach \u00a7 7g Abs. 1 und 2 EStG a. F./\u00a7 7g Abs. 5 EStG n. F.(f. Kfz)": { + "account_number": "6242" + }, + "K\u00fcrzung der Anschaffungs- oder Herstellungskosten gem\u00e4\u00df \u00a7 7g Abs. 2 EStG n.F. (ohne Kfz)": { + "account_number": "6243" + }, + "K\u00fcrzung der Anschaffungs- oder Herstellungskosten gem\u00e4\u00df \u00a7 7g Abs. 2 EStG n.F. (f. Kfz)": { + "account_number": "6244" + } + }, + "Kaufleasing": { + "account_number": "6250" + }, + "Sofortabschreibung geringwertiger Wirtschaftsg\u00fcter": { + "account_number": "6260", + "account_type": "Depreciation" + }, + "Abschreibungen auf aktivierte, geringwertige Wirtschaftsg\u00fcter": { + "account_number": "6262" + }, + "Abschreibungen auf den Sammelposten Wirtschaftsg\u00fcter": { + "account_number": "6264" + }, + "Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf aktivierte, geringwertige Wirtschaftsg\u00fcter": { + "account_number": "6266" + }, + "Abschreibungen auf Aufwendungen f. die Ingangsetzung und Erweiterung des Gesch\u00e4ftsbetriebs": { + "account_number": "6268" + }, + "Abschreibungen auf immaterielle VG (Gruppe)": { + "is_group": 1, + "Abschreibungen auf immaterielle VG": { + "account_number": "6200", + "account_type": "Depreciation" + }, + "Abschreibungen auf selbst geschaffene immaterielle VG": { + "account_number": "6201" + }, + "Abschreibungen auf den Gesch\u00e4fts- oder Firmenwert": { + "account_number": "6205" + }, + "Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf den Gesch\u00e4fts- oder Firmenwert": { + "account_number": "6209" + }, + "Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf immaterielle VG": { + "account_number": "6210" + }, + "Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf selbst geschaffene immaterielle VG": { + "account_number": "6211" + }, + "Abschreibungen auf Forderungen gg. Kapitalges., an denen eine Beteiligung besteht (soweit un\u00fcblich hoch)": { + "account_number": "6290" + } + }, + "Abschreibungen auf sonstige VG des Umlaufverm. (soweit un\u00fcbliche H\u00f6he) (Gruppe)": { + "is_group": 1, + "Abschreibungen auf sonstige VG des Umlaufverm. (soweit un\u00fcbliche H\u00f6he)": { + "account_number": "6270" + }, + "Abschreibungen auf Umlaufverm\u00f6gen, steuerrechtlich bedingt (soweit un\u00fcbliche H\u00f6he)": { + "account_number": "6272" + }, + "Abschreibungen auf Roh-, Hilfs- und Betriebsstoffe/Waren (soweit un\u00fcblich hoch)": { + "account_number": "6278" + }, + "Abschreibungen auf fertige und unfertige Erzeugnisse (soweit un\u00fcblich hoch)": { + "account_number": "6279" + }, + "Forderungsverluste, un\u00fcblich hoch (Gruppe)": { + "is_group": 1, + "Forderungsverluste, un\u00fcblich hoch": { + "account_number": "6280" + }, + "Forderungsverluste 7% USt (soweit un\u00fcblich hoch)": { + "account_number": "6281" + }, + "Forderungsverluste 16% USt (soweit un\u00fcblich hoch)": { + "account_number": "6285" + }, + "Forderungsverluste 19% USt (soweit un\u00fcblich hoch)": { + "account_number": "6286" + }, + "Forderungsverluste 15% USt (soweit un\u00fcblich hoch)": { + "account_number": "6287" + } + } + } + }, + "4 - Vertriebskosten": { + "root_type": "Expense", + "is_group": 1, + "Personalaufwand (Vertrieb)": { + "is_group": 1 + } + }, + "5 - allgemeine Verwaltungskosten": { + "root_type": "Expense", + "is_group": 1, + "Verwaltungskosten": { + "account_number": "6992", + "account_type": "Expenses Included In Valuation" + }, + "Personalaufwand (Verwaltung)": { + "is_group": 1 + } + }, + "6 - sonstige betriebliche Ertr\u00e4ge": { + "root_type": "Income", + "is_group": 1, + "Andere aktivierte Eigenleistungen": { + "account_number": "4820" + }, + "Aktivierte Eigenleistungen zur Erstellung von selbst geschaffenen immateriellen VGn": { + "account_number": "4825" + }, + "Sonstige betriebliche Ertr\u00e4ge": { + "account_number": "4830" + }, + "Sonstige betriebliche Ertr\u00e4ge von verbundenen Unternehmen": { + "account_number": "4832" + }, + "Andere Nebenerl\u00f6se": { + "account_number": "4833" + }, + "Sonstige Ertr\u00e4ge betrieblich und regelm\u00e4\u00dfig 16 % USt": { + "account_number": "4834" + }, + "Sonstige Ertr\u00e4ge betrieblich und regelm\u00e4\u00dfig": { + "account_number": "4835" + }, + "Sonstige Ertr\u00e4ge betrieblich und regelm\u00e4\u00dfig 19 % USt": { + "account_number": "4836" + }, + "Sonstige Ertr\u00e4ge betriebsfremd und regelm\u00e4\u00dfig": { + "account_number": "4837" + }, + "Erstattete Vorsteuer anderer L\u00e4nder": { + "account_number": "4838" + }, + "Sonstige Ertr\u00e4ge unregelm\u00e4\u00dfig": { + "account_number": "4839" + }, + "Ertr\u00e4ge aus Abgang von Gegenst\u00e4nden des Anlageverm\u00f6gens": { + "account_number": "4900" + }, + "Ertr\u00e4ge aus der Ver\u00e4u\u00dferung von Anteilen an Kap.Ges. (Finanzanlageverm., inl\u00e4nd. Kap.Ges.)": { + "account_number": "4901" + }, + "Ertr\u00e4ge aus Abgang von Gegenst\u00e4nden des Umlaufverm. (au\u00dfer Vorr\u00e4te)": { + "account_number": "4905" + }, + "Ertr\u00e4ge aus Abgang von Gegenst\u00e4nden des Umlaufverm. (au\u00dfer Vorr\u00e4te, inl\u00e4nd. Kap.Ges.)": { + "account_number": "4906" + }, + "Ertr\u00e4ge aus der W\u00e4hrungsumrechnung": { + "account_number": "4840" + }, + "Sonstige Erl\u00f6se betrieblich und regelm\u00e4\u00dfig, steuerfrei \u00a7 4 Nr. 8 ff UStG": { + "account_number": "4841" + }, + "Sonstige Erl\u00f6se betrieblich und regelm\u00e4\u00dfig, steuerfrei z. B. \u00a7 4 Nr. 2-7 UStG": { + "account_number": "4842" + }, + "Ertr\u00e4ge aus Bewertung Finanzmittelfonds": { + "account_number": "4843" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen steuerfrei \u00a7 4 Nr. 1a UStG (bei Buchgewinn)": { + "account_number": "4844" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen 19 % USt (bei Buchgewinn)": { + "account_number": "4845" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen steuerfrei \u00a7 4 Nr. 1b UStG (bei Buchgewinn)": { + "account_number": "4848" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen (bei Buchgewinn)": { + "account_number": "4849" + }, + "Erl\u00f6se aus Verk\u00e4ufen immaterieller VG (bei Buchgewinn) (Gruppe)": { + "is_group": 1, + "Erl\u00f6se aus Verk\u00e4ufen immaterieller VG (bei Buchgewinn)": { + "account_number": "4850" + }, + "Erl\u00f6se aus Verk\u00e4ufen Finanzanlagen (bei Buchgewinn)": { + "account_number": "4851" + }, + "Erl\u00f6se aus Verk\u00e4ufen Finanzanlagen (inl\u00e4ndische Kap.Ges., bei Buchgewinn)": { + "account_number": "4852" + }, + "Anlagenabg\u00e4nge Sachanlagen (Restbuchwert bei Buchvergewinn)": { + "account_number": "4855" + }, + "Anlagenabg\u00e4nge immaterielle VG (Restbuchwert bei Buchgewinn)": { + "account_number": "4856" + }, + "Anlagenabg\u00e4nge Finanzanlagen (Restbuchwert bei Buchgewinn)": { + "account_number": "4857" + }, + "Anlagenabg\u00e4nge Finanzanlagen (inl\u00e4ndische Kap.Ges., Restbuchwert bei Buchgewinn)": { + "account_number": "4858" + } + }, + "Ertr\u00e4ge aus Zuschreibungen des Sachanlageverm\u00f6gens": { + "account_number": "4910", + "account_type": "Round Off" + }, + "Ertr\u00e4ge aus Zuschreibungen des immateriellen Anlageverm\u00f6gens": { + "account_number": "4911" + }, + "Ertr\u00e4ge aus Zuschreibungen des Finanzanlageverm\u00f6gens": { + "account_number": "4912" + }, + "Ertr\u00e4ge aus Zuschreibungen des Finanzanlageverm\u00f6gens (inl\u00e4ndische Kap.Ges.)": { + "account_number": "4913" + }, + "Ertr\u00e4ge aus Zuschreibungen \u00a7 3 Nr. 40 EStG/\u00a7 8b Abs. 2 KStG (inl\u00e4ndische Kap.Ges.)": { + "account_number": "4914" + }, + "Ertr\u00e4ge aus Zuschreibungen des Umlaufverm. au\u00dfer Vorr\u00e4te": { + "account_number": "4915" + }, + "Ertr\u00e4ge aus Zuschreibungen des Umlaufverm. (inl\u00e4ndische Kap.Ges.)": { + "account_number": "4916" + }, + "Ertr\u00e4ge aus Herabsetzung der Pauschalwertberichtigung auf Forderungen": { + "account_number": "4920" + }, + "Ertr\u00e4ge aus Herabsetzung der Einzelwertberichtigung auf Forderungen": { + "account_number": "4923" + }, + "Ertr\u00e4ge aus abgeschriebenen Forderungen": { + "account_number": "4925" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung einer steuerlichen R\u00fccklage nach \u00a7 6b Abs. 3 EStG": { + "account_number": "4927" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung einer steuerlichen R\u00fccklage nach \u00a7 6b Abs. 10 EStG": { + "account_number": "4928" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung der R\u00fccklage f. Ersatzbeschaffung R 6.6 EStR": { + "account_number": "4929" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung von R\u00fcckstellungen": { + "account_number": "4930" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung einer steuerlichen R\u00fccklage (Existenzgr\u00fcnderr\u00fccklage)": { + "account_number": "4934" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung einer steuerlichen R\u00fccklage": { + "account_number": "4935" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung von steuerlichen R\u00fccklagen (Ansparabschreibungen)": { + "account_number": "4936" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung steuerrechtlicher Sonderabschreibungen": { + "account_number": "4937" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung einer steuerlichen R\u00fccklage nach \u00a7 4g EStG": { + "account_number": "4938" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung von steuerlichen R\u00fccklagen nach \u00a7 52 Abs. 16 EStG": { + "account_number": "4939" + }, + "Verrechnete sonstige Sachbez\u00fcge (Gruppe)": { + "is_group": 1, + "Verrechnete sonstige Sachbez\u00fcge (keine Waren)": { + "account_number": "4940" + }, + "Sachbez\u00fcge 7 % USt (Waren)": { + "account_number": "4941" + }, + "Sachbez\u00fcge 19 % USt (Waren)": { + "account_number": "4945" + }, + "Verrechnete sonstige Sachbez\u00fcge": { + "account_number": "4946" + }, + "Verrechnete sonstige Sachbez\u00fcge aus Kfz-Gestellung 19% USt": { + "account_number": "4947" + }, + "Verrechnete sonstige Sachbez\u00fcge 19% USt": { + "account_number": "4948" + }, + "Verrechnete sonstige Sachbez\u00fcge ohne Umsatzsteuer": { + "account_number": "4949" + } + }, + "Periodenfremde Ertr\u00e4ge (soweit nicht au\u00dferordentlich)": { + "account_number": "4960" + }, + "Versicherungsentsch\u00e4digungen und Schadenersatzleistungen": { + "account_number": "4970" + }, + "Erstattungen Aufwendungsausgleichsgesetz": { + "account_number": "4972" + }, + "Investitionszusch\u00fcsse (steuerpflichtig)": { + "account_number": "4975" + }, + "Investitionszulagen (steuerfrei)": { + "account_number": "4980" + }, + "Steuerfreie Ertr\u00e4ge aus der Aufl\u00f6sung von steuerlichen R\u00fccklagen": { + "account_number": "4981" + }, + "Sonstige steuerfreie Betriebseinnahmen": { + "account_number": "4982" + }, + "Ertr\u00e4ge aus der Aktivierung unentgeltlich erworbener VG": { + "account_number": "4987" + }, + "Kostenerstattungen, R\u00fcckverg\u00fctungen und Gutschriften f. fr\u00fchere Jahre": { + "account_number": "4989" + }, + "Ertr\u00e4ge aus Verwaltungskostenumlagen": { + "account_number": "4992" + }, + "Unentgeltliche Wertabgaben": { + "account_number": "4600" + }, + "Entnahme von Gegenst\u00e4nden ohne USt": { + "account_number": "4605" + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens 7 % USt (Gruppe)": { + "is_group": 1, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens 7 % USt": { + "account_number": "4630" + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens ohne USt": { + "account_number": "4637" + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternnehmens ohne USt (Telefon-Nutzung)": { + "account_number": "4638" + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens ohne USt (Kfz-Nutzung)": { + "account_number": "4639" + } + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens 19 % USt (Gruppe)": { + "is_group": 1, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens 19 % USt": { + "account_number": "4640" + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens 19 % USt (Kfz-Nutzung)": { + "account_number": "4645" + }, + "Verwendung von Gegenst\u00e4nden f. Zwecke au\u00dferhalb des Unternehmens 19 % USt (Telefon-Nutzung)": { + "account_number": "4646" + } + }, + "Unentgeltliche Erbringung einer sonstigen Leistung 7 % USt": { + "account_number": "4650" + }, + "Unentgeltliche Erbringung einer sonstigen Leistung ohne USt": { + "account_number": "4659" + }, + "Unentgeltliche Erbringung einer sonstigen Leistung 19 % USt": { + "account_number": "4660" + }, + "Unentgeltliche Zuwendung von Waren 7 % USt": { + "account_number": "4670" + }, + "Unentgeltliche Zuwendung von Waren ohne USt": { + "account_number": "4679" + }, + "Unentgeltliche Zuwendung von Waren 19 % USt": { + "account_number": "4680" + }, + "Unentgeltliche Zuwendung von Gegenst\u00e4nden 19 % USt": { + "account_number": "4686" + }, + "Unentgeltliche Zuwendung von Gegenst\u00e4nden ohne USt": { + "account_number": "4689" + }, + "Nicht steuerbare Ums\u00e4tze (Innenums\u00e4tze) (Gruppe)": { + "is_group": 1, + "Nicht steuerbare Ums\u00e4tze (Innenums\u00e4tze)": { + "account_number": "4690" + }, + "Umsatzsteuerverg\u00fctungen, z.B. nach \u00a7 24 UStG": { + "account_number": "4695" + } + }, + "Au\u00dferordentliche Ertr\u00e4ge (Gruppe)": { + "is_group": 1, + "Au\u00dferordentliche Ertr\u00e4ge": { + "account_number": "7400" + }, + "Au\u00dferordentliche Ertr\u00e4ge finanzwirksam": { + "account_number": "7401" + }, + "Au\u00dferordentliche Ertr\u00e4ge nicht finanzwirksam (Gruppe)": { + "is_group": 1, + "Au\u00dferordentliche Ertr\u00e4ge nicht finanzwirksam": { + "account_number": "7450" + }, + "Ertr\u00e4ge durch Verschmelzung und Umwandlung": { + "account_number": "7451" + }, + "Ertr\u00e4ge durch den Verkauf von bedeutenden Beteiligungen": { + "account_number": "7452" + }, + "Ert\u00e4ge durch den Verkauf von bedeutenden Grundst\u00fccken": { + "account_number": "7453" + }, + "Gewinn aus der Ver\u00e4u\u00dferung oder der Aufgabe von Gesch\u00e4ftsaktivit\u00e4ten nach Steuern": { + "account_number": "7454" + } + }, + "Au\u00dferordentliche Ertr\u00e4ge aus der Anwendung von \u00dcbergangsvorschriften (Gruppe)": { + "is_group": 1, + "Au\u00dferordentliche Ertr\u00e4ge aus der Anwendung von \u00dcbergangsvorschriften": { + "account_number": "7460" + }, + "Au\u00dferordentliche Ertr\u00e4ge: Zuschreibung f. Sachanlageverm\u00f6gen": { + "account_number": "7461" + }, + "Au\u00dferordentliche Ertr\u00e4ge: Zuschreibung f. Finanzanlageverm\u00f6gen": { + "account_number": "7462" + }, + "Au\u00dferordentliche Ertr\u00e4ge: Wertpapiere im Umlaufverm\u00f6gen": { + "account_number": "7463" + }, + "Au\u00dferordentliche Ertr\u00e4ge: latente Steuern": { + "account_number": "7464" + } + } + } + }, + "7 - sonstige betriebliche Aufwendungen": { + "root_type": "Expense", + "is_group": 1, + "Sonstige betriebliche Aufwendungen": { + "account_number": "6300" + }, + "Interimskonto f. Aufw. in einem anderen Land (Vorst.verg. m\u00f6glich)": { + "account_number": "6302" + }, + "Fremdleistungen/Fremdarbeiten": { + "account_number": "6303" + }, + "Sonstige Aufwendungen betrieblich und regelm\u00e4\u00dfig": { + "account_number": "6304" + }, + "Raumkosten": { + "account_number": "6305" + }, + "Miete (unbewegliche Wirtschaftsg\u00fcter)": { + "account_number": "6310" + }, + "Miete/Aufwendungen f. doppelte Haushaltsf\u00fchrung": { + "account_number": "6312" + }, + "Pacht (unbewegliche Wirtschaftsg\u00fcter)": { + "account_number": "6315" + }, + "Leasing (unbewegliche Wirtschaftsg\u00fcter)": { + "account_number": "6316" + }, + "Aufwendungen f. gemietete oder gepachtete unbewegliche Wirtschaftsg., die GewSt hinzuzurechnen sind": { + "account_number": "6317" + }, + "Miet- und Pachtnebenkosten (GewSt nicht zu ber\u00fccksichtigen)": { + "account_number": "6318" + }, + "Heizung": { + "account_number": "6320" + }, + "Gas, Strom, Wasser": { + "account_number": "6325" + }, + "Reinigung": { + "account_number": "6330" + }, + "Instandhaltung betrieblicher R\u00e4ume": { + "account_number": "6335" + }, + "Abgaben f. betrieblich genutzten Grundbesitz": { + "account_number": "6340" + }, + "Sonstige Raumkosten": { + "account_number": "6345" + }, + "Aufwendungen f. ein h\u00e4usliches Arbeitszimmer (abziehbarer Anteil)": { + "account_number": "6348" + }, + "Aufwendungen f. ein h\u00e4usliches Arbeitszimmer (nicht abziehbarer Anteil)": { + "account_number": "6349" + }, + "Grundst\u00fccksaufwendungen betrieblich": { + "account_number": "6350" + }, + "Grundst\u00fccksaufwendungen neutral": { + "account_number": "6352" + }, + "Zuwendungen, Spenden (Gruppe)": { + "is_group": 1, + "Zuwendungen, Spenden, steuerlich nicht abziehbar": { + "account_number": "6390" + }, + "Zuwendungen, Spenden f. wissenschaftliche und kulturelle Zwecke": { + "account_number": "6391" + }, + "Zuwendungen, Spenden f. mildt\u00e4tige Zwecke": { + "account_number": "6392" + }, + "Zuwendungen, Spenden f. kirchliche, religi\u00f6se und gemeinn\u00fctzige Zwecke": { + "account_number": "6393" + }, + "Zuwendungen, Spenden an politische Parteien": { + "account_number": "6394" + }, + "Zuwendungen, Spenden an Stiftungen f. gemeinn\u00fctzige Zwecke i. S. d. \u00a7 52 Abs. 2 Nr. 1-3 AO": { + "account_number": "6395" + }, + "Zuwendungen, Spenden an Stiftungen f. gemeinn\u00fctzige Zwecke i. S. d. \u00a7 52 Abs. 2 Nr. 4 AO": { + "account_number": "6396" + }, + "Zuwendungen, Spenden an Stiftungen f. kirchliche, religi\u00f6se und gemeinn\u00fctzige Zwecke": { + "account_number": "6397" + }, + "Zuwendungen, Spenden an Stiftungen f.wissenschaftliche, mildt\u00e4tige und kulturelle Zwecke": { + "account_number": "6398" + } + }, + "Versicherungen (Gruppe)": { + "is_group": 1, + "Versicherungen": { + "account_number": "6400" + }, + "Versicherungen f. Geb\u00e4ude, die zum Betriebsverm\u00f6gen geh\u00f6ren": { + "account_number": "6405" + }, + "Netto-Pr\u00e4mie f. R\u00fcckdeckung k\u00fcnftiger Versorgungsleistungen": { + "account_number": "6410" + }, + "Beitr\u00e4ge": { + "account_number": "6420" + }, + "Sonstige Abgaben": { + "account_number": "6430" + }, + "Steuerlich abzugsf\u00e4hige Versp\u00e4tungszuschl\u00e4ge und Zwangsgelder": { + "account_number": "6436" + }, + "Steuerlich nicht abzugsf\u00e4hige Versp\u00e4tungszuschl\u00e4ge und Zwangsgelder": { + "account_number": "6437" + }, + "Ausgleichsabgabe i. S. d. Schwerbehindertengesetzes": { + "account_number": "6440" + }, + "Reparaturen und Instandhaltung von Bauten": { + "account_number": "6450" + }, + "Reparaturen und Instandhaltung von technischenAnlagen und Maschinen": { + "account_number": "6460" + }, + "Reparaturen und Instandhaltung von anderen Anlagen und Betriebs- und Gesch\u00e4ftsausstattung": { + "account_number": "6470" + }, + "Zuf\u00fchrung zu Aufwandsr\u00fcckstellungen": { + "account_number": "6475" + }, + "Reparaturen und Instandhaltung von anderen Anlagen": { + "account_number": "6485" + }, + "Sonstige Reparaturen und Instandhaltungen": { + "account_number": "6490" + }, + "Wartungskosten f. Hard- und Software": { + "account_number": "6495" + }, + "Mietleasing (bewegliche Wirtschaftsg\u00fcter)": { + "account_number": "6498" + } + }, + "Fahrzeugkosten (Gruppe)": { + "is_group": 1, + "Fahrzeugkosten": { + "account_number": "6500" + }, + "Kfz-Versicherungen (Gruppe)": { + "is_group": 1, + "Kfz-Versicherungen": { + "account_number": "6520" + } + }, + "Laufende Kfz-Betriebskosten (Gruppe)": { + "is_group": 1, + "Laufende Kfz-Betriebskosten": { + "account_number": "6530" + } + }, + "Kfz-Reparaturen (Gruppe)": { + "is_group": 1, + "Kfz-Reparaturen": { + "account_number": "6540" + } + }, + "Garagenmiete (Gruppe)": { + "is_group": 1, + "Garagenmiete": { + "account_number": "6550" + } + }, + "Mietleasing Kfz (Gruppe)": { + "is_group": 1, + "Mietleasing Kfz": { + "account_number": "6560" + } + }, + "Sonstige Kfz-Kosten (Gruppe)": { + "is_group": 1, + "Sonstige Kfz-Kosten": { + "account_number": "6570" + } + }, + "Mautgeb\u00fchren (Gruppe)": { + "is_group": 1, + "Mautgeb\u00fchren": { + "account_number": "6580" + } + }, + "Kfz-Kosten f. betrieblich genutzte zum Privatverm\u00f6gen geh\u00f6rende Kraftfahrzeuge": { + "account_number": "6590" + }, + "Fremdfahrzeugkosten": { + "account_number": "6595" + } + }, + "Werbekosten (Gruppe)": { + "is_group": 1, + "Werbekosten": { + "account_number": "6600" + }, + "Streuartikel": { + "account_number": "6605" + }, + "Geschenke abzugsf\u00e4hig ohne \u00a7 37b EStG": { + "account_number": "6610" + }, + "Geschenke abzugsf\u00e4hig mit \u00a7 37b EStG": { + "account_number": "6611" + }, + "Pauschale Steuern f. Geschenke und Zugaben abzugsf\u00e4hig": { + "account_number": "6612" + }, + "Geschenke nicht abzugsf\u00e4hig ohne \u00a7 37b EStG": { + "account_number": "6620" + }, + "Geschenke nicht abzugsf\u00e4hig mit \u00a7 37b EStG": { + "account_number": "6621" + }, + "Pauschale Steuern f. Geschenke und Zuwendungen nicht abzugsf\u00e4hig": { + "account_number": "6622" + }, + "Geschenke ausschlie\u00dflich betrieblich genutzt": { + "account_number": "6625" + }, + "Zugaben mit \u00a7 37b EStG": { + "account_number": "6629" + }, + "Repr\u00e4sentationskosten": { + "account_number": "6630" + }, + "Bewirtungskosten": { + "account_number": "6640" + }, + "Sonstige eingeschr\u00e4nkt abziehbare Betriebsausgaben (abziehbarer Anteil)": { + "account_number": "6641" + }, + "Sonstige eingeschr\u00e4nkt abziehbare Betriebsausgaben (nicht abziehbarer Anteil)": { + "account_number": "6642" + }, + "Aufmerksamkeiten": { + "account_number": "6643" + }, + "Nicht abzugsf\u00e4hige Bewirtungskosten": { + "account_number": "6644" + }, + "Nicht abzugsf\u00e4hige Betriebsausgaben aus Werbe- und Repr\u00e4sentationskosten": { + "account_number": "6645" + }, + "Reisekosten Arbeitnehmer": { + "account_number": "6650" + }, + "Reisekosten Arbeitnehmer \u00dcbernachtungsaufwand": { + "account_number": "6660" + }, + "Reisekosten Arbeitnehmer Fahrtkosten": { + "account_number": "6663" + }, + "Reisekosten Arbeitnehmer Verpflegungsmehraufwand": { + "account_number": "6664" + }, + "Kilometergelderstattung Arbeitnehmer": { + "account_number": "6668" + }, + "Reisekosten Unternehmer (Gruppe)": { + "is_group": 1, + "Reisekosten Unternehmer": { + "account_number": "6670" + }, + "Reisekosten Unternehmer (nicht abziehbarer Anteil)": { + "account_number": "6672" + }, + "Reisekosten Unternehmer Fahrtkosten": { + "account_number": "6673" + }, + "Reisekosten Unternehmer Verpflegungsmehraufwand": { + "account_number": "6674" + }, + "Reisekosten Unternehmer \u00dcbernachtungsaufwand": { + "account_number": "6680" + } + }, + "Fahrten zwischen Wohnung und Betriebsst\u00e4tte und Familienheimfahrten (abziehbarer Anteil)": { + "account_number": "6688" + }, + "Fahrten zwischen Wohnung und Betriebsst\u00e4tte und Familienheimfahrten (nicht abziehbarer Anteil)": { + "account_number": "6689" + }, + "Fahrten zwischen Wohnung und Betriebsst\u00e4tte und Familienheimfahrten (Haben)": { + "account_number": "6690" + }, + "Verpflegungsmehraufwendungen i. R. d. doppelten Haushaltsf\u00fchrung (abziehbarer Anteil)": { + "account_number": "6691" + } + }, + "Kosten Warenabgabe (Gruppe)": { + "is_group": 1, + "Kosten Warenabgabe": { + "account_number": "6700" + }, + "Verpackungsmaterial": { + "account_number": "6710" + }, + "Ausgangsfrachten": { + "account_number": "6740" + }, + "Transportversicherungen": { + "account_number": "6760" + }, + "Verkaufsprovisionen": { + "account_number": "6770" + }, + "Fremdarbeiten (Vertrieb)": { + "account_number": "6780" + }, + "Aufwand f. Gew\u00e4hrleistungen": { + "account_number": "6790" + } + }, + "Porto": { + "account_number": "6800" + }, + "Telefon": { + "account_number": "6805" + }, + "Telefax und Internetkosten": { + "account_number": "6810" + }, + "B\u00fcrobedarf": { + "account_number": "6815" + }, + "Zeitschriften, B\u00fccher": { + "account_number": "6820" + }, + "Fortbildungskosten": { + "account_number": "6821" + }, + "Freiwillige Sozialleistungen": { + "account_number": "6822" + }, + "Rechts- und Beratungskosten": { + "account_number": "6825" + }, + "Abschluss- und Pr\u00fcfungskosten": { + "account_number": "6827" + }, + "Buchf\u00fchrungskosten": { + "account_number": "6830" + }, + "Mieten f. Einrichtungen (bewegliche Wirtschaftsg\u00fcter)": { + "account_number": "6835" + }, + "Pacht (bewegliche Wirtschaftsg\u00fcter)": { + "account_number": "6836" + }, + "Aufwendungen f. die zeitlich befristete \u00dcberlassung von Rechten (Lizenzen, Konzessionen)": { + "account_number": "6837" + }, + "Aufwendungen f. gemietete oder gepachtete bewegliche Wirtschaftsg., die gewerbest. hinzuzurechnen sind": { + "account_number": "6838" + }, + "Werkzeuge und Kleinger\u00e4te": { + "account_number": "6845" + }, + "Betriebsbedarf": { + "account_number": "6850" + }, + "Nebenkosten des Geldverkehrs": { + "account_number": "6855" + }, + "Aufwendungen aus Anteilen an inl\u00e4ndischen Kap.Ges.": { + "account_number": "6856" + }, + "Ver\u00e4u\u00dferungskosten \u00a7 3 Nr. 40 EStG/\u00a7 8b Abs. 2 KStG (inl. Kap.Ges.)": { + "account_number": "6857" + }, + "Aufwendungen f. Abraum- und Abfallbeseitigung": { + "account_number": "6859" + }, + "Nicht abziehbare Vorsteuer 19 %": { + "account_number": "6871" + }, + "Aufwendungen aus der W\u00e4hrungsumrechnung": { + "account_number": "6880" + }, + "Aufwendungen aus Bewertung Finanzmittelfonds": { + "account_number": "6883" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen steuerfrei \u00a7 4 Nr. 1a UStG (bei Buchverlust)": { + "account_number": "6884" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen 19 % USt (bei Buchverlust)": { + "account_number": "6885" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen steuerfrei \u00a7 4 Nr. 1b UStG (bei Buchverlust)": { + "account_number": "6888" + }, + "Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen (bei Buchverlust)": { + "account_number": "6889" + }, + "Erl\u00f6se aus Verk\u00e4ufen immaterieller VG (bei Buchverlust)": { + "account_number": "6890" + }, + "Erl\u00f6se aus Verk\u00e4ufen Finanzanlagen (bei Buchverlust)": { + "account_number": "6891" + }, + "Erl\u00f6se aus Verk\u00e4ufen Finanzanlagen (inl. Kap.Ges., bei Buchverlust)": { + "account_number": "6892" + }, + "Anlagenabg\u00e4nge Sachanlagen (Restbuchwert bei Buchverlust)": { + "account_number": "6895" + }, + "Anlagenabg\u00e4nge immaterielle VG (Restbuchwert bei Buchverlust)": { + "account_number": "6896" + }, + "Anlagenabg\u00e4nge Finanzanlagen (Restbuchwert bei Buchverlust)": { + "account_number": "6897" + }, + "Anlagenabg\u00e4nge Finanzanlagen (inl. Kap.Ges., Restbuchwert bei Buchverlust)": { + "account_number": "6898" + }, + "Verluste aus dem Abgang von Gegenst\u00e4nden des Anlageverm\u00f6gens": { + "account_number": "6900" + }, + "Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kap.Ges. (Finanzanlageverm\u00f6gen, inl. Kap.Ges.)": { + "account_number": "6903" + }, + "Verluste aus dem Abgang von Ggenst\u00e4nden des Umlaufverm. (au\u00dfer Vorr\u00e4te)": { + "account_number": "6905" + }, + "Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm. (au\u00dfer Vorr\u00e4te, inl. Kap.Ges.)": { + "account_number": "6906" + }, + "Abschreibungen auf Umlaufverm\u00f6gen au\u00dfer Vorr\u00e4te und Wertpapiere (\u00fcbliche H\u00f6he)": { + "account_number": "6910", + "account_type": "Round Off" + }, + "Abschreibungen auf Umlaufverm\u00f6gen, steuerrechtlich bedingt (\u00fcbliche H\u00f6he)": { + "account_number": "6912" + }, + "Einstellung in die Pauschalwertberichtigung auf Forderungen": { + "account_number": "6920" + }, + "Einstellungen in die steuerliche R\u00fccklage nach \u00a7 6b Abs. 3 EStG": { + "account_number": "6922" + }, + "Einstellung in die Einzelwertberichtigung auf Forderungen": { + "account_number": "6923" + }, + "Einstellungen in die steuerliche R\u00fccklage nach \u00a7 6b Abs. 10 EStG": { + "account_number": "6924" + }, + "Einstellungen in steuerliche R\u00fccklagen": { + "account_number": "6927" + }, + "Einstellungen in die R\u00fccklage f. Ersatzbeschaffung nach R 6.6 EStR": { + "account_number": "6928" + }, + "Einstellungen in die steuerliche R\u00fccklage nach \u00a7 4g EStG": { + "account_number": "6929" + }, + "Forderungsverluste (\u00fcbliche H\u00f6he) (Gruppe)": { + "is_group": 1, + "Forderungsverluste (\u00fcbliche H\u00f6he)": { + "account_number": "6930" + }, + "Forderungsverluste 7 % USt (\u00fcbliche H\u00f6he)": { + "account_number": "6931" + }, + "Forderungsverluste aus steuerfreien EU-Lieferungen (\u00fcbliche H\u00f6he)": { + "account_number": "6932" + }, + "Forderungsverluste aus im Inland steuerpfl. EU-Lieferungen 7 % USt (\u00fcbliche H\u00f6he)": { + "account_number": "6933" + }, + "Forderungsverluste aus im Inland steuerpfl. EU-Lieferungen 16 % USt (\u00fcbliche H\u00f6he)": { + "account_number": "6934" + }, + "Forderungsverluste 16% USt (\u00fcbliche H\u00f6he)": { + "account_number": "6935" + }, + "Forderungsverluste 19 % USt (\u00fcbliche H\u00f6he)": { + "account_number": "6936" + }, + "Forderungsverluste 15% USt (\u00fcbliche H\u00f6he)": { + "account_number": "6937" + }, + "Forderungsverluste aus im Inland steuerpfl. EU-Lieferungen 19 % USt (\u00fcbliche H\u00f6he)": { + "account_number": "6938" + }, + "Forderungsverluste aus im Inland steuerpfl. EU-Lieferungen 15% USt (\u00fcbliche H\u00f6he)": { + "account_number": "6939" + } + }, + "Periodenfremde Aufwendungen (soweit nicht au\u00dferordentlich)": { + "account_number": "6960" + }, + "Sonstige Aufwendungen betriebsfremd und regelm\u00e4\u00dfig": { + "account_number": "6967" + }, + "Sonstige Aufwendungen unregelm\u00e4\u00dfig": { + "account_number": "6969" + }, + "Au\u00dferordentliche Aufwendungen (Gruppe)": { + "is_group": 1, + "Au\u00dferordentliche Aufwendungen": { + "account_number": "7500" + }, + "Au\u00dferordentliche Aufwendungen finanzwirksam": { + "account_number": "7501" + }, + "Au\u00dferordentliche Aufwendungen nicht finanzwirksam": { + "account_number": "7550" + }, + "Verluste durch Verschmelzung und Umwandlung": { + "account_number": "7551" + }, + "Verluste durch au\u00dfergew\u00f6hnliche Schadensf\u00e4lle": { + "account_number": "7552" + }, + "Aufwendungen f. Restrukturierungs- und Sanierungsma\u00dfnahmen": { + "account_number": "7553" + }, + "Verluste aus Gesch\u00e4ftsaufgabe oder -ver\u00e4u\u00dferung nach Steuern": { + "account_number": "7554" + }, + "Au\u00dferordentliche Aufwendungen aus der Anwendung von \u00dcbergangsvorschriften (Gruppe)": { + "is_group": 1, + "Au\u00dferordentliche Aufwendungen aus der Anwendung von \u00dcbergangsvorschriften": { + "account_number": "7560" + }, + "Au\u00dferordentliche Aufwendungen aus der Anwendung von \u00dcbergangsvorschriften (Pensionsr\u00fcckst.)": { + "account_number": "7561" + }, + "Au\u00dferordentliche Aufwendungen aus der Anwendung von \u00dcbergangsvorschriften (Bilanzierungshilfen)": { + "account_number": "7562" + }, + "Au\u00dferordentliche Aufwendungen aus der Anwendung von \u00dcbergangsvorschriften (Latente Steuern)": { + "account_number": "7563" + } + } + } + }, + "8 - Ertr\u00e4ge aus Beteiligungen": { + "root_type": "Income", + "is_group": 1, + "Ertr\u00e4ge aus Beteiligungen": { + "account_number": "7000", + "account_type": "Income Account" + }, + "Ertr\u00e4ge aus Beteiligungen an Personengesellschaften (verb. Unternehmen), \u00a7 9 GewStG": { + "account_number": "7004" + }, + "Ertr\u00e4ge aus Anteilen an Kap.Ges. (inl\u00e4ndische Beteiligung)": { + "account_number": "7005" + }, + "Ertr\u00e4ge aus Anteilen an Kap.Ges. (inl\u00e4ndische verb. Unternehmen)": { + "account_number": "7006" + }, + "Sonstige GewSt-freie Gewinne aus Anteilen an einer Kap.Ges. (K\u00fcrzung gem. \u00a7 9 Nr. 2a GewStG)": { + "account_number": "7007" + }, + "Gewinnanteile aus Mitunternehmerschaften \u00a7 9 GewStG": { + "account_number": "7008" + }, + "Ertr\u00e4ge aus Beteiligungen an verbundenen Unternehmen": { + "account_number": "7009" + }, + "Zins- und Dividendenertr\u00e4ge": { + "account_number": "7020" + }, + "Erhaltene Ausgleichszahlungen (als au\u00dfenstehender Aktion\u00e4r)": { + "account_number": "7030" + } + }, + "9 - Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": { + "root_type": "Income", + "is_group": 1, + "Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": { + "account_number": "7010", + "account_type": "Income Account" + }, + "Ertr\u00e4ge aus Ausleihungen des Finanzanlageverm\u00f6gens": { + "account_number": "7011" + }, + "Ertr\u00e4ge aus Ausleihungen des Finanzanlageverm\u00f6gens an verbundenen Unternehmen": { + "account_number": "7012" + }, + "Ertr\u00e4ge aus Anteilen an Personengesellschaften (Finanzanlageverm\u00f6gen)": { + "account_number": "7013" + }, + "Ertr\u00e4ge aus Anteilen an Kap.Ges. (Finanzanlageverm\u00f6gen, inl\u00e4ndische Kap.Ges.)": { + "account_number": "7014" + }, + "Ertr\u00e4ge aus Anteilen an Personengesellschaften (verb. Unternehmen)": { + "account_number": "7016" + }, + "Ertr\u00e4ge aus anderen Wertpapieren des Finanzanlageverm. an Kap.Ges. (verb. Unternehmen)": { + "account_number": "7017" + }, + "Ertr\u00e4ge aus anderen Wertpapieren des Finanzanlageverm. an Pers.Ges. (verb. Unternehmen)": { + "account_number": "7018" + }, + "Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm. aus verbundenen Unternehmen": { + "account_number": "7019" + } + }, + "10 - sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge": { + "root_type": "Income", + "is_group": 1, + "davon aus verbundenen Unternehmen": { + "is_group": 1, + "Diskontertr\u00e4ge aus verbundenen Unternehmen": { + "account_number": "7139" + }, + "Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge aus verbundenen Unternehmen": { + "account_number": "7109" + }, + "Sonstige Zinsertr\u00e4ge aus verbundenen Unternehmen": { + "account_number": "7119", + "account_type": "Income Account" + }, + "Zins\u00e4hnliche Ertr\u00e4ge aus verbundenen Unternehmen": { + "account_number": "7129" + } + }, + "Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge": { + "account_number": "7100", + "account_type": "Income Account" + }, + "Ertr\u00e4ge aus Anteilen an Kap.Ges. (Umlaufverm\u00f6gen, inl\u00e4ndische Kap.Ges.)": { + "account_number": "7103" + }, + "Zinsertr\u00e4ge \u00a7 233a AO steuerpflichtig": { + "account_number": "7105" + }, + "Zinsertr\u00e4ge \u00a7 233a AO, \u00a7 4 Abs. 5b EStG, steuerfrei": { + "account_number": "7107" + }, + "Sonstige Zinsertr\u00e4ge": { + "account_number": "7110" + }, + "Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Umlaufverm.": { + "account_number": "7115" + }, + "Zins\u00e4hnliche Ertr\u00e4ge": { + "account_number": "7120" + }, + "Diskontertr\u00e4ge": { + "account_number": "7130" + }, + "Zinsertr\u00e4ge aus der Abzinsung von Verb.": { + "account_number": "7141" + }, + "Zinsertr\u00e4ge aus der Abzinsung von R\u00fcckstellungen": { + "account_number": "7142" + }, + "Zinsertr\u00e4ge aus der Abzinsung von Pensionsr\u00fcckst. und \u00e4hnl./vergleichb. Verplicht.": { + "account_number": "7143" + }, + "Zinsertr\u00e4ge aus der Abzinsung von Pensionsr\u00fcckst. und \u00e4hnl. Verplicht. zur Verrechnung": { + "account_number": "7144" + }, + "Erhaltene Gewinne auf Grund einer Gewinngemeinschaft": { + "account_number": "7192" + }, + "Erhaltene Gewinne auf Grund einer Gewinn- oder Teilgewinnabf\u00fchrungsvertrags": { + "account_number": "7194" + } + }, + "11 - Abschreibungen auf Finanzanlagen und auf Wertpapiere des Umlaufverm.": { + "root_type": "Expense", + "is_group": 1, + "Abschreibungen auf Finanzanlagen (dauerhaft)": { + "account_number": "7200", + "account_type": "Depreciation" + }, + "Abschreibungen auf Finanzanlagen (nicht dauerhaft)": { + "account_number": "7201" + }, + "Abschreibungen auf Finanzanlagen \u00a7 3 Nr. 40 EStG / \u00a7 8b Abs. 3 KStG (inl. Kap.Ges., dauerh.)": { + "account_number": "7204" + }, + "Abschreibungen auf Finanzanlagen - verb. Unternehmen": { + "account_number": "7207" + }, + "Aufwendungen auf Grund von Verlustanteilen an Mitunternehmerschaften \u00a7 8 GewStG": { + "account_number": "7208" + }, + "Abschreibungen auf Wertpapiere des Umlaufverm. (Gruppe)": { + "is_group": 1, + "Abschreibungen auf Wertpapiere des Umlaufverm.": { + "account_number": "7210" + }, + "Abschreibungen auf Wertpapiere des Umlaufverm. \u00a73Nr.40EStG/\u00a78bAbs.3KStG (inl. Kap.Ges.)": { + "account_number": "7214" + }, + "Abschreibungen auf Wertpapiere des Umlaufverm. - verb. Unternehmen": { + "account_number": "7217" + } + }, + "Abschreibungen auf Finanzanlagen auf Grund \u00a7 6b EStG-R\u00fccklage": { + "account_number": "7250" + }, + "Abschreibungen auf Finanzanlagen auf Grund \u00a7 3Nr.40EStG/\u00a78bAbs.3KStG (inl. Kap.Ges.)": { + "account_number": "7255" + } + }, + "12- Zinsen und \u00e4hnliche Aufwendungen": { + "root_type": "Expense", + "is_group": 1, + "davon an verb. Unternehmen": { + "is_group": 1, + "Zinsen und \u00e4hnliche Aufwendungen an verb. Unternehmen (inl. Kap.Ges.)": { + "account_number": "7351" + }, + "Zinsen und \u00e4hnliche Aufwendungen an verb. Unternehmen": { + "account_number": "7309" + }, + "Zinsaufwendungen f. kurzfistige Verb. an verb. Unternehmen": { + "account_number": "7319" + }, + "Zinsaufwendungen f. langfristigeVerb. an verb. Unternehmen": { + "account_number": "7329" + }, + "Diskontaufwendungen an verb. Unternehmen": { + "account_number": "7349" + } + }, + "Zinsen und \u00e4hnliche Aufwendungen": { + "account_number": "7300" + }, + "Steuerlich nicht abzugsf\u00e4hige andere Nebenleistungen zu Steuern \u00a7 4 Abs. 5b EStG": { + "account_number": "7302" + }, + "Steuerlich abzugsf\u00e4hige, andere Nebenleistungen zu Steuern": { + "account_number": "7303" + }, + "Steuerlich nicht abzugsf\u00e4hige, andere Nebenleistungen zu Steuern": { + "account_number": "7304" + }, + "Zinsaufwendungen \u00a7 233a AO betriebliche Steuern": { + "account_number": "7305" + }, + "Zinsaufwendungen \u00a7\u00a7 233a bis 237 AO Personensteuern": { + "account_number": "7306" + }, + "Zinsaufwendungen \u00a7 233a AO, \u00a7 4 Abs. 5b EStG": { + "account_number": "7308" + }, + "Zinsaufwendungen f. kurzfristige Verb.": { + "account_number": "7310" + }, + "Nicht abzugsf\u00e4hige Schuldzinsen gem\u00e4\u00df \u00a7 4 Abs. 4a EStG (Hinzurechnungsbetrag)": { + "account_number": "7313" + }, + "Zinsen auf Kontokorrentkonten": { + "account_number": "7318" + }, + "Zinsaufwendungen f. langfristige Verb.": { + "account_number": "7320" + }, + "Abschreibungen auf Disagio/Damnum zur Finanzierung": { + "account_number": "7323" + }, + "Abschreibungen auf Disagio/Damnum zur Finanzierung des Anlageverm\u00f6gens": { + "account_number": "7324" + }, + "Zinsaufwendungen f. Geb\u00e4ude, die zum Betriebsverm\u00f6gen geh\u00f6ren": { + "account_number": "7325" + }, + "Zinsen zur Finanzierung des Anlageverm\u00f6gens": { + "account_number": "7326" + }, + "Renten und dauernde Lasten": { + "account_number": "7327" + }, + "Zins\u00e4hnliche Aufwendungen": { + "account_number": "7330" + }, + "Diskontaufwendungen": { + "account_number": "7340" + }, + "Zinsen und \u00e4hnl. Aufwendungen \u00a7\u00a73Nr.40,3cEStG/\u00a78bAbs.1KStG (inl. Kap.Ges.)": { + "account_number": "7350" + }, + "Kreditprovisionen und Verwaltungskostenbeitr\u00e4ge": { + "account_number": "7355" + }, + "Zinsanteil der Zuf\u00fchrungen zu Pensionsr\u00fcckst.": { + "account_number": "7360" + }, + "Zinsaufwendungen aus der Abzinsung von Verb.": { + "account_number": "7361" + }, + "Zinsaufwendungen aus der Abzinsung von R\u00fcckstellungen": { + "account_number": "7362" + }, + "Zinsaufwendungen aus der Abzinsung von Pensionsr\u00fcckst. und \u00e4hnl. Verplicht.": { + "account_number": "7363" + }, + "Zinsaufwendungen aus der Abzinsung von Pensionsr\u00fcckst. und \u00e4hnl. Verplicht. zur Verrechnung": { + "account_number": "7364" + }, + "Aufwendungen aus Verlust\u00fcbernahme": { + "account_number": "7390" + } + }, + "13 - Steuern vom Einkommen und vom Ertrag": { + "root_type": "Expense", + "is_group": 1, + "K\u00f6rperschaftsteuer": { + "account_number": "7600", + "account_type": "Tax" + }, + "Gewerbesteuer": { + "account_number": "7610", + "account_type": "Tax" + }, + "Kapitalertragsteuer 25 %": { + "account_number": "7630" + }, + "Anrechenbarer Solidarit\u00e4tszuschlag auf Kapitalertragsteuer 25 %": { + "account_number": "7633" + }, + "Anzurechnende ausl\u00e4ndische Quellensteuer": { + "account_number": "7639" + }, + "Gewerbesteuernachzahlungen Vorjahre": { + "account_number": "7640" + }, + "Gewerbesteuernachzahlungen und Gewerbesteuererstattungen f. Vorjahre, \u00a7 4 Abs. 5b EStG": { + "account_number": "7641" + }, + "Gewerbesteuererstattungen Vorjahre": { + "account_number": "7642" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung von Gewerbesteuerr\u00fcckstellungen, \u00a7 4 Abs. 5b EStG": { + "account_number": "7643" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung von Gewerbesteuerr\u00fcckstellungen": { + "account_number": "7644" + }, + "Aufwendungen aus der Zuf\u00fchrung und Aufl\u00f6sung von latenten Steuern": { + "account_number": "7645" + }, + "Ertr\u00e4ge aus der Zuf\u00fchrung und Aufl\u00f6sung von latenten Steuern": { + "account_number": "7649" + } + }, + "15 - sonstige Steuern": { + "root_type": "Expense", + "is_group": 1, + "Verbrauchsteuer": { + "account_number": "7675" + }, + "\u00d6kosteuer": { + "account_number": "7678" + }, + "Grundsteuer": { + "account_number": "7680" + }, + "Kfz-Steuer": { + "account_number": "7685" + }, + "Steuernachzahlungen Vorjahre f. sonstige Steuern": { + "account_number": "7690" + }, + "Steuererstattungen Vorjahre f. sonstige Steuern": { + "account_number": "7692" + }, + "Ertr\u00e4ge aus der Aufl\u00f6sung von R\u00fcckstellungen f. sonstige Steuern": { + "account_number": "7694" + } + }, + "Debitoren" : { + "root_type": "Asset", + "is_group": 1 + }, + "Kreditoren" : { + "root_type": "Liability", + "is_group": 1 + } + } +} From 00303858df2729078b201f19160bd28dba947baa Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Fri, 19 Apr 2019 00:09:37 +0200 Subject: [PATCH 18/59] fix missing account types --- ..._kontenplan_SKR04_with_account_number.json | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json b/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json index b0f06911cd3..b042bcc4204 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04_with_account_number.json @@ -795,6 +795,7 @@ }, "Kasse (Gruppe)": { "is_group": 1, + "account_type": "Cash", "Kasse": { "account_number": "1600", "account_type": "Cash" @@ -840,6 +841,7 @@ }, "Bank (Gruppe)": { "is_group": 1, + "account_type": "Bank", "Bank": { "account_number": "1800", "account_type": "Bank" @@ -1822,9 +1824,14 @@ "2 - Herstellungskosten der zur Erzielung der Umsatzerl\u00f6se erbrachten Leistungen": { "root_type": "Expense", "is_group": 1, - "Herstellungskosten": { - "account_number": "6990", - "account_type": "Cost of Goods Sold" + "Herstellungskosten (Gruppe)": { + "Herstellungskosten": { + "account_number": "6990", + "account_type": "Cost of Goods Sold" + }, + "Herstellungskosten: Schwund": { + "account_type": "Stock Adjustment" + } }, "Aufwendungen f. Roh-, Hilfs- und Betriebsstoffe und f. bezogene Waren": { "account_number": "5000", @@ -3603,13 +3610,17 @@ "account_number": "7694" } }, - "Debitoren" : { + "Debitoren": { "root_type": "Asset", "is_group": 1 }, - "Kreditoren" : { + "Kreditoren": { "root_type": "Liability", - "is_group": 1 + "is_group": 1, + "Wareneingangs-­Verrechnungskonto" : { + "account_number": "70001", + "account_type": "Stock Received But Not Billed" + } } } } From 613d82e12f734aa8f06d3a9093dad9f15cc77301 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 19 Apr 2019 16:28:19 +0530 Subject: [PATCH 19/59] fix: received qty in the purchase order item showing incorrect if user has returned the rejected quantity --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index eb821023568..7f03fdca36f 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -31,7 +31,7 @@ class PurchaseReceipt(BuyingController): 'target_parent_dt': 'Purchase Order', 'target_parent_field': 'per_received', 'target_ref_field': 'qty', - 'source_field': 'qty', + 'source_field': 'received_qty', 'percent_join_field': 'purchase_order', 'overflow_type': 'receipt' }, From 4a9127f9a66aa5b3245b8262ae7f3c7d53a608cb Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Mon, 22 Apr 2019 03:46:25 +0200 Subject: [PATCH 20/59] feat(accounts): validate IBAN --- .../doctype/bank_account/bank_account.py | 24 ++++++++++++++ .../doctype/bank_account/test_bank_account.py | 33 ++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 3c679fa215a..06393e7a54e 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -21,11 +21,35 @@ class BankAccount(Document): def validate(self): self.validate_company() + self.validate_iban() def validate_company(self): if self.is_company_account and not self.company: frappe.throw(_("Company is manadatory for company account")) + def validate_iban(self): + ''' + Algorithm: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN + ''' + def encode_char(c): + # Position in the alphabet (A=1, B=2, ...) plus nine + return str(9 + ord(c) - 64) + + # remove whitespaces, upper case to get the right number from ord() + iban = ''.join(self.iban.split(' ')).upper() + + # Move country code and checksum from the start to the end + flipped = iban[4:] + iban[:4] + + # Encode characters as numbers + encoded = [encode_char(c) if ord(c) >= 65 and ord(c) <= 90 else c for c in flipped] + + to_check = int(''.join(encoded)) + + if to_check % 97 != 1: + frappe.throw(_('IBAN is not valid')) + + @frappe.whitelist() def make_bank_account(doctype, docname): doc = frappe.new_doc("Bank Account") diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index 43a3298ec4a..8e1a91bc45f 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -4,9 +4,40 @@ from __future__ import unicode_literals import frappe +from frappe import _ +from frappe import ValidationError import unittest # test_records = frappe.get_test_records('Bank Account') class TestBankAccount(unittest.TestCase): - pass + + def test_validate_iban(self): + valid_ibans = [ + 'GB82 WEST 1234 5698 7654 32', + 'DE91 1000 0000 0123 4567 89', + 'FR76 3000 6000 0112 3456 7890 189' + ] + + invalid_ibans = [ + # wrong checksum (3rd place) + 'GB72 WEST 1234 5698 7654 32', + 'DE81 1000 0000 0123 4567 89', + 'FR66 3000 6000 0112 3456 7890 189' + ] + + bank_account = frappe.get_doc({'doctype':'Bank Account'}) + + for iban in valid_ibans: + bank_account.iban = iban + try: + bank_account.validate_iban() + except ValidationError: + msg = _('BankAccount.validate_iban() failed for valid IBAN {}'.format(iban)) + self.fail(msg=msg) + + for not_iban in invalid_ibans: + bank_account.iban = not_iban + msg = _('BankAccount.validate_iban() accepted invalid IBAN {}'.format(iban)) + with self.assertRaises(ValidationError, msg=msg): + bank_account.validate_iban() From 49f919a4fcf7b4d7b372416fd48d1892e8812203 Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Mon, 22 Apr 2019 05:32:35 +0200 Subject: [PATCH 21/59] fix test's error message --- erpnext/accounts/doctype/bank_account/test_bank_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index 8e1a91bc45f..bd148df33ba 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -38,6 +38,6 @@ class TestBankAccount(unittest.TestCase): for not_iban in invalid_ibans: bank_account.iban = not_iban - msg = _('BankAccount.validate_iban() accepted invalid IBAN {}'.format(iban)) + msg = _('BankAccount.validate_iban() accepted invalid IBAN {}'.format(not_iban)) with self.assertRaises(ValidationError, msg=msg): bank_account.validate_iban() From 393b12a37fa752b39414cf1686681bcb6d0815b8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Apr 2019 13:24:02 +0530 Subject: [PATCH 22/59] fix: Renamed depends_on_lwp to depends_on_payment_days --- .../additional_salary/additional_salary.py | 2 +- .../employee_benefit_application.py | 12 +- .../employee_benefit_claim.py | 2 +- .../salary_component/salary_component.js | 2 +- .../salary_component/salary_component.json | 38 ++++++- .../doctype/salary_detail/salary_detail.json | 28 ++++- erpnext/hr/doctype/salary_slip/salary_slip.js | 13 +-- erpnext/hr/doctype/salary_slip/salary_slip.py | 24 ++-- .../salary_structure/salary_structure.js | 2 +- .../salary_structure/salary_structure.py | 4 +- .../salary_slip_based_on_timesheet.json | 30 ++--- .../salary_slip_standard.json | 38 +++---- erpnext/patches.txt | 3 +- .../patches/v11_1/rename_depends_on_lwp.py | 13 +++ ...e.py => set_salary_details_submittable.py} | 2 - .../patches/v7_0/rename_salary_components.py | 106 +++++++++--------- 16 files changed, 188 insertions(+), 131 deletions(-) create mode 100644 erpnext/patches/v11_1/rename_depends_on_lwp.py rename erpnext/patches/v11_1/{set_salary_details_submitable.py => set_salary_details_submittable.py} (98%) diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py index 968a1c4571c..9ca1260fe06 100644 --- a/erpnext/hr/doctype/additional_salary/additional_salary.py +++ b/erpnext/hr/doctype/additional_salary/additional_salary.py @@ -51,7 +51,7 @@ def get_additional_salary_component(employee, start_date, end_date): for d in additional_components: component = frappe.get_doc("Salary Component", d.salary_component) struct_row = {'salary_component': d.salary_component} - for field in ["depends_on_lwp", "abbr", "is_tax_applicable", "variable_based_on_taxable_salary", "is_additional_component"]: + for field in ["depends_on_payment_days", "abbr", "is_tax_applicable", "variable_based_on_taxable_salary", "is_additional_component"]: struct_row[field] = component.get(field) additional_components_list.append({ diff --git a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py index 9b6dba5ff81..c613a13223e 100644 --- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py +++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py @@ -113,7 +113,7 @@ def get_max_benefits(employee, on_date): def get_max_benefits_remaining(employee, on_date, payroll_period): max_benefits = get_max_benefits(employee, on_date) if max_benefits and max_benefits > 0: - have_depends_on_lwp = False + have_depends_on_payment_days = False per_day_amount_total = 0 payroll_period_days = get_payroll_period_days(on_date, on_date, employee)[0] payroll_period_obj = frappe.get_doc("Payroll Period", payroll_period) @@ -122,22 +122,22 @@ def get_max_benefits_remaining(employee, on_date, payroll_period): prev_sal_slip_flexi_total = get_sal_slip_total_benefit_given(employee, payroll_period_obj) if prev_sal_slip_flexi_total > 0: - # Check salary structure hold depends_on_lwp component + # Check salary structure hold depends_on_payment_days component # If yes then find the amount per day of each component and find the sum sal_struct_name = get_assigned_salary_structure(employee, on_date) if sal_struct_name: sal_struct = frappe.get_doc("Salary Structure", sal_struct_name) for sal_struct_row in sal_struct.get("earnings"): salary_component = frappe.get_doc("Salary Component", sal_struct_row.salary_component) - if salary_component.depends_on_lwp == 1 and salary_component.pay_against_benefit_claim != 1: - have_depends_on_lwp = True + if salary_component.depends_on_payment_days == 1 and salary_component.pay_against_benefit_claim != 1: + have_depends_on_payment_days = True benefit_amount = get_benefit_pro_rata_ratio_amount(sal_struct, salary_component.max_benefit_amount) amount_per_day = benefit_amount / payroll_period_days per_day_amount_total += amount_per_day # Then the sum multiply with the no of lwp in that period # Include that amount to the prev_sal_slip_flexi_total to get the actual - if have_depends_on_lwp and per_day_amount_total > 0: + if have_depends_on_payment_days and per_day_amount_total > 0: holidays = get_holidays_for_employee(employee, payroll_period_obj.start_date, on_date) working_days = date_diff(on_date, payroll_period_obj.start_date) + 1 leave_days = calculate_lwp(employee, payroll_period_obj.start_date, holidays, working_days) @@ -185,7 +185,7 @@ def get_benefit_component_amount(employee, start_date, end_date, struct_row, sal 'payroll_period': payroll_period }) - if frappe.db.get_value("Salary Component", struct_row.salary_component, "depends_on_lwp") != 1: + if frappe.db.get_value("Salary Component", struct_row.salary_component, "depends_on_payment_days") != 1: if frequency == "Monthly" and actual_payroll_days in range(360, 370): period_length = 1 period_factor = 12 diff --git a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py index bf150b12322..8be67a866ab 100644 --- a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py +++ b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py @@ -170,7 +170,7 @@ def get_last_payroll_period_benefits(employee, sal_slip_start_date, sal_slip_end amount += current_claimed_amount struct_row = {} salary_components_dict = {} - struct_row['depends_on_lwp'] = salary_component.depends_on_lwp + struct_row['depends_on_payment_days'] = salary_component.depends_on_payment_days struct_row['salary_component'] = salary_component.name struct_row['abbr'] = salary_component.salary_component_abbr struct_row['do_not_include_in_total'] = salary_component.do_not_include_in_total diff --git a/erpnext/hr/doctype/salary_component/salary_component.js b/erpnext/hr/doctype/salary_component/salary_component.js index b33451bc35c..1d398ccd59c 100644 --- a/erpnext/hr/doctype/salary_component/salary_component.js +++ b/erpnext/hr/doctype/salary_component/salary_component.js @@ -75,5 +75,5 @@ var set_value_for_condition_and_formula = function(frm) { frm.set_value("amount_based_on_formula", 0); frm.set_value("statistical_component", 0); frm.set_value("do_not_include_in_total", 0); - frm.set_value("depends_on_lwp", 0); + frm.set_value("depends_on_payment_days", 0); }; diff --git a/erpnext/hr/doctype/salary_component/salary_component.json b/erpnext/hr/doctype/salary_component/salary_component.json index f7ce08c737a..697d224092c 100644 --- a/erpnext/hr/doctype/salary_component/salary_component.json +++ b/erpnext/hr/doctype/salary_component/salary_component.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 1, @@ -19,6 +20,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "salary_component", "fieldtype": "Data", "hidden": 0, @@ -51,6 +53,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "salary_component_abbr", "fieldtype": "Data", "hidden": 0, @@ -85,6 +88,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "type", "fieldtype": "Select", "hidden": 0, @@ -119,6 +123,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.is_flexible_benefit != 1", + "fetch_if_empty": 0, "fieldname": "is_additional_component", "fieldtype": "Check", "hidden": 0, @@ -153,6 +158,7 @@ "columns": 0, "default": "1", "depends_on": "eval:doc.type == \"Earning\"", + "fetch_if_empty": 0, "fieldname": "is_tax_applicable", "fieldtype": "Check", "hidden": 0, @@ -186,6 +192,7 @@ "collapsible": 0, "columns": 0, "default": "1", + "fetch_if_empty": 0, "fieldname": "is_payable", "fieldtype": "Check", "hidden": 0, @@ -218,7 +225,9 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "depends_on_lwp", + "default": "1", + "fetch_if_empty": 0, + "fieldname": "depends_on_payment_days", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, @@ -227,7 +236,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Depends on Leave Without Pay", + "label": "Depends on Payment Days", "length": 0, "no_copy": 0, "permlevel": 0, @@ -250,6 +259,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "do_not_include_in_total", "fieldtype": "Check", "hidden": 0, @@ -282,6 +292,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_4", "fieldtype": "Column Break", "hidden": 0, @@ -313,6 +324,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "disabled", "fieldtype": "Check", "hidden": 0, @@ -345,6 +357,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "description", "fieldtype": "Small Text", "hidden": 0, @@ -378,6 +391,7 @@ "collapsible": 0, "columns": 0, "description": "If selected, the value specified or calculated in this component will not contribute to the earnings or deductions. However, it's value can be referenced by other components that can be added or deducted. ", + "fetch_if_empty": 0, "fieldname": "statistical_component", "fieldtype": "Check", "hidden": 0, @@ -411,6 +425,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.type==\"Earning\" && doc.is_additional_component != 1 && doc.statistical_component!=1", + "fetch_if_empty": 0, "fieldname": "flexible_benefits", "fieldtype": "Section Break", "hidden": 0, @@ -444,6 +459,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.is_additional_component != 1", + "fetch_if_empty": 0, "fieldname": "is_flexible_benefit", "fieldtype": "Check", "hidden": 0, @@ -477,6 +493,7 @@ "collapsible": 0, "columns": 0, "depends_on": "is_flexible_benefit", + "fetch_if_empty": 0, "fieldname": "max_benefit_amount", "fieldtype": "Currency", "hidden": 0, @@ -509,6 +526,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_9", "fieldtype": "Column Break", "hidden": 0, @@ -541,6 +559,7 @@ "collapsible": 0, "columns": 0, "depends_on": "is_flexible_benefit", + "fetch_if_empty": 0, "fieldname": "pay_against_benefit_claim", "fieldtype": "Check", "hidden": 0, @@ -574,6 +593,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.is_flexible_benefit == 1 & doc.create_separate_payment_entry_against_benefit_claim !=1", + "fetch_if_empty": 0, "fieldname": "only_tax_impact", "fieldtype": "Check", "hidden": 0, @@ -607,6 +627,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.is_flexible_benefit == 1 & doc.only_tax_impact !=1", + "fetch_if_empty": 0, "fieldname": "create_separate_payment_entry_against_benefit_claim", "fieldtype": "Check", "hidden": 0, @@ -640,6 +661,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.type=='Deduction'", + "fetch_if_empty": 0, "fieldname": "section_break_11", "fieldtype": "Section Break", "hidden": 0, @@ -671,6 +693,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "variable_based_on_taxable_salary", "fieldtype": "Check", "hidden": 0, @@ -704,6 +727,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.statistical_component != 1", + "fetch_if_empty": 0, "fieldname": "section_break_5", "fieldtype": "Section Break", "hidden": 0, @@ -736,6 +760,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "accounts", "fieldtype": "Table", "hidden": 0, @@ -771,6 +796,7 @@ "collapsible_depends_on": "", "columns": 0, "depends_on": "eval:doc.is_flexible_benefit != 1 && doc.variable_based_on_taxable_salary != 1", + "fetch_if_empty": 0, "fieldname": "condition_and_formula", "fieldtype": "Section Break", "hidden": 0, @@ -803,6 +829,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "condition", "fieldtype": "Code", "hidden": 0, @@ -836,6 +863,7 @@ "collapsible": 0, "columns": 0, "default": "", + "fetch_if_empty": 0, "fieldname": "amount_based_on_formula", "fieldtype": "Check", "hidden": 0, @@ -869,6 +897,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.amount_based_on_formula!==0", + "fetch_if_empty": 0, "fieldname": "formula", "fieldtype": "Code", "hidden": 0, @@ -902,6 +931,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.amount_based_on_formula!==1", + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -934,6 +964,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_28", "fieldtype": "Column Break", "hidden": 0, @@ -965,6 +996,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "help", "fieldtype": "HTML", "hidden": 0, @@ -1003,7 +1035,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-09-20 16:44:58.876044", + "modified": "2019-04-16 19:08:55.323567", "modified_by": "Administrator", "module": "HR", "name": "Salary Component", diff --git a/erpnext/hr/doctype/salary_detail/salary_detail.json b/erpnext/hr/doctype/salary_detail/salary_detail.json index 0ec3cd64138..8f2649ad21b 100644 --- a/erpnext/hr/doctype/salary_detail/salary_detail.json +++ b/erpnext/hr/doctype/salary_detail/salary_detail.json @@ -19,6 +19,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "salary_component", "fieldtype": "Link", "hidden": 0, @@ -55,6 +56,7 @@ "default": "", "depends_on": "eval:doc.parenttype=='Salary Structure'", "fetch_from": "salary_component.salary_component_abbr", + "fetch_if_empty": 0, "fieldname": "abbr", "fieldtype": "Data", "hidden": 0, @@ -88,6 +90,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_3", "fieldtype": "Column Break", "hidden": 0, @@ -121,6 +124,7 @@ "columns": 0, "description": "If selected, the value specified or calculated in this component will not contribute to the earnings or deductions. However, it's value can be referenced by other components that can be added or deducted. ", "fetch_from": "salary_component.statistical_component", + "fetch_if_empty": 0, "fieldname": "statistical_component", "fieldtype": "Check", "hidden": 0, @@ -154,6 +158,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "salary_component.is_tax_applicable", + "fetch_if_empty": 0, "fieldname": "is_tax_applicable", "fieldtype": "Check", "hidden": 0, @@ -187,6 +192,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "salary_component.is_flexible_benefit", + "fetch_if_empty": 0, "fieldname": "is_flexible_benefit", "fieldtype": "Check", "hidden": 0, @@ -221,6 +227,7 @@ "columns": 0, "default": "", "fetch_from": "salary_component.is_additional_component", + "fetch_if_empty": 0, "fieldname": "is_additional_component", "fieldtype": "Check", "hidden": 1, @@ -255,6 +262,7 @@ "columns": 0, "default": "", "fetch_from": "salary_component.variable_based_on_taxable_salary", + "fetch_if_empty": 0, "fieldname": "variable_based_on_taxable_salary", "fieldtype": "Check", "hidden": 0, @@ -288,8 +296,9 @@ "collapsible": 0, "columns": 0, "depends_on": "", - "fetch_from": "salary_component.depends_on_lwp", - "fieldname": "depends_on_lwp", + "fetch_from": "salary_component.depends_on_payment_days", + "fetch_if_empty": 0, + "fieldname": "depends_on_payment_days", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, @@ -298,7 +307,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Depends on Leave Without Pay", + "label": "Depends on Payment Days", "length": 0, "no_copy": 0, "permlevel": 0, @@ -322,6 +331,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.is_flexible_benefit != 1", + "fetch_if_empty": 0, "fieldname": "section_break_2", "fieldtype": "Section Break", "hidden": 0, @@ -354,6 +364,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.parenttype=='Salary Structure'", + "fetch_if_empty": 0, "fieldname": "condition", "fieldtype": "Code", "hidden": 0, @@ -389,6 +400,7 @@ "default": "0", "depends_on": "eval:doc.parenttype=='Salary Structure'", "fetch_from": "", + "fetch_if_empty": 0, "fieldname": "amount_based_on_formula", "fieldtype": "Check", "hidden": 0, @@ -425,6 +437,7 @@ "default": "", "depends_on": "eval:doc.amount_based_on_formula!==0 && doc.parenttype==='Salary Structure'", "description": "", + "fetch_if_empty": 0, "fieldname": "formula", "fieldtype": "Code", "hidden": 0, @@ -458,6 +471,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.amount_based_on_formula!==1 || doc.parenttype==='Salary Slip'", + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -491,6 +505,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "do_not_include_in_total", "fieldtype": "Check", "hidden": 0, @@ -524,6 +539,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.parenttype=='Salary Structure'", + "fetch_if_empty": 0, "fieldname": "default_amount", "fieldtype": "Currency", "hidden": 0, @@ -558,6 +574,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.parenttype=='Salary Slip' && doc.parentfield=='deductions' && doc.variable_based_on_taxable_salary == 1", + "fetch_if_empty": 0, "fieldname": "tax_on_flexible_benefit", "fieldtype": "Currency", "hidden": 0, @@ -591,6 +608,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.parenttype=='Salary Slip' && doc.parentfield=='deductions' && doc.variable_based_on_taxable_salary == 1", + "fetch_if_empty": 0, "fieldname": "tax_on_additional_salary", "fieldtype": "Currency", "hidden": 0, @@ -624,6 +642,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.parenttype=='Salary Structure'", + "fetch_if_empty": 0, "fieldname": "section_break_11", "fieldtype": "Column Break", "hidden": 0, @@ -656,6 +675,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.parenttype=='Salary Structure'", + "fetch_if_empty": 0, "fieldname": "condition_and_formula_help", "fieldtype": "HTML", "hidden": 0, @@ -693,7 +713,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-04 14:41:56.030991", + "modified": "2019-04-16 19:09:31.726597", "modified_by": "Administrator", "module": "HR", "name": "Salary Detail", diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js index 86c50d08ba1..4e9fcce8982 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/salary_slip.js @@ -132,9 +132,6 @@ var get_emp_and_leave_details = function(doc, dt, dn) { }); } -cur_frm.cscript.employee = function(doc,dt,dn){ - get_emp_and_leave_details(doc, dt, dn); -} cur_frm.cscript.leave_without_pay = function(doc,dt,dn){ if (doc.employee && doc.start_date && doc.end_date) { @@ -160,7 +157,7 @@ cur_frm.cscript.amount = function(doc,dt,dn){ calculate_all(doc, dt, dn); } -cur_frm.cscript.depends_on_lwp = function(doc,dt,dn){ +cur_frm.cscript.depends_on_payment_days = function(doc,dt,dn){ calculate_earning_total(doc, dt, dn, true); calculate_ded_total(doc, dt, dn, true); calculate_net_pay(doc, dt, dn); @@ -174,7 +171,7 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) { var tbl = doc.earnings || []; var total_earn = 0; for(var i = 0; i < tbl.length; i++){ - if(cint(tbl[i].depends_on_lwp) == 1) { + if(cint(tbl[i].depends_on_payment_days) == 1) { tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) / cint(doc.total_working_days)*100)/100; } else if(reset_amount && tbl[i].default_amount) { @@ -196,7 +193,7 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) { var tbl = doc.deductions || []; var total_ded = 0; for(var i = 0; i < tbl.length; i++){ - if(cint(tbl[i].depends_on_lwp) == 1) { + if(cint(tbl[i].depends_on_payment_days) == 1) { tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100; } else if(reset_amount && tbl[i].default_amount) { tbl[i].amount = tbl[i].default_amount; @@ -209,16 +206,12 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) { refresh_many(['deductions', 'total_deduction']); } -// Calculate net payable amount -// ------------------------------------------------------------------------ var calculate_net_pay = function(doc, dt, dn) { doc.net_pay = flt(doc.gross_pay) - flt(doc.total_deduction); doc.rounded_total = Math.round(doc.net_pay); refresh_many(['net_pay', 'rounded_total']); } -// validate -// ------------------------------------------------------------------------ cur_frm.cscript.validate = function(doc, dt, dn) { calculate_all(doc, dt, dn); } diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 3fd266b4bba..19aaba894f1 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -131,11 +131,12 @@ class SalarySlip(TransactionBase): for d in self.get(key): if d.salary_component == struct_row.salary_component: component_row = d + if not component_row: self.append(key, { 'amount': amount, 'default_amount': amount, - 'depends_on_lwp' : struct_row.depends_on_lwp, + 'depends_on_payment_days' : struct_row.depends_on_payment_days, 'salary_component' : struct_row.salary_component, 'abbr' : struct_row.abbr, 'do_not_include_in_total' : struct_row.do_not_include_in_total, @@ -147,12 +148,11 @@ class SalarySlip(TransactionBase): 'tax_on_additional_salary': additional_tax }) else: - if overwrite: - component_row.default_amount = amount - component_row.amount = amount - else: - component_row.default_amount += amount - component_row.amount = component_row.default_amount + if not overwrite: + amount += struct_row.get("default_amount", 0) + + component_row.default_amount = amount + component_row.amount = amount component_row.tax_on_flexible_benefit = benefit_tax component_row.tax_on_additional_salary = additional_tax @@ -418,7 +418,7 @@ class SalarySlip(TransactionBase): for d in self.get(component_type): if (self.salary_structure and - cint(d.depends_on_lwp) and + cint(d.depends_on_payment_days) and (not self.salary_slip_based_on_timesheet or getdate(self.start_date) < joining_date or @@ -431,7 +431,7 @@ class SalarySlip(TransactionBase): ) elif not self.payment_days and not self.salary_slip_based_on_timesheet and \ - cint(d.depends_on_lwp): + cint(d.depends_on_payment_days): d.amount = 0 elif not d.amount: d.amount = d.default_amount @@ -441,7 +441,7 @@ class SalarySlip(TransactionBase): def calculate_net_pay(self): if self.salary_structure: self.calculate_component_amounts() - + disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, "disable_rounded_total")) precision = frappe.defaults.get_global_default("currency_precision") self.total_deduction = 0 @@ -455,7 +455,7 @@ class SalarySlip(TransactionBase): self.net_pay = flt(self.gross_pay) - (flt(self.total_deduction) + flt(self.total_loan_repayment)) self.rounded_total = rounded(self.net_pay, self.precision("net_pay") if disable_rounded_total else 0) - + if self.net_pay < 0: frappe.throw(_("Net Pay cannnot be negative")) @@ -784,7 +784,7 @@ class SalarySlip(TransactionBase): component = frappe.get_doc("Salary Component", salary_component) # Data for update_component_row struct_row = {} - struct_row['depends_on_lwp'] = component.depends_on_lwp + struct_row['depends_on_payment_days'] = component.depends_on_payment_days struct_row['salary_component'] = component.name struct_row['abbr'] = component.salary_component_abbr struct_row['do_not_include_in_total'] = component.do_not_include_in_total diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js index 79d75bfdf6e..e3f37e71059 100755 --- a/erpnext/hr/doctype/salary_structure/salary_structure.js +++ b/erpnext/hr/doctype/salary_structure/salary_structure.js @@ -246,7 +246,7 @@ frappe.ui.form.on('Salary Detail', { frappe.model.set_value(cdt, cdn, 'amount', result.amount); } frappe.model.set_value(cdt, cdn, 'statistical_component', result.statistical_component); - frappe.model.set_value(cdt, cdn, 'depends_on_lwp', result.depends_on_lwp); + frappe.model.set_value(cdt, cdn, 'depends_on_payment_days', result.depends_on_payment_days); frappe.model.set_value(cdt, cdn, 'do_not_include_in_total', result.do_not_include_in_total); frappe.model.set_value(cdt, cdn, 'variable_based_on_taxable_salary', result.variable_based_on_taxable_salary); frappe.model.set_value(cdt, cdn, 'is_tax_applicable', result.is_tax_applicable); diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py index 202ae9bcfe5..26efd00d473 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.py +++ b/erpnext/hr/doctype/salary_structure/salary_structure.py @@ -18,7 +18,7 @@ class SalaryStructure(Document): self.validate_max_benefits_with_flexi() def set_missing_values(self): - overwritten_fields = ["depends_on_lwp", "variable_based_on_taxable_salary", "is_tax_applicable", "is_flexible_benefit"] + overwritten_fields = ["depends_on_payment_days", "variable_based_on_taxable_salary", "is_tax_applicable", "is_flexible_benefit"] overwritten_fields_if_missing = ["amount_based_on_formula", "formula", "amount"] for table in ["earnings", "deductions"]: for d in self.get(table): @@ -126,7 +126,7 @@ def create_salary_structures_assignment(employee, salary_structure, from_date, b def get_existing_assignments(employees, salary_structure,from_date): salary_structures_assignments = frappe.db.sql_list(""" - select distinct employee from `tabSalary Structure Assignment` + select distinct employee from `tabSalary Structure Assignment` where salary_structure=%s and employee in (%s) and from_date=%s and docstatus=1 """ % ('%s', ', '.join(['%s']*len(employees)),'%s'), [salary_structure] + employees+[from_date]) diff --git a/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json b/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json index 20c7d232494..ceaf4a6ac71 100644 --- a/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json +++ b/erpnext/hr/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json @@ -1,18 +1,18 @@ { - "creation": "2016-07-07 12:38:32.447281", - "custom_format": 0, - "disabled": 0, - "doc_type": "Salary Slip", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"HTML\", \"options\": \"

{{doc.name}}


\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\"}, {\"print_hide\": 0, \"fieldname\": \"department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_hours\"}, {\"print_hide\": 0, \"fieldname\": \"hour_rate\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"time_sheet\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"working_hours\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"timesheets\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_lwp\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_lwp\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\"}]", - "idx": 0, - "modified": "2016-08-21 21:02:59.896033", - "modified_by": "Administrator", - "name": "Salary Slip based on Timesheet", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_type": "Server", + "creation": "2016-07-07 12:38:32.447281", + "custom_format": 0, + "disabled": 0, + "doc_type": "Salary Slip", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"HTML\", \"options\": \"

{{doc.name}}


\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\"}, {\"print_hide\": 0, \"fieldname\": \"department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_hours\"}, {\"print_hide\": 0, \"fieldname\": \"hour_rate\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"time_sheet\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"working_hours\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"timesheets\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\"}]", + "idx": 0, + "modified": "2016-08-21 21:02:59.896033", + "modified_by": "Administrator", + "name": "Salary Slip based on Timesheet", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Server", "standard": "Yes" } \ No newline at end of file diff --git a/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json b/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json index 9f299df0ed3..b01239fe02d 100644 --- a/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json +++ b/erpnext/hr/print_format/salary_slip_standard/salary_slip_standard.json @@ -1,22 +1,22 @@ { - "align_labels_right": 0, - "creation": "2016-07-07 11:45:14.872204", - "custom_format": 0, - "disabled": 0, - "doc_type": "Salary Slip", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"

{{doc.name}}

\\n
\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\", \"label\": \"Employee\"}, {\"print_hide\": 0, \"fieldname\": \"company\", \"label\": \"Company\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\", \"label\": \"Employee Name\"}, {\"print_hide\": 0, \"fieldname\": \"department\", \"label\": \"Department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\", \"label\": \"Designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\", \"label\": \"Branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\", \"label\": \"Start Date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\", \"label\": \"End Date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_days\", \"label\": \"Working Days\"}, {\"print_hide\": 0, \"fieldname\": \"leave_without_pay\", \"label\": \"Leave Without Pay\"}, {\"print_hide\": 0, \"fieldname\": \"payment_days\", \"label\": \"Payment Days\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\", \"label\": \"Earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_lwp\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\", \"label\": \"Deductions\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\", \"label\": \"Gross Pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\", \"label\": \"Total Deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\", \"label\": \"Net Pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\", \"label\": \"Rounded Total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\", \"label\": \"Total in words\"}]", - "idx": 0, - "line_breaks": 0, - "modified": "2018-07-24 19:31:39.040701", - "modified_by": "Administrator", - "module": "HR", - "name": "Salary Slip Standard", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_type": "Server", - "show_section_headings": 0, + "align_labels_right": 0, + "creation": "2016-07-07 11:45:14.872204", + "custom_format": 0, + "disabled": 0, + "doc_type": "Salary Slip", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"

{{doc.name}}

\\n
\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\", \"label\": \"Employee\"}, {\"print_hide\": 0, \"fieldname\": \"company\", \"label\": \"Company\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\", \"label\": \"Employee Name\"}, {\"print_hide\": 0, \"fieldname\": \"department\", \"label\": \"Department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\", \"label\": \"Designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\", \"label\": \"Branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\", \"label\": \"Start Date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\", \"label\": \"End Date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_days\", \"label\": \"Working Days\"}, {\"print_hide\": 0, \"fieldname\": \"leave_without_pay\", \"label\": \"Leave Without Pay\"}, {\"print_hide\": 0, \"fieldname\": \"payment_days\", \"label\": \"Payment Days\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\", \"label\": \"Earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\", \"label\": \"Deductions\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\", \"label\": \"Gross Pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\", \"label\": \"Total Deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\", \"label\": \"Net Pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\", \"label\": \"Rounded Total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\", \"label\": \"Total in words\"}]", + "idx": 0, + "line_breaks": 0, + "modified": "2018-07-24 19:31:39.040701", + "modified_by": "Administrator", + "module": "HR", + "name": "Salary Slip Standard", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Server", + "show_section_headings": 0, "standard": "Yes" } \ No newline at end of file diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2df10899800..75cdd0842b3 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -591,4 +591,5 @@ erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019 erpnext.patches.v11_1.make_job_card_time_logs erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user -erpnext.patches.v11_1.set_salary_details_submitable \ No newline at end of file +erpnext.patches.v11_1.set_salary_details_submittable +erpnext.patches.v11_1.rename_depends_on_lwp diff --git a/erpnext/patches/v11_1/rename_depends_on_lwp.py b/erpnext/patches/v11_1/rename_depends_on_lwp.py new file mode 100644 index 00000000000..20d8867e1d2 --- /dev/null +++ b/erpnext/patches/v11_1/rename_depends_on_lwp.py @@ -0,0 +1,13 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe import scrub +from frappe.model.utils.rename_field import rename_field + +def execute(): + for doctype in ("Salary Component", "Salary Detail"): + if "depends_on_lwp" in frappe.db.get_table_columns(doctype): + frappe.reload_doc("hr", "doctype", scrub(doctype)) + rename_field(doctype, "depends_on_lwp", "depends_on_payment_days") \ No newline at end of file diff --git a/erpnext/patches/v11_1/set_salary_details_submitable.py b/erpnext/patches/v11_1/set_salary_details_submittable.py similarity index 98% rename from erpnext/patches/v11_1/set_salary_details_submitable.py rename to erpnext/patches/v11_1/set_salary_details_submittable.py index f4477d9fd6d..6d847ec3d05 100644 --- a/erpnext/patches/v11_1/set_salary_details_submitable.py +++ b/erpnext/patches/v11_1/set_salary_details_submittable.py @@ -7,5 +7,3 @@ def execute(): set sd.docstatus=1 where ss.name=sd.parent and ss.docstatus=1 and sd.parenttype='Salary Structure' """) - - diff --git a/erpnext/patches/v7_0/rename_salary_components.py b/erpnext/patches/v7_0/rename_salary_components.py index de92fc6083b..bc48e343174 100644 --- a/erpnext/patches/v7_0/rename_salary_components.py +++ b/erpnext/patches/v7_0/rename_salary_components.py @@ -5,79 +5,79 @@ from frappe.model.utils.rename_field import update_property_setters def execute(): if not frappe.db.exists("DocType", "Salary Structure Earning"): return - + frappe.reload_doc("hr", "doctype", "salary_detail") frappe.reload_doc("hr", "doctype", "salary_component") - + standard_cols = ["name", "creation", "modified", "owner", "modified_by", "parent", "parenttype", "parentfield", "idx"] - + dt_cols = { "Salary Structure Deduction": ["d_type", "d_modified_amt", "depend_on_lwp"], "Salary Structure Earning": ["e_type", "modified_value", "depend_on_lwp"], "Salary Slip Earning": ["e_type", "e_modified_amount", "e_depends_on_lwp", "e_amount"], "Salary Slip Deduction": ["d_type", "d_modified_amount", "d_depends_on_lwp", "d_amount"], } - + earning_type_exists = True if "earning_type" in frappe.db.get_table_columns("Salary Slip Earning") else False e_type_exists = True if "e_type" in frappe.db.get_table_columns("Salary Slip Earning") else False - - + + if e_type_exists and earning_type_exists: - frappe.db.sql("""update `tabSalary Slip Earning` + frappe.db.sql("""update `tabSalary Slip Earning` set e_type = earning_type, e_modified_amount = earning_amount where e_type is null and earning_type is not null""") - frappe.db.sql("""update `tabSalary Structure Earning` set e_type = earning_type + frappe.db.sql("""update `tabSalary Structure Earning` set e_type = earning_type where e_type is null and earning_type is not null""") - frappe.db.sql("""update `tabSalary Slip Deduction` set + frappe.db.sql("""update `tabSalary Slip Deduction` set d_type = deduction_type, d_modified_amount = deduction_amount where d_type is null and deduction_type is not null""") - frappe.db.sql("""update `tabSalary Structure Deduction` set d_type = deduction_type + frappe.db.sql("""update `tabSalary Structure Deduction` set d_type = deduction_type where d_type is null and deduction_type is not null""") - + if earning_type_exists and not e_type_exists: for val in dt_cols.values(): if val[0] == "e_type": val[0] = "earning_type" - + if val[0] == "d_type": val[0] = "deduction_type" - + if val[1] == "e_modified_amount": val[1] ="earning_amount" - + if val[1] == "d_modified_amount": val[1] ="deduction_amount" - - - target_cols = standard_cols + ["salary_component", "amount", "depends_on_lwp", "default_amount"] - target_cols = "`" + "`, `".join(target_cols) + "`" - - for doctype, cols in dt_cols.items(): + + + target_cols = standard_cols + ["salary_component", "amount", "depends_on_payment_days", "default_amount"] + target_cols = "`" + "`, `".join(target_cols) + "`" + + for doctype, cols in dt_cols.items(): source_cols = "`" + "`, `".join(standard_cols + cols) + "`" if len(cols) == 3: source_cols += ", 0" - - + + frappe.db.sql("""INSERT INTO `tabSalary Detail` ({0}) SELECT {1} FROM `tab{2}`""" .format(target_cols, source_cols, doctype)) - - + + dt_cols_de = { "Deduction Type": ["deduction_name", "description"], "Earning Type": ["earning_name", "description"], } - + standard_cols_de = standard_cols - + target_cols = standard_cols_de + ["salary_component", "description"] - target_cols = "`" + "`, `".join(target_cols) + "`" - - for doctype, cols in dt_cols_de.items(): + target_cols = "`" + "`, `".join(target_cols) + "`" + + for doctype, cols in dt_cols_de.items(): source_cols = "`" + "`, `".join(standard_cols_de + cols) + "`" try: frappe.db.sql("""INSERT INTO `tabSalary Component` ({0}) SELECT {1} FROM `tab{2}`""" @@ -85,10 +85,10 @@ def execute(): except Exception as e: if e.args[0]==1062: pass - + update_customizations() - - for doctype in ["Salary Structure Deduction", "Salary Structure Earning", "Salary Slip Earning", + + for doctype in ["Salary Structure Deduction", "Salary Structure Earning", "Salary Slip Earning", "Salary Slip Deduction", "Deduction Type", "Earning Type"] : frappe.delete_doc("DocType", doctype) @@ -96,35 +96,35 @@ def execute(): def update_customizations(): dt_cols = { "Salary Structure Deduction": { - "d_type": "salary_component", - "deduction_type": "salary_component", + "d_type": "salary_component", + "deduction_type": "salary_component", "d_modified_amt": "amount", - "depend_on_lwp": "depends_on_lwp" + "depend_on_lwp": "depends_on_payment_days" }, "Salary Structure Earning": { - "e_type": "salary_component", - "earning_type": "salary_component", + "e_type": "salary_component", + "earning_type": "salary_component", "modified_value": "amount", - "depend_on_lwp": "depends_on_lwp" + "depend_on_lwp": "depends_on_payment_days" }, "Salary Slip Earning": { - "e_type": "salary_component", - "earning_type": "salary_component", + "e_type": "salary_component", + "earning_type": "salary_component", "e_modified_amount": "amount", "e_amount" : "default_amount", - "e_depends_on_lwp": "depends_on_lwp" + "e_depends_on_lwp": "depends_on_payment_days" }, "Salary Slip Deduction": { - "d_type": "salary_component", - "deduction_type": "salary_component", + "d_type": "salary_component", + "deduction_type": "salary_component", "d_modified_amount": "amount", "d_amount" : "default_amount", - "d_depends_on_lwp": "depends_on_lwp" + "d_depends_on_lwp": "depends_on_payment_days" } } - + update_property_setters_and_custom_fields("Salary Detail", dt_cols) - + dt_cols = { "Earning Type": { "earning_name": "salary_component" @@ -133,17 +133,17 @@ def update_customizations(): "deduction_name": "salary_component" } } - + update_property_setters_and_custom_fields("Salary Component", dt_cols) - - - - + + + + def update_property_setters_and_custom_fields(new_dt, dt_cols): for doctype, cols in dt_cols.items(): frappe.db.sql("update `tabProperty Setter` set doc_type = %s where doc_type=%s", (new_dt, doctype)) frappe.db.sql("update `tabCustom Field` set dt = %s where dt=%s", (new_dt, doctype)) - - + + for old_fieldname, new_fieldname in cols.items(): update_property_setters(new_dt, old_fieldname, new_fieldname) From 8a32ad206ab2e199a1eb03a0eec05c601d989105 Mon Sep 17 00:00:00 2001 From: "hello@openetech.com" Date: Mon, 22 Apr 2019 13:58:30 +0530 Subject: [PATCH 23/59] [fix] #17324 --- erpnext/hr/doctype/leave_application/leave_application.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 560dd1d3bfd..88b8f77b2e0 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -135,6 +135,7 @@ class LeaveApplication(Document): date = dt.strftime("%Y-%m-%d") doc = frappe.new_doc("Attendance") doc.employee = self.employee + doc.employee_name = self.employee_name doc.attendance_date = date doc.company = self.company doc.leave_type = self.leave_type From 759bb0eb628cb5414ed30d90d317841835fba9bf Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 22 Apr 2019 14:40:01 +0530 Subject: [PATCH 24/59] fix: (Patch) Removed page Bom-Browser --- erpnext/patches.txt | 6 +++++- erpnext/patches/v11_1/delete_bom_browser.py | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v11_1/delete_bom_browser.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2df10899800..faff5c4ffec 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -591,4 +591,8 @@ erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019 erpnext.patches.v11_1.make_job_card_time_logs erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user -erpnext.patches.v11_1.set_salary_details_submitable \ No newline at end of file +<<<<<<< HEAD +erpnext.patches.v11_1.set_salary_details_submitable +======= +erpnext.patches.v11_1.delete_bom_browser +>>>>>>> fix: (Patch) Removed page Bom-Browser diff --git a/erpnext/patches/v11_1/delete_bom_browser.py b/erpnext/patches/v11_1/delete_bom_browser.py new file mode 100644 index 00000000000..5b8251ca2fc --- /dev/null +++ b/erpnext/patches/v11_1/delete_bom_browser.py @@ -0,0 +1,8 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql(""" Delete from `tabPage` where name='bom-browser' """) \ No newline at end of file From 4f16d17d2181289c64885e636653cd3bc23ad187 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 22 Apr 2019 14:48:15 +0530 Subject: [PATCH 25/59] fix: resolve conflicts --- erpnext/patches.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index faff5c4ffec..c6672e9af3b 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -591,8 +591,5 @@ erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019 erpnext.patches.v11_1.make_job_card_time_logs erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user -<<<<<<< HEAD erpnext.patches.v11_1.set_salary_details_submitable -======= erpnext.patches.v11_1.delete_bom_browser ->>>>>>> fix: (Patch) Removed page Bom-Browser From 7bdd27f7e2956335c6096da411221d0c30187d30 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 22 Apr 2019 14:54:31 +0530 Subject: [PATCH 26/59] chore: used frappe.delete_doc_if_exists --- erpnext/patches/v11_1/delete_bom_browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v11_1/delete_bom_browser.py b/erpnext/patches/v11_1/delete_bom_browser.py index 5b8251ca2fc..457f5116670 100644 --- a/erpnext/patches/v11_1/delete_bom_browser.py +++ b/erpnext/patches/v11_1/delete_bom_browser.py @@ -5,4 +5,4 @@ from __future__ import unicode_literals import frappe def execute(): - frappe.db.sql(""" Delete from `tabPage` where name='bom-browser' """) \ No newline at end of file + frappe.delete_doc_if_exists('Page', 'bom-browser') \ No newline at end of file From 70f89462a86e78e33389f668d41e68d35326c6a7 Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Mon, 22 Apr 2019 12:27:12 +0200 Subject: [PATCH 27/59] fix: consider empty iban --- erpnext/accounts/doctype/bank_account/bank_account.py | 3 ++- erpnext/accounts/doctype/bank_account/test_bank_account.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 06393e7a54e..aa18b966707 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -21,7 +21,8 @@ class BankAccount(Document): def validate(self): self.validate_company() - self.validate_iban() + if self.validate_iban: + self.validate_iban() def validate_company(self): if self.is_company_account and not self.company: diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index bd148df33ba..f3bb086fa96 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -28,6 +28,12 @@ class TestBankAccount(unittest.TestCase): bank_account = frappe.get_doc({'doctype':'Bank Account'}) + try: + bank_account.validate_iban() + except AttributeError: + msg = _('BankAccount.validate_iban() failed for empty IBAN') + self.fail(msg=msg) + for iban in valid_ibans: bank_account.iban = iban try: From f3b07495f63784020d3916aeb7e628f2b4a83905 Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Mon, 22 Apr 2019 12:38:22 +0200 Subject: [PATCH 28/59] fix typo --- erpnext/accounts/doctype/bank_account/bank_account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index aa18b966707..e71fca256ea 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -21,7 +21,8 @@ class BankAccount(Document): def validate(self): self.validate_company() - if self.validate_iban: + + if self.iban: self.validate_iban() def validate_company(self): From 8aeb4b04bdcba408c7637ab265ceed2b1142a596 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Apr 2019 17:39:02 +0530 Subject: [PATCH 29/59] fix: Income tax period factor considering joining and relieving date --- erpnext/hr/doctype/salary_slip/salary_slip.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 19aaba894f1..ac4e40bd6de 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -599,12 +599,11 @@ class SalarySlip(TransactionBase): annual_earning = taxable_earning["taxable_earning"] * period_factor exemption_amount = 0 if frappe.db.exists("Employee Tax Exemption Declaration", {"employee": self.employee, - "payroll_period": payroll_period.name, "docstatus": 1}): + "payroll_period": payroll_period.name, "docstatus": 1}): exemption_amount = frappe.db.get_value("Employee Tax Exemption Declaration", {"employee": self.employee, "payroll_period": payroll_period.name, "docstatus": 1}, "total_exemption_amount") annual_taxable_earning = annual_earning - exemption_amount - if self.deduct_tax_for_unclaimed_employee_benefits or self.deduct_tax_for_unsubmitted_tax_exemption_proof: tax_detail = self.get_tax_paid_in_period(payroll_period, tax_component) if tax_detail: @@ -770,13 +769,21 @@ class SalarySlip(TransactionBase): def get_period_factor(self, period_start, period_end, start_date=None, end_date=None): # TODO if both deduct checked update the factor to make tax consistent + joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, ["date_of_joining", "relieving_date"]) + if getdate(joining_date) > getdate(period_start): + period_start = joining_date + if relieving_date and getdate(relieving_date) < getdate(period_end): + period_end = relieving_date + payroll_days = date_diff(period_end, period_start) + 1 if start_date and end_date: salary_days = date_diff(end_date, start_date) + 1 return flt(payroll_days)/flt(salary_days) + # if period configured for a year and monthly frequency return 12 to make tax calc consistent if 360 <= payroll_days <= 370 and self.payroll_frequency == "Monthly": return 12 + salary_days = date_diff(self.end_date, self.start_date) + 1 return flt(payroll_days)/flt(salary_days) From a5fbeaa3d34aa3e9f0db71a8842d03ad1ef6d074 Mon Sep 17 00:00:00 2001 From: Saif Date: Mon, 22 Apr 2019 17:29:36 +0500 Subject: [PATCH 30/59] fix: Remove duplicate/incorrect patch --- erpnext/patches.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e67b6a2f215..7d015527456 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -591,7 +591,6 @@ erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019 erpnext.patches.v11_1.make_job_card_time_logs erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user -erpnext.patches.v11_1.set_salary_details_submitable erpnext.patches.v11_1.delete_bom_browser erpnext.patches.v11_1.set_salary_details_submittable erpnext.patches.v11_1.rename_depends_on_lwp From af6360b273caf5e61f672059c0b7931c1f5cc7bd Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Tue, 23 Apr 2019 10:44:10 +0200 Subject: [PATCH 31/59] Bank reconciliation corrections --- .../bank_transaction_upload.py | 22 +++++++++++-------- .../bank_reconciliation.py | 6 +++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py index 8dd8d286729..ccee269bced 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py @@ -45,15 +45,19 @@ def create_bank_entries(columns, data, bank_account): fields.update({key: d[int(value)-1]}) - bank_transaction = frappe.get_doc({ - "doctype": "Bank Transaction" - }) - bank_transaction.update(fields) - bank_transaction.date = getdate(parse_date(bank_transaction.date)) - bank_transaction.bank_account = bank_account - bank_transaction.insert() - bank_transaction.submit() - count = count + 1 + try: + bank_transaction = frappe.get_doc({ + "doctype": "Bank Transaction" + }) + bank_transaction.update(fields) + bank_transaction.date = getdate(parse_date(bank_transaction.date)) + bank_transaction.bank_account = bank_account + bank_transaction.insert() + bank_transaction.submit() + count = count + 1 + except Exception as e: + frappe.throw(e) + frappe.log_error(frappe.get_traceback()) return count diff --git a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py index 1f96bade762..e2d6b58766b 100644 --- a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py @@ -33,10 +33,12 @@ def reconcile(bank_transaction, payment_doctype, payment_name): return 'reconciled' def add_payment_to_transaction(transaction, payment_entry, gl_entry): + gl_amount, transaction_amount = (gl_entry.credit, transaction.debit) if gl_entry.credit > 0 else (gl_entry.debit, transaction.credit) + allocated_amount = gl_amount if gl_amount <= transaction_amount else transaction_amount transaction.append("payment_entries", { "payment_document": payment_entry.doctype, "payment_entry": payment_entry.name, - "allocated_amount": gl_entry.credit if gl_entry.credit > 0 else gl_entry.debit + "allocated_amount": allocated_amount }) transaction.save() @@ -274,7 +276,7 @@ def check_amount_vs_description(amount_matching, description_matching): result.append(am_match) continue - if hasattr(am_match, "reference_no") and hasattr(des_match, "reference_no"): + if "reference_no" in am_match and "reference_no" in des_match: if difflib.SequenceMatcher(lambda x: x == " ", am_match["reference_no"], des_match["reference_no"]).ratio() > 70: if am_match not in result: result.append(am_match) From 05fb3f2d7573e56db48ff27fd28a7930edcd2e15 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Apr 2019 15:49:38 +0530 Subject: [PATCH 32/59] fix: don't allocate advances if POS --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 1 + erpnext/controllers/accounts_controller.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 0399cf95839..1ac69b3a180 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -356,6 +356,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte set_pos_data: function() { if(this.frm.doc.is_pos) { + this.frm.set_value("allocate_advances_automatically", this.frm.doc.is_pos ? 0 : 1); if(!this.frm.doc.company) { this.frm.set_value("is_pos", 0); frappe.msgprint(__("Please specify Company to proceed")); diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index ca24cd670bd..6d2c30abb50 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -88,7 +88,7 @@ class AccountsController(TransactionBase): self.validate_paid_amount() if self.doctype in ['Purchase Invoice', 'Sales Invoice']: - if cint(self.allocate_advances_automatically): + if cint(self.allocate_advances_automatically) and not cint(self.is_pos): self.set_advances() if self.is_return: From 17e6fce4861450424258e99de354d2081910ff25 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Apr 2019 15:51:28 +0530 Subject: [PATCH 33/59] fix: Rounded tax amount in salary slip --- .../employee_tax_exemption_declaration.json | 14 ++++++++++++-- erpnext/hr/doctype/salary_slip/salary_slip.py | 16 +++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json index 865e8219b31..899b869b90a 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 1, @@ -20,6 +21,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "employee", "fieldtype": "Link", "hidden": 0, @@ -54,6 +56,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "employee.company", + "fetch_if_empty": 0, "fieldname": "company", "fieldtype": "Link", "hidden": 0, @@ -87,6 +90,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_2", "fieldtype": "Column Break", "hidden": 0, @@ -118,6 +122,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "payroll_period", "fieldtype": "Link", "hidden": 0, @@ -151,6 +156,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_exemption_amount", "fieldtype": "Currency", "hidden": 0, @@ -184,6 +190,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "employee.department", + "fetch_if_empty": 0, "fieldname": "department", "fieldtype": "Link", "hidden": 0, @@ -217,6 +224,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amended_from", "fieldtype": "Link", "hidden": 0, @@ -249,6 +257,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_8", "fieldtype": "Section Break", "hidden": 0, @@ -280,6 +289,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "declarations", "fieldtype": "Table", "hidden": 0, @@ -300,7 +310,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "translatable": 0, @@ -317,7 +327,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-08-21 16:15:49.363307", + "modified": "2019-04-23 15:50:48.693555", "modified_by": "Administrator", "module": "HR", "name": "Employee Tax Exemption Declaration", diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 19aaba894f1..8e09614dfbc 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -167,7 +167,7 @@ class SalarySlip(TransactionBase): if d.amount_based_on_formula: formula = d.formula.strip() if d.formula else None if formula: - amount = frappe.safe_eval(formula, self.whitelisted_globals, data) + amount = rounded(frappe.safe_eval(formula, self.whitelisted_globals, data)) if amount: data[d.abbr] = amount @@ -736,22 +736,24 @@ class SalarySlip(TransactionBase): # less paid taxes if args.get("pro_rata_tax_paid"): tax_amount -= args.get("pro_rata_tax_paid") + tax_amount = rounded(tax_amount) struct_row = self.get_salary_slip_row(args.get("tax_component")) return [struct_row, tax_amount, benefit_tax, additional_tax] - def calculate_tax_by_tax_slab(self, payroll_period, annual_earning): + def calculate_tax_by_tax_slab(self, payroll_period, annual_taxable_earning): payroll_period_obj = frappe.get_doc("Payroll Period", payroll_period) data = self.get_data_for_eval() + data.update({"annual_taxable_earning": annual_taxable_earning}) taxable_amount = 0 for slab in payroll_period_obj.taxable_salary_slabs: if slab.condition and not self.eval_tax_slab_condition(slab.condition, data): continue - if not slab.to_amount and annual_earning > slab.from_amount: - taxable_amount += (annual_earning - slab.from_amount) * slab.percent_deduction *.01 + if not slab.to_amount and annual_taxable_earning > slab.from_amount: + taxable_amount += (annual_taxable_earning - slab.from_amount) * slab.percent_deduction *.01 continue - if annual_earning > slab.from_amount and annual_earning < slab.to_amount: - taxable_amount += (annual_earning - slab.from_amount) * slab.percent_deduction *.01 - elif annual_earning > slab.from_amount and annual_earning > slab.to_amount: + if annual_taxable_earning > slab.from_amount and annual_taxable_earning < slab.to_amount: + taxable_amount += (annual_taxable_earning - slab.from_amount) * slab.percent_deduction *.01 + elif annual_taxable_earning > slab.from_amount and annual_taxable_earning > slab.to_amount: taxable_amount += (slab.to_amount - slab.from_amount) * slab.percent_deduction * .01 return taxable_amount From cba64988df527029d995db3e333f0cd9021859bf Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Tue, 23 Apr 2019 16:06:43 +0530 Subject: [PATCH 34/59] fix(selling): Fix method to also consider return documents --- erpnext/stock/doctype/delivery_note/delivery_note.py | 5 ++--- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index a3bda0161d0..184bf17aea8 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -407,7 +407,6 @@ def get_returned_qty_map(delivery_note): @frappe.whitelist() def make_sales_invoice(source_name, target_doc=None): doc = frappe.get_doc('Delivery Note', source_name) - sales_orders = [d.against_sales_order for d in doc.items] returned_qty_map = get_returned_qty_map(source_name) invoiced_qty_map = get_invoiced_qty_map(source_name) @@ -447,7 +446,7 @@ def make_sales_invoice(source_name, target_doc=None): returned_qty = 0 return pending_qty, returned_qty - doc = get_mapped_doc("Delivery Note", source_name, { + doc = get_mapped_doc("Delivery Note", source_name, { "Delivery Note": { "doctype": "Sales Invoice", "validation": { @@ -465,7 +464,7 @@ def make_sales_invoice(source_name, target_doc=None): "cost_center": "cost_center" }, "postprocess": update_item, - "filter": lambda d: get_pending_qty(d)[0]<=0 + "filter": lambda d: get_pending_qty(d)[0] <= 0 if not doc.get("is_return") else get_pending_qty(d)[0] > 0 }, "Sales Taxes and Charges": { "doctype": "Sales Taxes and Charges", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index eb821023568..94134f1df23 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -458,7 +458,7 @@ def make_purchase_invoice(source_name, target_doc=None): "asset": "asset", }, "postprocess": update_item, - "filter": lambda d: get_pending_qty(d)[0]<=0 + "filter": lambda d: get_pending_qty(d)[0] <= 0 if not doc.get("is_return") else get_pending_qty(d)[0] > 0 }, "Purchase Taxes and Charges": { "doctype": "Purchase Taxes and Charges", From 2f4193757e18045fbc0174b2348ceeee5adf3b4e Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 23 Apr 2019 17:30:11 +0530 Subject: [PATCH 35/59] fix: Stock Ledger report fix (#17342) --- erpnext/stock/report/stock_ledger/stock_ledger.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index a6210a697a9..af5e5e9f0a0 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -151,10 +151,10 @@ def get_opening_balance(filters, columns): "posting_date": filters.from_date, "posting_time": "00:00:00" }) - row = [""]*len(columns) - row[1] = _("'Opening'") - for i, v in ((9, 'qty_after_transaction'), (11, 'valuation_rate'), (12, 'stock_value')): - row[i] = last_entry.get(v, 0) + row = {} + row["item_code"] = _("'Opening'") + for dummy, v in ((9, 'qty_after_transaction'), (11, 'valuation_rate'), (12, 'stock_value')): + row[v] = last_entry.get(v, 0) return row From 6ea108f01de904b89d07d540ec5cb1cf856e9a11 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 23 Apr 2019 18:33:01 +0530 Subject: [PATCH 36/59] feat: Get invoiced item's gross margin using API --- .../report/gross_profit/gross_profit.js | 6 ++++++ .../report/gross_profit/gross_profit.py | 6 ++++++ erpnext/accounts/report/utils.py | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js index 1f7d24db1e4..ba17a94e8d3 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.js +++ b/erpnext/accounts/report/gross_profit/gross_profit.js @@ -23,6 +23,12 @@ frappe.query_reports["Gross Profit"] = { "fieldtype": "Date", "default": frappe.defaults.get_user_default("year_end_date") }, + { + "fieldname":"sales_invoice", + "label": __("Sales Invoice"), + "fieldtype": "Link", + "options": "Sales Invoice" + }, { "fieldname":"group_by", "label": __("Group By"), diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index e5aaafaff49..ee5a4d28e37 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -302,6 +302,12 @@ class GrossProfitGenerator(object): sales_person_cols = "" sales_team_table = "" + if self.filters.get("sales_invoice"): + conditions += " and `tabSales Invoice`.name = %(sales_invoice)s" + + if self.filters.get("item_code"): + conditions += " and `tabSales Invoice Item`.item_code = %(item_code)s" + self.si_list = frappe.db.sql(""" select `tabSales Invoice Item`.parenttype, `tabSales Invoice Item`.parent, diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py index 8500aea4159..0b17c8f964a 100644 --- a/erpnext/accounts/report/utils.py +++ b/erpnext/accounts/report/utils.py @@ -135,3 +135,22 @@ def get_appropriate_company(filters): company = get_default_company() return company + +@frappe.whitelist() +def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=None): + from erpnext.accounts.report.gross_profit.gross_profit import GrossProfitGenerator + + sales_invoice = sales_invoice or frappe.form_dict.get('sales_invoice') + item_code = item_code or frappe.form_dict.get('item_code') + company = company or frappe.get_cached_value("Sales Invoice", sales_invoice, 'company') + + filters = { + 'sales_invoice': sales_invoice, + 'item_code': item_code, + 'company': company, + 'group_by': 'Invoice' + } + + gross_profit_data = GrossProfitGenerator(filters) + + return gross_profit_data.grouped_data From 5a6fc77751c17a3c381688603ffedd334799744e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 23 Apr 2019 17:26:01 +0530 Subject: [PATCH 37/59] fix: Straight line asset depreciation not working if Expected Value After Useful Life is defined --- erpnext/assets/doctype/asset/asset.js | 6 ++++++ erpnext/assets/doctype/asset/asset.py | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index 18ba8f9b5cb..3b41006f2b3 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -296,6 +296,12 @@ frappe.ui.form.on('Asset', { frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation); }, + gross_purchase_amount: function(frm) { + frm.doc.finance_books.forEach(d => { + frm.events.set_depreciation_rate(frm, d); + }) + }, + set_depreciation_rate: function(frm, row) { if (row.total_number_of_depreciations && row.frequency_of_depreciation) { frappe.call({ diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 8011038b1b1..72f5c627a71 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -101,7 +101,7 @@ class Asset(AccountsController): def set_depreciation_rate(self): for d in self.get("finance_books"): - d.rate_of_depreciation = self.get_depreciation_rate(d) + d.rate_of_depreciation = self.get_depreciation_rate(d, on_validate=True) def make_depreciation_schedule(self): depreciation_method = [d.depreciation_method for d in self.finance_books] @@ -125,7 +125,7 @@ class Asset(AccountsController): no_of_depreciations * cint(d.frequency_of_depreciation)) total_days = date_diff(end_date, self.available_for_use_date) - rate_per_day = value_after_depreciation / total_days + rate_per_day = (value_after_depreciation - d.get("expected_value_after_useful_life")) / total_days number_of_pending_depreciations = cint(d.total_number_of_depreciations) - \ cint(self.number_of_depreciations_booked) @@ -291,8 +291,8 @@ class Asset(AccountsController): def validate_expected_value_after_useful_life(self): for row in self.get('finance_books'): - accumulated_depreciation_after_full_schedule = \ - max([d.accumulated_depreciation_amount for d in self.get("schedules") if d.finance_book_id == row.idx]) + accumulated_depreciation_after_full_schedule = max([d.accumulated_depreciation_amount + for d in self.get("schedules") if cint(d.finance_book_id) == row.idx]) asset_value_after_full_schedule = flt(flt(self.gross_purchase_amount) - flt(accumulated_depreciation_after_full_schedule), @@ -403,7 +403,7 @@ class Asset(AccountsController): make_gl_entries(gl_entries) self.db_set('booked_fixed_asset', 1) - def get_depreciation_rate(self, args): + def get_depreciation_rate(self, args, on_validate=False): if isinstance(args, string_types): args = json.loads(args) @@ -420,7 +420,10 @@ class Asset(AccountsController): if args.get("depreciation_method") == 'Double Declining Balance': return 200.0 / args.get("total_number_of_depreciations") - if args.get("depreciation_method") == "Written Down Value" and not args.get("rate_of_depreciation"): + if args.get("depreciation_method") == "Written Down Value": + if args.get("rate_of_depreciation") and on_validate: + return args.get("rate_of_depreciation") + no_of_years = flt(args.get("total_number_of_depreciations") * flt(args.get("frequency_of_depreciation"))) / 12 value = flt(args.get("expected_value_after_useful_life")) / flt(self.gross_purchase_amount) From 62d51d82ea62b7022bc502a5e1349583bcfa39db Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 16 Apr 2019 17:07:13 +0530 Subject: [PATCH 38/59] feat: Added filters and columns for inactive items report --- .../stock/report/inactive_items/__init__.py | 0 .../report/inactive_items/inactive_items.js | 39 ++++++++++++ .../report/inactive_items/inactive_items.json | 31 ++++++++++ .../report/inactive_items/inactive_items.py | 60 +++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 erpnext/stock/report/inactive_items/__init__.py create mode 100644 erpnext/stock/report/inactive_items/inactive_items.js create mode 100644 erpnext/stock/report/inactive_items/inactive_items.json create mode 100644 erpnext/stock/report/inactive_items/inactive_items.py diff --git a/erpnext/stock/report/inactive_items/__init__.py b/erpnext/stock/report/inactive_items/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/stock/report/inactive_items/inactive_items.js b/erpnext/stock/report/inactive_items/inactive_items.js new file mode 100644 index 00000000000..73ce59b977d --- /dev/null +++ b/erpnext/stock/report/inactive_items/inactive_items.js @@ -0,0 +1,39 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Inactive Items"] = { + "filters": [ + { + fieldname: "territory", + label: __("Territory"), + fieldtype: "Link", + options: "Territory" + }, + { + fieldname: "customer", + label: __("Customer"), + fieldtype: "Link", + options: "Customer" + }, + { + fieldname: "item", + label: __("Item"), + fieldtype: "Link", + options: "Item" + }, + { + fieldname: "item_group", + label: __("Item Group"), + fieldtype: "Link", + options: "Item Group" + }, + { + fieldname: "days", + label: __("Days Since Last order"), + fieldtype: "Select", + options: [30, 60, 90], + default: 30 + }, + ] +} diff --git a/erpnext/stock/report/inactive_items/inactive_items.json b/erpnext/stock/report/inactive_items/inactive_items.json new file mode 100644 index 00000000000..b9eb05ec050 --- /dev/null +++ b/erpnext/stock/report/inactive_items/inactive_items.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2019-04-16 16:05:00.647308", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Test Letter Head 1", + "modified": "2019-04-16 16:06:33.630043", + "modified_by": "Administrator", + "module": "Stock", + "name": "Inactive Items", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "report_name": "Inactive Items", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/erpnext/stock/report/inactive_items/inactive_items.py b/erpnext/stock/report/inactive_items/inactive_items.py new file mode 100644 index 00000000000..8aeb24349a7 --- /dev/null +++ b/erpnext/stock/report/inactive_items/inactive_items.py @@ -0,0 +1,60 @@ +# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe + +def execute(filters=None): + columns, data = [], [] + return columns, data + +def get_columns(): + + columns = [ + { + "fieldname": "territory", + "fieldtype": "Link", + "label": _("Territory"), + "options": "Territory", + "width": 100 + }, + { + "fieldname": "item_group", + "fieldtype": "Link", + "label": _("Item Group"), + "options": "Item Group", + "width": 100 + }, + { + "fieldname": "item", + "fieldtype": "Link", + "label": _("Item"), + "options": "Item", + "width": 100 + }, + { + "fieldname": "customer", + "fieldtype": "Link", + "label": _("Customer"), + "options": "Customer", + "width": 100 + }, + { + "fieldname": "last_order_date", + "fieldtype": "Date", + "label": _("Last Order Date"), + "width": 100 + }, + { + "fieldname": "qty", + "fieldtype": "Float", + "label": _("Quantity"), + "width": 100 + }, + { + "fieldname": "days_since_last_order", + "fieldtype": "Int", + "label": _("Days Since Last Order"), + "width": 100 + }, + ] From 1bd69b449086b795f1c8d92d0d6db4d743d0a3f9 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 18 Apr 2019 08:29:21 +0530 Subject: [PATCH 39/59] fix: Reordered and deleted unnecessary filters --- .../report/inactive_items/inactive_items.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/erpnext/stock/report/inactive_items/inactive_items.js b/erpnext/stock/report/inactive_items/inactive_items.js index 73ce59b977d..39dfd5c8c36 100644 --- a/erpnext/stock/report/inactive_items/inactive_items.js +++ b/erpnext/stock/report/inactive_items/inactive_items.js @@ -4,18 +4,6 @@ frappe.query_reports["Inactive Items"] = { "filters": [ - { - fieldname: "territory", - label: __("Territory"), - fieldtype: "Link", - options: "Territory" - }, - { - fieldname: "customer", - label: __("Customer"), - fieldtype: "Link", - options: "Customer" - }, { fieldname: "item", label: __("Item"), @@ -28,6 +16,13 @@ frappe.query_reports["Inactive Items"] = { fieldtype: "Link", options: "Item Group" }, + { + fieldname: "based_on", + label: __("Based On"), + fieldtype: "Select", + options: "Sales Order\nSales Invoice", + default: "Sales Order" + }, { fieldname: "days", label: __("Days Since Last order"), From da64113b9adff34beba7d212934f3ddffc8de708 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 18 Apr 2019 08:45:10 +0530 Subject: [PATCH 40/59] feat: Logic for query and report creation for inactive items --- .../report/inactive_items/inactive_items.py | 95 ++++++++++++++++++- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/report/inactive_items/inactive_items.py b/erpnext/stock/report/inactive_items/inactive_items.py index 8aeb24349a7..95cec7bb348 100644 --- a/erpnext/stock/report/inactive_items/inactive_items.py +++ b/erpnext/stock/report/inactive_items/inactive_items.py @@ -3,9 +3,13 @@ from __future__ import unicode_literals import frappe +from frappe.utils import getdate, add_days, today, cint +from frappe import _ def execute(filters=None): - columns, data = [], [] + + columns = get_columns() + data = get_data(filters) return columns, data def get_columns(): @@ -26,12 +30,20 @@ def get_columns(): "width": 100 }, { - "fieldname": "item", + "fieldname": "item_name", "fieldtype": "Link", - "label": _("Item"), + "options": "Item", + "label": "Item", + "width": 100 + }, + { + "fieldname": "Item Name", + "fieldtype": "Link", + "label": _("Item Name"), "options": "Item", "width": 100 }, + { "fieldname": "customer", "fieldtype": "Link", @@ -58,3 +70,80 @@ def get_columns(): "width": 100 }, ] + + return columns + + +def get_data(filters): + + data = [] + items = get_items(filters) + sales_invoice_data = get_sales_details(filters) + + for item in items: + if sales_invoice_data.get(item.name): + item_obj = sales_invoice_data[item.name] + if item_obj.days_since_last_order > cint(filters['days']): + row = { + "territory": item_obj.territory, + "item_group": item_obj.item_group, + "item": item_obj.name, + "item_name": item_obj.item_name, + "customer": item_obj.customer, + "last_order_date": item_obj.last_order_date, + "qty": item_obj.qty, + "days_since_last_order": item_obj.days_since_last_order + } + data.append(row) + else: + row = { + "item_group": item.item_group, + "item": item.name, + "item_name": item.item_name + } + data.append(row) + + return data + + +def get_sales_details(filters): + + data = [] + item_details_map = {} + + date_field = "s.transaction_date" if filters["based_on"] == "Sales Order" else "s.posting_date" + + sales_data = frappe.db.sql(""" + select s.territory, s.customer, si.item_group, si.item_name, si.qty, {date_field} as last_order_date, + DATEDIFF(CURDATE(), {date_field}) as days_since_last_order + from `tab{doctype}` s, `tab{doctype} Item` si + where s.name = si.parent and s.docstatus = 1 + group by si.name order by days_since_last_order """ + .format(date_field = date_field, doctype = filters['based_on']), as_dict=1) + + for d in sales_data: + item_details_map.setdefault(d.item_name, d) + + return item_details_map + +def get_items(filters): + + filters_dict = { + "disabled": 0, + "is_stock_item": 1 + } + + if filters.get("item_group"): + filters_dict.update({ + "item_group": filters["item_group"] + }) + + if filters.get("item"): + filters_dict.update({ + "name": filtesr["item"] + }) + + items = frappe.get_all("Item", fields=["name", "item_group", "item_name"], filters=filters_dict) + + return items + From fe7baae9f747fc73aa0f1f42e55fc103912e05a9 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 22 Apr 2019 17:15:23 +0530 Subject: [PATCH 41/59] fix: Ordering and datatype fixes in inactive items report --- .../stock/report/inactive_items/inactive_items.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/report/inactive_items/inactive_items.py b/erpnext/stock/report/inactive_items/inactive_items.py index 95cec7bb348..3aaf1ce7090 100644 --- a/erpnext/stock/report/inactive_items/inactive_items.py +++ b/erpnext/stock/report/inactive_items/inactive_items.py @@ -27,21 +27,20 @@ def get_columns(): "fieldtype": "Link", "label": _("Item Group"), "options": "Item Group", - "width": 100 + "width": 150 }, { "fieldname": "item_name", "fieldtype": "Link", "options": "Item", "label": "Item", - "width": 100 + "width": 150 }, { - "fieldname": "Item Name", - "fieldtype": "Link", + "fieldname": "item_name", + "fieldtype": "Data", "label": _("Item Name"), - "options": "Item", - "width": 100 + "width": 150 }, { @@ -143,7 +142,7 @@ def get_items(filters): "name": filtesr["item"] }) - items = frappe.get_all("Item", fields=["name", "item_group", "item_name"], filters=filters_dict) + items = frappe.get_all("Item", fields=["name", "item_group", "item_name"], filters=filters_dict, order_by="name") return items From 11e1c60cd3b235f3274fcc8359758b384ebe73dc Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 22 Apr 2019 17:54:38 +0530 Subject: [PATCH 42/59] fix: Typo fixes --- erpnext/stock/report/inactive_items/inactive_items.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/report/inactive_items/inactive_items.py b/erpnext/stock/report/inactive_items/inactive_items.py index 3aaf1ce7090..188f59bf09e 100644 --- a/erpnext/stock/report/inactive_items/inactive_items.py +++ b/erpnext/stock/report/inactive_items/inactive_items.py @@ -139,7 +139,7 @@ def get_items(filters): if filters.get("item"): filters_dict.update({ - "name": filtesr["item"] + "name": filters["item"] }) items = frappe.get_all("Item", fields=["name", "item_group", "item_name"], filters=filters_dict, order_by="name") From a981a8a1536d053dd644534e7fc865bc68d5c8b1 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 22 Apr 2019 21:08:29 +0530 Subject: [PATCH 43/59] fix: Ignore sql injections --- erpnext/stock/report/inactive_items/inactive_items.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/report/inactive_items/inactive_items.py b/erpnext/stock/report/inactive_items/inactive_items.py index 188f59bf09e..8d879126da6 100644 --- a/erpnext/stock/report/inactive_items/inactive_items.py +++ b/erpnext/stock/report/inactive_items/inactive_items.py @@ -117,7 +117,7 @@ def get_sales_details(filters): DATEDIFF(CURDATE(), {date_field}) as days_since_last_order from `tab{doctype}` s, `tab{doctype} Item` si where s.name = si.parent and s.docstatus = 1 - group by si.name order by days_since_last_order """ + group by si.name order by days_since_last_order """ #nosec .format(date_field = date_field, doctype = filters['based_on']), as_dict=1) for d in sales_data: From e534221245a01aff8613e89b3c2556bc6c87e34c Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Wed, 24 Apr 2019 16:22:34 +0200 Subject: [PATCH 44/59] fix: validate IBAN only if it exists --- erpnext/accounts/doctype/bank_account/bank_account.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index e71fca256ea..20ce7ca9a4c 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -21,9 +21,7 @@ class BankAccount(Document): def validate(self): self.validate_company() - - if self.iban: - self.validate_iban() + self.validate_iban() def validate_company(self): if self.is_company_account and not self.company: @@ -33,6 +31,10 @@ class BankAccount(Document): ''' Algorithm: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN ''' + # IBAN field is optional + if not self.iban: + return + def encode_char(c): # Position in the alphabet (A=1, B=2, ...) plus nine return str(9 + ord(c) - 64) From d14799a9fa9034c581017f46a5e7f310f0f9b9a4 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Wed, 24 Apr 2019 18:06:14 +0200 Subject: [PATCH 45/59] fix: verbose error message when api keys are not setup --- .../doctype/plaid_settings/plaid_settings.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js index 76205e6c823..1f6499ec98a 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js @@ -22,6 +22,10 @@ erpnext.integrations.plaidLink = class plaidLink { frappe.xcall('erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings.plaid_configuration') .then(result => { if (result !== "disabled") { + console.log(result) + if (result.plaid_env == undefined || result.plaid_public_key == undefined) { + frappe.throw(__("Please add valid Plaid api keys in site_config.json first")); + } me.plaid_env = result.plaid_env; me.plaid_public_key = result.plaid_public_key; me.client_name = result.client_name; From 97842ca8048d0a357824b429b537f62b25df54c8 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Wed, 24 Apr 2019 18:15:46 +0200 Subject: [PATCH 46/59] fix: cleanup development --- .../doctype/plaid_settings/plaid_settings.js | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js index 1f6499ec98a..ace4fbf9e30 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.js @@ -22,7 +22,6 @@ erpnext.integrations.plaidLink = class plaidLink { frappe.xcall('erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings.plaid_configuration') .then(result => { if (result !== "disabled") { - console.log(result) if (result.plaid_env == undefined || result.plaid_public_key == undefined) { frappe.throw(__("Please add valid Plaid api keys in site_config.json first")); } From 7d0bc2bd5ac907780c9a21407c6068581621e860 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 25 Apr 2019 01:26:27 +0530 Subject: [PATCH 47/59] fixed test cases --- erpnext/assets/doctype/asset/test_asset.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 985097b447d..ef85ffa1cb8 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -102,9 +102,9 @@ class TestAsset(unittest.TestCase): asset.save() self.assertEqual(asset.status, "Draft") expected_schedules = [ - ["2020-06-06", 163.93, 163.93], - ["2021-04-06", 49836.07, 50000.0], - ["2022-02-06", 40000.0, 90000.00] + ["2020-06-06", 147.54, 147.54], + ["2021-04-06", 44852.46, 45000.0], + ["2022-02-06", 45000.0, 90000.00] ] schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount] @@ -130,8 +130,8 @@ class TestAsset(unittest.TestCase): self.assertEqual(asset.status, "Draft") asset.save() expected_schedules = [ - ["2020-06-06", 197.37, 40197.37], - ["2021-04-06", 49802.63, 90000.00] + ["2020-06-06", 164.47, 40164.47], + ["2021-04-06", 49835.53, 90000.00] ] schedules = [[cstr(d.schedule_date), flt(d.depreciation_amount, 2), d.accumulated_depreciation_amount] for d in asset.get("schedules")] @@ -266,8 +266,8 @@ class TestAsset(unittest.TestCase): self.assertEqual(asset.get("schedules")[0].journal_entry[:4], "DEPR") expected_gle = ( - ("_Test Accumulated Depreciations - _TC", 0.0, 35699.15), - ("_Test Depreciations - _TC", 35699.15, 0.0) + ("_Test Accumulated Depreciations - _TC", 0.0, 32129.24), + ("_Test Depreciations - _TC", 32129.24, 0.0) ) gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry` From 3d31bccaf63cf1d474615780744b2a2e6dd69a8a Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 25 Apr 2019 17:29:21 +0530 Subject: [PATCH 48/59] fix: Change dynamic_field name and minor fixes --- erpnext/crm/doctype/lead/lead.py | 4 +- .../crm/doctype/opportunity/opportunity.js | 23 ++++------ .../crm/doctype/opportunity/opportunity.json | 11 ++--- .../crm/doctype/opportunity/opportunity.py | 42 ++++++++----------- .../doctype/opportunity/test_opportunity.py | 14 +++---- .../crm/doctype/opportunity/test_records.json | 2 +- .../move_customer_lead_to_dynamic_column.py | 8 ++-- erpnext/selling/doctype/customer/customer.py | 3 -- .../doctype/customer/customer_dashboard.py | 4 +- .../selling/doctype/quotation/quotation.js | 10 ++--- .../selling/doctype/quotation/quotation.json | 8 ++-- .../selling/doctype/quotation/quotation.py | 6 +-- .../doctype/quotation/test_quotation.py | 10 ++--- .../doctype/quotation/test_records.json | 2 +- erpnext/shopping_cart/cart.py | 12 +++--- erpnext/shopping_cart/test_shopping_cart.py | 6 +-- 16 files changed, 75 insertions(+), 90 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index b80c43f1ff5..d3d31b8e702 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -90,11 +90,11 @@ class Lead(SellingController): return frappe.db.get_value("Customer", {"lead_name": self.name}) def has_opportunity(self): - return frappe.db.get_value("Opportunity", {"customer_lead": self.name, "status": ["!=", "Lost"]}) + return frappe.db.get_value("Opportunity", {"party_name": self.name, "status": ["!=", "Lost"]}) def has_quotation(self): return frappe.db.get_value("Quotation", { - "customer_lead": self.name, + "party_name": self.name, "docstatus": 1, "status": ["!=", "Lost"] diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 655427ea08b..88ce10c9561 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -20,7 +20,7 @@ frappe.ui.form.on("Opportunity", { }); }, - customer_lead: function(frm) { + party_name: function(frm) { if (frm.doc.opportunity_from == "Customer") { frm.trigger('set_contact_link'); erpnext.utils.get_party_details(frm); @@ -38,7 +38,7 @@ frappe.ui.form.on("Opportunity", { contact_person: erpnext.utils.get_contact_details, opportunity_from: function(frm) { - frm.toggle_reqd("customer_lead", frm.doc.opportunity_from); + frm.toggle_reqd("party_name", frm.doc.opportunity_from); frm.trigger("set_dynamic_field_label"); }, @@ -81,22 +81,17 @@ frappe.ui.form.on("Opportunity", { }, set_contact_link: function(frm) { - if(frm.doc.opportunity_from == "Customer" && frm.doc.customer_lead) { + if(frm.doc.opportunity_from == "Customer" && frm.doc.party_name) { frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'} - } else if(frm.doc.opportunity_from == "Lead" && frm.doc.customer_lead) { + } else if(frm.doc.opportunity_from == "Lead" && frm.doc.party_name) { frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'} } }, set_dynamic_field_label: function(frm){ - if (frm.doc.opportunity_from == "Customer") - { - frm.set_df_property("customer_lead", "label", "Customer"); - } - if (frm.doc.opportunity_from == "Lead") - { - frm.set_df_property("customer_lead", "label", "Lead"); + if (frm.doc.opportunity_from) { + frm.set_df_property("party_name", "label", frm.doc.opportunity_from); } }, @@ -162,7 +157,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ $.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm})); cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { - if(doc.opportunity_from == 'Lead' && doc.customer_lead) + if(doc.opportunity_from == 'Lead' && doc.party_name) cur_frm.cscript.lead(doc, cdt, cdn); } @@ -185,10 +180,10 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { } cur_frm.cscript.lead = function(doc, cdt, cdn) { - cur_frm.toggle_display("contact_info", doc.customer_lead); + cur_frm.toggle_display("contact_info", doc.party_name); erpnext.utils.map_current_doc({ method: "erpnext.crm.doctype.lead.lead.make_opportunity", - source_name: cur_frm.doc.customer_lead, + source_name: cur_frm.doc.party_name, frm: cur_frm }); } diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index 7e23a3c12bd..4026ff77ddb 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -127,7 +127,7 @@ "columns": 0, "depends_on": "", "fetch_if_empty": 0, - "fieldname": "customer_lead", + "fieldname": "party_name", "fieldtype": "Dynamic Link", "hidden": 0, "ignore_user_permissions": 0, @@ -148,7 +148,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "translatable": 0, @@ -162,6 +162,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_from": "party_name.customer_name", "fetch_if_empty": 0, "fieldname": "customer_name", "fieldtype": "Data", @@ -1467,7 +1468,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-04-14 21:00:16.007097", + "modified": "2019-04-25 17:10:09.399721", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", @@ -1515,11 +1516,11 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 0, - "search_fields": "status,transaction_date,customer_lead,opportunity_type,territory,company", + "search_fields": "status,transaction_date,party_name,opportunity_type,territory,company", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", - "timeline_field": "customer_lead", + "timeline_field": "party_name", "title_field": "title", "track_changes": 0, "track_seen": 1, diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 13337e1657e..ed58821cbbd 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -17,7 +17,7 @@ sender_field = "contact_email" class Opportunity(TransactionBase): def after_insert(self): if self.opportunity_from == "Lead": - frappe.get_doc("Lead", self.customer_lead).set_status(update=True) + frappe.get_doc("Lead", self.party_name).set_status(update=True) def validate(self): self._prev = frappe._dict({ @@ -29,9 +29,6 @@ class Opportunity(TransactionBase): self.make_new_lead_if_required() - if not self.opportunity_from: - frappe.throw(_("Opportunity From field is mandatory")) - self.validate_item_details() self.validate_uom_is_integer("uom", "qty") self.validate_lead_cust() @@ -45,7 +42,7 @@ class Opportunity(TransactionBase): def make_new_lead_if_required(self): """Set lead against new opportunity""" - if (not self.get("customer_lead")) and self.contact_email: + if (not self.get("party_name")) and self.contact_email: # check if customer is already created agains the self.contact_email customer = frappe.db.sql("""select distinct `tabDynamic Link`.link_name as customer @@ -61,7 +58,7 @@ class Opportunity(TransactionBase): `tabDynamic Link`.link_doctype='Customer' """.format(self.contact_email), as_dict=True) if customer and customer[0].customer: - self.customer_lead = customer[0].customer + self.party_name = customer[0].customer self.opportunity_from = "Customer" return @@ -90,7 +87,7 @@ class Opportunity(TransactionBase): lead_name = lead.name self.opportunity_from = "Lead" - self.customer_lead = lead_name + self.party_name = lead_name def declare_enquiry_lost(self,arg): if not self.has_active_quotation(): @@ -137,10 +134,10 @@ class Opportunity(TransactionBase): return True def validate_cust_name(self): - if self.customer_lead and self.opportunity_from == 'Customer': - self.customer_name = frappe.db.get_value("Customer", self.customer_lead, "customer_name") - elif self.customer_lead and self.opportunity_from == 'Lead': - lead_name, company_name = frappe.db.get_value("Lead", self.customer_lead, ["lead_name", "company_name"]) + if self.party_name and self.opportunity_from == 'Customer': + self.customer_name = frappe.db.get_value("Customer", self.party_name, "customer_name") + elif self.party_name and self.opportunity_from == 'Lead': + lead_name, company_name = frappe.db.get_value("Lead", self.party_name, ["lead_name", "company_name"]) self.customer_name = company_name or lead_name def on_update(self): @@ -153,16 +150,16 @@ class Opportunity(TransactionBase): opts.description = "" opts.contact_date = self.contact_date - if self.customer_lead and self.opportunity_from == 'Customer': + if self.party_name and self.opportunity_from == 'Customer': if self.contact_person: opts.description = 'Contact '+cstr(self.contact_person) else: - opts.description = 'Contact customer '+cstr(self.customer_lead) - elif self.customer_lead and self.opportunity_from == 'Lead': + opts.description = 'Contact customer '+cstr(self.party_name) + elif self.party_name and self.opportunity_from == 'Lead': if self.contact_display: opts.description = 'Contact '+cstr(self.contact_display) else: - opts.description = 'Contact lead '+cstr(self.customer_lead) + opts.description = 'Contact lead '+cstr(self.party_name) opts.subject = opts.description opts.description += '. By : ' + cstr(self.contact_by) @@ -187,14 +184,6 @@ class Opportunity(TransactionBase): for key in item_fields: if not d.get(key): d.set(key, item.get(key)) - def validate_lead_cust(self): - if self.opportunity_from == 'Lead': - if not self.customer_lead: - frappe.throw(_("Lead must be set if Opportunity is made from Lead")) - elif self.opportunity_from == 'Customer': - if not self.customer_lead: - msgprint(_("Customer is mandatory if 'Opportunity From' is selected as Customer"), raise_exception=1) - @frappe.whitelist() def get_item_details(item_code): @@ -216,8 +205,11 @@ def make_quotation(source_name, target_doc=None): quotation = frappe.get_doc(target) company_currency = frappe.get_cached_value('Company', quotation.company, "default_currency") - party_account_currency = get_party_account_currency("Customer", quotation.customer_lead, - quotation.company) if quotation.customer_lead else company_currency + + if quotation.quotation_to == 'Customer' and quotation.party_name: + party_account_currency = get_party_account_currency("Customer", quotation.party_name, quotation.company) + else: + party_account_currency = company_currency quotation.currency = party_account_currency or company_currency diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 1fc18bae24b..61dac90cd9f 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -37,13 +37,13 @@ class TestOpportunity(unittest.TestCase): # new lead should be created against the new.opportunity@example.com opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) - self.assertTrue(opp_doc.customer_lead) + self.assertTrue(opp_doc.party_name) self.assertEqual(opp_doc.opportunity_from, "Lead") - self.assertEqual(frappe.db.get_value("Lead", opp_doc.customer_lead, "email_id"), + self.assertEqual(frappe.db.get_value("Lead", opp_doc.party_name, "email_id"), 'new.opportunity@example.com') # create new customer and create new contact against 'new.opportunity@example.com' - customer = make_customer(opp_doc.customer_lead).insert(ignore_permissions=True) + customer = make_customer(opp_doc.party_name).insert(ignore_permissions=True) frappe.get_doc({ "doctype": "Contact", "email_id": "new.opportunity@example.com", @@ -55,9 +55,9 @@ class TestOpportunity(unittest.TestCase): }).insert(ignore_permissions=True) opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) - self.assertTrue(opp_doc.customer_lead) + self.assertTrue(opp_doc.party_name) self.assertEqual(opp_doc.opportunity_from, "Customer") - self.assertEqual(opp_doc.customer_lead, customer.name) + self.assertEqual(opp_doc.party_name, customer.name) def make_opportunity(**args): args = frappe._dict(args) @@ -72,10 +72,10 @@ def make_opportunity(**args): }) if opp_doc.opportunity_from == 'Customer': - opp_doc.customer_lead= args.customer or "_Test Customer" + opp_doc.party_name= args.customer or "_Test Customer" if opp_doc.opportunity_from == 'Lead': - opp_doc.customer_lead = args.lead or "_T-Lead-00001" + opp_doc.party_name = args.lead or "_T-Lead-00001" if args.with_items: opp_doc.append('items', { diff --git a/erpnext/crm/doctype/opportunity/test_records.json b/erpnext/crm/doctype/opportunity/test_records.json index afabb764a1f..a1e0ad921b4 100644 --- a/erpnext/crm/doctype/opportunity/test_records.json +++ b/erpnext/crm/doctype/opportunity/test_records.json @@ -4,7 +4,7 @@ "name": "_Test Opportunity 1", "opportunity_from": "Lead", "enquiry_type": "Sales", - "customer_lead": "_T-Lead-00001", + "party_name": "_T-Lead-00001", "transaction_date": "2013-12-12", "items": [{ "item_name": "Test Item", diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py index 33eb713cc51..5b1251c31cf 100644 --- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py +++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py @@ -6,9 +6,9 @@ import frappe def execute(): frappe.reload_doctype("Quotation") - frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) - frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) + frappe.db.sql(""" UPDATE `tabQuotation` set party_name = lead WHERE quotation_to = 'Lead' """) + frappe.db.sql(""" UPDATE `tabQuotation` set party_name = customer WHERE quotation_to = 'Customer' """) frappe.reload_doctype("Opportunity") - frappe.db.sql(""" UPDATE `tabOpportunity` set customer_lead = lead WHERE opportunity_from = 'Lead' """) - frappe.db.sql(""" UPDATE `tabOpportunity` set customer_lead = customer WHERE opportunity_from = 'Customer' """) \ No newline at end of file + frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = lead WHERE opportunity_from = 'Lead' """) + frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = customer WHERE opportunity_from = 'Customer' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 968b6faed39..f815e5f97cb 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -104,9 +104,6 @@ class Customer(TransactionBase): if self.lead_name: frappe.db.set_value('Lead', self.lead_name, 'status', 'Converted', update_modified=False) - for d in frappe.get_all('Opportunity', {'customer_lead': self.lead_name}): - frappe.db.set_value('Opportunity', d.name, 'customer_lead', self.name, update_modified=False) - def create_lead_address_contact(self): if self.lead_name: # assign lead address to customer (if already not set) diff --git a/erpnext/selling/doctype/customer/customer_dashboard.py b/erpnext/selling/doctype/customer/customer_dashboard.py index f8dbbd6d4ec..6d6c86fbefd 100644 --- a/erpnext/selling/doctype/customer/customer_dashboard.py +++ b/erpnext/selling/doctype/customer/customer_dashboard.py @@ -7,8 +7,8 @@ def get_data(): 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), 'fieldname': 'customer', 'non_standard_fieldnames': { - 'Quotation': 'customer_lead', - 'Opportunity': 'customer_lead' + 'Quotation': 'party_name', + 'Opportunity': 'party_name' }, 'transactions': [ { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 257f9919c88..3116e65b686 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -108,15 +108,15 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ set_dynamic_field_label: function(){ if (this.frm.doc.quotation_to == "Customer") { - this.frm.set_df_property("customer_lead", "label", "Customer"); - this.frm.fields_dict.customer_lead.get_query = null; + this.frm.set_df_property("party_name", "label", "Customer"); + this.frm.fields_dict.party_name.get_query = null; } if (this.frm.doc.quotation_to == "Lead") { - this.frm.set_df_property("customer_lead", "label", "Lead"); + this.frm.set_df_property("party_name", "label", "Lead"); - this.frm.fields_dict.customer_lead.get_query = function() { + this.frm.fields_dict.party_name.get_query = function() { return{ query: "erpnext.controllers.queries.lead_query" } } } @@ -126,7 +126,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ var me = this; // to overwrite the customer_filter trigger from queries.js - this.frm.toggle_reqd("customer_lead", this.frm.doc.quotation_to); + this.frm.toggle_reqd("party_name", this.frm.doc.quotation_to); this.frm.set_query('customer_address', erpnext.queries.address_query); this.frm.set_query('shipping_address_name', erpnext.queries.address_query); }, diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 87a8aab3cfc..4b247075451 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -161,7 +161,7 @@ "columns": 0, "depends_on": "", "fetch_if_empty": 0, - "fieldname": "customer_lead", + "fieldname": "party_name", "fieldtype": "Dynamic Link", "hidden": 0, "ignore_user_permissions": 0, @@ -3224,7 +3224,7 @@ "istable": 0, "max_attachments": 1, "menu_index": 0, - "modified": "2019-04-02 10:18:58.506125", + "modified": "2019-04-25 15:26:21.983298", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", @@ -3390,11 +3390,11 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 1, - "search_fields": "status,transaction_date,customer_lead,order_type", + "search_fields": "status,transaction_date,party_name,order_type", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", - "timeline_field": "customer_lead", + "timeline_field": "party_name", "title_field": "title", "track_changes": 0, "track_seen": 0, diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index e99b635af9b..42b68728ad2 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -43,8 +43,8 @@ class Quotation(SellingController): super(Quotation, self).validate_order_type() def update_lead(self): - if self.quotation_to == "Lead" and self.customer_lead: - frappe.get_doc("Lead", self.customer_lead).set_status(update=True) + if self.quotation_to == "Lead" and self.party_name: + frappe.get_doc("Lead", self.party_name).set_status(update=True) def update_opportunity(self): for opportunity in list(set([d.prevdoc_docname for d in self.get("items")])): @@ -204,7 +204,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): return doclist def _make_customer(source_name, ignore_permissions=False): - quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "customer_lead", "customer_name"]) + quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "party_name", "customer_name"]) if quotation and quotation[1] and not quotation[2]: lead_name = quotation[1] customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name}, diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 124c7922a80..8bb8c618f29 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -203,15 +203,15 @@ class TestQuotation(unittest.TestCase): test_records = frappe.get_test_records('Quotation') -def get_quotation_dict(customer_lead=None, item_code=None): - if not customer_lead: - customer_lead = '_Test Customer' +def get_quotation_dict(party_name=None, item_code=None): + if not party_name: + party_name = '_Test Customer' if not item_code: item_code = '_Test Item' return { 'doctype': 'Quotation', - 'customer_lead': customer_lead, + 'party_name': party_name, 'items': [ { 'item_code': item_code, @@ -229,7 +229,7 @@ def make_quotation(**args): qo.transaction_date = args.transaction_date qo.company = args.company or "_Test Company" - qo.customer_lead = args.customer_lead or "_Test Customer" + qo.party_name = args.party_name or "_Test Customer" qo.currency = args.currency or "INR" if args.selling_price_list: qo.selling_price_list = args.selling_price_list diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json index e18798926ba..1564f7de0ce 100644 --- a/erpnext/selling/doctype/quotation/test_records.json +++ b/erpnext/selling/doctype/quotation/test_records.json @@ -3,7 +3,7 @@ "company": "_Test Company", "conversion_rate": 1.0, "currency": "INR", - "customer_lead": "_Test Customer", + "party_name": "_Test Customer", "customer_group": "_Test Customer Group", "customer_name": "_Test Customer", "doctype": "Quotation", diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 59539e62572..efc128aa0c5 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -196,7 +196,7 @@ def _get_cart_quotation(party=None): party = get_party() quotation = frappe.get_all("Quotation", fields=["name"], filters= - {"customer_lead": party.name, "order_type": "Shopping Cart", "docstatus": 0}, + {"party_name": party.name, "order_type": "Shopping Cart", "docstatus": 0}, order_by="modified desc", limit_page_length=1) if quotation: @@ -211,7 +211,7 @@ def _get_cart_quotation(party=None): "status": "Draft", "docstatus": 0, "__islocal": 1, - "customer_lead": party.name + "party_name": party.name }) qdoc.contact_person = frappe.db.get_value("Contact", {"email_id": frappe.session.user}) @@ -291,9 +291,9 @@ def _set_price_list(quotation, cart_settings): # check if customer price list exists selling_price_list = None - if quotation.customer_lead: + if quotation.party_name: from erpnext.accounts.party import get_default_price_list - selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.customer_lead)) + selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.party_name)) # else check for territory based price list if not selling_price_list: @@ -305,9 +305,9 @@ def set_taxes(quotation, cart_settings): """set taxes based on billing territory""" from erpnext.accounts.party import set_taxes - customer_group = frappe.db.get_value("Customer", quotation.customer_lead, "customer_group") + customer_group = frappe.db.get_value("Customer", quotation.party_name, "customer_group") - quotation.taxes_and_charges = set_taxes(quotation.customer_lead, "Customer", \ + quotation.taxes_and_charges = set_taxes(quotation.party_name, "Customer", \ quotation.transaction_date, quotation.company, customer_group, None, \ quotation.customer_address, quotation.shipping_address_name, 1) # diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index adf57b85cdf..be08ec44445 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -43,7 +43,7 @@ class TestShoppingCart(unittest.TestCase): # test if quotation with customer is fetched quotation = _get_cart_quotation() self.assertEqual(quotation.quotation_to, "Customer") - self.assertEqual(quotation.customer_lead, "_Test Customer") + self.assertEqual(quotation.party_name, "_Test Customer") self.assertEqual(quotation.contact_email, frappe.session.user) return quotation @@ -105,7 +105,7 @@ class TestShoppingCart(unittest.TestCase): from erpnext.accounts.party import set_taxes - tax_rule_master = set_taxes(quotation.customer_lead, "Customer", \ + tax_rule_master = set_taxes(quotation.party_name, "Customer", \ quotation.transaction_date, quotation.company, None, None, \ quotation.customer_address, quotation.shipping_address_name, 1) self.assertEqual(quotation.taxes_and_charges, tax_rule_master) @@ -120,7 +120,7 @@ class TestShoppingCart(unittest.TestCase): "doctype": "Quotation", "quotation_to": "Customer", "order_type": "Shopping Cart", - "customer_lead": get_party(frappe.session.user).name, + "party_name": get_party(frappe.session.user).name, "docstatus": 0, "contact_email": frappe.session.user, "selling_price_list": "_Test Price List Rest of the World", From 13c15d0222bf7d1963d6b0fc3374d966e36e93d8 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 25 Apr 2019 17:46:44 +0530 Subject: [PATCH 49/59] fix: Trial balance finance book issue --- erpnext/accounts/report/financial_statements.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 52056ef2193..d26aeb11b9e 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -359,7 +359,8 @@ def set_gl_entries_by_account( "from_date": from_date, "to_date": to_date, "cost_center": filters.cost_center, - "project": filters.project + "project": filters.project, + "finance_book": filters.get("finance_book") }, as_dict=True) From 619bf561dac5cea03bbd664e72f1526a7bf56980 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Apr 2019 17:47:26 +0530 Subject: [PATCH 50/59] fix: Don't allocate advance if pos --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 1 + erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- erpnext/controllers/accounts_controller.py | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 8702a82cd6b..2d415bb5b17 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -285,6 +285,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ is_paid: function() { hide_fields(this.frm.doc); if(cint(this.frm.doc.is_paid)) { + this.frm.set_value("allocate_advances_automatically", 0); if(!this.frm.doc.company) { this.frm.set_value("is_paid", 0) frappe.msgprint(__("Please specify Company to proceed")); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 1ac69b3a180..a836a1813e6 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -356,7 +356,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte set_pos_data: function() { if(this.frm.doc.is_pos) { - this.frm.set_value("allocate_advances_automatically", this.frm.doc.is_pos ? 0 : 1); + this.frm.set_value("allocate_advances_automatically", 0); if(!this.frm.doc.company) { this.frm.set_value("is_pos", 0); frappe.msgprint(__("Please specify Company to proceed")); diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 6d2c30abb50..6d767edbdcb 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -88,7 +88,8 @@ class AccountsController(TransactionBase): self.validate_paid_amount() if self.doctype in ['Purchase Invoice', 'Sales Invoice']: - if cint(self.allocate_advances_automatically) and not cint(self.is_pos): + pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid" + if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)): self.set_advances() if self.is_return: From 80374be7249ca8b0450dd5229ceb1ac45b4ec496 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Apr 2019 18:44:10 +0530 Subject: [PATCH 51/59] refactor: Employee Tax Exemption --- .../employee_tax_exemption_category.json | 15 +- .../employee_tax_exemption_declaration.js | 13 + .../employee_tax_exemption_declaration.json | 219 +++++++-- .../employee_tax_exemption_declaration.py | 66 ++- ...test_employee_tax_exemption_declaration.py | 89 ++-- ...ee_tax_exemption_declaration_category.json | 299 +++++++------ ...employee_tax_exemption_proof_submission.js | 29 +- ...ployee_tax_exemption_proof_submission.json | 422 ++++++++++++------ ...employee_tax_exemption_proof_submission.py | 29 +- ...tax_exemption_proof_submission_detail.json | 62 ++- .../employee_tax_exemption_sub_category.json | 30 +- .../employee_tax_exemption_sub_category.py | 8 +- .../doctype/salary_slip/test_salary_slip.py | 281 +++++++----- erpnext/hr/utils.py | 35 +- erpnext/regional/india/setup.py | 28 +- erpnext/regional/india/utils.py | 67 ++- 16 files changed, 1109 insertions(+), 583 deletions(-) diff --git a/erpnext/hr/doctype/employee_tax_exemption_category/employee_tax_exemption_category.json b/erpnext/hr/doctype/employee_tax_exemption_category/employee_tax_exemption_category.json index 7b2804b3262..66fac5bee5c 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_category/employee_tax_exemption_category.json +++ b/erpnext/hr/doctype/employee_tax_exemption_category/employee_tax_exemption_category.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 1, @@ -20,6 +21,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "max_amount", "fieldtype": "Currency", "hidden": 0, @@ -29,7 +31,7 @@ "in_global_search": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Max Amount", + "label": "Max Exemption Amount", "length": 0, "no_copy": 0, "permlevel": 0, @@ -39,7 +41,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "translatable": 0, @@ -52,6 +54,8 @@ "bold": 0, "collapsible": 0, "columns": 0, + "default": "1", + "fetch_if_empty": 0, "fieldname": "is_active", "fieldtype": "Check", "hidden": 0, @@ -88,7 +92,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-06-19 16:33:48.419267", + "modified": "2019-04-25 13:20:31.367158", "modified_by": "Administrator", "module": "HR", "name": "Employee Tax Exemption Category", @@ -159,6 +163,7 @@ "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0 + "track_changes": 0, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.js b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.js index 9560df53e13..a827eca1c46 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.js +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.js @@ -10,6 +10,7 @@ frappe.ui.form.on('Employee Tax Exemption Declaration', { } } }); + frm.set_query('payroll_period', function() { const fields = {'employee': 'Employee', 'company': 'Company'}; @@ -27,6 +28,7 @@ frappe.ui.form.on('Employee Tax Exemption Declaration', { } } }); + frm.set_query('exemption_sub_category', 'declarations', function() { return { filters: { @@ -34,5 +36,16 @@ frappe.ui.form.on('Employee Tax Exemption Declaration', { } } }); + }, + + refresh: function(frm) { + if(frm.doc.docstatus==1) { + frm.add_custom_button(__('Submit Proof'), function() { + frappe.model.open_mapped_doc({ + method: "erpnext.hr.doctype.employee_tax_exemption_declaration.employee_tax_exemption_declaration.make_proof_submission", + frm: frm + }); + }).addClass("btn-primary"); + } } }); diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json index 899b869b90a..8891b97a5de 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json @@ -55,9 +55,43 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fetch_from": "employee.company", + "fetch_from": "employee.employee_name", "fetch_if_empty": 0, - "fieldname": "company", + "fieldname": "employee_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Employee Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "employee.department", + "fetch_if_empty": 0, + "fieldname": "department", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -66,15 +100,15 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Company", + "label": "Department", "length": 0, "no_copy": 0, - "options": "Company", + "options": "Department", "permlevel": 0, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 0, + "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -156,42 +190,9 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_from": "employee.company", "fetch_if_empty": 0, - "fieldname": "total_exemption_amount", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Total Exemption Amount", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "employee.department", - "fetch_if_empty": 0, - "fieldname": "department", + "fieldname": "company", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -200,15 +201,15 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Department", + "label": "Company", "length": 0, "no_copy": 0, - "options": "Department", + "options": "Company", "permlevel": 0, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 1, + "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -315,6 +316,136 @@ "set_only_once": 0, "translatable": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_10", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "total_declared_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Declared Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "total_exemption_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Exemption Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 } ], "has_web_view": 0, @@ -327,7 +458,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-04-23 15:50:48.693555", + "modified": "2019-04-25 16:38:05.847925", "modified_by": "Administrator", "module": "HR", "name": "Employee Tax Exemption Declaration", diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py index 186b2e10526..f3449d441ba 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py @@ -6,28 +6,60 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe import _ -from erpnext.hr.utils import validate_tax_declaration, calculate_annual_eligible_hra_exemption +from frappe.utils import flt +from frappe.model.mapper import get_mapped_doc +from erpnext.hr.utils import validate_tax_declaration, get_total_exemption_amount, calculate_annual_eligible_hra_exemption + +class DuplicateDeclarationError(frappe.ValidationError): pass class EmployeeTaxExemptionDeclaration(Document): def validate(self): validate_tax_declaration(self.declarations) - self.total_exemption_amount = 0 + self.validate_duplicate() + self.set_total_declared_amount() + self.set_total_exemption_amount() self.calculate_hra_exemption() - for item in self.declarations: - self.total_exemption_amount += item.amount - def before_submit(self): - if frappe.db.exists({"doctype": "Employee Tax Exemption Declaration", - "employee": self.employee, - "payroll_period": self.payroll_period, - "docstatus": 1}): - frappe.throw(_("Tax Declaration of {0} for period {1} already submitted.")\ - .format(self.employee, self.payroll_period), frappe.DocstatusTransitionError) + def validate_duplicate(self): + duplicate = frappe.db.exists({ + "doctype": "Employee Tax Exemption Declaration", + "employee": self.employee, + "payroll_period": self.payroll_period, + "name": ["!=", self.name] + }) + if duplicate: + frappe.throw(_("Duplicate Tax Declaration of {0} for period {1}") + .format(self.employee, self.payroll_period), DuplicateDeclarationError) + + def set_total_declared_amount(self): + self.total_declared_amount = 0.0 + for d in self.declarations: + self.total_declared_amount += flt(d.amount) + + def set_total_exemption_amount(self): + self.total_exemption_amount = get_total_exemption_amount(self.declarations) def calculate_hra_exemption(self): - hra_exemption = calculate_annual_eligible_hra_exemption(self) - if hra_exemption: - self.total_exemption_amount += hra_exemption["annual_exemption"] - self.salary_structure_hra = hra_exemption["hra_amount"] - self.annual_hra_exemption = hra_exemption["annual_exemption"] - self.monthly_hra_exemption = hra_exemption["monthly_exemption"] + self.salary_structure_hra, self.annual_hra_exemption, self.monthly_hra_exemption = 0, 0, 0 + if self.monthly_house_rent: + hra_exemption = calculate_annual_eligible_hra_exemption(self) + if hra_exemption: + self.total_exemption_amount += hra_exemption["annual_exemption"] + self.salary_structure_hra = hra_exemption["hra_amount"] + self.annual_hra_exemption = hra_exemption["annual_exemption"] + self.monthly_hra_exemption = hra_exemption["monthly_exemption"] + +@frappe.whitelist() +def make_proof_submission(source_name, target_doc=None): + doclist = get_mapped_doc("Employee Tax Exemption Declaration", source_name, { + "Employee Tax Exemption Declaration": { + "doctype": "Employee Tax Exemption Proof Submission", + "field_no_map": ["monthly_house_rent", "monthly_hra_exemption"] + }, + "Employee Tax Exemption Declaration Category": { + "doctype": "Employee Tax Exemption Proof Submission Detail", + "add_if_empty": True + } + }, target_doc) + + return doclist diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py b/erpnext/hr/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py index beaddd98dd0..9c87bbd1f30 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import frappe, erpnext import unittest from erpnext.hr.doctype.employee.test_employee import make_employee +from erpnext.hr.doctype.employee_tax_exemption_declaration.employee_tax_exemption_declaration import DuplicateDeclarationError class TestEmployeeTaxExemptionDeclaration(unittest.TestCase): def setUp(self): @@ -15,71 +16,71 @@ class TestEmployeeTaxExemptionDeclaration(unittest.TestCase): create_exemption_category() frappe.db.sql("""delete from `tabEmployee Tax Exemption Declaration`""") - def test_exemption_amount_greater_than_category_max(self): - declaration = frappe.get_doc({ - "doctype": "Employee Tax Exemption Declaration", - "employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"), - "payroll_period": "_Test Payroll Period", - "declarations": [dict(exemption_sub_category = "_Test Sub Category", - exemption_category = "_Test Category", - amount = 150000)] - }) - self.assertRaises(frappe.ValidationError, declaration.save) - declaration = frappe.get_doc({ - "doctype": "Employee Tax Exemption Declaration", - "payroll_period": "_Test Payroll Period", - "employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"), - "declarations": [dict(exemption_sub_category = "_Test Sub Category", - exemption_category = "_Test Category", - amount = 90000)] - }) - self.assertTrue(declaration.save) - def test_duplicate_category_in_declaration(self): declaration = frappe.get_doc({ "doctype": "Employee Tax Exemption Declaration", "employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"), "company": erpnext.get_default_company(), "payroll_period": "_Test Payroll Period", - "declarations": [dict(exemption_sub_category = "_Test Sub Category", - exemption_category = "_Test Category", - amount = 100000), - dict(exemption_sub_category = "_Test Sub Category", - exemption_category = "_Test Category", - amount = 50000), - ] + "declarations": [ + dict(exemption_sub_category = "_Test Sub Category", + exemption_category = "_Test Category", + amount = 100000), + dict(exemption_sub_category = "_Test Sub Category", + exemption_category = "_Test Category", + amount = 50000) + ] }) self.assertRaises(frappe.ValidationError, declaration.save) - def test_duplicate_submission_for_payroll_period(self): + def test_duplicate_entry_for_payroll_period(self): declaration = frappe.get_doc({ "doctype": "Employee Tax Exemption Declaration", "employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"), "company": erpnext.get_default_company(), "payroll_period": "_Test Payroll Period", - "declarations": [dict(exemption_sub_category = "_Test Sub Category", - exemption_category = "_Test Category", - amount = 100000), - dict(exemption_sub_category = "_Test1 Sub Category", - exemption_category = "_Test Category", - amount = 50000), - ] + "declarations": [ + dict(exemption_sub_category = "_Test Sub Category", + exemption_category = "_Test Category", + amount = 100000), + dict(exemption_sub_category = "_Test1 Sub Category", + exemption_category = "_Test Category", + amount = 50000), + ] }).insert() - declaration.submit() - self.assertEquals(declaration.docstatus, 1) + duplicate_declaration = frappe.get_doc({ "doctype": "Employee Tax Exemption Declaration", "employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"), "company": erpnext.get_default_company(), "payroll_period": "_Test Payroll Period", - "declarations": [dict(exemption_sub_category = "_Test Sub Category", - exemption_category = "_Test Category", - amount = 100000) - ] - }).insert() - self.assertRaises(frappe.DocstatusTransitionError, duplicate_declaration.submit) + "declarations": [ + dict(exemption_sub_category = "_Test Sub Category", + exemption_category = "_Test Category", + amount = 100000) + ] + }) + self.assertRaises(DuplicateDeclarationError, duplicate_declaration.insert) duplicate_declaration.employee = frappe.get_value("Employee", {"user_id":"employee1@taxexepmtion.com"}, "name") - self.assertTrue(duplicate_declaration.submit) + self.assertTrue(duplicate_declaration.insert) + + def test_exemption_amount(self): + declaration = frappe.get_doc({ + "doctype": "Employee Tax Exemption Declaration", + "employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"), + "company": erpnext.get_default_company(), + "payroll_period": "_Test Payroll Period", + "declarations": [ + dict(exemption_sub_category = "_Test Sub Category", + exemption_category = "_Test Category", + amount = 80000), + dict(exemption_sub_category = "_Test1 Sub Category", + exemption_category = "_Test Category", + amount = 60000), + ] + }).insert() + + self.assertEqual(declaration.total_exemption_amount, 100000) def create_payroll_period(): if not frappe.db.exists("Payroll Period", "_Test Payroll Period"): diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json b/erpnext/hr/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json index ebde4c9c717..56556c10305 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json @@ -1,140 +1,179 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2018-04-13 16:56:23.333041", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-04-13 16:56:23.333041", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "exemption_sub_category", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Exemption Sub Category", - "length": 0, - "no_copy": 0, - "options": "Employee Tax Exemption Sub Category", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "exemption_sub_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Exemption Sub Category", + "length": 0, + "no_copy": 0, + "options": "Employee Tax Exemption Sub Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "exemption_sub_category.exemption_category", - "fieldname": "exemption_category", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Exemption Category", - "length": 0, - "no_copy": 0, - "options": "Employee Tax Exemption Category", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "exemption_sub_category.exemption_category", + "fetch_if_empty": 0, + "fieldname": "exemption_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Exemption Category", + "length": 0, + "no_copy": 0, + "options": "Employee Tax Exemption Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amount", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Amount", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "exemption_sub_category.max_amount", + "fetch_if_empty": 0, + "fieldname": "max_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Maximum Exemption Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "amount", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Declared Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2018-05-29 15:58:05.779031", - "modified_by": "Administrator", - "module": "HR", - "name": "Employee Tax Exemption Declaration Category", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0 + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-04-25 15:45:11.279158", + "modified_by": "Administrator", + "module": "HR", + "name": "Employee Tax Exemption Declaration Category", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js index 99bec14b180..66118c08111 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js +++ b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js @@ -10,6 +10,7 @@ frappe.ui.form.on('Employee Tax Exemption Proof Submission', { } } }); + frm.set_query('payroll_period', function() { if(frm.doc.employee && frm.doc.company){ return { @@ -21,6 +22,7 @@ frappe.ui.form.on('Employee Tax Exemption Proof Submission', { frappe.msgprint(__("Please select Employee")); } }); + frm.set_query('exemption_sub_category', 'tax_exemption_proofs', function() { return { filters: { @@ -29,11 +31,28 @@ frappe.ui.form.on('Employee Tax Exemption Proof Submission', { } }); }, - employee: function(frm){ - if(frm.doc.employee){ - frm.add_fetch('employee', 'company', 'company'); - }else{ - frm.set_value('company', ''); + + refresh: function(frm) { + if(frm.doc.docstatus === 0) { + let filters = { + docstatus: 1, + company: frm.doc.company + }; + if(frm.doc.employee) filters["employee"] = frm.doc.employee; + if(frm.doc.payroll_period) filters["payroll_period"] = frm.doc.payroll_period; + + frm.add_custom_button(__('Get Details From Declaration'), function() { + erpnext.utils.map_current_doc({ + method: "erpnext.hr.doctype.employee_tax_exemption_declaration.employee_tax_exemption_declaration.make_proof_submission", + source_doctype: "Employee Tax Exemption Declaration", + target: frm, + date_field: "creation", + setters: { + employee: frm.doc.employee || undefined + }, + get_query_filters: filters + }); + }); } } }); diff --git a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json index ebc04353e0a..76c09d6c7b7 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json +++ b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json @@ -1,8 +1,9 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, + "allow_import": 1, + "allow_rename": 1, "autoname": "HR-TAX-PRF-.YYYY.-.#####", "beta": 0, "creation": "2018-04-13 17:24:11.456132", @@ -20,6 +21,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "employee", "fieldtype": "Link", "hidden": 0, @@ -53,8 +55,10 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "company", - "fieldtype": "Link", + "fetch_from": "employee.employee_name", + "fetch_if_empty": 0, + "fieldname": "employee_name", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -62,10 +66,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Company", + "label": "Employee Name", "length": 0, "no_copy": 0, - "options": "Company", "permlevel": 0, "precision": "", "print_hide": 0, @@ -79,70 +82,6 @@ "translatable": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "payroll_period", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Payroll Period", - "length": 0, - "no_copy": 0, - "options": "Payroll Period", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -151,6 +90,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "employee.department", + "fetch_if_empty": 0, "fieldname": "department", "fieldtype": "Link", "hidden": 0, @@ -184,8 +124,9 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "submission_date", - "fieldtype": "Date", + "fetch_if_empty": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -193,7 +134,6 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Submission Date", "length": 0, "no_copy": 0, "permlevel": 0, @@ -216,6 +156,273 @@ "bold": 0, "collapsible": 0, "columns": 0, + "default": "Today", + "fetch_if_empty": 0, + "fieldname": "submission_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Submission Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "payroll_period", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Payroll Period", + "length": 0, + "no_copy": 0, + "options": "Payroll Period", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "employee.company", + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "tax_exemption_proofs", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tax Exemption Proofs", + "length": 0, + "no_copy": 0, + "options": "Employee Tax Exemption Proof Submission Detail", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_10", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "total_actual_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Actual Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "exemption_amount", "fieldtype": "Currency", "hidden": 0, @@ -248,70 +455,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "section_break_5", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "tax_exemption_proofs", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Tax Exemption Proofs", - "length": 0, - "no_copy": 0, - "options": "Employee Tax Exemption Proof Submission Detail", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, + "fetch_if_empty": 0, "fieldname": "attachment_section", "fieldtype": "Section Break", "hidden": 0, @@ -344,6 +488,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "attachments", "fieldtype": "Attach", "hidden": 0, @@ -376,6 +521,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amended_from", "fieldtype": "Link", "hidden": 0, @@ -412,7 +558,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-08-21 16:15:38.096846", + "modified": "2019-04-25 17:06:36.569549", "modified_by": "Administrator", "module": "HR", "name": "Employee Tax Exemption Proof Submission", diff --git a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py index 54e0b2041bc..5299cacd258 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py +++ b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py @@ -6,20 +6,29 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe import _ -from erpnext.hr.utils import validate_tax_declaration, calculate_hra_exemption_for_period +from frappe.utils import flt +from erpnext.hr.utils import validate_tax_declaration, get_total_exemption_amount, calculate_hra_exemption_for_period class EmployeeTaxExemptionProofSubmission(Document): def validate(self): validate_tax_declaration(self.tax_exemption_proofs) - self.exemption_amount = 0 + self.set_total_actual_amount() + self.set_total_exemption_amount() self.calculate_hra_exemption() - for proof in self.tax_exemption_proofs: - self.exemption_amount += proof.amount + + def set_total_actual_amount(self): + self.total_actual_amount = flt(self.house_rent_payment_amount) + for d in self.tax_exemption_proofs: + self.total_actual_amount += flt(d.amount) + + def set_total_exemption_amount(self): + self.exemption_amount = get_total_exemption_amount(self.tax_exemption_proofs) def calculate_hra_exemption(self): - hra_exemption = calculate_hra_exemption_for_period(self) - if hra_exemption: - self.exemption_amount += hra_exemption["total_eligible_hra_exemption"] - self.monthly_hra_exemption = hra_exemption["monthly_exemption"] - self.monthly_house_rent = hra_exemption["monthly_house_rent"] - self.total_eligible_hra_exemption = hra_exemption["total_eligible_hra_exemption"] + if self.house_rent_payment_amount: + hra_exemption = calculate_hra_exemption_for_period(self) + if hra_exemption: + self.exemption_amount += hra_exemption["total_eligible_hra_exemption"] + self.monthly_hra_exemption = hra_exemption["monthly_exemption"] + self.monthly_house_rent = hra_exemption["monthly_house_rent"] + self.total_eligible_hra_exemption = hra_exemption["total_eligible_hra_exemption"] \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json b/erpnext/hr/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json index c1c5896d7f9..b9254afad07 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json +++ b/erpnext/hr/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, @@ -14,10 +15,12 @@ "fields": [ { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "exemption_sub_category", "fieldtype": "Link", "hidden": 0, @@ -41,16 +44,18 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "fetch_from": "exemption_sub_category.exemption_category", + "fetch_from": "exemption_sub_category.exemption_category", + "fetch_if_empty": 0, "fieldname": "exemption_category", "fieldtype": "Read Only", "hidden": 0, @@ -74,15 +79,51 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_from": "exemption_sub_category.max_amount", + "fetch_if_empty": 0, + "fieldname": "max_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Maximum Exemption Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "type_of_proof", "fieldtype": "Data", "hidden": 0, @@ -106,15 +147,17 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -124,7 +167,7 @@ "in_global_search": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Amount", + "label": "Actual Amount", "length": 0, "no_copy": 0, "permlevel": 0, @@ -134,10 +177,10 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 } ], @@ -151,7 +194,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2018-05-16 22:42:59.750733", + "modified": "2019-04-25 15:45:03.154904", "modified_by": "Administrator", "module": "HR", "name": "Employee Tax Exemption Proof Submission Detail", @@ -165,5 +208,6 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.json b/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.json index dc997850675..b0e492e7ca4 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.json +++ b/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 1, @@ -15,10 +16,12 @@ "fields": [ { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "exemption_category", "fieldtype": "Link", "hidden": 0, @@ -26,8 +29,8 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, + "in_list_view": 1, + "in_standard_filter": 1, "label": "Tax Exemption Category", "length": 0, "no_copy": 0, @@ -42,14 +45,18 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_from": "exemption_category.max_amount", + "fetch_if_empty": 1, "fieldname": "max_amount", "fieldtype": "Currency", "hidden": 0, @@ -59,7 +66,7 @@ "in_global_search": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Max Amount", + "label": "Max Exemption Amount", "length": 0, "no_copy": 0, "permlevel": 0, @@ -69,17 +76,21 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "default": "1", + "fetch_if_empty": 0, "fieldname": "is_active", "fieldtype": "Check", "hidden": 0, @@ -102,6 +113,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -115,7 +127,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-05-09 13:25:01.595240", + "modified": "2019-04-25 13:24:05.164877", "modified_by": "Administrator", "module": "HR", "name": "Employee Tax Exemption Sub Category", @@ -124,7 +136,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -144,7 +155,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -164,7 +174,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -189,6 +198,7 @@ "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0 + "track_changes": 0, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py b/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py index cd58136d8db..a8dd7e4d6dd 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py +++ b/erpnext/hr/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py @@ -4,7 +4,13 @@ from __future__ import unicode_literals import frappe +from frappe import _ +from frappe.utils import flt from frappe.model.document import Document class EmployeeTaxExemptionSubCategory(Document): - pass + def validate(self): + category_max_amount = frappe.db.get_value("Employee Tax Exemption Category", self.exemption_category, "max_amount") + if flt(self.max_amount) > flt(category_max_amount): + frappe.throw(_("Max Exemption Amount cannot be greater than maximum exemption amount {0} of Tax Exemption Category {1}") + .format(category_max_amount, self.exemption_category)) \ No newline at end of file diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py index 079bec51b2e..746bf8cff1d 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py @@ -13,7 +13,8 @@ from frappe.utils import getdate, nowdate, add_days, add_months, flt, get_first_ from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip from erpnext.hr.doctype.payroll_entry.payroll_entry import get_month_details from erpnext.hr.doctype.employee.test_employee import make_employee -from erpnext.hr.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration import create_payroll_period, create_exemption_category +from erpnext.hr.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration \ + import create_payroll_period, create_exemption_category class TestSalarySlip(unittest.TestCase): def setUp(self): @@ -36,8 +37,10 @@ class TestSalarySlip(unittest.TestCase): no_of_days = self.get_no_of_days() frappe.db.set_value("HR Settings", None, "include_holidays_in_total_working_days", 1) make_employee("test_employee@salary.com") - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None) - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active") + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None) + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active") ss = make_employee_salary_slip("test_employee@salary.com", "Monthly") self.assertEqual(ss.total_working_days, no_of_days[0]) @@ -53,8 +56,10 @@ class TestSalarySlip(unittest.TestCase): no_of_days = self.get_no_of_days() frappe.db.set_value("HR Settings", None, "include_holidays_in_total_working_days", 0) make_employee("test_employee@salary.com") - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None) - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active") + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None) + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active") ss = make_employee_salary_slip("test_employee@salary.com", "Monthly") self.assertEqual(ss.total_working_days, no_of_days[0] - no_of_days[1]) @@ -100,16 +105,21 @@ class TestSalarySlip(unittest.TestCase): self.assertEqual(ss.payment_days, (no_of_days[0] - getdate(date_of_joining).day + 1)) # set relieving date in the same month - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "date_of_joining", (add_days(nowdate(),-60))) - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", relieving_date) - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "status", "Left") + frappe.db.set_value("Employee",frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "date_of_joining", (add_days(nowdate(),-60))) + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", relieving_date) + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "status", "Left") ss.save() self.assertEqual(ss.total_working_days, no_of_days[0]) self.assertEqual(ss.payment_days, getdate(relieving_date).day) - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None) - frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active") + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None) + frappe.db.set_value("Employee", frappe.get_value("Employee", + {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active") def test_employee_salary_slip_read_permission(self): make_employee("test_employee@salary.com") @@ -168,17 +178,22 @@ class TestSalarySlip(unittest.TestCase): def test_tax_for_payroll_period(self): data = {} - # test the impact of tax exemption declaration, tax exemption proof submission and deduct check boxes in annual tax calculation + # test the impact of tax exemption declaration, tax exemption proof submission + # and deduct check boxes in annual tax calculation # as per assigned salary structure 40500 in monthly salary so 236000*5/100/12 frappe.db.sql("""delete from `tabPayroll Period`""") frappe.db.sql("""delete from `tabSalary Component`""") payroll_period = create_payroll_period() create_tax_slab(payroll_period) employee = make_employee("test_tax@salary.slip") - delete_docs = ["Salary Slip", "Additional Salary", - "Employee Tax Exemption Declaration", - "Employee Tax Exemption Proof Submission", - "Employee Benefit Claim", "Salary Structure Assignment"] + delete_docs = [ + "Salary Slip", + "Additional Salary", + "Employee Tax Exemption Declaration", + "Employee Tax Exemption Proof Submission", + "Employee Benefit Claim", + "Salary Structure Assignment" + ] for doc in delete_docs: frappe.db.sql("delete from `tab%s` where employee='%s'" % (doc, employee)) @@ -298,12 +313,11 @@ def make_employee_salary_slip(user, payroll_frequency, salary_structure=None): if not salary_slip: salary_slip = make_salary_slip(salary_structure_doc.name, employee = employee) - salary_slip.employee_name = frappe.get_value("Employee", {"name":frappe.db.get_value("Employee", {"user_id": user})}, "employee_name") + salary_slip.employee_name = frappe.get_value("Employee", + {"name":frappe.db.get_value("Employee", {"user_id": user})}, "employee_name") salary_slip.payroll_frequency = payroll_frequency salary_slip.posting_date = nowdate() salary_slip.insert() - # salary_slip.submit() - # salary_slip = salary_slip.name return salary_slip @@ -338,99 +352,99 @@ def create_account(company): salary_account = frappe.db.get_value("Account", "Salary - " + frappe.get_cached_value('Company', company, 'abbr')) if not salary_account: frappe.get_doc({ - "doctype": "Account", - "account_name": "Salary", - "parent_account": "Indirect Expenses - " + frappe.get_cached_value('Company', company, 'abbr'), - "company": company + "doctype": "Account", + "account_name": "Salary", + "parent_account": "Indirect Expenses - " + frappe.get_cached_value('Company', company, 'abbr'), + "company": company }).insert() return salary_account def make_earning_salary_component(setup=False, test_tax=False): data = [ + { + "salary_component": 'Basic Salary', + "abbr":'BS', + "condition": 'base > 10000', + "formula": 'base*.5', + "type": "Earning", + "amount_based_on_formula": 1 + }, + { + "salary_component": 'HRA', + "abbr":'H', + "amount": 3000, + "type": "Earning" + }, + { + "salary_component": 'Special Allowance', + "abbr":'SA', + "condition": 'H < 10000', + "formula": 'BS*.5', + "type": "Earning", + "amount_based_on_formula": 1 + }, + { + "salary_component": "Leave Encashment", + "abbr": 'LE', + "is_additional_component": 1, + "type": "Earning" + } + ] + if test_tax: + data.extend([ { - "salary_component": 'Basic Salary', - "abbr":'BS', - "condition": 'base > 10000', - "formula": 'base*.5', + "salary_component": "Leave Travel Allowance", + "abbr": 'B', + "is_flexible_benefit": 1, "type": "Earning", - "amount_based_on_formula": 1 + "pay_against_benefit_claim": 1, + "max_benefit_amount": 100000 }, { - "salary_component": 'HRA', - "abbr":'H', - "amount": 3000, - "type": "Earning" - }, - { - "salary_component": 'Special Allowance', - "abbr":'SA', - "condition": 'H < 10000', - "formula": 'BS*.5', + "salary_component": "Medical Allowance", + "abbr": 'B', + "is_flexible_benefit": 1, + "pay_against_benefit_claim": 0, "type": "Earning", - "amount_based_on_formula": 1 + "max_benefit_amount": 15000 }, { - "salary_component": "Leave Encashment", - "abbr": 'LE', + "salary_component": "Perfomance Bonus", + "abbr": 'B', "is_additional_component": 1, "type": "Earning" } - ] - if test_tax: - data.extend([ - { - "salary_component": "Leave Travel Allowance", - "abbr": 'B', - "is_flexible_benefit": 1, - "type": "Earning", - "pay_against_benefit_claim": 1, - "max_benefit_amount": 100000 - }, - { - "salary_component": "Medical Allowance", - "abbr": 'B', - "is_flexible_benefit": 1, - "pay_against_benefit_claim": 0, - "type": "Earning", - "max_benefit_amount": 15000 - }, - { - "salary_component": "Perfomance Bonus", - "abbr": 'B', - "is_additional_component": 1, - "type": "Earning" - } - ]) + ]) if setup or test_tax: make_salary_component(data, test_tax) data.append({ - "salary_component": 'Basic Salary', - "abbr":'BS', - "condition": 'base < 10000', - "formula": 'base*.2', - "type": "Earning", - "amount_based_on_formula": 1 - }) + "salary_component": 'Basic Salary', + "abbr":'BS', + "condition": 'base < 10000', + "formula": 'base*.2', + "type": "Earning", + "amount_based_on_formula": 1 + }) return data def make_deduction_salary_component(setup=False, test_tax=False): data = [ - { - "salary_component": 'Professional Tax', - "abbr":'PT', - "condition": 'base > 10000', - "formula": 'base*.1', - "type": "Deduction", - "amount_based_on_formula": 1 - }, - { - "salary_component": 'TDS', - "abbr":'T', - "formula": 'base*.1', - "type": "Deduction", - "amount_based_on_formula": 1 - } - ] + { + "salary_component": 'Professional Tax', + "abbr":'PT', + "condition": 'base > 10000', + "formula": 'base*.1', + "type": "Deduction", + "amount_based_on_formula": 1 + }, + { + "salary_component": 'TDS', + "abbr":'T', + "formula": 'base*.1', + "type": "Deduction", + "amount_based_on_formula": 1 + } + ] if not test_tax: data.append({ "salary_component": 'TDS', @@ -453,48 +467,63 @@ def get_tax_paid_in_period(employee): def create_exemption_declaration(employee, payroll_period): create_exemption_category() - declaration = frappe.get_doc({"doctype": "Employee Tax Exemption Declaration", - "employee": employee, - "payroll_period": payroll_period, - "company": erpnext.get_default_company()}) - declaration.append("declarations", {"exemption_sub_category": "_Test Sub Category", - "exemption_category": "_Test Category", - "amount": 100000}) + declaration = frappe.get_doc({ + "doctype": "Employee Tax Exemption Declaration", + "employee": employee, + "payroll_period": payroll_period, + "company": erpnext.get_default_company() + }) + declaration.append("declarations", { + "exemption_sub_category": "_Test Sub Category", + "exemption_category": "_Test Category", + "amount": 100000 + }) declaration.submit() def create_proof_submission(employee, payroll_period, amount): submission_date = add_months(payroll_period.start_date, random.randint(0, 11)) - proof_submission = frappe.get_doc({"doctype": "Employee Tax Exemption Proof Submission", - "employee": employee, - "payroll_period": payroll_period.name, - "submission_date": submission_date}) - proof_submission.append("tax_exemption_proofs", {"exemption_sub_category": "_Test Sub Category", - "exemption_category": "_Test Category", "type_of_proof": "Test", "amount": amount}) + proof_submission = frappe.get_doc({ + "doctype": "Employee Tax Exemption Proof Submission", + "employee": employee, + "payroll_period": payroll_period.name, + "submission_date": submission_date + }) + proof_submission.append("tax_exemption_proofs", { + "exemption_sub_category": "_Test Sub Category", + "exemption_category": "_Test Category", + "type_of_proof": "Test", "amount": amount + }) proof_submission.submit() return submission_date def create_benefit_claim(employee, payroll_period, amount, component): claim_date = add_months(payroll_period.start_date, random.randint(0, 11)) - frappe.get_doc({"doctype": "Employee Benefit Claim", "employee": employee, - "claimed_amount": amount, "claim_date": claim_date, "earning_component": - component}).submit() + frappe.get_doc({ + "doctype": "Employee Benefit Claim", + "employee": employee, + "claimed_amount": amount, + "claim_date": claim_date, + "earning_component": component + }).submit() return claim_date def create_tax_slab(payroll_period): - data = [{ - "from_amount": 250000, - "to_amount": 500000, - "percent_deduction": 5 - }, - { - "from_amount": 500000, - "to_amount": 1000000, - "percent_deduction": 20 - }, - { - "from_amount": 1000000, - "percent_deduction": 30 - }] + data = [ + { + "from_amount": 250000, + "to_amount": 500000, + "percent_deduction": 5 + }, + { + "from_amount": 500000, + "to_amount": 1000000, + "percent_deduction": 20 + }, + { + "from_amount": 1000000, + "percent_deduction": 30 + } + ] payroll_period.taxable_salary_slabs = [] for item in data: payroll_period.append("taxable_salary_slabs", item) @@ -526,9 +555,13 @@ def create_salary_slips_for_payroll_period(employee, salary_structure, payroll_p def create_additional_salary(employee, payroll_period, amount): salary_date = add_months(payroll_period.start_date, random.randint(0, 11)) - frappe.get_doc({"doctype": "Additional Salary", "employee": employee, - "company": erpnext.get_default_company(), - "salary_component": "Perfomance Bonus", - "payroll_date": salary_date, - "amount": amount, "type": "Earning"}).submit() + frappe.get_doc({ + "doctype": "Additional Salary", + "employee": employee, + "company": erpnext.get_default_company(), + "salary_component": "Perfomance Bonus", + "payroll_date": salary_date, + "amount": amount, + "type": "Earning" + }).submit() return salary_date diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index 02262012f1c..ebd225d713d 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -220,16 +220,31 @@ def get_employee_leave_policy(employee): def validate_tax_declaration(declarations): subcategories = [] - for declaration in declarations: - if declaration.exemption_sub_category in subcategories: - frappe.throw(_("More than one selection for {0} not \ - allowed").format(declaration.exemption_sub_category), frappe.ValidationError) - subcategories.append(declaration.exemption_sub_category) - max_amount = frappe.db.get_value("Employee Tax Exemption Sub Category", \ - declaration.exemption_sub_category, "max_amount") - if declaration.amount > max_amount: - frappe.throw(_("Max exemption amount for {0} is {1}").format(\ - declaration.exemption_sub_category, max_amount), frappe.ValidationError) + for d in declarations: + if d.exemption_sub_category in subcategories: + frappe.throw(_("More than one selection for {0} not allowed").format(d.exemption_sub_category)) + subcategories.append(d.exemption_sub_category) + +def get_total_exemption_amount(declarations): + exemption_category = list(set([d.exemption_category for d in declarations])) + exemptions = frappe._dict() + for d in declarations: + exemptions.setdefault(d.exemption_category, frappe._dict()) + category_max_amount = exemptions.get(d.exemption_category).max_amount + if not category_max_amount: + category_max_amount = frappe.db.get_value("Employee Tax Exemption Category", d.exemption_category, "max_amount") + exemptions.get(d.exemption_category).max_amount = category_max_amount + sub_category_exemption_amount = d.max_amount \ + if (d.max_amount and flt(d.amount) > flt(d.max_amount)) else d.amount + + exemptions.get(d.exemption_category).setdefault("total_exemption_amount", 0.0) + exemptions.get(d.exemption_category).total_exemption_amount += flt(sub_category_exemption_amount) + + if category_max_amount and exemptions.get(d.exemption_category).total_exemption_amount > category_max_amount: + exemptions.get(d.exemption_category).total_exemption_amount = category_max_amount + + total_exemption_amount = sum([flt(d.total_exemption_amount) for d in exemptions.values()]) + return total_exemption_amount def get_leave_period(from_date, to_date, company): leave_period = frappe.db.sql(""" diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index 34d5991e7e0..f1a64dc8310 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -262,18 +262,18 @@ def make_custom_fields(update=True): 'Employee Tax Exemption Declaration':[ dict(fieldname='hra_section', label='HRA Exemption', fieldtype='Section Break', insert_after='declarations'), - dict(fieldname='salary_structure_hra', label='HRA as per Salary Structure', - fieldtype='Currency', insert_after='hra_section', read_only=1), dict(fieldname='monthly_house_rent', label='Monthly House Rent', - fieldtype='Currency', insert_after='salary_structure_hra'), + fieldtype='Currency', insert_after='hra_section'), dict(fieldname='rented_in_metro_city', label='Rented in Metro City', - fieldtype='Check', insert_after='monthly_house_rent'), + fieldtype='Check', insert_after='monthly_house_rent', depends_on='monthly_house_rent'), + dict(fieldname='salary_structure_hra', label='HRA as per Salary Structure', + fieldtype='Currency', insert_after='rented_in_metro_city', read_only=1, depends_on='monthly_house_rent'), dict(fieldname='hra_column_break', fieldtype='Column Break', - insert_after='rented_in_metro_city'), + insert_after='salary_structure_hra', depends_on='monthly_house_rent'), dict(fieldname='annual_hra_exemption', label='Annual HRA Exemption', - fieldtype='Currency', insert_after='hra_column_break', read_only=1), + fieldtype='Currency', insert_after='hra_column_break', read_only=1, depends_on='monthly_house_rent'), dict(fieldname='monthly_hra_exemption', label='Monthly HRA Exemption', - fieldtype='Currency', insert_after='annual_hra_exemption', read_only=1) + fieldtype='Currency', insert_after='annual_hra_exemption', read_only=1, depends_on='monthly_house_rent') ], 'Employee Tax Exemption Proof Submission': [ dict(fieldname='hra_section', label='HRA Exemption', @@ -281,19 +281,19 @@ def make_custom_fields(update=True): dict(fieldname='house_rent_payment_amount', label='House Rent Payment Amount', fieldtype='Currency', insert_after='hra_section'), dict(fieldname='rented_in_metro_city', label='Rented in Metro City', - fieldtype='Check', insert_after='house_rent_payment_amount'), + fieldtype='Check', insert_after='house_rent_payment_amount', depends_on='house_rent_payment_amount'), dict(fieldname='rented_from_date', label='Rented From Date', - fieldtype='Date', insert_after='rented_in_metro_city'), + fieldtype='Date', insert_after='rented_in_metro_city', depends_on='house_rent_payment_amount'), dict(fieldname='rented_to_date', label='Rented To Date', - fieldtype='Date', insert_after='rented_from_date'), + fieldtype='Date', insert_after='rented_from_date', depends_on='house_rent_payment_amount'), dict(fieldname='hra_column_break', fieldtype='Column Break', - insert_after='rented_to_date'), + insert_after='rented_to_date', depends_on='house_rent_payment_amount'), dict(fieldname='monthly_house_rent', label='Monthly House Rent', - fieldtype='Currency', insert_after='hra_column_break', read_only=1), + fieldtype='Currency', insert_after='hra_column_break', read_only=1, depends_on='house_rent_payment_amount'), dict(fieldname='monthly_hra_exemption', label='Monthly Eligible Amount', - fieldtype='Currency', insert_after='monthly_house_rent', read_only=1), + fieldtype='Currency', insert_after='monthly_house_rent', read_only=1, depends_on='house_rent_payment_amount'), dict(fieldname='total_eligible_hra_exemption', label='Total Eligible HRA Exemption', - fieldtype='Currency', insert_after='monthly_hra_exemption', read_only=1) + fieldtype='Currency', insert_after='monthly_hra_exemption', read_only=1, depends_on='house_rent_payment_amount') ], 'Supplier': [ { diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 9747b245694..aafcc9ebaed 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import frappe, re from frappe import _ -from frappe.utils import cstr, flt, date_diff, getdate +from frappe.utils import cstr, flt, date_diff, getdate, nowdate from erpnext.regional.india import states, state_numbers from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount from erpnext.controllers.accounts_controller import get_taxes_and_charges @@ -144,24 +144,40 @@ def get_regional_address_details(out, doctype, company): def calculate_annual_eligible_hra_exemption(doc): basic_component = frappe.get_cached_value('Company', doc.company, "basic_component") hra_component = frappe.get_cached_value('Company', doc.company, "hra_component") + if not (basic_component and hra_component): + frappe.throw(_("Please mention Basic and HRA component in Company")) + annual_exemption, monthly_exemption, hra_amount = 0, 0, 0 if hra_component and basic_component: - assignment = get_salary_assignment(doc.employee, getdate()) - if assignment and frappe.db.exists("Salary Detail", { - "parent": assignment.salary_structure, - "salary_component": hra_component, "parentfield": "earnings"}): - basic_amount, hra_amount = get_component_amt_from_salary_slip(doc.employee, - assignment.salary_structure, basic_component, hra_component) - if hra_amount: - if doc.monthly_house_rent: - annual_exemption = calculate_hra_exemption(assignment.salary_structure, - basic_amount, hra_amount, doc.monthly_house_rent, - doc.rented_in_metro_city) - if annual_exemption > 0: - monthly_exemption = annual_exemption / 12 - else: - annual_exemption = 0 - return {"hra_amount": hra_amount, "annual_exemption": annual_exemption, "monthly_exemption": monthly_exemption} + assignment = get_salary_assignment(doc.employee, nowdate()) + + if assignment: + hra_component_exists = frappe.db.exists("Salary Detail", { + "parent": assignment.salary_structure, + "salary_component": hra_component, + "parentfield": "earnings", + "parenttype": "Salary Structure" + }) + if hra_component_exists: + basic_amount, hra_amount = get_component_amt_from_salary_slip(doc.employee, + assignment.salary_structure, basic_component, hra_component) + if hra_amount: + if doc.monthly_house_rent: + annual_exemption = calculate_hra_exemption(assignment.salary_structure, + basic_amount, hra_amount, doc.monthly_house_rent, + doc.rented_in_metro_city) + if annual_exemption > 0: + monthly_exemption = annual_exemption / 12 + else: + annual_exemption = 0 + elif doc.docstatus == 1: + frappe.throw(_("Salary Structure must be submitted before submission of Tax Ememption Declaration")) + + return frappe._dict({ + "hra_amount": hra_amount, + "annual_exemption": annual_exemption, + "monthly_exemption": monthly_exemption + }) def get_component_amt_from_salary_slip(employee, salary_structure, basic_component, hra_component): salary_slip = make_salary_slip(salary_structure, employee=employee) @@ -181,8 +197,10 @@ def calculate_hra_exemption(salary_structure, basic, monthly_hra, monthly_house_ frequency = frappe.get_value("Salary Structure", salary_structure, "payroll_frequency") # case 1: The actual amount allotted by the employer as the HRA. exemptions.append(get_annual_component_pay(frequency, monthly_hra)) + actual_annual_rent = monthly_house_rent * 12 annual_basic = get_annual_component_pay(frequency, basic) + # case 2: Actual rent paid less 10% of the basic salary. exemptions.append(flt(actual_annual_rent) - flt(annual_basic * 0.1)) # case 3: 50% of the basic salary, if the employee is staying in a metro city (40% for a non-metro city). @@ -205,13 +223,18 @@ def get_annual_component_pay(frequency, amount): def validate_house_rent_dates(doc): if not doc.rented_to_date or not doc.rented_from_date: frappe.throw(_("House rented dates required for exemption calculation")) + if date_diff(doc.rented_to_date, doc.rented_from_date) < 14: frappe.throw(_("House rented dates should be atleast 15 days apart")) - proofs = frappe.db.sql("""select name from `tabEmployee Tax Exemption Proof Submission` - where docstatus=1 and employee='{0}' and payroll_period='{1}' and - (rented_from_date between '{2}' and '{3}' or rented_to_date between - '{2}' and '{3}')""".format(doc.employee, doc.payroll_period, - doc.rented_from_date, doc.rented_to_date)) + + proofs = frappe.db.sql(""" + select name + from `tabEmployee Tax Exemption Proof Submission` + where + docstatus=1 and employee='{0}' and payroll_period='{1}' + and (rented_from_date between '{2}' and '{3}' or rented_to_date between '{2}' and '{3}') + """.format(doc.employee, doc.payroll_period, doc.rented_from_date, doc.rented_to_date)) + if proofs: frappe.throw(_("House rent paid days overlap with {0}").format(proofs[0][0])) From 51f0d6d409c6246eae757a41105ac3ca1e925ef0 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 25 Apr 2019 18:56:08 +0530 Subject: [PATCH 52/59] fix: Remove fetch_from from customer name --- erpnext/crm/doctype/opportunity/opportunity.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index 4026ff77ddb..e3f43f40fd3 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -162,7 +162,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", - "fetch_from": "party_name.customer_name", + "fetch_from": "", "fetch_if_empty": 0, "fieldname": "customer_name", "fieldtype": "Data", @@ -1468,7 +1468,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-04-25 17:10:09.399721", + "modified": "2019-04-25 18:55:43.874656", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", From 891d9aeee9594b617af3c7d19e4e506e622f6e94 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 25 Apr 2019 19:19:01 +0530 Subject: [PATCH 53/59] fix: Remove method from validation --- erpnext/crm/doctype/opportunity/opportunity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index ed58821cbbd..dad249213c7 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -31,7 +31,6 @@ class Opportunity(TransactionBase): self.validate_item_details() self.validate_uom_is_integer("uom", "qty") - self.validate_lead_cust() self.validate_cust_name() if not self.title: From 485d9c133ac1a330bb276afc0ac9c7614be1821f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Apr 2019 19:54:20 +0530 Subject: [PATCH 54/59] fix: test cases --- .../employee_tax_exemption_declaration.py | 2 +- erpnext/hr/utils.py | 1 - erpnext/regional/india/utils.py | 15 ++++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py index f3449d441ba..99ad18fc72b 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py @@ -41,7 +41,7 @@ class EmployeeTaxExemptionDeclaration(Document): def calculate_hra_exemption(self): self.salary_structure_hra, self.annual_hra_exemption, self.monthly_hra_exemption = 0, 0, 0 - if self.monthly_house_rent: + if self.get("monthly_house_rent"): hra_exemption = calculate_annual_eligible_hra_exemption(self) if hra_exemption: self.total_exemption_amount += hra_exemption["annual_exemption"] diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index ebd225d713d..70752c65323 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -226,7 +226,6 @@ def validate_tax_declaration(declarations): subcategories.append(d.exemption_sub_category) def get_total_exemption_amount(declarations): - exemption_category = list(set([d.exemption_category for d in declarations])) exemptions = frappe._dict() for d in declarations: exemptions.setdefault(d.exemption_category, frappe._dict()) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index aafcc9ebaed..4267a94043b 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import frappe, re from frappe import _ -from frappe.utils import cstr, flt, date_diff, getdate, nowdate +from frappe.utils import cstr, flt, date_diff, nowdate from erpnext.regional.india import states, state_numbers from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount from erpnext.controllers.accounts_controller import get_taxes_and_charges @@ -231,12 +231,17 @@ def validate_house_rent_dates(doc): select name from `tabEmployee Tax Exemption Proof Submission` where - docstatus=1 and employee='{0}' and payroll_period='{1}' - and (rented_from_date between '{2}' and '{3}' or rented_to_date between '{2}' and '{3}') - """.format(doc.employee, doc.payroll_period, doc.rented_from_date, doc.rented_to_date)) + docstatus=1 and employee=%(employee)s and payroll_period=%(payroll_period)s + and (rented_from_date between %(from_date)s and %(to_date)s or rented_to_date between %(from_date)s and %(to_date)s) + """, { + "employee": doc.employee, + "payroll_period": doc.payroll_period, + "from_date": doc.rented_from_date, + "to_date": doc.rented_to_date + }) if proofs: - frappe.throw(_("House rent paid days overlap with {0}").format(proofs[0][0])) + frappe.throw(_("House rent paid days overlapping with {0}").format(proofs[0][0])) def calculate_hra_exemption_for_period(doc): monthly_rent, eligible_hra = 0, 0 From 4a950abf2e2de03956c95666359f1f33f153f6f0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Apr 2019 21:42:01 +0530 Subject: [PATCH 55/59] fix: test cases --- .../employee_tax_exemption_declaration.py | 13 +++++++------ .../employee_tax_exemption_proof_submission.py | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py index 99ad18fc72b..cbdfcf8ecdf 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py +++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py @@ -21,12 +21,13 @@ class EmployeeTaxExemptionDeclaration(Document): self.calculate_hra_exemption() def validate_duplicate(self): - duplicate = frappe.db.exists({ - "doctype": "Employee Tax Exemption Declaration", - "employee": self.employee, - "payroll_period": self.payroll_period, - "name": ["!=", self.name] - }) + duplicate = frappe.db.get_value("Employee Tax Exemption Declaration", + filters = { + "employee": self.employee, + "payroll_period": self.payroll_period, + "name": ["!=", self.name] + } + ) if duplicate: frappe.throw(_("Duplicate Tax Declaration of {0} for period {1}") .format(self.employee, self.payroll_period), DuplicateDeclarationError) diff --git a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py index 5299cacd258..ca46ee96fcb 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py +++ b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py @@ -25,7 +25,8 @@ class EmployeeTaxExemptionProofSubmission(Document): self.exemption_amount = get_total_exemption_amount(self.tax_exemption_proofs) def calculate_hra_exemption(self): - if self.house_rent_payment_amount: + self.monthly_hra_exemption, self.monthly_house_rent, self.total_eligible_hra_exemption = 0, 0, 0 + if self.get("house_rent_payment_amount"): hra_exemption = calculate_hra_exemption_for_period(self) if hra_exemption: self.exemption_amount += hra_exemption["total_eligible_hra_exemption"] From 2d90e8a2de50cd81ade80258de44ea17160214fe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Apr 2019 22:29:49 +0530 Subject: [PATCH 56/59] fix: test cases --- .../employee_tax_exemption_proof_submission.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py index ca46ee96fcb..97ceb63476b 100644 --- a/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py +++ b/erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py @@ -17,7 +17,7 @@ class EmployeeTaxExemptionProofSubmission(Document): self.calculate_hra_exemption() def set_total_actual_amount(self): - self.total_actual_amount = flt(self.house_rent_payment_amount) + self.total_actual_amount = flt(self.get("house_rent_payment_amount")) for d in self.tax_exemption_proofs: self.total_actual_amount += flt(d.amount) From 5a67431daa86da28ba08319822fb6bfdfa91e681 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 26 Apr 2019 11:12:19 +0530 Subject: [PATCH 57/59] fix: Price list for UOM other than stock UOM -Fixes conversion from default UOM item price to other UOMs --- erpnext/public/js/controllers/transaction.js | 1 + erpnext/stock/get_item_details.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 168a727f270..ca8c6d734af 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1154,6 +1154,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ "brand": d.brand, "qty": d.qty, "uom": d.uom, + "stock_uom": d.stock_uom, "parenttype": d.parenttype, "parent": d.parent, "pricing_rule": d.pricing_rule, diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 8b81972b4d1..814ee0394f8 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -498,7 +498,7 @@ def get_price_list_rate_for(args, item_code): general_price_list_rate = get_item_price(item_price_args, item_code, ignore_party=args.get("ignore_party")) if not general_price_list_rate and args.get("uom") != args.get("stock_uom"): - item_price_args["args"] = args.get("stock_uom") + item_price_args["uom"] = args.get("stock_uom") general_price_list_rate = get_item_price(item_price_args, item_code, ignore_party=args.get("ignore_party")) if general_price_list_rate: From 36a8c431f504fca960f02f8460e91aed71b5e101 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 26 Apr 2019 11:12:51 +0530 Subject: [PATCH 58/59] fix: Typo --- erpnext/stock/get_item_details.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 814ee0394f8..1c614dffab9 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -431,7 +431,7 @@ def insert_item_price(args): def get_item_price(args, item_code, ignore_party=False): """ Get name, price_list_rate from Item Price based on conditions - Check if the Derised qty is within the increment of the packing list. + Check if the desired qty is within the increment of the packing list. :param args: dict (or frappe._dict) with mandatory fields price_list, uom optional fields min_qty, transaction_date, customer, supplier :param item_code: str, Item Doctype field item_code @@ -469,11 +469,11 @@ def get_price_list_rate_for(args, item_code): for min_qty 9 and min_qty 20. It returns Item Price Rate for qty 9 as the best fit in the range of avaliable min_qtyies - :param customer: link to Customer DocType - :param supplier: link to Supplier DocType + :param customer: link to Customer DocType + :param supplier: link to Supplier DocType :param price_list: str (Standard Buying or Standard Selling) :param item_code: str, Item Doctype field item_code - :param qty: Derised Qty + :param qty: Desired Qty :param transaction_date: Date of the price """ item_price_args = { @@ -514,11 +514,11 @@ def get_price_list_rate_for(args, item_code): def check_packing_list(price_list_rate_name, desired_qty, item_code): """ - Check if the Derised qty is within the increment of the packing list. + Check if the desired qty is within the increment of the packing list. :param price_list_rate_name: Name of Item Price - :param desired_qty: Derised Qt + :param desired_qty: Desired Qt :param item_code: str, Item Doctype field item_code - :param qty: Derised Qt + :param qty: Desired Qt """ flag = True From 5742d0836e7779b2668e21678e01b81ed1aeb406 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Mon, 29 Apr 2019 16:55:41 +0550 Subject: [PATCH 59/59] bumped to version 11.1.23 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1c187fa01c4..01e4dda55e6 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '11.1.22' +__version__ = '11.1.23' def get_default_company(user=None): '''Get default company for user'''