From ba3643514ee2011b24736c2b39d71e0107cf22d4 Mon Sep 17 00:00:00 2001 From: niralisatapara Date: Mon, 21 Nov 2022 15:43:03 +0530 Subject: [PATCH 01/50] feat: item wise tds in purchase order (cherry picked from commit b9d0b4e2d37731c35ec426429b6111cc9f761680) --- .../purchase_order/purchase_order.json | 22 +++++++++++++++++++ .../purchase_order_item.json | 7 ++++++ 2 files changed, 29 insertions(+) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index ded45b866ef..e2a70c21bef 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -54,6 +54,8 @@ "column_break_26", "total", "net_total", + "tax_withholding_net_total", + "base_tax_withholding_net_total", "section_break_48", "pricing_rules", "raw_material_details", @@ -1220,6 +1222,26 @@ "label": "Additional Info", "oldfieldtype": "Section Break" }, + { + "default": "0", + "fieldname": "tax_withholding_net_total", + "fieldtype": "Currency", + "hidden": 1, + "label": "Tax Withholding Net Total", + "no_copy": 1, + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "base_tax_withholding_net_total", + "fieldtype": "Currency", + "hidden": 1, + "label": "Base Tax Withholding Net Total", + "no_copy": 1, + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, { "fieldname": "column_break_99", "fieldtype": "Column Break" diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index b8203bd1286..d471783ab99 100644 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -44,6 +44,7 @@ "discount_amount", "base_rate_with_margin", "sec_break2", + "apply_tds", "rate", "amount", "item_tax_template", @@ -889,6 +890,12 @@ { "fieldname": "column_break_54", "fieldtype": "Column Break" + }, + { + "default": "1", + "fieldname": "apply_tds", + "fieldtype": "Check", + "label": "Apply TDS" } ], "idx": 1, From 2bd8bd224ba7f0414cdd74126012887da1d10445 Mon Sep 17 00:00:00 2001 From: niralisatapara Date: Tue, 22 Nov 2022 14:15:36 +0530 Subject: [PATCH 02/50] feat: item wise tds calculation for purchase order. (cherry picked from commit 46e8cdf31a75bbd1be7a8f8be2bc6031fb573be4) --- .../test_tax_withholding_category.py | 69 +++++++++++++++++++ ...fields.py => update_partial_tds_fields.py} | 16 +++++ 2 files changed, 85 insertions(+) rename erpnext/patches/v14_0/{update_tds_fields.py => update_partial_tds_fields.py} (64%) diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 40c732bae52..23caac047ad 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -226,6 +226,42 @@ class TestTaxWithholdingCategory(unittest.TestCase): for d in reversed(invoices): d.cancel() + orders = [] + + po = create_purchase_order(supplier="Test TDS Supplier4", rate=20000, do_not_save=True) + po.extend( + "items", + [ + { + "doctype": "Purchase Order Item", + "item_code": frappe.db.get_value("Item", {"item_name": "TDS Item"}, "name"), + "qty": 1, + "rate": 20000, + "cost_center": "Main - _TC", + "expense_account": "Stock Received But Not Billed - _TC", + "apply_tds": 0, + }, + { + "doctype": "Purchase Order Item", + "item_code": frappe.db.get_value("Item", {"item_name": "TDS Item"}, "name"), + "qty": 1, + "rate": 35000, + "cost_center": "Main - _TC", + "expense_account": "Stock Received But Not Billed - _TC", + "apply_tds": 1, + }, + ], + ) + po.save() + po.submit() + orders.append(po) + + self.assertEqual(po.taxes[0].tax_amount, 5500) + + # cancel orders to avoid clashing + for d in reversed(orders): + d.cancel() + def test_multi_category_single_supplier(self): frappe.db.set_value( "Supplier", "Test TDS Supplier5", "tax_withholding_category", "Test Service Category" @@ -348,6 +384,39 @@ def create_purchase_invoice(**args): return pi +def create_purchase_order(**args): + # return purchase order doc object + item = frappe.db.get_value("Item", {"item_name": "TDS Item"}, "name") + + args = frappe._dict(args) + po = frappe.get_doc( + { + "doctype": "Purchase Order", + "transaction_date": today(), + "schedule_date": today(), + "apply_tds": 0 if args.do_not_apply_tds else 1, + "supplier": args.supplier, + "company": "_Test Company", + "taxes_and_charges": "", + "currency": "INR", + "taxes": [], + "items": [ + { + "doctype": "Purchase Order Item", + "item_code": item, + "qty": args.qty or 1, + "rate": args.rate or 10000, + "cost_center": "Main - _TC", + "expense_account": "Stock Received But Not Billed - _TC", + } + ], + } + ) + + po.save() + return po + + def create_sales_invoice(**args): # return sales invoice doc object item = frappe.db.get_value("Item", {"item_name": "TCS Item"}, "name") diff --git a/erpnext/patches/v14_0/update_tds_fields.py b/erpnext/patches/v14_0/update_partial_tds_fields.py similarity index 64% rename from erpnext/patches/v14_0/update_tds_fields.py rename to erpnext/patches/v14_0/update_partial_tds_fields.py index a333c5d7a50..5ccc2dc3aa2 100644 --- a/erpnext/patches/v14_0/update_tds_fields.py +++ b/erpnext/patches/v14_0/update_partial_tds_fields.py @@ -25,5 +25,21 @@ def execute(): ).where( purchase_invoice.docstatus == 1 ).run() + + purchase_order = frappe.qb.DocType("Purchase Order") + + frappe.qb.update(purchase_order).set( + purchase_order.tax_withholding_net_total, purchase_order.net_total + ).set( + purchase_order.base_tax_withholding_net_total, purchase_order.base_net_total + ).where( + purchase_order.company == company.name + ).where( + purchase_order.apply_tds == 1 + ).where( + purchase_order.transaction_date >= fiscal_year_details.year_start_date + ).where( + purchase_order.docstatus == 1 + ).run() except FiscalYearError: pass From 5f8f574e20579dcebd332c2144173800a775b27e Mon Sep 17 00:00:00 2001 From: niralisatapara Date: Tue, 22 Nov 2022 14:36:30 +0530 Subject: [PATCH 03/50] feat: item wise tds calculation for purchase order (cherry picked from commit 0fdde2e5c0171487dd1118f7570b26764285963d) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 8e726bf0c0a..53b3171ac64 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -316,5 +316,9 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization +<<<<<<< HEAD erpnext.patches.v13_0.update_schedule_type_in_loans -erpnext.patches.v14_0.update_tds_fields \ No newline at end of file +erpnext.patches.v14_0.update_tds_fields +======= +erpnext.patches.v14_0.update_partial_tds_fields +>>>>>>> 0fdde2e5c0 (feat: item wise tds calculation for purchase order) From f1dd4d0449ac602d19f90ef1d1e652711ad49f52 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Nov 2022 15:48:44 +0530 Subject: [PATCH 04/50] fix: UX for inventory dimension (cherry picked from commit 0a69523940584d465bf963af526d073746e6781a) --- .../inventory_dimension.js | 2 + .../inventory_dimension.json | 49 ++++++++++--------- .../inventory_dimension.py | 14 +++++- .../test_inventory_dimension.py | 11 ++--- 4 files changed, 47 insertions(+), 29 deletions(-) diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js index 79e7895f6d0..ba1023ac691 100644 --- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js +++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js @@ -71,6 +71,8 @@ frappe.ui.form.on('Inventory Dimension', { if (r.message && r.message.length) { frm.set_df_property("fetch_from_parent", "options", [""].concat(r.message)); + } else { + frm.set_df_property("fetch_from_parent", "hidden", 1); } } }); diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json index 09f4f63031c..4397e11f540 100644 --- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json +++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json @@ -11,20 +11,20 @@ "reference_document", "column_break_4", "disabled", - "section_break_7", "field_mapping_section", "source_fieldname", "column_break_9", "target_fieldname", "applicable_for_documents_tab", "apply_to_all_doctypes", + "column_break_13", "document_type", - "istable", "type_of_transaction", "fetch_from_parent", - "column_break_16", - "condition", + "istable", "applicable_condition_example_section", + "condition", + "conditional_rule_examples_section", "html_19" ], "fields": [ @@ -52,13 +52,13 @@ { "fieldname": "applicable_for_documents_tab", "fieldtype": "Tab Break", - "label": "Applicable For Documents" + "label": "Applicable For" }, { "depends_on": "eval:!doc.apply_to_all_doctypes", "fieldname": "document_type", "fieldtype": "Link", - "label": "Applicable to Document", + "label": "Apply to Document", "mandatory_depends_on": "eval:!doc.apply_to_all_doctypes", "options": "DocType" }, @@ -72,6 +72,7 @@ "fetch_from": "document_type.istable", "fieldname": "istable", "fieldtype": "Check", + "hidden": 1, "label": " Is Child Table", "read_only": 1 }, @@ -79,13 +80,13 @@ "depends_on": "eval:!doc.apply_to_all_doctypes", "fieldname": "condition", "fieldtype": "Code", - "label": "Applicable Condition" + "label": "Conditional Rule" }, { - "default": "0", + "default": "1", "fieldname": "apply_to_all_doctypes", "fieldtype": "Check", - "label": "Apply to All Inventory Document Types" + "label": "Apply to All Inventory Documents" }, { "default": "0", @@ -93,10 +94,6 @@ "fieldtype": "Check", "label": "Disabled" }, - { - "fieldname": "section_break_7", - "fieldtype": "Section Break" - }, { "fieldname": "target_fieldname", "fieldtype": "Data", @@ -115,13 +112,11 @@ "collapsible": 1, "fieldname": "field_mapping_section", "fieldtype": "Section Break", + "hidden": 1, "label": "Field Mapping" }, { - "fieldname": "column_break_16", - "fieldtype": "Column Break" - }, - { + "depends_on": "eval:!doc.apply_to_all_doctypes", "fieldname": "type_of_transaction", "fieldtype": "Select", "label": "Type of Transaction", @@ -136,23 +131,33 @@ "collapsible": 1, "depends_on": "eval:!doc.apply_to_all_doctypes", "fieldname": "applicable_condition_example_section", - "fieldtype": "Section Break", - "label": "Applicable Condition Examples" + "fieldtype": "Column Break" }, { "fieldname": "column_break_4", "fieldtype": "Column Break" }, { - "description": "Set fieldname or DocType name like Supplier, Customer etc.", + "depends_on": "eval:!doc.apply_to_all_doctypes", + "description": "Set fieldname from which you want to fetch the data from the parent form.", "fieldname": "fetch_from_parent", "fieldtype": "Select", - "label": "Fetch Value From Parent Form" + "label": "Fetch Value From" + }, + { + "fieldname": "column_break_13", + "fieldtype": "Section Break" + }, + { + "depends_on": "eval:!doc.apply_to_all_doctypes", + "fieldname": "conditional_rule_examples_section", + "fieldtype": "Section Break", + "label": "Conditional Rule Examples" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-09-02 13:29:04.098469", + "modified": "2022-11-15 15:50:16.767105", "modified_by": "Administrator", "module": "Stock", "name": "Inventory Dimension", diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py index 7b99b0097bb..009548abf26 100644 --- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py @@ -33,10 +33,22 @@ class InventoryDimension(Document): ) def validate(self): + self.validate_reference_document() + + def before_save(self): self.do_not_update_document() self.reset_value() - self.validate_reference_document() self.set_source_and_target_fieldname() + self.set_type_of_transaction() + self.set_fetch_value_from() + + def set_type_of_transaction(self): + if self.apply_to_all_doctypes: + self.type_of_transaction = "Both" + + def set_fetch_value_from(self): + if self.apply_to_all_doctypes: + self.fetch_from_parent = self.reference_document def do_not_update_document(self): if self.is_new() or not self.has_stock_ledger(): diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py index 52b3deb3f01..edff3fd556c 100644 --- a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py @@ -140,14 +140,13 @@ class TestInventoryDimension(FrappeTestCase): self.assertRaises(DoNotChangeError, inv_dim1.save) def test_inventory_dimension_for_purchase_receipt_and_delivery_note(self): - create_inventory_dimension( - reference_document="Rack", - type_of_transaction="Both", - dimension_name="Rack", - apply_to_all_doctypes=1, - fetch_from_parent="Rack", + inv_dimension = create_inventory_dimension( + reference_document="Rack", dimension_name="Rack", apply_to_all_doctypes=1 ) + self.assertEqual(inv_dimension.type_of_transaction, "Both") + self.assertEqual(inv_dimension.fetch_from_parent, "Rack") + create_custom_field( "Purchase Receipt", dict(fieldname="rack", label="Rack", fieldtype="Link", options="Rack") ) From fd4bcd9f7f1b603394a8ab4290fb04c7ceafbf24 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 21 Nov 2022 15:16:53 +0530 Subject: [PATCH 05/50] fix: create rounding gl entry for PCV during gle post processing (cherry picked from commit 022d8d5d795cdeec61ab1b2f0181356f389277de) --- erpnext/accounts/general_ledger.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index 6d164eef2be..c757057437b 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -394,20 +394,22 @@ def make_round_off_gle(gl_map, debit_credit_diff, precision): round_off_account, round_off_cost_center = get_round_off_account_and_cost_center( gl_map[0].company, gl_map[0].voucher_type, gl_map[0].voucher_no ) - round_off_account_exists = False round_off_gle = frappe._dict() - for d in gl_map: - if d.account == round_off_account: - round_off_gle = d - if d.debit: - debit_credit_diff -= flt(d.debit) - else: - debit_credit_diff += flt(d.credit) - round_off_account_exists = True + round_off_account_exists = False - if round_off_account_exists and abs(debit_credit_diff) < (1.0 / (10**precision)): - gl_map.remove(round_off_gle) - return + if gl_map[0].voucher_type != "Period Closing Voucher": + for d in gl_map: + if d.account == round_off_account: + round_off_gle = d + if d.debit: + debit_credit_diff -= flt(d.debit) - flt(d.credit) + else: + debit_credit_diff += flt(d.credit) + round_off_account_exists = True + + if round_off_account_exists and abs(debit_credit_diff) < (1.0 / (10**precision)): + gl_map.remove(round_off_gle) + return if not round_off_gle: for k in ["voucher_type", "voucher_no", "company", "posting_date", "remarks"]: @@ -430,7 +432,6 @@ def make_round_off_gle(gl_map, debit_credit_diff, precision): ) update_accounting_dimensions(round_off_gle) - if not round_off_account_exists: gl_map.append(round_off_gle) From 7a9f384b180a416d060ff702dd5efcc4e4046c05 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 23 Nov 2022 10:58:47 +0530 Subject: [PATCH 06/50] chore: resolve conflicts --- erpnext/patches.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 53b3171ac64..7e7112a82cd 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -316,9 +316,6 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization -<<<<<<< HEAD erpnext.patches.v13_0.update_schedule_type_in_loans -erpnext.patches.v14_0.update_tds_fields -======= erpnext.patches.v14_0.update_partial_tds_fields ->>>>>>> 0fdde2e5c0 (feat: item wise tds calculation for purchase order) + From 5c065e8a64b5e7a6c29dcf73f5dcb861bd897425 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 23 Nov 2022 16:32:23 +0530 Subject: [PATCH 07/50] fix: Valuation Rate column UX in stock ledger report (cherry picked from commit be19e4f621261bb08cd05005420a054d63ad3149) --- .../stock/report/stock_ledger/stock_ledger.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index b725d49de70..8b63c0f9986 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -58,6 +58,12 @@ def execute(filters=None): if sle.serial_no: update_available_serial_nos(available_serial_nos, sle) + if sle.actual_qty: + sle["in_out_rate"] = flt(sle.stock_value_difference / sle.actual_qty, precision) + + elif sle.voucher_type == "Stock Reconciliation": + sle["in_out_rate"] = sle.valuation_rate + data.append(sle) if include_uom: @@ -185,10 +191,18 @@ def get_columns(filters): "convertible": "rate", }, { - "label": _("Valuation Rate"), + "label": _("Avg Rate (Balance Stock)"), "fieldname": "valuation_rate", "fieldtype": "Currency", - "width": 110, + "width": 180, + "options": "Company:company:default_currency", + "convertible": "rate", + }, + { + "label": _("Valuation Rate"), + "fieldname": "in_out_rate", + "fieldtype": "Currency", + "width": 140, "options": "Company:company:default_currency", "convertible": "rate", }, From c11a31b39045e9d54a4e335cef92b0e11f5862a5 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 23 Nov 2022 20:29:12 +0530 Subject: [PATCH 08/50] fix: Debit and Credit not equal while submitting PI containing asset item (cherry picked from commit dc8d635120550b647e2d173ff4d101351c96aba9) --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9a31aafb79d..161832216f8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -606,7 +606,7 @@ class PurchaseInvoice(BuyingController): def make_supplier_gl_entry(self, gl_entries): # Checked both rounding_adjustment and rounded_total - # because rounded_total had value even before introcution of posting GLE based on rounded total + # because rounded_total had value even before introduction of posting GLE based on rounded total grand_total = ( self.rounded_total if (self.rounding_adjustment and self.rounded_total) else self.grand_total ) @@ -809,10 +809,7 @@ class PurchaseInvoice(BuyingController): else item.deferred_expense_account ) - if not item.is_fixed_asset: - dummy, amount = self.get_amount_and_base_amount(item, None) - else: - amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount")) + dummy, amount = self.get_amount_and_base_amount(item, None) if provisional_accounting_for_non_stock_items: if item.purchase_receipt: From 0fe5e9a9d19c2f3ecaefa3d1811c90fd9a342f63 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Thu, 24 Nov 2022 15:38:05 +0530 Subject: [PATCH 09/50] fix: precision in asset test_scrap_asset (cherry picked from commit 0e726609f1db0539480d9138f05f9802cf9caed6) --- erpnext/assets/doctype/asset/test_asset.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 19c913ae910..136a033b7db 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -224,7 +224,10 @@ class TestAsset(AssetSetup): asset.finance_books[0], 9000, get_last_day(add_months(purchase_date, 1)), date ) pro_rata_amount = flt(pro_rata_amount, asset.precision("gross_purchase_amount")) - self.assertEquals(accumulated_depr_amount, 18000.00 + pro_rata_amount) + self.assertEquals( + accumulated_depr_amount, + flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), + ) self.assertEqual(asset.status, "Scrapped") self.assertTrue(asset.journal_entry_for_scrap) From ef687e22b8bff7e9d8e350451c436dd2601b8ed2 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 24 Nov 2022 16:41:40 +0530 Subject: [PATCH 10/50] fix: Dispatch address display (cherry picked from commit 104fdcb9f9fde8627ac26c13c365dea85cf22982) --- erpnext/controllers/selling_controller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index e8e9076975e..88d2f0687dc 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -581,6 +581,7 @@ class SellingController(StockController): "customer_address": "address_display", "shipping_address_name": "shipping_address", "company_address": "company_address_display", + "dispatch_address_name": "dispatch_address", } for address_field, address_display_field in address_dict.items(): From 59e2ab702f10ea63f6b1dad173152dc1e2fc2f5e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 24 Nov 2022 17:29:50 +0530 Subject: [PATCH 11/50] fix: job card for quantity UX (cherry picked from commit 87d37e90a2728ec665dda70c14fb2c3fdd1b211b) --- erpnext/manufacturing/doctype/job_card/job_card.js | 5 +++++ erpnext/manufacturing/doctype/job_card/job_card.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js index b6646b19f6d..619e6bd1a00 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.js +++ b/erpnext/manufacturing/doctype/job_card/job_card.js @@ -33,6 +33,11 @@ frappe.ui.form.on('Job Card', { return; } + let has_stock_entry = frm.doc.__onload && + frm.doc.__onload.has_stock_entry ? true : false; + + frm.toggle_enable("for_quantity", !has_stock_entry); + if (!frm.is_new() && has_items && frm.doc.docstatus < 2) { let to_request = frm.doc.for_quantity > frm.doc.transferred_qty; let excess_transfer_allowed = frm.doc.__onload.job_card_excess_transfer; diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index 822647526f7..3133628cbf2 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -57,6 +57,10 @@ class JobCard(Document): ) self.set_onload("job_card_excess_transfer", excess_transfer) self.set_onload("work_order_closed", self.is_work_order_closed()) + self.set_onload("has_stock_entry", self.has_stock_entry()) + + def has_stock_entry(self): + return frappe.db.exists("Stock Entry", {"job_card": self.name, "docstatus": ["!=", 2]}) def before_validate(self): self.set_wip_warehouse() From 85d108b8100f78745fcf2fc0c90d32a94a7b8503 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Fri, 25 Nov 2022 20:42:57 +0530 Subject: [PATCH 12/50] fix: MR Item `description` and `item_name` gets reset on `qty` change (cherry picked from commit df0fee23124c66edf2dc2178de4cd376e7852d50) --- erpnext/stock/doctype/material_request/material_request.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index e68b0abfb94..5f05de6991b 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -370,9 +370,6 @@ frappe.ui.form.on("Material Request Item", { if (flt(d.qty) < flt(d.min_order_qty)) { frappe.msgprint(__("Warning: Material Requested Qty is less than Minimum Order Qty")); } - - const item = locals[doctype][name]; - frm.events.get_item_data(frm, item, false); }, from_warehouse: function(frm, doctype, name) { From 5edaf83733d788f9a2a6aa86a6b703e7a24699cf Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Fri, 25 Nov 2022 13:20:01 +0530 Subject: [PATCH 13/50] fix: disbursable amount on currrent security price (cherry picked from commit fe87c27acdd54ac5ec1061eedcabbba148e60d5d) --- .../doctype/loan_disbursement/loan_disbursement.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py index 0c2042ba500..ec117a12ad0 100644 --- a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py +++ b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py @@ -191,7 +191,9 @@ def get_total_pledged_security_value(loan): for security, qty in pledged_securities.items(): after_haircut_percentage = 100 - hair_cut_map.get(security) - security_value += (loan_security_price_map.get(security) * qty * after_haircut_percentage) / 100 + security_value += ( + loan_security_price_map.get(security, 0) * qty * after_haircut_percentage + ) / 100 return security_value From bc649b371f450284e22de436fbddd80ec0c00f19 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Sun, 27 Nov 2022 16:39:32 +0530 Subject: [PATCH 14/50] fix: company name with `,` in `Work Order Summary Report` (cherry picked from commit 87b39f045ce2aedf0687fae355e1d14b965c58b8) --- .../report/work_order_summary/work_order_summary.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py index 41ffcbb1904..b69ad070e16 100644 --- a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py +++ b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py @@ -39,10 +39,14 @@ def get_data(filters): "lead_time", ] - for field in ["sales_order", "production_item", "status", "company"]: + for field in ["sales_order", "production_item"]: if filters.get(field): query_filters[field] = ("in", filters.get(field)) + for field in ["status", "company"]: + if filters.get(field): + query_filters[field] = filters.get(field) + query_filters["planned_start_date"] = (">=", filters.get("from_date")) query_filters["planned_end_date"] = ("<=", filters.get("to_date")) From b1571932d033dbf87c1fc84612d2797d70e65795 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Sun, 27 Nov 2022 16:54:53 +0530 Subject: [PATCH 15/50] fix: `Work Order` filter typo in `Job Card Summary Report` (cherry picked from commit 2e4f3e9317917dfadb3f90bb38f548f329c96025) --- .../report/job_card_summary/job_card_summary.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js index cb771e49941..782ce8110a8 100644 --- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js +++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js @@ -54,11 +54,11 @@ frappe.query_reports["Job Card Summary"] = { options: ["", "Open", "Work In Progress", "Completed", "On Hold"] }, { - label: __("Sales Orders"), - fieldname: "sales_order", + label: __("Work Orders"), + fieldname: "work_order", fieldtype: "MultiSelectList", get_data: function(txt) { - return frappe.db.get_link_options('Sales Order', txt); + return frappe.db.get_link_options('Work Order', txt); } }, { From 9c6d020e499375dd441899b37263a1431abd2c34 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Sun, 27 Nov 2022 16:55:45 +0530 Subject: [PATCH 16/50] fix: company name with `,` in `Job Card Summary Report` (cherry picked from commit 481149814e4170e970a9e74aaa41968cf47b7526) --- .../report/job_card_summary/job_card_summary.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py index 63c2d97d574..f867a758828 100644 --- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py +++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py @@ -36,10 +36,14 @@ def get_data(filters): "total_time_in_mins", ] - for field in ["work_order", "workstation", "operation", "status", "company"]: + for field in ["work_order"]: if filters.get(field): query_filters[field] = ("in", filters.get(field)) + for field in ["workstation", "operation", "status", "company"]: + if filters.get(field): + query_filters[field] = filters.get(field) + data = frappe.get_all("Job Card", fields=fields, filters=query_filters) if not data: From c9f4f6042584632cac884b1e2c687a8633435a24 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Sun, 27 Nov 2022 16:57:38 +0530 Subject: [PATCH 17/50] fix: `production_item` filter in `Job Card Summary Report` (cherry picked from commit ef7fd670fcbe3b5c0ea776bfd54f73e34d57509f) --- .../manufacturing/report/job_card_summary/job_card_summary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py index f867a758828..8d72ef1f36f 100644 --- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py +++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py @@ -36,7 +36,7 @@ def get_data(filters): "total_time_in_mins", ] - for field in ["work_order"]: + for field in ["work_order", "production_item"]: if filters.get(field): query_filters[field] = ("in", filters.get(field)) From 46075901baa47c87f94452fbbe65d0ff605193f0 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 25 Nov 2022 23:40:05 +0530 Subject: [PATCH 18/50] fix: production plan UX (cherry picked from commit 8cb7112e72b9a463b4a50bdb679e3eabfd7cc9c4) --- .../material_request_plan_item.json | 5 +- .../production_plan/production_plan.js | 93 ++++++++++--------- .../production_plan/production_plan.json | 25 +++-- .../production_plan/production_plan.py | 3 + .../production_plan_item.json | 4 +- 5 files changed, 78 insertions(+), 52 deletions(-) diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json index 27d7c4175e5..8c61d545b81 100644 --- a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json +++ b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json @@ -47,7 +47,7 @@ "fieldtype": "Link", "in_list_view": 1, "in_standard_filter": 1, - "label": "Warehouse", + "label": "For Warehouse", "options": "Warehouse", "reqd": 1 }, @@ -173,7 +173,7 @@ ], "istable": 1, "links": [], - "modified": "2021-08-23 18:17:58.400462", + "modified": "2022-11-26 14:59:25.879631", "modified_by": "Administrator", "module": "Manufacturing", "name": "Material Request Plan Item", @@ -182,5 +182,6 @@ "quick_entry": 1, "sort_field": "modified", "sort_order": "DESC", + "states": [], "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js index 59ddf1f0c58..62715e65653 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.js +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js @@ -3,13 +3,13 @@ frappe.ui.form.on('Production Plan', { - before_save: function(frm) { + before_save(frm) { // preserve temporary names on production plan item to re-link sub-assembly items frm.doc.po_items.forEach(item => { item.temporary_name = item.name; }); }, - setup: function(frm) { + setup(frm) { frm.custom_make_buttons = { 'Work Order': 'Work Order / Subcontract PO', 'Material Request': 'Material Request', @@ -70,7 +70,7 @@ frappe.ui.form.on('Production Plan', { } }, - refresh: function(frm) { + refresh(frm) { if (frm.doc.docstatus === 1) { frm.trigger("show_progress"); @@ -158,7 +158,7 @@ frappe.ui.form.on('Production Plan', { set_field_options("projected_qty_formula", projected_qty_formula); }, - close_open_production_plan: (frm, close=false) => { + close_open_production_plan(frm, close=false) { frappe.call({ method: "set_status", freeze: true, @@ -170,7 +170,7 @@ frappe.ui.form.on('Production Plan', { }); }, - make_work_order: function(frm) { + make_work_order(frm) { frappe.call({ method: "make_work_order", freeze: true, @@ -181,7 +181,7 @@ frappe.ui.form.on('Production Plan', { }); }, - make_material_request: function(frm) { + make_material_request(frm) { frappe.confirm(__("Do you want to submit the material request"), function() { @@ -193,7 +193,7 @@ frappe.ui.form.on('Production Plan', { ); }, - create_material_request: function(frm, submit) { + create_material_request(frm, submit) { frm.doc.submit_material_request = submit; frappe.call({ @@ -206,7 +206,7 @@ frappe.ui.form.on('Production Plan', { }); }, - get_sales_orders: function(frm) { + get_sales_orders(frm) { frappe.call({ method: "get_open_sales_orders", doc: frm.doc, @@ -216,7 +216,7 @@ frappe.ui.form.on('Production Plan', { }); }, - get_material_request: function(frm) { + get_material_request(frm) { frappe.call({ method: "get_pending_material_requests", doc: frm.doc, @@ -226,7 +226,7 @@ frappe.ui.form.on('Production Plan', { }); }, - get_items: function (frm) { + get_items(frm) { frm.clear_table('prod_plan_references'); frappe.call({ @@ -238,7 +238,7 @@ frappe.ui.form.on('Production Plan', { } }); }, - combine_items: function (frm) { + combine_items(frm) { frm.clear_table("prod_plan_references"); frappe.call({ @@ -254,14 +254,14 @@ frappe.ui.form.on('Production Plan', { }); }, - combine_sub_items: (frm) => { + combine_sub_items(frm) { if (frm.doc.sub_assembly_items.length > 0) { frm.clear_table("sub_assembly_items"); frm.trigger("get_sub_assembly_items"); } }, - get_sub_assembly_items: function(frm) { + get_sub_assembly_items(frm) { frm.dirty(); frappe.call({ @@ -274,9 +274,25 @@ frappe.ui.form.on('Production Plan', { }); }, - get_items_for_mr: function(frm) { + toggle_for_warehouse(frm) { + frm.toggle_reqd("for_warehouse", true); + }, + + get_items_for_mr(frm) { if (!frm.doc.for_warehouse) { - frappe.throw(__("To make material requests, 'Make Material Request for Warehouse' field is mandatory")); + frm.trigger("toggle_for_warehouse"); + frappe.throw(__("Select the Warehouse")); + } + + frm.events.get_items_for_material_requests(frm, [{ + warehouse: frm.doc.for_warehouse + }]); + }, + + transfer_materials(frm) { + if (!frm.doc.for_warehouse) { + frm.trigger("toggle_for_warehouse"); + frappe.throw(__("Select the Warehouse")); } if (frm.doc.ignore_existing_ordered_qty) { @@ -287,18 +303,10 @@ frappe.ui.form.on('Production Plan', { title: title, fields: [ { - 'label': __('Target Warehouse'), - 'fieldtype': 'Link', - 'fieldname': 'target_warehouse', - 'read_only': true, - 'default': frm.doc.for_warehouse - }, - { - 'label': __('Source Warehouses (Optional)'), + 'label': __('Transfer From Warehouses'), 'fieldtype': 'Table MultiSelect', 'fieldname': 'warehouses', 'options': 'Production Plan Material Request Warehouse', - 'description': __('If source warehouse selected then system will create the material request with type Material Transfer from Source to Target warehouse. If not selected then will create the material request with type Purchase for the target warehouse.'), get_query: function () { return { filters: { @@ -307,6 +315,13 @@ frappe.ui.form.on('Production Plan', { }; }, }, + { + 'label': __('For Warehouse'), + 'fieldtype': 'Link', + 'fieldname': 'target_warehouse', + 'read_only': true, + 'default': frm.doc.for_warehouse + } ] }); @@ -320,8 +335,8 @@ frappe.ui.form.on('Production Plan', { } }, - get_items_for_material_requests: function(frm, warehouses) { - const set_fields = ['actual_qty', 'item_code','item_name', 'description', 'uom', 'from_warehouse', + get_items_for_material_requests(frm, warehouses) { + let set_fields = ['actual_qty', 'item_code','item_name', 'description', 'uom', 'from_warehouse', 'min_order_qty', 'required_bom_qty', 'quantity', 'sales_order', 'warehouse', 'projected_qty', 'ordered_qty', 'reserved_qty_for_production', 'material_request_type']; @@ -335,13 +350,13 @@ frappe.ui.form.on('Production Plan', { callback: function(r) { if(r.message) { frm.set_value('mr_items', []); - $.each(r.message, function(i, d) { - var item = frm.add_child('mr_items'); - for (let key in d) { - if (d[key] && in_list(set_fields, key)) { - item[key] = d[key]; + r.message.forEach(row => { + let d = frm.add_child('mr_items'); + set_fields.forEach(field => { + if (row[field]) { + d[field] = row[field]; } - } + }); }); } refresh_field('mr_items'); @@ -349,13 +364,7 @@ frappe.ui.form.on('Production Plan', { }); }, - for_warehouse: function(frm) { - if (frm.doc.mr_items && frm.doc.for_warehouse) { - frm.trigger("get_items_for_mr"); - } - }, - - download_materials_required: function(frm) { + download_materials_required(frm) { const fields = [{ fieldname: 'warehouses', fieldtype: 'Table MultiSelect', @@ -381,7 +390,7 @@ frappe.ui.form.on('Production Plan', { }, __('Select Warehouses to get Stock for Materials Planning'), __('Get Stock')); }, - show_progress: function(frm) { + show_progress(frm) { var bars = []; var message = ''; var title = ''; @@ -416,7 +425,7 @@ frappe.ui.form.on('Production Plan', { }); frappe.ui.form.on("Production Plan Item", { - item_code: function(frm, cdt, cdn) { + item_code(frm, cdt, cdn) { const row = locals[cdt][cdn]; if (row.item_code) { frappe.call({ @@ -435,7 +444,7 @@ frappe.ui.form.on("Production Plan Item", { }); frappe.ui.form.on("Material Request Plan Item", { - warehouse: function(frm, cdt, cdn) { + warehouse(frm, cdt, cdn) { const row = locals[cdt][cdn]; if (row.warehouse && row.item_code && frm.doc.company) { frappe.call({ diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.json b/erpnext/manufacturing/doctype/production_plan/production_plan.json index 85f98430cd4..2624daa41e2 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.json +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.json @@ -38,6 +38,8 @@ "get_sub_assembly_items", "combine_sub_items", "sub_assembly_items", + "download_materials_request_plan_section_section", + "download_materials_required", "material_request_planning", "include_non_stock_items", "include_subcontracted_items", @@ -45,8 +47,8 @@ "ignore_existing_ordered_qty", "column_break_25", "for_warehouse", - "download_materials_required", "get_items_for_mr", + "transfer_materials", "section_break_27", "mr_items", "other_details", @@ -206,7 +208,7 @@ { "fieldname": "material_request_planning", "fieldtype": "Section Break", - "label": "Material Requirement Planning" + "label": "Material Request Planning" }, { "default": "1", @@ -235,12 +237,12 @@ "depends_on": "eval:!doc.__islocal", "fieldname": "download_materials_required", "fieldtype": "Button", - "label": "Download Required Materials" + "label": "Download Materials Request Plan" }, { "fieldname": "get_items_for_mr", "fieldtype": "Button", - "label": "Get Raw Materials For Production" + "label": "Get Raw Materials for Purchase" }, { "fieldname": "section_break_27", @@ -304,7 +306,7 @@ { "fieldname": "for_warehouse", "fieldtype": "Link", - "label": "Make Material Request for Warehouse", + "label": "Raw Materials Warehouse", "options": "Warehouse" }, { @@ -378,13 +380,24 @@ "fieldname": "combine_sub_items", "fieldtype": "Check", "label": "Consolidate Sub Assembly Items" + }, + { + "fieldname": "transfer_materials", + "fieldtype": "Button", + "label": "Get Raw Materials for Transfer" + }, + { + "collapsible": 1, + "fieldname": "download_materials_request_plan_section_section", + "fieldtype": "Section Break", + "label": "Download Materials Request Plan Section" } ], "icon": "fa fa-calendar", "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2022-03-25 09:15:25.017664", + "modified": "2022-11-26 14:51:08.774372", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Plan", diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index caff0a3e15c..1eb82a5728a 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -312,6 +312,9 @@ class ProductionPlan(Document): def add_items(self, items): refs = {} for data in items: + if not data.pending_qty: + continue + item_details = get_item_details(data.item_code) if self.combine_items: if item_details.bom_no in refs: diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json index df5862fcac8..0688278e091 100644 --- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json +++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json @@ -83,7 +83,7 @@ "fieldname": "warehouse", "fieldtype": "Link", "in_list_view": 1, - "label": "For Warehouse", + "label": "FG Warehouse", "options": "Warehouse" }, { @@ -216,7 +216,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2022-03-24 04:54:09.940224", + "modified": "2022-11-25 14:15:40.061514", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Plan Item", From b7119318a60f00732e5f21b44e2d345793872dfc Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:14:30 +0100 Subject: [PATCH 19/50] feat: add doctype Incoterm (cherry picked from commit 1a1bfc8db9a592954adbcce50af6316e7cec0b2b) --- erpnext/setup/doctype/incoterm/__init__.py | 0 erpnext/setup/doctype/incoterm/incoterm.js | 8 ++ erpnext/setup/doctype/incoterm/incoterm.json | 117 ++++++++++++++++++ erpnext/setup/doctype/incoterm/incoterm.py | 24 ++++ erpnext/setup/doctype/incoterm/incoterms.csv | 12 ++ .../setup/doctype/incoterm/test_incoterm.py | 9 ++ 6 files changed, 170 insertions(+) create mode 100644 erpnext/setup/doctype/incoterm/__init__.py create mode 100644 erpnext/setup/doctype/incoterm/incoterm.js create mode 100644 erpnext/setup/doctype/incoterm/incoterm.json create mode 100644 erpnext/setup/doctype/incoterm/incoterm.py create mode 100644 erpnext/setup/doctype/incoterm/incoterms.csv create mode 100644 erpnext/setup/doctype/incoterm/test_incoterm.py diff --git a/erpnext/setup/doctype/incoterm/__init__.py b/erpnext/setup/doctype/incoterm/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/setup/doctype/incoterm/incoterm.js b/erpnext/setup/doctype/incoterm/incoterm.js new file mode 100644 index 00000000000..bc65123dc15 --- /dev/null +++ b/erpnext/setup/doctype/incoterm/incoterm.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Incoterm", { +// refresh(frm) { + +// }, +// }); diff --git a/erpnext/setup/doctype/incoterm/incoterm.json b/erpnext/setup/doctype/incoterm/incoterm.json new file mode 100644 index 00000000000..5e7097dcf18 --- /dev/null +++ b/erpnext/setup/doctype/incoterm/incoterm.json @@ -0,0 +1,117 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:code", + "creation": "2022-11-17 15:17:34.717467", + "default_view": "List", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "code", + "title", + "description" + ], + "fields": [ + { + "fieldname": "code", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Code", + "length": 3, + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Title", + "reqd": 1 + }, + { + "fieldname": "description", + "fieldtype": "Long Text", + "label": "Description" + } + ], + "links": [], + "modified": "2022-11-17 17:31:49.113954", + "modified_by": "Administrator", + "module": "Setup", + "name": "Incoterm", + "naming_rule": "By fieldname", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock Manager", + "share": 1, + "write": 1 + }, + { + "read": 1, + "role": "Purchase User" + }, + { + "read": 1, + "role": "Sales User" + }, + { + "read": 1, + "role": "Accounts User" + }, + { + "read": 1, + "role": "Stock User" + } + ], + "show_title_field_in_link": 1, + "sort_field": "name", + "sort_order": "ASC", + "states": [], + "title_field": "title", + "translated_doctype": 1 +} \ No newline at end of file diff --git a/erpnext/setup/doctype/incoterm/incoterm.py b/erpnext/setup/doctype/incoterm/incoterm.py new file mode 100644 index 00000000000..7e2e622c24b --- /dev/null +++ b/erpnext/setup/doctype/incoterm/incoterm.py @@ -0,0 +1,24 @@ +# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + + +class Incoterm(Document): + pass + + +def create_incoterms(): + """Create Incoterm records from incoterms.csv.""" + import os + from csv import DictReader + + with open(os.path.join(os.path.dirname(__file__), "incoterms.csv"), "r") as f: + for incoterm in DictReader(f): + if frappe.db.exists("Incoterm", incoterm["code"]): + continue + + doc = frappe.new_doc("Incoterm") + doc.update(incoterm) + doc.save() diff --git a/erpnext/setup/doctype/incoterm/incoterms.csv b/erpnext/setup/doctype/incoterm/incoterms.csv new file mode 100644 index 00000000000..af532cff160 --- /dev/null +++ b/erpnext/setup/doctype/incoterm/incoterms.csv @@ -0,0 +1,12 @@ +code,title +EXW,Ex Works +FCA,Free Carrier +FAS,Free Alongside Ship +FOB,Free On Board +CPT,Carriage Paid To +CIP,Carriage and Insurance Paid to +CFR,Cost and Freight +CIF,"Cost, Insurance and Freight" +DAP,Delivered At Place +DPU,Delivered At Place Unloaded +DDP,Delivered Duty Paid diff --git a/erpnext/setup/doctype/incoterm/test_incoterm.py b/erpnext/setup/doctype/incoterm/test_incoterm.py new file mode 100644 index 00000000000..06b8c3bda9d --- /dev/null +++ b/erpnext/setup/doctype/incoterm/test_incoterm.py @@ -0,0 +1,9 @@ +# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestIncoterm(FrappeTestCase): + pass From 014896a59519672dc24ebc5f63cc997ce5758e0d Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:16:43 +0100 Subject: [PATCH 20/50] feat: create incoterms and migrate shipments (cherry picked from commit d2563ee97388290ee0acad09148af6f853637886) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 5 +++ .../create_incoterms_and_migrate_shipment.py | 32 +++++++++++++++++++ erpnext/stock/doctype/shipment/shipment.json | 10 +++--- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7e7112a82cd..6bcfeae14ec 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -316,6 +316,11 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization +<<<<<<< HEAD erpnext.patches.v13_0.update_schedule_type_in_loans erpnext.patches.v14_0.update_partial_tds_fields +======= +erpnext.patches.v14_0.update_tds_fields +erpnext.patches.v14_0.create_incoterms_and_migrate_shipment +>>>>>>> d2563ee973 (feat: create incoterms and migrate shipments) diff --git a/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py b/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py new file mode 100644 index 00000000000..fd3c071edbe --- /dev/null +++ b/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py @@ -0,0 +1,32 @@ +import frappe + +from erpnext.setup.doctype.incoterm.incoterm import create_incoterms + + +def execute(): + create_incoterms() + migrate_shipments() + + +def migrate_shipments(): + if not frappe.db.count("Shipment"): + return + + OLD_VALUES = [ + # old_value: (code, title), + "EXW (Ex Works)", + "FCA (Free Carrier)", + "FOB (Free On Board)", + "FAS (Free Alongside Ship)", + "CPT (Carriage Paid To)", + "CIP (Carriage and Insurance Paid to)", + "CFR (Cost and Freight)", + "DPU (Delivered At Place Unloaded)", + "DAP (Delivered At Place)", + "DDP (Delivered Duty Paid)", + ] + shipment = frappe.qb.DocType("Shipment") + for old_value in OLD_VALUES: + frappe.qb.update(shipment).set(shipment.incoterm, old_value[:3]).where( + shipment.incoterm == old_value + ).run() diff --git a/erpnext/stock/doctype/shipment/shipment.json b/erpnext/stock/doctype/shipment/shipment.json index a33cbc288c5..53b549deec1 100644 --- a/erpnext/stock/doctype/shipment/shipment.json +++ b/erpnext/stock/doctype/shipment/shipment.json @@ -412,9 +412,9 @@ }, { "fieldname": "incoterm", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Incoterm", - "options": "EXW (Ex Works)\nFCA (Free Carrier)\nCPT (Carriage Paid To)\nCIP (Carriage and Insurance Paid to)\nDPU (Delivered At Place Unloaded)\nDAP (Delivered At Place)\nDDP (Delivered Duty Paid)" + "options": "Incoterm" }, { "fieldname": "shipment_delivery_note", @@ -433,10 +433,11 @@ ], "is_submittable": 1, "links": [], - "modified": "2021-04-13 17:14:18.181818", + "modified": "2022-11-17 17:23:27.025802", "modified_by": "Administrator", "module": "Stock", "name": "Shipment", + "naming_rule": "Expression (old style)", "owner": "Administrator", "permissions": [ { @@ -470,5 +471,6 @@ ], "sort_field": "modified", "sort_order": "DESC", + "states": [], "track_changes": 1 -} +} \ No newline at end of file From 93e029df915521a226b7e9711adf328f6af3e1c6 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:17:19 +0100 Subject: [PATCH 21/50] feat: create Incoterm records after install (cherry picked from commit ce83f02f24e4c0c5dd41ad78eeb882a9dcf43d58) --- erpnext/setup/install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py index 2076dde5199..d3b47f985d5 100644 --- a/erpnext/setup/install.py +++ b/erpnext/setup/install.py @@ -10,6 +10,7 @@ from frappe.utils import cint from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS from erpnext.setup.default_energy_point_rules import get_default_energy_point_rules +from erpnext.setup.doctype.incoterm.incoterm import create_incoterms from .default_success_action import get_default_success_action @@ -25,6 +26,7 @@ def after_install(): create_default_cash_flow_mapper_templates() create_default_success_action() create_default_energy_point_rules() + create_incoterms() add_company_to_session_defaults() add_standard_navbar_items() add_app_name() From fcfe0cb9e9afddc9363d6ef278a8253009a20a70 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:17:59 +0100 Subject: [PATCH 22/50] feat: add incoterm to sales transactions (cherry picked from commit 029f22c5499518c640427b2a403db970a2e839f7) # Conflicts: # erpnext/accounts/doctype/sales_invoice/sales_invoice.json --- .../doctype/sales_invoice/sales_invoice.json | 21 ++++++++++++++++++- .../selling/doctype/quotation/quotation.json | 9 +++++++- .../doctype/sales_order/sales_order.json | 9 +++++++- .../doctype/delivery_note/delivery_note.json | 9 +++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index ceae52044d7..40d26c62b98 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -64,6 +64,7 @@ "taxes_and_charges", "column_break_38", "shipping_rule", + "incoterm", "column_break_55", "tax_category", "section_break_40", @@ -2097,6 +2098,24 @@ "hide_seconds": 1, "label": "Write Off", "width": "50%" +<<<<<<< HEAD +======= + }, + { + "default": "0", + "fieldname": "repost_required", + "fieldtype": "Check", + "hidden": 1, + "label": "Repost Required", + "no_copy": 1, + "read_only": 1 + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" +>>>>>>> 029f22c549 (feat: add incoterm to sales transactions) } ], "icon": "fa fa-file-text", @@ -2109,7 +2128,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2022-11-15 09:33:47.870616", + "modified": "2022-11-17 17:17:10.883487", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index fa64b1625bb..08918f4d61a 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -48,6 +48,7 @@ "tax_category", "column_break_34", "shipping_rule", + "incoterm", "section_break_36", "taxes", "section_break_39", @@ -1052,13 +1053,19 @@ { "fieldname": "column_break_108", "fieldtype": "Column Break" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-shopping-cart", "idx": 82, "is_submittable": 1, "links": [], - "modified": "2022-10-11 13:06:33.479650", + "modified": "2022-11-17 17:20:54.984348", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index e6ff39d8d4a..9ec32cbfc67 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -63,6 +63,7 @@ "tax_category", "column_break_49", "shipping_rule", + "incoterm", "section_break_40", "taxes", "section_break_43", @@ -1623,13 +1624,19 @@ { "fieldname": "column_break_152", "fieldtype": "Column Break" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-file-text", "idx": 105, "is_submittable": 1, "links": [], - "modified": "2022-10-11 13:06:10.469796", + "modified": "2022-11-17 17:22:00.413878", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 0ca3e69f76c..80e4bcb640f 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -62,6 +62,7 @@ "tax_category", "column_break_39", "shipping_rule", + "incoterm", "section_break_41", "taxes", "section_break_44", @@ -1381,13 +1382,19 @@ { "fieldname": "column_break_18", "fieldtype": "Column Break" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-truck", "idx": 146, "is_submittable": 1, "links": [], - "modified": "2022-10-11 13:06:58.655635", + "modified": "2022-11-17 17:22:42.860790", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", From 88346b17e93193631086ba3a353b6957cb2494a9 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:18:26 +0100 Subject: [PATCH 23/50] feat: add incoterm to purchasing transactions (cherry picked from commit 77105306f2a3ff88535d7260178f871eaa9c1f1a) # Conflicts: # erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json --- .../doctype/purchase_invoice/purchase_invoice.json | 11 +++++++++++ .../doctype/purchase_order/purchase_order.json | 9 ++++++++- .../request_for_quotation.json | 14 +++++++++++--- .../supplier_quotation/supplier_quotation.json | 9 ++++++++- .../doctype/purchase_receipt/purchase_receipt.json | 9 ++++++++- 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index a5981fdebd1..53ab28cb84b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -69,6 +69,7 @@ "tax_category", "column_break_49", "shipping_rule", + "incoterm", "section_break_51", "taxes", "totals", @@ -1534,13 +1535,23 @@ "oldfieldtype": "Section Break", "options": "fa fa-file-text", "print_hide": 1 + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-file-text", "idx": 204, "is_submittable": 1, "links": [], +<<<<<<< HEAD "modified": "2022-11-22 12:44:29.935567", +======= + "modified": "2022-11-17 17:30:45.559785", +>>>>>>> 77105306f2 (feat: add incoterm to purchasing transactions) "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index e2a70c21bef..93496261aa0 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -67,6 +67,7 @@ "tax_category", "column_break_50", "shipping_rule", + "incoterm", "section_break_52", "taxes", "totals", @@ -1249,13 +1250,19 @@ { "fieldname": "column_break_103", "fieldtype": "Column Break" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-file-text", "idx": 105, "is_submittable": 1, "links": [], - "modified": "2022-11-17 12:34:36.033363", + "modified": "2022-11-17 17:28:07.729943", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json index 083cab78f76..019d45b5683 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json @@ -28,6 +28,7 @@ "sec_break_email_2", "message_for_supplier", "terms_section_break", + "incoterm", "tc_name", "terms", "printing_settings", @@ -271,13 +272,19 @@ "fieldname": "schedule_date", "fieldtype": "Date", "label": "Required Date" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-shopping-cart", "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2022-04-06 17:47:49.909000", + "modified": "2022-11-17 17:26:33.770993", "modified_by": "Administrator", "module": "Buying", "name": "Request for Quotation", @@ -345,5 +352,6 @@ "search_fields": "status, transaction_date", "show_name_in_global_search": 1, "sort_field": "modified", - "sort_order": "DESC" -} + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json index 16365618ca9..7776ab8ec84 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json @@ -45,6 +45,7 @@ "tax_category", "column_break_36", "shipping_rule", + "incoterm", "section_break_38", "taxes", "totals", @@ -823,6 +824,12 @@ { "fieldname": "column_break_85", "fieldtype": "Column Break" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-shopping-cart", @@ -830,7 +837,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2022-09-27 18:20:09.462037", + "modified": "2022-11-17 17:27:32.179686", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index 3141212ee5d..ab91d7c8c94 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -63,6 +63,7 @@ "tax_category", "column_break_53", "shipping_rule", + "incoterm", "taxes_section", "taxes", "totals", @@ -1218,13 +1219,19 @@ { "fieldname": "column_break_104", "fieldtype": "Column Break" + }, + { + "fieldname": "incoterm", + "fieldtype": "Link", + "label": "Incoterm", + "options": "Incoterm" } ], "icon": "fa fa-truck", "idx": 261, "is_submittable": 1, "links": [], - "modified": "2022-10-11 13:02:31.776256", + "modified": "2022-11-17 17:29:30.067536", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", From f7988dea1b9aa216a07f8e45e7880a20767d2890 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:18:53 +0100 Subject: [PATCH 24/50] feat: add german translations for incoterm titles (cherry picked from commit ffd287d5a69796a47c77e1cd3a2173ea5121096d) --- erpnext/translations/de.csv | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv index bb7bf5528fe..ec9c50247fa 100644 --- a/erpnext/translations/de.csv +++ b/erpnext/translations/de.csv @@ -9905,3 +9905,14 @@ Total Asset,Aktiva, Total Liability,Verbindlichkeiten, Total Equity,Eigenkapital, Warehouse wise Stock Value,Warenwert nach Lager, +Ex Works,Ab Werk, +Free Carrier,Frei Frachtführer, +Free Alongside Ship,Frei Längsseite Schiff, +Free on Board,Frei an Bord, +Carriage Paid To,Frachtfrei, +Carriage and Insurance Paid to,Frachtfrei versichert, +Cost and Freight,Kosten und Fracht, +"Cost, Insurance and Freight","Kosten, Versicherung und Fracht", +Delivered at Place,Geliefert benannter Ort, +Delivered at Place Unloaded,Geliefert benannter Ort entladen, +Delivered Duty Paid,Geliefert verzollt, From 89b9a06204b350810f2e6de13db1231666c40cab Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 17 Nov 2022 22:37:04 +0100 Subject: [PATCH 25/50] feat: add connections to Incoterm doctype (cherry picked from commit a5966b6f8456507a9d63f9bab48362a4d95a44d6) --- erpnext/setup/doctype/incoterm/incoterm.json | 55 +++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/incoterm/incoterm.json b/erpnext/setup/doctype/incoterm/incoterm.json index 5e7097dcf18..c547b7c4ffd 100644 --- a/erpnext/setup/doctype/incoterm/incoterm.json +++ b/erpnext/setup/doctype/incoterm/incoterm.json @@ -35,8 +35,59 @@ "label": "Description" } ], - "links": [], - "modified": "2022-11-17 17:31:49.113954", + "links": [ + { + "group": "Selling", + "link_doctype": "Quotation", + "link_fieldname": "incoterm" + }, + { + "group": "Selling", + "link_doctype": "Sales Order", + "link_fieldname": "incoterm" + }, + { + "group": "Buying", + "link_doctype": "Request for Quotation", + "link_fieldname": "incoterm" + }, + { + "group": "Buying", + "link_doctype": "Supplier Quotation", + "link_fieldname": "incoterm" + }, + { + "group": "Buying", + "link_doctype": "Purchase Order", + "link_fieldname": "incoterm" + }, + { + "group": "Stock", + "link_doctype": "Delivery Note", + "link_fieldname": "incoterm" + }, + { + "group": "Stock", + "link_doctype": "Purchase Receipt", + "link_fieldname": "incoterm" + }, + { + "group": "Stock", + "link_doctype": "Shipment", + "link_fieldname": "incoterm" + }, + { + "group": "Accounts", + "link_doctype": "Sales Invoice", + "link_fieldname": "incoterm" + }, + { + "group": "Accounts", + "link_doctype": "Purchase Invoice", + "link_fieldname": "incoterm" + } + ], + "modified": "2022-11-17 22:35:52.084553", "modified_by": "Administrator", "module": "Setup", "name": "Incoterm", From 978924a7e496bb684c1349ada566d93a6adf9c0a Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Fri, 18 Nov 2022 10:57:52 +0100 Subject: [PATCH 26/50] fix: remove obsolete comment (cherry picked from commit 491857b3c88a7e4031d4d38f89bff18776dbfd57) --- erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py b/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py index fd3c071edbe..6e1e09ad146 100644 --- a/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py +++ b/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py @@ -13,7 +13,6 @@ def migrate_shipments(): return OLD_VALUES = [ - # old_value: (code, title), "EXW (Ex Works)", "FCA (Free Carrier)", "FOB (Free On Board)", From 21deb02d81870f295dbbe18bbebc71f1ca405005 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Sun, 27 Nov 2022 16:30:19 +0100 Subject: [PATCH 27/50] chore: resolve merge conflicts --- .../doctype/purchase_invoice/purchase_invoice.json | 6 +----- .../doctype/sales_invoice/sales_invoice.json | 12 ------------ 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 53ab28cb84b..7fa555d0ab9 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1547,11 +1547,7 @@ "idx": 204, "is_submittable": 1, "links": [], -<<<<<<< HEAD - "modified": "2022-11-22 12:44:29.935567", -======= - "modified": "2022-11-17 17:30:45.559785", ->>>>>>> 77105306f2 (feat: add incoterm to purchasing transactions) + "modified": "2022-11-27 16:28:45.559785", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 40d26c62b98..d45d9ee1844 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -2098,24 +2098,12 @@ "hide_seconds": 1, "label": "Write Off", "width": "50%" -<<<<<<< HEAD -======= - }, - { - "default": "0", - "fieldname": "repost_required", - "fieldtype": "Check", - "hidden": 1, - "label": "Repost Required", - "no_copy": 1, - "read_only": 1 }, { "fieldname": "incoterm", "fieldtype": "Link", "label": "Incoterm", "options": "Incoterm" ->>>>>>> 029f22c549 (feat: add incoterm to sales transactions) } ], "icon": "fa fa-file-text", From 0ba2a4d084cd3cde5c3d1c793690059066cd53eb Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 28 Nov 2022 11:19:32 +0530 Subject: [PATCH 28/50] fix: opportunity list doesn't show assigned user (backport #33110) (#33131) fix: opportunity list doesn't show assigned user (#33110) Because `db_update` is performed `_assign` property is not updated and hence lead -> opportunity conversion makes it disappear from list view. Steps to reproduce: 1. Create lead 2. Assign anyone 3. Create opportunity from lead. 4. Form view shows assigned user, list view wont. (cherry picked from commit 63b9795d4101ca941cf76f6c1e68fe635313e143) Co-authored-by: Ankush Menat --- erpnext/crm/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/crm/utils.py b/erpnext/crm/utils.py index 433d974a443..737452021c0 100644 --- a/erpnext/crm/utils.py +++ b/erpnext/crm/utils.py @@ -120,7 +120,7 @@ def link_open_tasks(ref_doctype, ref_docname, doc): todo_doc = frappe.get_doc("ToDo", todo.name) todo_doc.reference_type = doc.doctype todo_doc.reference_name = doc.name - todo_doc.db_update() + todo_doc.save() def link_open_events(ref_doctype, ref_docname, doc): From 6e3ad109d22c52ccb2f417255e764aa4b1f36963 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 27 Nov 2022 21:50:26 +0530 Subject: [PATCH 29/50] chore: Supplier invoice no field description (cherry picked from commit 4f2ece34dfc758f1971a8d5f248729c6e8123a09) --- .../accounts/doctype/accounts_settings/accounts_settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 3e0b82c5610..1e2e2acd79a 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -91,7 +91,7 @@ }, { "default": "0", - "description": "Enabling ensure each Sales Invoice has a unique value in Supplier Invoice No. field", + "description": "Enabling ensure each Purchase Invoice has a unique value in Supplier Invoice No. field", "fieldname": "check_supplier_invoice_uniqueness", "fieldtype": "Check", "label": "Check Supplier Invoice Number Uniqueness" @@ -354,7 +354,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2022-07-11 13:37:50.605141", + "modified": "2022-11-27 21:49:52.538655", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", From 5fc4dfaad6289d6fdb6ac6544a028968b573c184 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 28 Nov 2022 15:00:52 +0530 Subject: [PATCH 30/50] feat: make Material Request for sub-assembly items (cherry picked from commit e02f35c8ff985489a033fa89bed0a59826bfa90f) --- .../production_plan/production_plan.py | 19 +++++++++++++ .../production_plan/test_production_plan.py | 28 +++++++++++++++++++ .../production_plan_sub_assembly_item.json | 4 +-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 1eb82a5728a..0cc0f80cf1a 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -521,6 +521,9 @@ class ProductionPlan(Document): subcontracted_po.setdefault(row.supplier, []).append(row) continue + if row.type_of_manufacturing == "Material Request": + continue + work_order_data = { "wip_warehouse": default_warehouses.get("wip_warehouse"), "fg_warehouse": default_warehouses.get("fg_warehouse"), @@ -1161,6 +1164,7 @@ def get_bin_details(row, company, for_warehouse=None, all_warehouse=False): subquery = frappe.qb.from_(wh).select(wh.name).where(wh.company == company) + warehouse = "" if not all_warehouse: warehouse = for_warehouse or row.get("source_warehouse") or row.get("default_warehouse") @@ -1226,6 +1230,21 @@ def get_items_for_material_requests(doc, warehouses=None, get_parent_warehouse_d doc["mr_items"] = [] po_items = doc.get("po_items") if doc.get("po_items") else doc.get("items") + + if doc.get("sub_assembly_items"): + for sa_row in doc.sub_assembly_items: + sa_row = frappe._dict(sa_row) + if sa_row.type_of_manufacturing == "Material Request": + po_items.append( + frappe._dict( + { + "item_code": sa_row.production_item, + "required_qty": sa_row.qty, + "include_exploded_items": 0, + } + ) + ) + # Check for empty table or empty rows if not po_items or not [row.get("item_code") for row in po_items if row.get("item_code")]: frappe.throw( diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index a6d034d8cb8..2bf14c24cf3 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -840,6 +840,34 @@ class TestProductionPlan(FrappeTestCase): self.assertEqual(row.uom, "Nos") self.assertEqual(row.qty, 1) + def test_material_request_for_sub_assembly_items(self): + from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom + + bom_tree = { + "Fininshed Goods1 For MR": { + "SubAssembly1 For MR": {"SubAssembly1-1 For MR": {"ChildPart1 For MR": {}}} + } + } + + parent_bom = create_nested_bom(bom_tree, prefix="") + plan = create_production_plan( + item_code=parent_bom.item, planned_qty=10, ignore_existing_ordered_qty=1, do_not_submit=1 + ) + + plan.get_sub_assembly_items() + + mr_items = [] + for row in plan.sub_assembly_items: + mr_items.append(row.production_item) + row.type_of_manufacturing = "Material Request" + + plan.save() + items = get_items_for_material_requests(plan.as_dict()) + + validate_mr_items = [d.get("item_code") for d in items] + for item_code in mr_items: + self.assertTrue(item_code in validate_mr_items) + def create_production_plan(**args): """ diff --git a/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json b/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json index 45ea26c3a8a..4eb6bf6ecfc 100644 --- a/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json +++ b/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json @@ -169,7 +169,7 @@ "fieldtype": "Select", "in_list_view": 1, "label": "Manufacturing Type", - "options": "In House\nSubcontract" + "options": "In House\nSubcontract\nMaterial Request" }, { "fieldname": "supplier", @@ -188,7 +188,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2022-01-30 21:31:10.527559", + "modified": "2022-11-28 13:50:15.116082", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Plan Sub Assembly Item", From 65ac84e020ffdbb6cbdf8f52f500dd2917b292ce Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Mon, 28 Nov 2022 18:01:30 +0530 Subject: [PATCH 31/50] fix: validation msg in stock entry (cherry picked from commit ba77da0874ef8219e57b03b3f71db84ce9953063) --- erpnext/stock/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index cdf6e89fcbb..fb50b46003a 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -264,7 +264,7 @@ def repost_future_sle( def validate_item_warehouse(args): for field in ["item_code", "warehouse", "posting_date", "posting_time"]: if not args.get(field): - validation_msg = f"The field {frappe.unscrub(args.get(field))} is required for the reposting" + validation_msg = f"The field {frappe.unscrub(field)} is required for the reposting" frappe.throw(_(validation_msg)) From 4b0c9b61157c01a29ee80aff15d0f6e8be6cdc5f Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 12 Jan 2022 20:55:30 +0530 Subject: [PATCH 32/50] fix: reposting error `AttributeError: 'datetime.timedelta' object has no attribute 'replace'` (cherry picked from commit eeda264eb6b53cf4e463f8de121d9c5b3371faa8) --- erpnext/stock/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index fb50b46003a..e7f55e9b35d 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -263,7 +263,7 @@ def repost_future_sle( def validate_item_warehouse(args): for field in ["item_code", "warehouse", "posting_date", "posting_time"]: - if not args.get(field): + if args.get(field) in [None, ""]: validation_msg = f"The field {frappe.unscrub(field)} is required for the reposting" frappe.throw(_(validation_msg)) From 5652af04ba7587de7fecbf78578a11b7403d363c Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 25 Nov 2022 00:21:33 +0100 Subject: [PATCH 33/50] feat: german tax templates (cherry picked from commit 7fd2639e68a3a2c527e5512ca318e0b2cad59897) --- .../setup_wizard/data/country_wise_tax.json | 2774 +++++++++++++++-- 1 file changed, 2574 insertions(+), 200 deletions(-) diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json index 98817253a4c..45e39c5bd0b 100644 --- a/erpnext/setup/setup_wizard/data/country_wise_tax.json +++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json @@ -481,136 +481,461 @@ }, "Germany": { - "tax_categories": [ - "Umsatzsteuer", - "Vorsteuer" - ], + "tax_categories": [], "chart_of_accounts": { "SKR04 mit Kontonummern": { "sales_tax_templates": [ { - "title": "Umsatzsteuer", - "tax_category": "Umsatzsteuer", + "title": "Lieferung oder sonstige Leistung im Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Umsatzsteuer 19%", + "account_name": "Umsatzsteuer 19 %", "account_number": "3806", "tax_rate": 19.00 }, + "description": "Umsatzsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Umsatzsteuer 7%", + "account_name": "Umsatzsteuer 7 %", "account_number": "3801", "tax_rate": 7.00 }, - "rate": 0.00 - } - ] - } - ], - "purchase_tax_templates": [ - { - "title": "Vorsteuer", - "tax_category": "Vorsteuer", - "is_default": 1, - "taxes": [ - { - "account_head": { - "account_name": "Abziehbare Vorsteuer 19%", - "account_number": "1406", - "root_type": "Asset", - "tax_rate": 19.00 - }, - "rate": 0.00 - }, - { - "account_head": { - "account_name": "Abziehbare Vorsteuer 7%", - "account_number": "1401", - "root_type": "Asset", - "tax_rate": 7.00 - }, + "description": "Umsatzsteuer 7 %", "rate": 0.00 } ] }, { - "title": "Innergemeinschaftlicher Erwerb 19% Umsatzsteuer und 19% Vorsteuer", + "title": "Lieferung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Lieferung oder sonstige Leistung an nicht-Unternehmen in der EU", + "is_default": 0, "taxes": [ { "account_head": { - "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", - "account_number": "1407", - "root_type": "Asset", + "account_name": "Umsatzsteuer 19 %", + "account_number": "3806", "tax_rate": 19.00 }, - "add_deduct_tax": "Add" + "description": "Umsatzsteuer 19 %", + "rate": 0.00 }, { "account_head": { - "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_name": "Umsatzsteuer 7 %", + "account_number": "3801", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an nicht-Unternehmen in Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "3806", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "3801", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [] + } + ], + "purchase_tax_templates": [ + { + "title": "Lieferung aus dem Inland", + "is_default": 1, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1406", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1401", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus dem Inland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1406", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1401", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1404", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1402", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "3804", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "3802", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", "account_number": "3837", "root_type": "Liability", "tax_rate": 19.00 }, - "add_deduct_tax": "Deduct" + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "3835", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "3837", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "3835", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1406", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1401", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1433", + "root_type": "Asset" + }, + "description": "Entstandene Einfuhrumsatzsteuer", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "3837", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "3835", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 } ] } ], "item_tax_templates": [ { - "title": "Umsatzsteuer 19%", + "title": "19 %", "taxes": [ { "tax_type": { - "account_name": "Umsatzsteuer 19%", + "account_name": "Umsatzsteuer 19 %", "account_number": "3806", + "root_type": "Liability", "tax_rate": 19.00 }, "tax_rate": 19.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", + "account_name": "Umsatzsteuer 7 %", "account_number": "3801", + "root_type": "Liability", "tax_rate": 7.00 }, "tax_rate": 0.00 - } - ] - }, - { - "title": "Umsatzsteuer 7%", - "taxes": [ - { - "tax_type": { - "account_name": "Umsatzsteuer 19%", - "account_number": "3806", - "tax_rate": 19.00 - }, - "tax_rate": 0.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", - "account_number": "3801", - "tax_rate": 7.00 + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "3804", + "root_type": "Liability", + "tax_rate": 19.00 }, - "tax_rate": 7.00 - } - ] - }, - { - "title": "Vorsteuer 19%", - "taxes": [ + "tax_rate": 19.00 + }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "3802", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "3837", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "3835", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", "account_number": "1406", "root_type": "Asset", "tax_rate": 19.00 @@ -619,21 +944,119 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "account_number": "1401", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1404", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1402", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1433", + "root_type": "Asset" + }, + "tax_rate": 19.00 } ] }, { - "title": "Vorsteuer 7%", + "title": "7 %", "taxes": [ { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Umsatzsteuer 19 %", + "account_number": "3806", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "3801", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "3804", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "3802", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "3837", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "3835", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", "account_number": "1406", "root_type": "Asset", "tax_rate": 19.00 @@ -642,12 +1065,177 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "account_number": "1401", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1404", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1402", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1433", + "root_type": "Asset" + }, + "tax_rate": 7.00 + } + ] + }, + { + "title": "0 %", + "taxes": [ + { + "tax_type": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "3806", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "3801", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "3804", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "3802", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "3837", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "3835", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1406", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1401", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1404", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1402", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1433", + "root_type": "Asset" + }, + "tax_rate": 0.00 } ] } @@ -656,51 +1244,390 @@ "SKR03 mit Kontonummern": { "sales_tax_templates": [ { - "title": "Umsatzsteuer", - "tax_category": "Umsatzsteuer", + "title": "Lieferung oder sonstige Leistung im Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Umsatzsteuer 19%", + "account_name": "Umsatzsteuer 19 %", "account_number": "1776", "tax_rate": 19.00 }, + "description": "Umsatzsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Umsatzsteuer 7%", + "account_name": "Umsatzsteuer 7 %", "account_number": "1771", "tax_rate": 7.00 }, + "description": "Umsatzsteuer 7 %", "rate": 0.00 } ] + }, + { + "title": "Lieferung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Lieferung oder sonstige Leistung an nicht-Unternehmen in der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "1776", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "1771", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an nicht-Unternehmen in Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "1776", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "1771", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [] } ], "purchase_tax_templates": [ { - "title": "Vorsteuer", - "tax_category": "Vorsteuer", + "title": "Lieferung aus dem Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Abziehbare Vorsteuer 19 %", "account_number": "1576", "root_type": "Asset", "tax_rate": 19.00 }, + "description": "Abziehbare Vorsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "account_number": "1571", "root_type": "Asset", "tax_rate": 7.00 }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus dem Inland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1576", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1571", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1574", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1572", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1774", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1772", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "1787", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "1785", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "1787", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "1785", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1576", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1571", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1588", + "root_type": "Asset" + }, + "description": "Entstandene Einfuhrumsatzsteuer", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "1787", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "1785", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", "rate": 0.00 } ] @@ -708,53 +1635,65 @@ ], "item_tax_templates": [ { - "title": "Umsatzsteuer 19%", + "title": "19 %", "taxes": [ { "tax_type": { - "account_name": "Umsatzsteuer 19%", + "account_name": "Umsatzsteuer 19 %", "account_number": "1776", + "root_type": "Liability", "tax_rate": 19.00 }, "tax_rate": 19.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", + "account_name": "Umsatzsteuer 7 %", "account_number": "1771", + "root_type": "Liability", "tax_rate": 7.00 }, "tax_rate": 0.00 - } - ] - }, - { - "title": "Umsatzsteuer 7%", - "taxes": [ - { - "tax_type": { - "account_name": "Umsatzsteuer 19%", - "account_number": "1776", - "tax_rate": 19.00 - }, - "tax_rate": 0.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", - "account_number": "1771", - "tax_rate": 7.00 + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1774", + "root_type": "Liability", + "tax_rate": 19.00 }, - "tax_rate": 7.00 - } - ] - }, - { - "title": "Vorsteuer 19%", - "taxes": [ + "tax_rate": 19.00 + }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1772", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "1787", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "1785", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", "account_number": "1576", "root_type": "Asset", "tax_rate": 19.00 @@ -763,21 +1702,119 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "account_number": "1571", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1574", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1572", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1588", + "root_type": "Asset" + }, + "tax_rate": 19.00 } ] }, { - "title": "Vorsteuer 7%", + "title": "7 %", "taxes": [ { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Umsatzsteuer 19 %", + "account_number": "1776", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "1771", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1774", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1772", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "1787", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "1785", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", "account_number": "1576", "root_type": "Asset", "tax_rate": 19.00 @@ -786,12 +1823,177 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "account_number": "1571", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1574", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1572", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1588", + "root_type": "Asset" + }, + "tax_rate": 7.00 + } + ] + }, + { + "title": "0 %", + "taxes": [ + { + "tax_type": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "1776", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "1771", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1774", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1772", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "account_number": "1787", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "account_number": "1785", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1576", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1571", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "account_number": "1574", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "account_number": "1572", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1588", + "root_type": "Asset" + }, + "tax_rate": 0.00 } ] } @@ -800,51 +2002,390 @@ "Standard with Numbers": { "sales_tax_templates": [ { - "title": "Umsatzsteuer", - "tax_category": "Umsatzsteuer", + "title": "Lieferung oder sonstige Leistung im Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Umsatzsteuer 19%", - "account_number": "2301", + "account_name": "Umsatzsteuer 19 %", + "account_number": "2320", "tax_rate": 19.00 }, + "description": "Umsatzsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Umsatzsteuer 7%", - "account_number": "2302", + "account_name": "Umsatzsteuer 7 %", + "account_number": "2321", "tax_rate": 7.00 }, + "description": "Umsatzsteuer 7 %", "rate": 0.00 } ] + }, + { + "title": "Lieferung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Lieferung oder sonstige Leistung an nicht-Unternehmen in der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "2320", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "2321", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an nicht-Unternehmen in Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "2320", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "2321", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [] } ], "purchase_tax_templates": [ { - "title": "Vorsteuer", - "tax_category": "Vorsteuer", + "title": "Lieferung aus dem Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Abziehbare Vorsteuer 19%", - "account_number": "1501", + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1520", "root_type": "Asset", "tax_rate": 19.00 }, + "description": "Abziehbare Vorsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Abziehbare Vorsteuer 7%", - "account_number": "1502", + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1521", "root_type": "Asset", "tax_rate": 7.00 }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus dem Inland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1520", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1521", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "1530", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "1531", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 7 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "2330", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "2331", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 7 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_number": "2340", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19%", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 7%", + "account_number": "2341", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 7%", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_number": "2340", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19%", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 7%", + "account_number": "2341", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 7%", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1520", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1521", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1550", + "root_type": "Asset" + }, + "description": "Entstandene Einfuhrumsatzsteuer", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_number": "2340", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19%", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 7%", + "account_number": "2341", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 7%", + "add_deduct_tax": "Deduct", "rate": 0.00 } ] @@ -852,54 +2393,66 @@ ], "item_tax_templates": [ { - "title": "Umsatzsteuer 19%", + "title": "19%", "taxes": [ { "tax_type": { - "account_name": "Umsatzsteuer 19%", - "account_number": "2301", + "account_name": "Umsatzsteuer 19 %", + "account_number": "2320", + "root_type": "Liability", "tax_rate": 19.00 }, "tax_rate": 19.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", - "account_number": "2302", + "account_name": "Umsatzsteuer 7 %", + "account_number": "2321", + "root_type": "Liability", "tax_rate": 7.00 }, "tax_rate": 0.00 - } - ] - }, - { - "title": "Umsatzsteuer 7%", - "taxes": [ - { - "tax_type": { - "account_name": "Umsatzsteuer 19%", - "account_number": "2301", - "tax_rate": 19.00 - }, - "tax_rate": 0.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", - "account_number": "2302", - "tax_rate": 7.00 + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "2330", + "root_type": "Liability", + "tax_rate": 19.00 }, - "tax_rate": 7.00 - } - ] - }, - { - "title": "Vorsteuer 19%", - "taxes": [ + "tax_rate": 19.00 + }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", - "account_number": "1501", + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "2331", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_number": "2340", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 7%", + "account_number": "2341", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1520", "root_type": "Asset", "tax_rate": 19.00 }, @@ -907,22 +2460,120 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", - "account_number": "1502", + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1521", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "1530", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "1531", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1550", + "root_type": "Asset" + }, + "tax_rate": 19.00 } ] }, { - "title": "Vorsteuer 7%", + "title": "7%", "taxes": [ { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", - "account_number": "1501", + "account_name": "Umsatzsteuer 19 %", + "account_number": "2320", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "2321", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "2330", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "2331", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_number": "2340", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 7%", + "account_number": "2341", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1520", "root_type": "Asset", "tax_rate": 19.00 }, @@ -930,12 +2581,177 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", - "account_number": "1502", + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1521", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "1530", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "1531", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1550", + "root_type": "Asset" + }, + "tax_rate": 7.00 + } + ] + }, + { + "title": "0 %", + "taxes": [ + { + "tax_type": { + "account_name": "Umsatzsteuer 19 %", + "account_number": "2320", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "account_number": "2321", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "2330", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "2331", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19%", + "account_number": "2340", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 7%", + "account_number": "2341", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", + "account_number": "1520", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 7 %", + "account_number": "1521", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 19 %", + "account_number": "1530", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichen Erwerb 7 %", + "account_number": "1531", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19%", + "account_number": "1540", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 7%", + "account_number": "1541", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "account_number": "1550", + "root_type": "Asset" + }, + "tax_rate": 0.00 } ] } @@ -944,47 +2760,361 @@ "*": { "sales_tax_templates": [ { - "title": "Umsatzsteuer", - "tax_category": "Umsatzsteuer", + "title": "Lieferung oder sonstige Leistung im Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Umsatzsteuer 19%", + "account_name": "Umsatzsteuer 19 %", "tax_rate": 19.00 }, + "description": "Umsatzsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Umsatzsteuer 7%", + "account_name": "Umsatzsteuer 7 %", "tax_rate": 7.00 }, + "description": "Umsatzsteuer 7 %", "rate": 0.00 } ] + }, + { + "title": "Lieferung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in der EU", + "is_default": 0, + "taxes": [] + }, + { + "title": "Lieferung oder sonstige Leistung an nicht-Unternehmen in der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an Unternehmen in Drittland", + "is_default": 0, + "taxes": [] + }, + { + "title": "Sonstige Leistung an nicht-Unternehmen in Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Umsatzsteuer 19 %", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer 7 %", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [] } ], "purchase_tax_templates": [ { - "title": "Vorsteuer 19%", - "tax_category": "Vorsteuer", + "title": "Lieferung aus dem Inland", "is_default": 1, "taxes": [ { "account_head": { - "account_name": "Abziehbare Vorsteuer 19%", - "tax_rate": 19.00, - "root_type": "Asset" + "account_name": "Abziehbare Vorsteuer 19 %", + "root_type": "Asset", + "tax_rate": 19.00 }, + "description": "Abziehbare Vorsteuer 19 %", "rate": 0.00 }, { "account_head": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "root_type": "Asset", "tax_rate": 7.00 }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus dem Inland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus der EU", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Sonstige Leistung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Lieferung aus Drittland", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer 7 %", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer 7 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "root_type": "Asset" + }, + "description": "Entstandene Einfuhrumsatzsteuer", + "add_deduct_tax": "Deduct", + "rate": 0.00 + } + ] + }, + { + "title": "Bauleistungen nach § 13b UStG", + "is_default": 0, + "taxes": [ + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "description": "Abziehbare Vorsteuer nach § 13b UStG", + "add_deduct_tax": "Add", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "description": "Umsatzsteuer nach § 13b UStG 19 %", + "add_deduct_tax": "Deduct", + "rate": 0.00 + }, + { + "account_head": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "description": "Umsatzsteuer nach § 13b UStG", + "add_deduct_tax": "Deduct", "rate": 0.00 } ] @@ -992,49 +3122,59 @@ ], "item_tax_templates": [ { - "title": "Umsatzsteuer 19%", + "title": "19 %", "taxes": [ { "tax_type": { - "account_name": "Umsatzsteuer 19%", + "account_name": "Umsatzsteuer 19 %", + "root_type": "Liability", "tax_rate": 19.00 }, "tax_rate": 19.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", + "account_name": "Umsatzsteuer 7 %", + "root_type": "Liability", "tax_rate": 7.00 }, "tax_rate": 0.00 - } - ] - }, - { - "title": "Umsatzsteuer 7%", - "taxes": [ - { - "tax_type": { - "account_name": "Umsatzsteuer 19%", - "tax_rate": 19.00 - }, - "tax_rate": 0.00 }, { "tax_type": { - "account_name": "Umsatzsteuer 7%", - "tax_rate": 7.00 + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Liability", + "tax_rate": 19.00 }, - "tax_rate": 7.00 - } - ] - }, - { - "title": "Vorsteuer 19%", - "taxes": [ + "tax_rate": 19.00 + }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", "root_type": "Asset", "tax_rate": 19.00 }, @@ -1042,20 +3182,107 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 19.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "root_type": "Asset" + }, + "tax_rate": 19.00 } ] }, { - "title": "Vorsteuer 7%", + "title": "7 %", "taxes": [ { "tax_type": { - "account_name": "Abziehbare Vorsteuer 19%", + "account_name": "Umsatzsteuer 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", "root_type": "Asset", "tax_rate": 19.00 }, @@ -1063,11 +3290,158 @@ }, { "tax_type": { - "account_name": "Abziehbare Vorsteuer 7%", + "account_name": "Abziehbare Vorsteuer 7 %", "root_type": "Asset", "tax_rate": 7.00 }, "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 7.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "root_type": "Asset" + }, + "tax_rate": 7.00 + } + ] + }, + { + "title": "0%", + "taxes": [ + { + "tax_type": { + "account_name": "Umsatzsteuer 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer 7 %", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG 19 %", + "root_type": "Liability", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Umsatzsteuer nach § 13b UStG", + "root_type": "Liability", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer 7 %", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG 19 %", + "root_type": "Asset", + "tax_rate": 19.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Abziehbare Vorsteuer nach § 13b UStG", + "root_type": "Asset", + "tax_rate": 7.00 + }, + "tax_rate": 0.00 + }, + { + "tax_type": { + "account_name": "Entstandene Einfuhrumsatzsteuer", + "root_type": "Asset" + }, + "tax_rate": 0.00 } ] } From 7477bb96c831b78ddf566f75a11d26155186b109 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Mon, 28 Nov 2022 18:51:40 +0100 Subject: [PATCH 34/50] chore: resolve merge conflict --- erpnext/patches.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6bcfeae14ec..8bc52305b68 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -316,11 +316,6 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization -<<<<<<< HEAD erpnext.patches.v13_0.update_schedule_type_in_loans erpnext.patches.v14_0.update_partial_tds_fields - -======= -erpnext.patches.v14_0.update_tds_fields erpnext.patches.v14_0.create_incoterms_and_migrate_shipment ->>>>>>> d2563ee973 (feat: create incoterms and migrate shipments) From f92b5011dace89d76c5038cd91dea567ee286408 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 28 Nov 2022 22:51:35 +0530 Subject: [PATCH 35/50] fix: incorrect balance qty (cherry picked from commit b2105a8be7ba3891df1253a94c8322632db22956) --- .../stock/doctype/stock_reconciliation/stock_reconciliation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index d92d0f1686e..260c1344b1e 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -348,6 +348,9 @@ class StockReconciliation(StockController): if row.qty: args = self.get_sle_for_items(row) + if row.serial_no and row.batch_no: + args["qty_after_transaction"] = row.qty + args.update( { "actual_qty": row.qty, From 93ec57dd4440e24a2764e73bbb541a4961bfb7f8 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 29 Nov 2022 00:08:07 +0530 Subject: [PATCH 36/50] test: test case for serialized batched item (cherry picked from commit b606a9684beb7a7f3256fad25c9389dc7e763d4f) --- .../stock_reconciliation.py | 6 ++-- .../test_stock_reconciliation.py | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 260c1344b1e..3a0b38a0fcd 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -230,7 +230,7 @@ class StockReconciliation(StockController): if item.has_serial_no or item.has_batch_no: has_serial_no = True - self.get_sle_for_serialized_items(row, sl_entries) + self.get_sle_for_serialized_items(row, sl_entries, item) else: if row.serial_no or row.batch_no: frappe.throw( @@ -282,7 +282,7 @@ class StockReconciliation(StockController): if has_serial_no and sl_entries: self.update_valuation_rate_for_serial_no() - def get_sle_for_serialized_items(self, row, sl_entries): + def get_sle_for_serialized_items(self, row, sl_entries, item): from erpnext.stock.stock_ledger import get_previous_sle serial_nos = get_serial_nos(row.serial_no) @@ -348,7 +348,7 @@ class StockReconciliation(StockController): if row.qty: args = self.get_sle_for_items(row) - if row.serial_no and row.batch_no: + if item.has_serial_no and item.has_batch_no: args["qty_after_transaction"] = row.qty args.update( diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 7b984d38475..eaea301432e 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -644,6 +644,38 @@ class TestStockReconciliation(FrappeTestCase, StockTestMixin): ) self.assertEqual(len(active_sr_no), 0) + def test_serial_no_batch_no_item(self): + item = self.make_item( + "Test Serial No Batch No Item", + { + "is_stock_item": 1, + "has_serial_no": 1, + "has_batch_no": 1, + "serial_no_series": "SRS9.####", + "batch_number_series": "BNS9.####", + "create_new_batch": 1, + }, + ) + + warehouse = "_Test Warehouse - _TC" + + sr = create_stock_reconciliation( + item_code=item.name, + warehouse=warehouse, + qty=1, + rate=100, + ) + + sl_entry = frappe.db.get_value( + "Stock Ledger Entry", + {"voucher_type": "Stock Reconciliation", "voucher_no": sr.name}, + ["actual_qty", "qty_after_transaction"], + as_dict=1, + ) + + self.assertEqual(flt(sl_entry.actual_qty), 1.0) + self.assertEqual(flt(sl_entry.qty_after_transaction), 1.0) + def create_batch_item_with_batch(item_name, batch_id): batch_item_doc = create_item(item_name, is_stock_item=1) From 93b8cc3042fe22a6412bd5f084b6cd3ef36db714 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 28 Nov 2022 17:37:41 +0530 Subject: [PATCH 37/50] fix(ux): Action buttons in Bank Reconciliation (cherry picked from commit 6ebe8ad60d62645b1604481ff6d9b2b97a0fc104) --- .../doctype/bank_clearance/bank_clearance.js | 28 ++++++++++++++---- .../bank_clearance/bank_clearance.json | 29 ++++--------------- .../doctype/bank_clearance/bank_clearance.py | 2 -- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.js b/erpnext/accounts/doctype/bank_clearance/bank_clearance.js index 7e57c2fc471..ceba99a56a8 100644 --- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.js +++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.js @@ -37,6 +37,14 @@ frappe.ui.form.on("Bank Clearance", { refresh: function(frm) { frm.disable_save(); + + if (frm.doc.account && frm.doc.from_date && frm.doc.to_date) { + frm.add_custom_button(__('Get Payment Entries'), () => + frm.trigger("get_payment_entries") + ); + + frm.change_custom_button_type('Get Payment Entries', null, 'primary'); + } }, update_clearance_date: function(frm) { @@ -46,22 +54,30 @@ frappe.ui.form.on("Bank Clearance", { callback: function(r, rt) { frm.refresh_field("payment_entries"); frm.refresh_fields(); + + if (!frm.doc.payment_entries.length) { + frm.change_custom_button_type('Get Payment Entries', null, 'primary'); + frm.change_custom_button_type('Update Clearance Date', null, 'default'); + } } }); }, + get_payment_entries: function(frm) { return frappe.call({ method: "get_payment_entries", doc: frm.doc, callback: function(r, rt) { frm.refresh_field("payment_entries"); - frm.refresh_fields(); - $(frm.fields_dict.payment_entries.wrapper).find("[data-fieldname=amount]").each(function(i,v){ - if (i !=0){ - $(v).addClass("text-right") - } - }) + if (frm.doc.payment_entries.length) { + frm.add_custom_button(__('Update Clearance Date'), () => + frm.trigger("update_clearance_date") + ); + + frm.change_custom_button_type('Get Payment Entries', null, 'default'); + frm.change_custom_button_type('Update Clearance Date', null, 'primary'); + } } }); } diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.json b/erpnext/accounts/doctype/bank_clearance/bank_clearance.json index a436d1effb8..591d01949b8 100644 --- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.json +++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.json @@ -1,4 +1,5 @@ { + "actions": [], "allow_copy": 1, "creation": "2013-01-10 16:34:05", "doctype": "DocType", @@ -13,11 +14,8 @@ "bank_account", "include_reconciled_entries", "include_pos_transactions", - "get_payment_entries", "section_break_10", - "payment_entries", - "update_clearance_date", - "total_amount" + "payment_entries" ], "fields": [ { @@ -76,11 +74,6 @@ "fieldtype": "Check", "label": "Include POS Transactions" }, - { - "fieldname": "get_payment_entries", - "fieldtype": "Button", - "label": "Get Payment Entries" - }, { "fieldname": "section_break_10", "fieldtype": "Section Break" @@ -91,25 +84,14 @@ "fieldtype": "Table", "label": "Payment Entries", "options": "Bank Clearance Detail" - }, - { - "fieldname": "update_clearance_date", - "fieldtype": "Button", - "label": "Update Clearance Date" - }, - { - "fieldname": "total_amount", - "fieldtype": "Currency", - "label": "Total Amount", - "options": "account_currency", - "read_only": 1 } ], "hide_toolbar": 1, "icon": "fa fa-check", "idx": 1, "issingle": 1, - "modified": "2020-04-06 16:12:06.628008", + "links": [], + "modified": "2022-11-28 17:24:13.008692", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Clearance", @@ -126,5 +108,6 @@ "quick_entry": 1, "read_only": 1, "sort_field": "modified", - "sort_order": "ASC" + "sort_order": "ASC", + "states": [] } \ No newline at end of file diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py index 78c35266542..80878ac5068 100644 --- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py @@ -179,7 +179,6 @@ class BankClearance(Document): ) self.set("payment_entries", []) - self.total_amount = 0.0 default_currency = erpnext.get_default_currency() for d in entries: @@ -198,7 +197,6 @@ class BankClearance(Document): d.pop("debit") d.pop("account_currency") row.update(d) - self.total_amount += flt(amount) @frappe.whitelist() def update_clearance_date(self): From 2aada1a0d95d9fde65314d1078eb850dedce7801 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 28 Nov 2022 19:22:35 +0530 Subject: [PATCH 38/50] fix: Auto repeat date validations (cherry picked from commit fa152214552e37236ff927e35ed09d016933a26c) --- erpnext/controllers/accounts_controller.py | 4 ++++ erpnext/controllers/buying_controller.py | 1 + erpnext/controllers/selling_controller.py | 1 + 3 files changed, 6 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 1849e8b3b55..dc42a89df7f 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -239,6 +239,10 @@ class AccountsController(TransactionBase): else: item.set(field_map.get(self.doctype), default_deferred_account) + def validate_auto_repeat_subscription_dates(self): + if getdate(self.from_date) > getdate(self.to_date): + frappe.throw(_("To Date cannot be before From Date"), title=_("Invalid Auto Repeat Date")) + def validate_deferred_start_and_end_date(self): for d in self.items: if d.get("enable_deferred_revenue") or d.get("enable_deferred_expense"): diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 48fe7cb083d..051460474ac 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -41,6 +41,7 @@ class BuyingController(SubcontractingController): self.validate_from_warehouse() self.set_supplier_address() self.validate_asset_return() + self.validate_auto_repeat_subscription_dates() if self.doctype == "Purchase Invoice": self.validate_purchase_receipt_if_update_stock() diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 88d2f0687dc..965335b1a3f 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -40,6 +40,7 @@ class SellingController(StockController): self.set_customer_address() self.validate_for_duplicate_items() self.validate_target_warehouse() + self.validate_auto_repeat_subscription_dates() def set_missing_values(self, for_validate=False): From 5abcb478d0c90a23b5ed0cc3ffde9e3c28caf324 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 28 Nov 2022 22:47:44 +0530 Subject: [PATCH 39/50] chore: Update condition (cherry picked from commit 6a47fb6c9e9e93553b622a795217f3a15ded1eb9) --- erpnext/controllers/accounts_controller.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index dc42a89df7f..b7a80c10192 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -240,7 +240,11 @@ class AccountsController(TransactionBase): item.set(field_map.get(self.doctype), default_deferred_account) def validate_auto_repeat_subscription_dates(self): - if getdate(self.from_date) > getdate(self.to_date): + if ( + self.get("from_date") + and self.get("to_date") + and getdate(self.from_date) > getdate(self.to_date) + ): frappe.throw(_("To Date cannot be before From Date"), title=_("Invalid Auto Repeat Date")) def validate_deferred_start_and_end_date(self): From cdd13cd95fe3344ab342de98436c1f125d6b8182 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 25 Nov 2022 16:23:20 +0530 Subject: [PATCH 40/50] fix: remove duplicate schema (cherry picked from commit 2c18a95115baf3cbc79a2c2d7ba48b862425f159) --- erpnext/templates/generators/item/item.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/templates/generators/item/item.html b/erpnext/templates/generators/item/item.html index 4070d40d47e..358c1c52e5f 100644 --- a/erpnext/templates/generators/item/item.html +++ b/erpnext/templates/generators/item/item.html @@ -32,7 +32,7 @@
-
+
{% if show_tabs and tabs %}
From c1ae5b0af5aa49f53ed64cf45ae99c1845b25234 Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Fri, 25 Nov 2022 15:06:06 +0530 Subject: [PATCH 41/50] fix(pos): filter on customer groups Signed-off-by: Sabu Siyad (cherry picked from commit cc63415887071b7675b95b6698884fd61847ab73) --- .../doctype/pos_invoice/pos_invoice.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js index 15c292211c0..fa11b7d9d8f 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js @@ -5,6 +5,8 @@ frappe.provide("erpnext.accounts"); erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnext.selling.SellingController { + settings = {}; + setup(doc) { this.setup_posting_date_time_check(); super.setup(doc); @@ -25,8 +27,13 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype); } + onload_post_render(frm) { + this.pos_profile(frm); + } + refresh(doc) { super.refresh(); + if (doc.docstatus == 1 && !doc.is_return) { this.frm.add_custom_button(__('Return'), this.make_sales_return, __('Create')); this.frm.page.set_inner_btn_group_as_primary(__('Create')); @@ -36,6 +43,18 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex this.frm.return_print_format = "Sales Invoice Return"; this.frm.set_value('consolidated_invoice', ''); } + + this.frm.set_query("customer", (function () { + const customer_groups = this.settings?.customer_groups; + + if (!customer_groups?.length) return {}; + + return { + filters: { + customer_group: ["in", customer_groups], + } + } + }).bind(this)); } is_pos() { @@ -88,6 +107,25 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex }); } + pos_profile(frm) { + if (!frm.pos_profile || frm.pos_profile == '') { + this.update_customer_groups_settings([]); + return; + } + + frappe.call({ + method: "erpnext.selling.page.point_of_sale.point_of_sale.get_pos_profile_data", + args: { "pos_profile": frm.pos_profile }, + callback: ({ message: profile }) => { + this.update_customer_groups_settings(profile?.customer_groups); + }, + }); + } + + update_customer_groups_settings(customer_groups) { + this.settings.customer_groups = customer_groups?.map((group) => group.name) + } + amount(){ this.write_off_outstanding_amount_automatically() } From c03ec80d1add7d2b854cf2252cc43c1a51e67c81 Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Thu, 24 Nov 2022 15:40:05 +0530 Subject: [PATCH 42/50] fix(pos): warehouse should be in company Signed-off-by: Sabu Siyad (cherry picked from commit 95a620a30d67e6b2ac5137d87efa97f3f149b95f) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js index 15c292211c0..c868d9ec7e9 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js @@ -12,6 +12,8 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex company() { erpnext.accounts.dimensions.update_dimension(this.frm, this.frm.doctype); + this.frm.set_value("set_warehouse", ""); + this.frm.set_value("taxes_and_charges", ""); } onload(doc) { From c379baf7a2d7f038e7eff5b204a9704434f2e5ed Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Thu, 24 Nov 2022 16:11:26 +0530 Subject: [PATCH 43/50] feat(pos): invoice: fitler warehouse by company Signed-off-by: Sabu Siyad (cherry picked from commit 4ad0e2ed7eb925c893a84ef00964fbc1cab09cc6) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js index c868d9ec7e9..40df6187d29 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js @@ -19,11 +19,20 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex onload(doc) { super.onload(); this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice Merge Log', 'POS Closing Entry']; + if(doc.__islocal && doc.is_pos && frappe.get_route_str() !== 'point-of-sale') { this.frm.script_manager.trigger("is_pos"); this.frm.refresh_fields(); } + this.frm.set_query("set_warehouse", function(doc) { + return { + filters: { + company: doc.company ? doc.company : '', + } + } + }); + erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype); } From 8d0f715087baf8940cc72986094d33c910e3c58b Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 25 Nov 2022 17:03:00 +0530 Subject: [PATCH 44/50] fix: only show serial no batch selector only once (cherry picked from commit 0f87d329d616c65249e180c57011cda4955e1e23) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 266ea5f674f..b9102445e01 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -1079,7 +1079,8 @@ erpnext.stock.select_batch_and_serial_no = (frm, item) => { if (frm.doc.purpose === 'Material Receipt') return; frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() { - new erpnext.SerialNoBatchSelector({ + if (frm.batch_selector?.dialog?.display) return; + frm.batch_selector = new erpnext.SerialNoBatchSelector({ frm: frm, item: item, warehouse_details: get_warehouse_type_and_name(item), From 04f50ea76a34ab95c83b4d62c560f0b1fab53ec9 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Thu, 17 Nov 2022 11:00:01 +0100 Subject: [PATCH 45/50] feat: validate repost item valuation against accounts freeze date (cherry picked from commit 61f05132dbd0cd3d0ed76e04f2d45a8a6ebf1c66) --- .../repost_item_valuation.py | 19 +++++++++++++-- .../test_repost_item_valuation.py | 23 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index d6f9bae5da2..5fc0ee094f6 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -5,7 +5,7 @@ import frappe from frappe import _ from frappe.exceptions import QueryDeadlockError, QueryTimeoutError from frappe.model.document import Document -from frappe.utils import cint, get_link_to_form, get_weekday, now, nowtime +from frappe.utils import cint, get_link_to_form, get_weekday, getdate, now, nowtime from frappe.utils.user import get_users_with_role from rq.timeouts import JobTimeoutException @@ -25,6 +25,21 @@ class RepostItemValuation(Document): self.set_status(write=False) self.reset_field_values() self.set_company() + self.validate_accounts_freeze() + + def validate_accounts_freeze(self): + acc_settings = frappe.db.get_value( + 'Accounts Settings', + 'Accounts Settings', + ['acc_frozen_upto', 'frozen_accounts_modifier'], + as_dict=1 + ) + if not acc_settings.acc_frozen_upto: + return + if acc_settings.frozen_accounts_modifier and self.owner in get_users_with_role(acc_settings.frozen_accounts_modifier): + return + if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto): + frappe.throw(_("You cannot repost item valuation before {}").format(acc_settings.acc_frozen_upto)) def reset_field_values(self): if self.based_on == "Transaction": @@ -240,7 +255,7 @@ def _get_directly_dependent_vouchers(doc): def notify_error_to_stock_managers(doc, traceback): recipients = get_users_with_role("Stock Manager") if not recipients: - get_users_with_role("System Manager") + recipients = get_users_with_role("System Manager") subject = _("Error while reposting item valuation") message = ( diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py index e0f24797100..dc03c79b33c 100644 --- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py @@ -327,3 +327,26 @@ class TestRepostItemValuation(FrappeTestCase, StockTestMixin): # outstanding should not be affected sinv.reload() self.assertEqual(sinv.outstanding_amount, 100) + + def test_account_freeze_validation(self): + today = nowdate() + + riv = frappe.get_doc( + doctype="Repost Item Valuation", + item_code="_Test Item", + warehouse="_Test Warehouse - _TC", + based_on="Item and Warehouse", + posting_date=today, + posting_time="00:01:00", + ) + riv.flags.dont_run_in_test = True # keep it queued + + accounts_settings = frappe.get_doc("Accounts Settings") + accounts_settings.acc_frozen_upto = today + accounts_settings.frozen_accounts_modifier = '' + accounts_settings.save() + + self.assertRaises(frappe.ValidationError, riv.save) + + accounts_settings.acc_frozen_upto = '' + accounts_settings.save() \ No newline at end of file From 68d9161a6602796e968b05e126cff7b7e0cef4e4 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Thu, 17 Nov 2022 11:00:34 +0100 Subject: [PATCH 46/50] chore: pre-commit (cherry picked from commit be15419bd5d3481dd83c7c4fedbb010d3e0e13d9) --- .../repost_item_valuation.py | 16 ++++++++++------ .../test_repost_item_valuation.py | 6 +++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index 5fc0ee094f6..b62933821c0 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -29,17 +29,21 @@ class RepostItemValuation(Document): def validate_accounts_freeze(self): acc_settings = frappe.db.get_value( - 'Accounts Settings', - 'Accounts Settings', - ['acc_frozen_upto', 'frozen_accounts_modifier'], - as_dict=1 + "Accounts Settings", + "Accounts Settings", + ["acc_frozen_upto", "frozen_accounts_modifier"], + as_dict=1, ) if not acc_settings.acc_frozen_upto: return - if acc_settings.frozen_accounts_modifier and self.owner in get_users_with_role(acc_settings.frozen_accounts_modifier): + if acc_settings.frozen_accounts_modifier and self.owner in get_users_with_role( + acc_settings.frozen_accounts_modifier + ): return if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto): - frappe.throw(_("You cannot repost item valuation before {}").format(acc_settings.acc_frozen_upto)) + frappe.throw( + _("You cannot repost item valuation before {}").format(acc_settings.acc_frozen_upto) + ) def reset_field_values(self): if self.based_on == "Transaction": diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py index dc03c79b33c..f1667757a75 100644 --- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py @@ -343,10 +343,10 @@ class TestRepostItemValuation(FrappeTestCase, StockTestMixin): accounts_settings = frappe.get_doc("Accounts Settings") accounts_settings.acc_frozen_upto = today - accounts_settings.frozen_accounts_modifier = '' + accounts_settings.frozen_accounts_modifier = "" accounts_settings.save() self.assertRaises(frappe.ValidationError, riv.save) - accounts_settings.acc_frozen_upto = '' - accounts_settings.save() \ No newline at end of file + accounts_settings.acc_frozen_upto = "" + accounts_settings.save() From c9c7222ded872f504f8b0b7b9d2d99f5b9e844dd Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Wed, 23 Nov 2022 18:59:15 +0530 Subject: [PATCH 47/50] fix: check for session user rather than owner (cherry picked from commit b482e3876dccb2547330b95c1c8d4f2cf7039918) --- .../repost_item_valuation/repost_item_valuation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index b62933821c0..a98d16e390f 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -36,11 +36,12 @@ class RepostItemValuation(Document): ) if not acc_settings.acc_frozen_upto: return - if acc_settings.frozen_accounts_modifier and self.owner in get_users_with_role( - acc_settings.frozen_accounts_modifier - ): - return if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto): + if acc_settings.frozen_accounts_modifier and frappe.session.user in get_users_with_role( + acc_settings.frozen_accounts_modifier + ): + frappe.msgprint(_("Caution: This might alter frozen accounts.")) + return frappe.throw( _("You cannot repost item valuation before {}").format(acc_settings.acc_frozen_upto) ) From 5854f1791c9bf809ae892417291bb9b96821765f Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Wed, 23 Nov 2022 19:04:11 +0530 Subject: [PATCH 48/50] chore: pre-commit (cherry picked from commit 88a0aa4077b6cd96800a813e5ba163b573d01f47) --- .../doctype/repost_item_valuation/repost_item_valuation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index a98d16e390f..8e914e6b807 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -37,8 +37,9 @@ class RepostItemValuation(Document): if not acc_settings.acc_frozen_upto: return if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto): - if acc_settings.frozen_accounts_modifier and frappe.session.user in get_users_with_role( + if ( acc_settings.frozen_accounts_modifier + and frappe.session.user in get_users_with_role(acc_settings.frozen_accounts_modifier) ): frappe.msgprint(_("Caution: This might alter frozen accounts.")) return From e530f0b2fbfe876ce164b984a8cd2c55b4799d55 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Tue, 29 Nov 2022 15:56:37 +0530 Subject: [PATCH 49/50] fix: reset `voucher_type` and `voucher_no` if `based_on` is set to `Item and Warehouse` (cherry picked from commit eeec00854700ca18197a91e8705ce8e528cb4cd6) --- .../repost_item_valuation.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js index d595a80b20a..8aec5328476 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js @@ -34,6 +34,22 @@ frappe.ui.form.on('Repost Item Valuation', { frm.trigger('setup_realtime_progress'); }, + based_on: function(frm) { + var fields_to_reset = []; + + if (frm.doc.based_on == 'Transaction') { + fields_to_reset = ['item_code', 'warehouse']; + } else if (frm.doc.based_on == 'Item and Warehouse') { + fields_to_reset = ['voucher_type', 'voucher_no']; + } + + if (fields_to_reset) { + fields_to_reset.forEach(field => { + frm.set_value(field, undefined); + }); + } + }, + setup_realtime_progress: function(frm) { frappe.realtime.on('item_reposting_progress', data => { if (frm.doc.name !== data.name) { From 5728300f036dbca6214088363532b18da22af3fb Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 30 Nov 2022 16:07:13 +0530 Subject: [PATCH 50/50] chore: make `posting_date` and `posting_time` read-only if `based_on` is set to `Transaction` (cherry picked from commit 4e10352b487303b42f21253a8c692e9d664de984) --- .../repost_item_valuation/repost_item_valuation.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json index e0939338294..8a5309c3480 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json @@ -50,13 +50,15 @@ "fieldname": "posting_date", "fieldtype": "Date", "label": "Posting Date", + "read_only_depends_on": "eval: doc.based_on == \"Transaction\"", "reqd": 1 }, { "fetch_from": "voucher_no.posting_time", "fieldname": "posting_time", "fieldtype": "Time", - "label": "Posting Time" + "label": "Posting Time", + "read_only_depends_on": "eval: doc.based_on == \"Transaction\"" }, { "default": "Queued", @@ -195,7 +197,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2022-06-13 12:20:22.182322", + "modified": "2022-11-28 16:00:05.637440", "modified_by": "Administrator", "module": "Stock", "name": "Repost Item Valuation",