From c258ac82c58f5937a0f5fcd564ef624f5ec6227a Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 12 Jun 2020 18:33:42 +0530 Subject: [PATCH 01/14] feat: Accounting entries for service item in Purchase receipt --- erpnext/accounts/doctype/account/account.json | 82 +++- .../purchase_invoice/purchase_invoice.py | 14 +- erpnext/setup/doctype/company/company.js | 5 +- erpnext/setup/doctype/company/company.json | 373 +++++++++++++----- .../purchase_receipt/purchase_receipt.py | 27 ++ .../stock_settings/stock_settings.json | 131 ++++-- 6 files changed, 490 insertions(+), 142 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index af252e6191..d2659d429b 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -34,11 +34,15 @@ { "fieldname": "properties", "fieldtype": "Section Break", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break0", "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1, "width": "50%" }, { @@ -49,7 +53,9 @@ "no_copy": 1, "oldfieldname": "account_name", "oldfieldtype": "Data", - "reqd": 1 + "reqd": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "account_number", @@ -57,13 +63,17 @@ "in_list_view": 1, "in_standard_filter": 1, "label": "Account Number", - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "is_group", "fieldtype": "Check", - "label": "Is Group" + "label": "Is Group", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "company", @@ -75,7 +85,9 @@ "options": "Company", "read_only": 1, "remember_last_selected_value": 1, - "reqd": 1 + "reqd": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "root_type", @@ -83,7 +95,9 @@ "in_standard_filter": 1, "label": "Root Type", "options": "\nAsset\nLiability\nIncome\nExpense\nEquity", - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "report_type", @@ -91,24 +105,32 @@ "in_standard_filter": 1, "label": "Report Type", "options": "\nBalance Sheet\nProfit and Loss", - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:doc.is_group==0", "fieldname": "account_currency", "fieldtype": "Link", "label": "Currency", - "options": "Currency" + "options": "Currency", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "inter_company_account", "fieldtype": "Check", - "label": "Inter Company Account" + "label": "Inter Company Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break1", "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1, "width": "50%" }, { @@ -120,7 +142,9 @@ "oldfieldtype": "Link", "options": "Account", "reqd": 1, - "search_index": 1 + "search_index": 1, + "show_days": 1, + "show_seconds": 1 }, { "description": "Setting Account Type helps in selecting this Account in transactions.", @@ -130,7 +154,9 @@ "label": "Account Type", "oldfieldname": "account_type", "oldfieldtype": "Select", - "options": "\nAccumulated Depreciation\nAsset Received But Not Billed\nBank\nCash\nChargeable\nCapital Work in Progress\nCost of Goods Sold\nDepreciation\nEquity\nExpense Account\nExpenses Included In Asset Valuation\nExpenses Included In Valuation\nFixed Asset\nIncome Account\nPayable\nReceivable\nRound Off\nStock\nStock Adjustment\nStock Received But Not Billed\nTax\nTemporary" + "options": "\nAccumulated Depreciation\nAsset Received But Not Billed\nBank\nCash\nChargeable\nCapital Work in Progress\nCost of Goods Sold\nDepreciation\nEquity\nExpense Account\nExpenses Included In Asset Valuation\nExpenses Included In Valuation\nFixed Asset\nIncome Account\nPayable\nReceivable\nRound Off\nStock\nStock Adjustment\nStock Received But Not Billed\nService Received But Not Billed\nTax\nTemporary", + "show_days": 1, + "show_seconds": 1 }, { "description": "Rate at which this tax is applied", @@ -138,7 +164,9 @@ "fieldtype": "Float", "label": "Rate", "oldfieldname": "tax_rate", - "oldfieldtype": "Currency" + "oldfieldtype": "Currency", + "show_days": 1, + "show_seconds": 1 }, { "description": "If the account is frozen, entries are allowed to restricted users.", @@ -147,13 +175,17 @@ "label": "Frozen", "oldfieldname": "freeze_account", "oldfieldtype": "Select", - "options": "No\nYes" + "options": "No\nYes", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "balance_must_be", "fieldtype": "Select", "label": "Balance must be", - "options": "\nDebit\nCredit" + "options": "\nDebit\nCredit", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "lft", @@ -162,7 +194,9 @@ "label": "Lft", "print_hide": 1, "read_only": 1, - "search_index": 1 + "search_index": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "rgt", @@ -171,7 +205,9 @@ "label": "Rgt", "print_hide": 1, "read_only": 1, - "search_index": 1 + "search_index": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "old_parent", @@ -179,27 +215,33 @@ "hidden": 1, "label": "Old Parent", "print_hide": 1, - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "depends_on": "eval:(doc.report_type == 'Profit and Loss' && !doc.is_group)", "fieldname": "include_in_gross", "fieldtype": "Check", - "label": "Include in gross" + "label": "Include in gross", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "disabled", "fieldtype": "Check", - "label": "Disable" + "label": "Disable", + "show_days": 1, + "show_seconds": 1 } ], "icon": "fa fa-money", "idx": 1, "is_tree": 1, "links": [], - "modified": "2020-03-18 17:57:52.063233", + "modified": "2020-06-11 15:15:54.338622", "modified_by": "Administrator", "module": "Accounts", "name": "Account", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index aa1d5b526c..30c661a972 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -570,6 +570,18 @@ class PurchaseInvoice(BuyingController): else: amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount")) + auto_accounting_for_non_stock_items = cint(frappe.db.get_single_value('Stock Settings', 'enable_perpetual_inventory_for_non_stock_items')) + service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") + + if item.purchase_receipt and auto_accounting_for_non_stock_items: + # Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt + expense_booked_in_pr = frappe.db.get_value('GL Entry', {'is_cancelled': 0, + 'voucher_type': 'Purchase Receipt', 'voucher_no': item.purchase_receipt, 'voucher_detail_no': item.pr_detail, + 'account':service_received_but_not_billed_account}, ['name']) + + if expense_booked_in_pr: + expense_account = service_received_but_not_billed_account + gl_entries.append(self.get_gl_dict({ "account": expense_account, "against": self.supplier, @@ -1020,7 +1032,7 @@ class PurchaseInvoice(BuyingController): # calculate totals again after applying TDS self.calculate_taxes_and_totals() - + def set_status(self, update=False, status=None, update_modified=True): if self.is_new(): if self.get('amended_from'): diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 875904fe6f..7ae5385a23 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -264,7 +264,10 @@ erpnext.company.setup_queries = function(frm) { ["expenses_included_in_valuation", {"root_type": "Expense", "account_type": "Expenses Included in Valuation"}], ["stock_received_but_not_billed", - {"root_type": "Liability", "account_type": "Stock Received But Not Billed"}] + {"root_type": "Liability", "account_type": "Stock Received But Not Billed"}], + ["service_received_but_not_billed", + {"root_type": "Liability", "account_type": "Service Received But Not Billed"}], + ], function(i, v) { erpnext.company.set_custom_query(frm, v); }); diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 020a93ff6a..0b91b70034 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -71,6 +71,7 @@ "stock_adjustment_account", "column_break_32", "stock_received_but_not_billed", + "service_received_but_not_billed", "expenses_included_in_valuation", "fixed_asset_depreciation_settings", "accumulated_depreciation_account", @@ -106,7 +107,9 @@ { "fieldname": "details", "fieldtype": "Section Break", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "company_name", @@ -115,6 +118,8 @@ "oldfieldname": "company_name", "oldfieldtype": "Data", "reqd": 1, + "show_days": 1, + "show_seconds": 1, "unique": 1 }, { @@ -123,36 +128,48 @@ "label": "Abbr", "oldfieldname": "abbr", "oldfieldtype": "Data", - "reqd": 1 + "reqd": 1, + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")", "fieldname": "change_abbr", "fieldtype": "Button", - "label": "Change Abbreviation" + "label": "Change Abbreviation", + "show_days": 1, + "show_seconds": 1 }, { "bold": 1, "default": "0", "fieldname": "is_group", "fieldtype": "Check", - "label": "Is Group" + "label": "Is Group", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_finance_book", "fieldtype": "Link", "label": "Default Finance Book", - "options": "Finance Book" + "options": "Finance Book", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "cb0", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "domain", "fieldtype": "Link", "label": "Domain", - "options": "Domain" + "options": "Domain", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "parent_company", @@ -160,24 +177,32 @@ "ignore_user_permissions": 1, "in_list_view": 1, "label": "Parent Company", - "options": "Company" + "options": "Company", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "company_logo", "fieldtype": "Attach Image", "hidden": 1, - "label": "Company Logo" + "label": "Company Logo", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "company_description", "fieldtype": "Text Editor", - "label": "Company Description" + "label": "Company Description", + "show_days": 1, + "show_seconds": 1 }, { "collapsible": 1, "fieldname": "sales_settings", "fieldtype": "Section Break", - "label": "Sales Settings" + "label": "Sales Settings", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "sales_monthly_history", @@ -185,7 +210,9 @@ "hidden": 1, "label": "Sales Monthly History", "no_copy": 1, - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "transactions_annual_history", @@ -193,17 +220,23 @@ "hidden": 1, "label": "Transactions Annual History", "no_copy": 1, - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "monthly_sales_target", "fieldtype": "Currency", "label": "Monthly Sales Target", - "options": "default_currency" + "options": "default_currency", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_goals", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "total_monthly_sales", @@ -211,12 +244,16 @@ "label": "Total Monthly Sales", "no_copy": 1, "options": "default_currency", - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "charts_section", "fieldtype": "Section Break", - "label": "Default Values" + "label": "Default Values", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_currency", @@ -224,34 +261,46 @@ "ignore_user_permissions": 1, "label": "Default Currency", "options": "Currency", - "reqd": 1 + "reqd": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_letter_head", "fieldtype": "Link", "label": "Default Letter Head", - "options": "Letter Head" + "options": "Letter Head", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_holiday_list", "fieldtype": "Link", "label": "Default Holiday List", - "options": "Holiday List" + "options": "Holiday List", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "standard_working_hours", "fieldtype": "Float", - "label": "Standard Working Hours" + "label": "Standard Working Hours", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_warehouse_for_sales_return", "fieldtype": "Link", "label": "Default warehouse for Sales Return", - "options": "Warehouse" + "options": "Warehouse", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_10", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "country", @@ -259,20 +308,26 @@ "in_list_view": 1, "label": "Country", "options": "Country", - "reqd": 1 + "reqd": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "create_chart_of_accounts_based_on", "fieldtype": "Select", "label": "Create Chart Of Accounts Based On", - "options": "\nStandard Template\nExisting Company" + "options": "\nStandard Template\nExisting Company", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"", "fieldname": "chart_of_accounts", "fieldtype": "Select", "label": "Chart Of Accounts Template", - "no_copy": 1 + "no_copy": 1, + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"", @@ -281,23 +336,31 @@ "ignore_user_permissions": 1, "label": "Existing Company ", "no_copy": 1, - "options": "Company" + "options": "Company", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "tax_id", "fieldtype": "Data", - "label": "Tax ID" + "label": "Tax ID", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "date_of_establishment", "fieldtype": "Date", - "label": "Date of Establishment" + "label": "Date of Establishment", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_settings", "fieldtype": "Section Break", "label": "Accounts Settings", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -308,7 +371,9 @@ "no_copy": 1, "oldfieldname": "default_bank_account", "oldfieldtype": "Link", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -317,7 +382,9 @@ "ignore_user_permissions": 1, "label": "Default Cash Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -328,54 +395,72 @@ "no_copy": 1, "oldfieldname": "receivables_group", "oldfieldtype": "Link", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "round_off_account", "fieldtype": "Link", "label": "Round Off Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "round_off_cost_center", "fieldtype": "Link", "label": "Round Off Cost Center", - "options": "Cost Center" + "options": "Cost Center", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "write_off_account", "fieldtype": "Link", "label": "Write Off Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "discount_allowed_account", "fieldtype": "Link", "label": "Discount Allowed Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "discount_received_account", "fieldtype": "Link", "label": "Discount Received Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "exchange_gain_loss_account", "fieldtype": "Link", "label": "Exchange Gain / Loss Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "unrealized_exchange_gain_loss_account", "fieldtype": "Link", "label": "Unrealized Exchange Gain/Loss Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break0", "fieldtype": "Column Break", "oldfieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1, "width": "50%" }, { @@ -383,7 +468,9 @@ "depends_on": "eval:doc.parent_company", "fieldname": "allow_account_creation_against_child_company", "fieldtype": "Check", - "label": "Allow Account Creation Against Child Company" + "label": "Allow Account Creation Against Child Company", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -394,14 +481,18 @@ "no_copy": 1, "oldfieldname": "payables_group", "oldfieldtype": "Link", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_employee_advance_account", "fieldtype": "Link", "label": "Default Employee Advance Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -410,7 +501,9 @@ "ignore_user_permissions": 1, "label": "Default Cost of Goods Sold Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -419,7 +512,9 @@ "ignore_user_permissions": 1, "label": "Default Income Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -428,7 +523,9 @@ "ignore_user_permissions": 1, "label": "Default Deferred Revenue Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -437,7 +534,9 @@ "ignore_user_permissions": 1, "label": "Default Deferred Expense Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -446,7 +545,9 @@ "ignore_user_permissions": 1, "label": "Default Payroll Payable Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -455,11 +556,15 @@ "ignore_user_permissions": 1, "label": "Default Expense Claim Payable Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "section_break_22", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -468,11 +573,15 @@ "ignore_user_permissions": 1, "label": "Default Cost Center", "no_copy": 1, - "options": "Cost Center" + "options": "Cost Center", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_26", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", @@ -481,31 +590,41 @@ "label": "Credit Limit", "oldfieldname": "credit_limit", "oldfieldtype": "Currency", - "options": "default_currency" + "options": "default_currency", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "payment_terms", "fieldtype": "Link", "label": "Default Payment Terms Template", - "options": "Payment Terms Template" + "options": "Payment Terms Template", + "show_days": 1, + "show_seconds": 1 }, { "depends_on": "eval:!doc.__islocal", "fieldname": "auto_accounting_for_stock_settings", "fieldtype": "Section Break", - "label": "Stock Settings" + "label": "Stock Settings", + "show_days": 1, + "show_seconds": 1 }, { "default": "1", "fieldname": "enable_perpetual_inventory", "fieldtype": "Check", - "label": "Enable Perpetual Inventory" + "label": "Enable Perpetual Inventory", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_inventory_account", "fieldtype": "Link", "label": "Default Inventory Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "stock_adjustment_account", @@ -513,11 +632,15 @@ "ignore_user_permissions": 1, "label": "Stock Adjustment Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_32", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "stock_received_but_not_billed", @@ -525,7 +648,9 @@ "ignore_user_permissions": 1, "label": "Stock Received But Not Billed", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "expenses_included_in_valuation", @@ -533,108 +658,144 @@ "ignore_user_permissions": 1, "label": "Expenses Included In Valuation", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "collapsible": 1, "fieldname": "fixed_asset_depreciation_settings", "fieldtype": "Section Break", - "label": "Fixed Asset Depreciation Settings" + "label": "Fixed Asset Depreciation Settings", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "accumulated_depreciation_account", "fieldtype": "Link", "label": "Accumulated Depreciation Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "depreciation_expense_account", "fieldtype": "Link", "label": "Depreciation Expense Account", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "series_for_depreciation_entry", "fieldtype": "Data", - "label": "Series for Asset Depreciation Entry (Journal Entry)" + "label": "Series for Asset Depreciation Entry (Journal Entry)", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "expenses_included_in_asset_valuation", "fieldtype": "Link", "label": "Expenses Included In Asset Valuation", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_40", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "disposal_account", "fieldtype": "Link", "label": "Gain/Loss Account on Asset Disposal", "no_copy": 1, - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "depreciation_cost_center", "fieldtype": "Link", "label": "Asset Depreciation Cost Center", "no_copy": 1, - "options": "Cost Center" + "options": "Cost Center", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "capital_work_in_progress_account", "fieldtype": "Link", "label": "Capital Work In Progress Account", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "asset_received_but_not_billed", "fieldtype": "Link", "label": "Asset Received But Not Billed", - "options": "Account" + "options": "Account", + "show_days": 1, + "show_seconds": 1 }, { "collapsible": 1, "fieldname": "budget_detail", "fieldtype": "Section Break", - "label": "Budget Detail" + "label": "Budget Detail", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "exception_budget_approver_role", "fieldtype": "Link", "label": "Exception Budget Approver Role", - "options": "Role" + "options": "Role", + "show_days": 1, + "show_seconds": 1 }, { "collapsible": 1, "description": "For reference only.", "fieldname": "company_info", "fieldtype": "Section Break", - "label": "Company Info" + "label": "Company Info", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "date_of_incorporation", "fieldtype": "Date", - "label": "Date of Incorporation" + "label": "Date of Incorporation", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "address_html", - "fieldtype": "HTML" + "fieldtype": "HTML", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break1", "fieldtype": "Column Break", "oldfieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1, "width": "50%" }, { "depends_on": "eval:doc.date_of_incorporation", "fieldname": "date_of_commencement", "fieldtype": "Date", - "label": "Date of Commencement" + "label": "Date of Commencement", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "phone_no", @@ -642,7 +803,9 @@ "label": "Phone No", "oldfieldname": "phone_no", "oldfieldtype": "Data", - "options": "Phone" + "options": "Phone", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "fax", @@ -650,7 +813,9 @@ "label": "Fax", "oldfieldname": "fax", "oldfieldtype": "Data", - "options": "Phone" + "options": "Phone", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "email", @@ -658,19 +823,25 @@ "label": "Email", "oldfieldname": "email", "oldfieldtype": "Data", - "options": "Email" + "options": "Email", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "website", "fieldtype": "Data", "label": "Website", "oldfieldname": "website", - "oldfieldtype": "Data" + "oldfieldtype": "Data", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "registration_info", "fieldtype": "Section Break", "oldfieldtype": "Section Break", + "show_days": 1, + "show_seconds": 1, "width": "50%" }, { @@ -679,12 +850,16 @@ "fieldtype": "Code", "label": "Registration Details", "oldfieldname": "registration_details", - "oldfieldtype": "Code" + "oldfieldtype": "Code", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "delete_company_transactions", "fieldtype": "Button", - "label": "Delete Company Transactions" + "label": "Delete Company Transactions", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "lft", @@ -693,7 +868,9 @@ "label": "Lft", "print_hide": 1, "read_only": 1, - "search_index": 1 + "search_index": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "rgt", @@ -702,7 +879,9 @@ "label": "Rgt", "print_hide": 1, "read_only": 1, - "search_index": 1 + "search_index": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "old_parent", @@ -710,19 +889,35 @@ "hidden": 1, "label": "old_parent", "print_hide": 1, - "read_only": 1 + "read_only": 1, + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_selling_terms", "fieldtype": "Link", "label": "Default Selling Terms", - "options": "Terms and Conditions" + "options": "Terms and Conditions", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_buying_terms", "fieldtype": "Link", "label": "Default Buying Terms", - "options": "Terms and Conditions" + "options": "Terms and Conditions", + "show_days": 1, + "show_seconds": 1 + }, + { + "fieldname": "service_received_but_not_billed", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Service Received But Not Billed", + "no_copy": 1, + "options": "Account", + "show_days": 1, + "show_seconds": 1 } ], "icon": "fa fa-building", @@ -730,7 +925,7 @@ "image_field": "company_logo", "is_tree": 1, "links": [], - "modified": "2020-03-21 18:09:53.534211", + "modified": "2020-06-11 15:32:59.147735", "modified_by": "Administrator", "module": "Setup", "name": "Company", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index e6ab8d634d..94a6edd2c1 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -211,6 +211,8 @@ class PurchaseReceipt(BuyingController): stock_rbnb = self.get_company_default("stock_received_but_not_billed") landed_cost_entries = get_item_account_wise_additional_cost(self.name) expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") + service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") + auto_accounting_for_non_stock_items = cint(frappe.db.get_single_value('Stock Settings', 'enable_perpetual_inventory_for_non_stock_items')) gl_entries = [] warehouse_with_no_account = [] @@ -301,6 +303,31 @@ class PurchaseReceipt(BuyingController): elif d.warehouse not in warehouse_with_no_account or \ d.rejected_warehouse not in warehouse_with_no_account: warehouse_with_no_account.append(d.warehouse) + elif d.item_code not in stock_items and flt(d.qty) and auto_accounting_for_non_stock_items: + + credit_currency = get_account_currency(service_received_but_not_billed_account) + + gl_entries.append(self.get_gl_dict({ + "account": service_received_but_not_billed_account, + "against": d.expense_account, + "cost_center": d.cost_center, + "remarks": self.get("remarks") or _("Accounting Entry for Service"), + "project": d.project, + "credit": d.amount, + "voucher_detail_no": d.name + }, credit_currency, item=d)) + + debit_currency = get_account_currency(d.expense_account) + + gl_entries.append(self.get_gl_dict({ + "account": d.expense_account, + "against": service_received_but_not_billed_account, + "cost_center": d.cost_center, + "remarks": self.get("remarks") or _("Accounting Entry for Service"), + "project": d.project, + "debit": d.amount, + "voucher_detail_no": d.name + }, debit_currency, item=d)) self.get_asset_gl_entry(gl_entries) # Cost center-wise amount breakup for other charges included for valuation diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index c9a3527e91..a7ed620dca 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -16,6 +16,7 @@ "action_if_quality_inspection_is_not_submitted", "show_barcode_field", "clean_description_html", + "enable_perpetual_inventory_for_non_stock_items", "section_break_7", "auto_insert_price_list_rate_if_missing", "allow_negative_stock", @@ -43,180 +44,248 @@ "fieldtype": "Select", "in_list_view": 1, "label": "Item Naming By", - "options": "Item Code\nNaming Series" + "options": "Item Code\nNaming Series", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "item_group", "fieldtype": "Link", "in_list_view": 1, "label": "Default Item Group", - "options": "Item Group" + "options": "Item Group", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "stock_uom", "fieldtype": "Link", "in_list_view": 1, "label": "Default Stock UOM", - "options": "UOM" + "options": "UOM", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "default_warehouse", "fieldtype": "Link", "label": "Default Warehouse", - "options": "Warehouse" + "options": "Warehouse", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "sample_retention_warehouse", "fieldtype": "Link", "label": "Sample Retention Warehouse", - "options": "Warehouse" + "options": "Warehouse", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_4", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "valuation_method", "fieldtype": "Select", "label": "Default Valuation Method", - "options": "FIFO\nMoving Average" + "options": "FIFO\nMoving Average", + "show_days": 1, + "show_seconds": 1 }, { "description": "Percentage you are allowed to receive or deliver more against the quantity ordered. For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units.", "fieldname": "over_delivery_receipt_allowance", "fieldtype": "Float", - "label": "Over Delivery/Receipt Allowance (%)" + "label": "Over Delivery/Receipt Allowance (%)", + "show_days": 1, + "show_seconds": 1 }, { "default": "Stop", "fieldname": "action_if_quality_inspection_is_not_submitted", "fieldtype": "Select", "label": "Action if Quality inspection is not submitted", - "options": "Stop\nWarn" + "options": "Stop\nWarn", + "show_days": 1, + "show_seconds": 1 }, { "default": "1", "fieldname": "show_barcode_field", "fieldtype": "Check", - "label": "Show Barcode Field" + "label": "Show Barcode Field", + "show_days": 1, + "show_seconds": 1 }, { "default": "1", "fieldname": "clean_description_html", "fieldtype": "Check", - "label": "Convert Item Description to Clean HTML" + "label": "Convert Item Description to Clean HTML", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "section_break_7", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "auto_insert_price_list_rate_if_missing", "fieldtype": "Check", - "label": "Auto insert Price List rate if missing" + "label": "Auto insert Price List rate if missing", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "allow_negative_stock", "fieldtype": "Check", - "label": "Allow Negative Stock" + "label": "Allow Negative Stock", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "column_break_10", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 }, { "default": "1", "fieldname": "automatically_set_serial_nos_based_on_fifo", "fieldtype": "Check", - "label": "Automatically Set Serial Nos based on FIFO" + "label": "Automatically Set Serial Nos based on FIFO", + "show_days": 1, + "show_seconds": 1 }, { "default": "1", "fieldname": "set_qty_in_transactions_based_on_serial_no_input", "fieldtype": "Check", - "label": "Set Qty in Transactions based on Serial No Input" + "label": "Set Qty in Transactions based on Serial No Input", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "auto_material_request", "fieldtype": "Section Break", - "label": "Auto Material Request" + "label": "Auto Material Request", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "auto_indent", "fieldtype": "Check", - "label": "Raise Material Request when stock reaches re-order level" + "label": "Raise Material Request when stock reaches re-order level", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "reorder_email_notify", "fieldtype": "Check", - "label": "Notify by Email on creation of automatic Material Request" + "label": "Notify by Email on creation of automatic Material Request", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "freeze_stock_entries", "fieldtype": "Section Break", - "label": "Freeze Stock Entries" + "label": "Freeze Stock Entries", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "stock_frozen_upto", "fieldtype": "Date", - "label": "Stock Frozen Upto" + "label": "Stock Frozen Upto", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "stock_frozen_upto_days", "fieldtype": "Int", - "label": "Freeze Stocks Older Than [Days]" + "label": "Freeze Stocks Older Than [Days]", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "stock_auth_role", "fieldtype": "Link", "label": "Role Allowed to edit frozen stock", - "options": "Role" + "options": "Role", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "batch_id_sb", "fieldtype": "Section Break", - "label": "Batch Identification" + "label": "Batch Identification", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "use_naming_series", "fieldtype": "Check", - "label": "Use Naming Series" + "label": "Use Naming Series", + "show_days": 1, + "show_seconds": 1 }, { "default": "BATCH-", "depends_on": "eval:doc.use_naming_series==1", "fieldname": "naming_series_prefix", "fieldtype": "Data", - "label": "Naming Series Prefix" + "label": "Naming Series Prefix", + "show_days": 1, + "show_seconds": 1 }, { "fieldname": "inter_warehouse_transfer_settings_section", "fieldtype": "Section Break", - "label": "Inter Warehouse Transfer Settings" + "label": "Inter Warehouse Transfer Settings", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "allow_from_dn", "fieldtype": "Check", - "label": "Allow Material Transfer From Delivery Note and Sales Invoice" + "label": "Allow Material Transfer From Delivery Note and Sales Invoice", + "show_days": 1, + "show_seconds": 1 }, { "default": "0", "fieldname": "allow_from_pr", "fieldtype": "Check", - "label": "Allow Material Transfer From Purchase Receipt and Purchase Invoice" + "label": "Allow Material Transfer From Purchase Receipt and Purchase Invoice", + "show_days": 1, + "show_seconds": 1 + }, + { + "default": "0", + "fieldname": "enable_perpetual_inventory_for_non_stock_items", + "fieldtype": "Check", + "label": "Enable Perpetual Inventory For Non Stock Items", + "show_days": 1, + "show_seconds": 1 } ], "icon": "icon-cog", "idx": 1, "issingle": 1, "links": [], - "modified": "2020-04-01 18:11:25.417678", + "modified": "2020-06-11 15:10:41.211638", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", From 53d5d16abb52790d60c0ef050a9c7a6685fbc5df Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 20 Jun 2020 11:55:56 +0530 Subject: [PATCH 02/14] fix: Move check from Stock Settings to Company Master --- .../purchase_invoice/purchase_invoice.py | 2 +- erpnext/setup/doctype/company/company.json | 373 +++++------------- .../purchase_receipt/purchase_receipt.py | 2 +- .../stock_settings/stock_settings.json | 131 ++---- 4 files changed, 130 insertions(+), 378 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 30c661a972..32d61f955b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -570,7 +570,7 @@ class PurchaseInvoice(BuyingController): else: amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount")) - auto_accounting_for_non_stock_items = cint(frappe.db.get_single_value('Stock Settings', 'enable_perpetual_inventory_for_non_stock_items')) + auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items')) service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") if item.purchase_receipt and auto_accounting_for_non_stock_items: diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 0b91b70034..c25edc5505 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -67,6 +67,7 @@ "payment_terms", "auto_accounting_for_stock_settings", "enable_perpetual_inventory", + "enable_perpetual_inventory_for_non_stock_items", "default_inventory_account", "stock_adjustment_account", "column_break_32", @@ -107,9 +108,7 @@ { "fieldname": "details", "fieldtype": "Section Break", - "oldfieldtype": "Section Break", - "show_days": 1, - "show_seconds": 1 + "oldfieldtype": "Section Break" }, { "fieldname": "company_name", @@ -118,8 +117,6 @@ "oldfieldname": "company_name", "oldfieldtype": "Data", "reqd": 1, - "show_days": 1, - "show_seconds": 1, "unique": 1 }, { @@ -128,48 +125,36 @@ "label": "Abbr", "oldfieldname": "abbr", "oldfieldtype": "Data", - "reqd": 1, - "show_days": 1, - "show_seconds": 1 + "reqd": 1 }, { "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")", "fieldname": "change_abbr", "fieldtype": "Button", - "label": "Change Abbreviation", - "show_days": 1, - "show_seconds": 1 + "label": "Change Abbreviation" }, { "bold": 1, "default": "0", "fieldname": "is_group", "fieldtype": "Check", - "label": "Is Group", - "show_days": 1, - "show_seconds": 1 + "label": "Is Group" }, { "fieldname": "default_finance_book", "fieldtype": "Link", "label": "Default Finance Book", - "options": "Finance Book", - "show_days": 1, - "show_seconds": 1 + "options": "Finance Book" }, { "fieldname": "cb0", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "domain", "fieldtype": "Link", "label": "Domain", - "options": "Domain", - "show_days": 1, - "show_seconds": 1 + "options": "Domain" }, { "fieldname": "parent_company", @@ -177,32 +162,24 @@ "ignore_user_permissions": 1, "in_list_view": 1, "label": "Parent Company", - "options": "Company", - "show_days": 1, - "show_seconds": 1 + "options": "Company" }, { "fieldname": "company_logo", "fieldtype": "Attach Image", "hidden": 1, - "label": "Company Logo", - "show_days": 1, - "show_seconds": 1 + "label": "Company Logo" }, { "fieldname": "company_description", "fieldtype": "Text Editor", - "label": "Company Description", - "show_days": 1, - "show_seconds": 1 + "label": "Company Description" }, { "collapsible": 1, "fieldname": "sales_settings", "fieldtype": "Section Break", - "label": "Sales Settings", - "show_days": 1, - "show_seconds": 1 + "label": "Sales Settings" }, { "fieldname": "sales_monthly_history", @@ -210,9 +187,7 @@ "hidden": 1, "label": "Sales Monthly History", "no_copy": 1, - "read_only": 1, - "show_days": 1, - "show_seconds": 1 + "read_only": 1 }, { "fieldname": "transactions_annual_history", @@ -220,23 +195,17 @@ "hidden": 1, "label": "Transactions Annual History", "no_copy": 1, - "read_only": 1, - "show_days": 1, - "show_seconds": 1 + "read_only": 1 }, { "fieldname": "monthly_sales_target", "fieldtype": "Currency", "label": "Monthly Sales Target", - "options": "default_currency", - "show_days": 1, - "show_seconds": 1 + "options": "default_currency" }, { "fieldname": "column_break_goals", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "total_monthly_sales", @@ -244,16 +213,12 @@ "label": "Total Monthly Sales", "no_copy": 1, "options": "default_currency", - "read_only": 1, - "show_days": 1, - "show_seconds": 1 + "read_only": 1 }, { "fieldname": "charts_section", "fieldtype": "Section Break", - "label": "Default Values", - "show_days": 1, - "show_seconds": 1 + "label": "Default Values" }, { "fieldname": "default_currency", @@ -261,46 +226,34 @@ "ignore_user_permissions": 1, "label": "Default Currency", "options": "Currency", - "reqd": 1, - "show_days": 1, - "show_seconds": 1 + "reqd": 1 }, { "fieldname": "default_letter_head", "fieldtype": "Link", "label": "Default Letter Head", - "options": "Letter Head", - "show_days": 1, - "show_seconds": 1 + "options": "Letter Head" }, { "fieldname": "default_holiday_list", "fieldtype": "Link", "label": "Default Holiday List", - "options": "Holiday List", - "show_days": 1, - "show_seconds": 1 + "options": "Holiday List" }, { "fieldname": "standard_working_hours", "fieldtype": "Float", - "label": "Standard Working Hours", - "show_days": 1, - "show_seconds": 1 + "label": "Standard Working Hours" }, { "fieldname": "default_warehouse_for_sales_return", "fieldtype": "Link", "label": "Default warehouse for Sales Return", - "options": "Warehouse", - "show_days": 1, - "show_seconds": 1 + "options": "Warehouse" }, { "fieldname": "column_break_10", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "country", @@ -308,26 +261,20 @@ "in_list_view": 1, "label": "Country", "options": "Country", - "reqd": 1, - "show_days": 1, - "show_seconds": 1 + "reqd": 1 }, { "fieldname": "create_chart_of_accounts_based_on", "fieldtype": "Select", "label": "Create Chart Of Accounts Based On", - "options": "\nStandard Template\nExisting Company", - "show_days": 1, - "show_seconds": 1 + "options": "\nStandard Template\nExisting Company" }, { "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"", "fieldname": "chart_of_accounts", "fieldtype": "Select", "label": "Chart Of Accounts Template", - "no_copy": 1, - "show_days": 1, - "show_seconds": 1 + "no_copy": 1 }, { "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"", @@ -336,31 +283,23 @@ "ignore_user_permissions": 1, "label": "Existing Company ", "no_copy": 1, - "options": "Company", - "show_days": 1, - "show_seconds": 1 + "options": "Company" }, { "fieldname": "tax_id", "fieldtype": "Data", - "label": "Tax ID", - "show_days": 1, - "show_seconds": 1 + "label": "Tax ID" }, { "fieldname": "date_of_establishment", "fieldtype": "Date", - "label": "Date of Establishment", - "show_days": 1, - "show_seconds": 1 + "label": "Date of Establishment" }, { "fieldname": "default_settings", "fieldtype": "Section Break", "label": "Accounts Settings", - "oldfieldtype": "Section Break", - "show_days": 1, - "show_seconds": 1 + "oldfieldtype": "Section Break" }, { "depends_on": "eval:!doc.__islocal", @@ -371,9 +310,7 @@ "no_copy": 1, "oldfieldname": "default_bank_account", "oldfieldtype": "Link", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -382,9 +319,7 @@ "ignore_user_permissions": 1, "label": "Default Cash Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -395,72 +330,54 @@ "no_copy": 1, "oldfieldname": "receivables_group", "oldfieldtype": "Link", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "round_off_account", "fieldtype": "Link", "label": "Round Off Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "round_off_cost_center", "fieldtype": "Link", "label": "Round Off Cost Center", - "options": "Cost Center", - "show_days": 1, - "show_seconds": 1 + "options": "Cost Center" }, { "fieldname": "write_off_account", "fieldtype": "Link", "label": "Write Off Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "discount_allowed_account", "fieldtype": "Link", "label": "Discount Allowed Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "discount_received_account", "fieldtype": "Link", "label": "Discount Received Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "exchange_gain_loss_account", "fieldtype": "Link", "label": "Exchange Gain / Loss Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "unrealized_exchange_gain_loss_account", "fieldtype": "Link", "label": "Unrealized Exchange Gain/Loss Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "column_break0", "fieldtype": "Column Break", "oldfieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1, "width": "50%" }, { @@ -468,9 +385,7 @@ "depends_on": "eval:doc.parent_company", "fieldname": "allow_account_creation_against_child_company", "fieldtype": "Check", - "label": "Allow Account Creation Against Child Company", - "show_days": 1, - "show_seconds": 1 + "label": "Allow Account Creation Against Child Company" }, { "depends_on": "eval:!doc.__islocal", @@ -481,18 +396,14 @@ "no_copy": 1, "oldfieldname": "payables_group", "oldfieldtype": "Link", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "default_employee_advance_account", "fieldtype": "Link", "label": "Default Employee Advance Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -501,9 +412,7 @@ "ignore_user_permissions": 1, "label": "Default Cost of Goods Sold Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -512,9 +421,7 @@ "ignore_user_permissions": 1, "label": "Default Income Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -523,9 +430,7 @@ "ignore_user_permissions": 1, "label": "Default Deferred Revenue Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -534,9 +439,7 @@ "ignore_user_permissions": 1, "label": "Default Deferred Expense Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -545,9 +448,7 @@ "ignore_user_permissions": 1, "label": "Default Payroll Payable Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "depends_on": "eval:!doc.__islocal", @@ -556,15 +457,11 @@ "ignore_user_permissions": 1, "label": "Default Expense Claim Payable Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "section_break_22", - "fieldtype": "Section Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Section Break" }, { "depends_on": "eval:!doc.__islocal", @@ -573,15 +470,11 @@ "ignore_user_permissions": 1, "label": "Default Cost Center", "no_copy": 1, - "options": "Cost Center", - "show_days": 1, - "show_seconds": 1 + "options": "Cost Center" }, { "fieldname": "column_break_26", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "depends_on": "eval:!doc.__islocal", @@ -590,41 +483,31 @@ "label": "Credit Limit", "oldfieldname": "credit_limit", "oldfieldtype": "Currency", - "options": "default_currency", - "show_days": 1, - "show_seconds": 1 + "options": "default_currency" }, { "fieldname": "payment_terms", "fieldtype": "Link", "label": "Default Payment Terms Template", - "options": "Payment Terms Template", - "show_days": 1, - "show_seconds": 1 + "options": "Payment Terms Template" }, { "depends_on": "eval:!doc.__islocal", "fieldname": "auto_accounting_for_stock_settings", "fieldtype": "Section Break", - "label": "Stock Settings", - "show_days": 1, - "show_seconds": 1 + "label": "Stock Settings" }, { "default": "1", "fieldname": "enable_perpetual_inventory", "fieldtype": "Check", - "label": "Enable Perpetual Inventory", - "show_days": 1, - "show_seconds": 1 + "label": "Enable Perpetual Inventory" }, { "fieldname": "default_inventory_account", "fieldtype": "Link", "label": "Default Inventory Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "stock_adjustment_account", @@ -632,15 +515,11 @@ "ignore_user_permissions": 1, "label": "Stock Adjustment Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "column_break_32", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "stock_received_but_not_billed", @@ -648,9 +527,7 @@ "ignore_user_permissions": 1, "label": "Stock Received But Not Billed", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "expenses_included_in_valuation", @@ -658,144 +535,108 @@ "ignore_user_permissions": 1, "label": "Expenses Included In Valuation", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "collapsible": 1, "fieldname": "fixed_asset_depreciation_settings", "fieldtype": "Section Break", - "label": "Fixed Asset Depreciation Settings", - "show_days": 1, - "show_seconds": 1 + "label": "Fixed Asset Depreciation Settings" }, { "fieldname": "accumulated_depreciation_account", "fieldtype": "Link", "label": "Accumulated Depreciation Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "depreciation_expense_account", "fieldtype": "Link", "label": "Depreciation Expense Account", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "series_for_depreciation_entry", "fieldtype": "Data", - "label": "Series for Asset Depreciation Entry (Journal Entry)", - "show_days": 1, - "show_seconds": 1 + "label": "Series for Asset Depreciation Entry (Journal Entry)" }, { "fieldname": "expenses_included_in_asset_valuation", "fieldtype": "Link", "label": "Expenses Included In Asset Valuation", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "column_break_40", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "disposal_account", "fieldtype": "Link", "label": "Gain/Loss Account on Asset Disposal", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "depreciation_cost_center", "fieldtype": "Link", "label": "Asset Depreciation Cost Center", "no_copy": 1, - "options": "Cost Center", - "show_days": 1, - "show_seconds": 1 + "options": "Cost Center" }, { "fieldname": "capital_work_in_progress_account", "fieldtype": "Link", "label": "Capital Work In Progress Account", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "fieldname": "asset_received_but_not_billed", "fieldtype": "Link", "label": "Asset Received But Not Billed", - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" }, { "collapsible": 1, "fieldname": "budget_detail", "fieldtype": "Section Break", - "label": "Budget Detail", - "show_days": 1, - "show_seconds": 1 + "label": "Budget Detail" }, { "fieldname": "exception_budget_approver_role", "fieldtype": "Link", "label": "Exception Budget Approver Role", - "options": "Role", - "show_days": 1, - "show_seconds": 1 + "options": "Role" }, { "collapsible": 1, "description": "For reference only.", "fieldname": "company_info", "fieldtype": "Section Break", - "label": "Company Info", - "show_days": 1, - "show_seconds": 1 + "label": "Company Info" }, { "fieldname": "date_of_incorporation", "fieldtype": "Date", - "label": "Date of Incorporation", - "show_days": 1, - "show_seconds": 1 + "label": "Date of Incorporation" }, { "fieldname": "address_html", - "fieldtype": "HTML", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "HTML" }, { "fieldname": "column_break1", "fieldtype": "Column Break", "oldfieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1, "width": "50%" }, { "depends_on": "eval:doc.date_of_incorporation", "fieldname": "date_of_commencement", "fieldtype": "Date", - "label": "Date of Commencement", - "show_days": 1, - "show_seconds": 1 + "label": "Date of Commencement" }, { "fieldname": "phone_no", @@ -803,9 +644,7 @@ "label": "Phone No", "oldfieldname": "phone_no", "oldfieldtype": "Data", - "options": "Phone", - "show_days": 1, - "show_seconds": 1 + "options": "Phone" }, { "fieldname": "fax", @@ -813,9 +652,7 @@ "label": "Fax", "oldfieldname": "fax", "oldfieldtype": "Data", - "options": "Phone", - "show_days": 1, - "show_seconds": 1 + "options": "Phone" }, { "fieldname": "email", @@ -823,25 +660,19 @@ "label": "Email", "oldfieldname": "email", "oldfieldtype": "Data", - "options": "Email", - "show_days": 1, - "show_seconds": 1 + "options": "Email" }, { "fieldname": "website", "fieldtype": "Data", "label": "Website", "oldfieldname": "website", - "oldfieldtype": "Data", - "show_days": 1, - "show_seconds": 1 + "oldfieldtype": "Data" }, { "fieldname": "registration_info", "fieldtype": "Section Break", "oldfieldtype": "Section Break", - "show_days": 1, - "show_seconds": 1, "width": "50%" }, { @@ -850,16 +681,12 @@ "fieldtype": "Code", "label": "Registration Details", "oldfieldname": "registration_details", - "oldfieldtype": "Code", - "show_days": 1, - "show_seconds": 1 + "oldfieldtype": "Code" }, { "fieldname": "delete_company_transactions", "fieldtype": "Button", - "label": "Delete Company Transactions", - "show_days": 1, - "show_seconds": 1 + "label": "Delete Company Transactions" }, { "fieldname": "lft", @@ -868,9 +695,7 @@ "label": "Lft", "print_hide": 1, "read_only": 1, - "search_index": 1, - "show_days": 1, - "show_seconds": 1 + "search_index": 1 }, { "fieldname": "rgt", @@ -879,9 +704,7 @@ "label": "Rgt", "print_hide": 1, "read_only": 1, - "search_index": 1, - "show_days": 1, - "show_seconds": 1 + "search_index": 1 }, { "fieldname": "old_parent", @@ -889,25 +712,19 @@ "hidden": 1, "label": "old_parent", "print_hide": 1, - "read_only": 1, - "show_days": 1, - "show_seconds": 1 + "read_only": 1 }, { "fieldname": "default_selling_terms", "fieldtype": "Link", "label": "Default Selling Terms", - "options": "Terms and Conditions", - "show_days": 1, - "show_seconds": 1 + "options": "Terms and Conditions" }, { "fieldname": "default_buying_terms", "fieldtype": "Link", "label": "Default Buying Terms", - "options": "Terms and Conditions", - "show_days": 1, - "show_seconds": 1 + "options": "Terms and Conditions" }, { "fieldname": "service_received_but_not_billed", @@ -915,9 +732,13 @@ "ignore_user_permissions": 1, "label": "Service Received But Not Billed", "no_copy": 1, - "options": "Account", - "show_days": 1, - "show_seconds": 1 + "options": "Account" + }, + { + "default": "0", + "fieldname": "enable_perpetual_inventory_for_non_stock_items", + "fieldtype": "Check", + "label": "Enable Perpetual Inventory For Non Stock Items" } ], "icon": "fa fa-building", @@ -925,7 +746,7 @@ "image_field": "company_logo", "is_tree": 1, "links": [], - "modified": "2020-06-11 15:32:59.147735", + "modified": "2020-06-20 11:38:43.178970", "modified_by": "Administrator", "module": "Setup", "name": "Company", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 94a6edd2c1..15068ec510 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -212,7 +212,7 @@ class PurchaseReceipt(BuyingController): landed_cost_entries = get_item_account_wise_additional_cost(self.name) expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") - auto_accounting_for_non_stock_items = cint(frappe.db.get_single_value('Stock Settings', 'enable_perpetual_inventory_for_non_stock_items')) + auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items')) gl_entries = [] warehouse_with_no_account = [] diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index a7ed620dca..9c5d3d8340 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -16,7 +16,6 @@ "action_if_quality_inspection_is_not_submitted", "show_barcode_field", "clean_description_html", - "enable_perpetual_inventory_for_non_stock_items", "section_break_7", "auto_insert_price_list_rate_if_missing", "allow_negative_stock", @@ -44,248 +43,180 @@ "fieldtype": "Select", "in_list_view": 1, "label": "Item Naming By", - "options": "Item Code\nNaming Series", - "show_days": 1, - "show_seconds": 1 + "options": "Item Code\nNaming Series" }, { "fieldname": "item_group", "fieldtype": "Link", "in_list_view": 1, "label": "Default Item Group", - "options": "Item Group", - "show_days": 1, - "show_seconds": 1 + "options": "Item Group" }, { "fieldname": "stock_uom", "fieldtype": "Link", "in_list_view": 1, "label": "Default Stock UOM", - "options": "UOM", - "show_days": 1, - "show_seconds": 1 + "options": "UOM" }, { "fieldname": "default_warehouse", "fieldtype": "Link", "label": "Default Warehouse", - "options": "Warehouse", - "show_days": 1, - "show_seconds": 1 + "options": "Warehouse" }, { "fieldname": "sample_retention_warehouse", "fieldtype": "Link", "label": "Sample Retention Warehouse", - "options": "Warehouse", - "show_days": 1, - "show_seconds": 1 + "options": "Warehouse" }, { "fieldname": "column_break_4", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "valuation_method", "fieldtype": "Select", "label": "Default Valuation Method", - "options": "FIFO\nMoving Average", - "show_days": 1, - "show_seconds": 1 + "options": "FIFO\nMoving Average" }, { "description": "Percentage you are allowed to receive or deliver more against the quantity ordered. For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units.", "fieldname": "over_delivery_receipt_allowance", "fieldtype": "Float", - "label": "Over Delivery/Receipt Allowance (%)", - "show_days": 1, - "show_seconds": 1 + "label": "Over Delivery/Receipt Allowance (%)" }, { "default": "Stop", "fieldname": "action_if_quality_inspection_is_not_submitted", "fieldtype": "Select", "label": "Action if Quality inspection is not submitted", - "options": "Stop\nWarn", - "show_days": 1, - "show_seconds": 1 + "options": "Stop\nWarn" }, { "default": "1", "fieldname": "show_barcode_field", "fieldtype": "Check", - "label": "Show Barcode Field", - "show_days": 1, - "show_seconds": 1 + "label": "Show Barcode Field" }, { "default": "1", "fieldname": "clean_description_html", "fieldtype": "Check", - "label": "Convert Item Description to Clean HTML", - "show_days": 1, - "show_seconds": 1 + "label": "Convert Item Description to Clean HTML" }, { "fieldname": "section_break_7", - "fieldtype": "Section Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Section Break" }, { "default": "0", "fieldname": "auto_insert_price_list_rate_if_missing", "fieldtype": "Check", - "label": "Auto insert Price List rate if missing", - "show_days": 1, - "show_seconds": 1 + "label": "Auto insert Price List rate if missing" }, { "default": "0", "fieldname": "allow_negative_stock", "fieldtype": "Check", - "label": "Allow Negative Stock", - "show_days": 1, - "show_seconds": 1 + "label": "Allow Negative Stock" }, { "fieldname": "column_break_10", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "default": "1", "fieldname": "automatically_set_serial_nos_based_on_fifo", "fieldtype": "Check", - "label": "Automatically Set Serial Nos based on FIFO", - "show_days": 1, - "show_seconds": 1 + "label": "Automatically Set Serial Nos based on FIFO" }, { "default": "1", "fieldname": "set_qty_in_transactions_based_on_serial_no_input", "fieldtype": "Check", - "label": "Set Qty in Transactions based on Serial No Input", - "show_days": 1, - "show_seconds": 1 + "label": "Set Qty in Transactions based on Serial No Input" }, { "fieldname": "auto_material_request", "fieldtype": "Section Break", - "label": "Auto Material Request", - "show_days": 1, - "show_seconds": 1 + "label": "Auto Material Request" }, { "default": "0", "fieldname": "auto_indent", "fieldtype": "Check", - "label": "Raise Material Request when stock reaches re-order level", - "show_days": 1, - "show_seconds": 1 + "label": "Raise Material Request when stock reaches re-order level" }, { "default": "0", "fieldname": "reorder_email_notify", "fieldtype": "Check", - "label": "Notify by Email on creation of automatic Material Request", - "show_days": 1, - "show_seconds": 1 + "label": "Notify by Email on creation of automatic Material Request" }, { "fieldname": "freeze_stock_entries", "fieldtype": "Section Break", - "label": "Freeze Stock Entries", - "show_days": 1, - "show_seconds": 1 + "label": "Freeze Stock Entries" }, { "fieldname": "stock_frozen_upto", "fieldtype": "Date", - "label": "Stock Frozen Upto", - "show_days": 1, - "show_seconds": 1 + "label": "Stock Frozen Upto" }, { "fieldname": "stock_frozen_upto_days", "fieldtype": "Int", - "label": "Freeze Stocks Older Than [Days]", - "show_days": 1, - "show_seconds": 1 + "label": "Freeze Stocks Older Than [Days]" }, { "fieldname": "stock_auth_role", "fieldtype": "Link", "label": "Role Allowed to edit frozen stock", - "options": "Role", - "show_days": 1, - "show_seconds": 1 + "options": "Role" }, { "fieldname": "batch_id_sb", "fieldtype": "Section Break", - "label": "Batch Identification", - "show_days": 1, - "show_seconds": 1 + "label": "Batch Identification" }, { "default": "0", "fieldname": "use_naming_series", "fieldtype": "Check", - "label": "Use Naming Series", - "show_days": 1, - "show_seconds": 1 + "label": "Use Naming Series" }, { "default": "BATCH-", "depends_on": "eval:doc.use_naming_series==1", "fieldname": "naming_series_prefix", "fieldtype": "Data", - "label": "Naming Series Prefix", - "show_days": 1, - "show_seconds": 1 + "label": "Naming Series Prefix" }, { "fieldname": "inter_warehouse_transfer_settings_section", "fieldtype": "Section Break", - "label": "Inter Warehouse Transfer Settings", - "show_days": 1, - "show_seconds": 1 + "label": "Inter Warehouse Transfer Settings" }, { "default": "0", "fieldname": "allow_from_dn", "fieldtype": "Check", - "label": "Allow Material Transfer From Delivery Note and Sales Invoice", - "show_days": 1, - "show_seconds": 1 + "label": "Allow Material Transfer From Delivery Note and Sales Invoice" }, { "default": "0", "fieldname": "allow_from_pr", "fieldtype": "Check", - "label": "Allow Material Transfer From Purchase Receipt and Purchase Invoice", - "show_days": 1, - "show_seconds": 1 - }, - { - "default": "0", - "fieldname": "enable_perpetual_inventory_for_non_stock_items", - "fieldtype": "Check", - "label": "Enable Perpetual Inventory For Non Stock Items", - "show_days": 1, - "show_seconds": 1 + "label": "Allow Material Transfer From Purchase Receipt and Purchase Invoice" } ], "icon": "icon-cog", "idx": 1, "issingle": 1, "links": [], - "modified": "2020-06-11 15:10:41.211638", + "modified": "2020-06-20 11:39:15.344112", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", From ded3ab1cd778389ab348bcb5628379f129a8d02d Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 22 Jun 2020 09:40:15 +0530 Subject: [PATCH 03/14] fix: Test Cases --- .../purchase_invoice/purchase_invoice.py | 18 ++++++++++-------- erpnext/setup/doctype/company/company.py | 7 +++++++ .../purchase_receipt/purchase_receipt.py | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 32d61f955b..0aa6475be8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -571,16 +571,18 @@ class PurchaseInvoice(BuyingController): amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount")) auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items')) - service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") - if item.purchase_receipt and auto_accounting_for_non_stock_items: - # Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt - expense_booked_in_pr = frappe.db.get_value('GL Entry', {'is_cancelled': 0, - 'voucher_type': 'Purchase Receipt', 'voucher_no': item.purchase_receipt, 'voucher_detail_no': item.pr_detail, - 'account':service_received_but_not_billed_account}, ['name']) + if auto_accounting_for_non_stock_items: + service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") - if expense_booked_in_pr: - expense_account = service_received_but_not_billed_account + if item.purchase_receipt: + # Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt + expense_booked_in_pr = frappe.db.get_value('GL Entry', {'is_cancelled': 0, + 'voucher_type': 'Purchase Receipt', 'voucher_no': item.purchase_receipt, 'voucher_detail_no': item.pr_detail, + 'account':service_received_but_not_billed_account}, ['name']) + + if expense_booked_in_pr: + expense_account = service_received_but_not_billed_account gl_entries.append(self.get_gl_dict({ "account": expense_account, diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 8bcaa28707..47b41a97ad 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -46,6 +46,7 @@ class Company(NestedSet): self.validate_currency() self.validate_coa_input() self.validate_perpetual_inventory() + self.validate_perpetual_inventory_for_non_stock_items() self.check_country_change() self.set_chart_of_accounts() self.validate_parent_company() @@ -182,6 +183,12 @@ class Company(NestedSet): frappe.msgprint(_("Set default inventory account for perpetual inventory"), alert=True, indicator='orange') + def validate_perpetual_inventory_for_non_stock_items(self): + if not self.get("__islocal"): + if cint(self.enable_perpetual_inventory_for_non_stock_items) == 1 and not self.service_received_but_not_billed: + frappe.throw(_("Set default {0} account for perpetual inventory for non stock items").format( + frappe.bold('Service Received But Not Billed'))) + def check_country_change(self): frappe.flags.country_change = False diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 15068ec510..d0ba001d7e 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -211,7 +211,6 @@ class PurchaseReceipt(BuyingController): stock_rbnb = self.get_company_default("stock_received_but_not_billed") landed_cost_entries = get_item_account_wise_additional_cost(self.name) expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") - service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items')) gl_entries = [] @@ -305,6 +304,7 @@ class PurchaseReceipt(BuyingController): warehouse_with_no_account.append(d.warehouse) elif d.item_code not in stock_items and flt(d.qty) and auto_accounting_for_non_stock_items: + service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed") credit_currency = get_account_currency(service_received_but_not_billed_account) gl_entries.append(self.get_gl_dict({ From ecbfda7d6adeaf0585d9f3186a47046ee9604e64 Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:33:49 +0530 Subject: [PATCH 04/14] fix: typo in template(#22401) --- .../doctype/salary_structure/condition_and_formula_help.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html b/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html index e59d78d1b8..d07a1ab551 100644 --- a/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html +++ b/erpnext/payroll/doctype/salary_structure/condition_and_formula_help.html @@ -8,7 +8,7 @@ Variables from Employee:
Employment Type = employment_type, Branch = branch etc.
  • - Variables Salary Slip:
    + Variables from Salary Slip:
    Payment Days = payment_days, Leave without pay = leave_without_pay etc.
  • From f5b7bd9dcbe389cd66373ff8feabd333196ecba7 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 23 Jun 2020 16:55:35 +0530 Subject: [PATCH 05/14] fix: add error prompt for wrong date range --- .../report/item_wise_sales_history/item_wise_sales_history.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py index bd59be663a..1bc4657f29 100644 --- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py +++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py @@ -9,6 +9,9 @@ from frappe.utils.nestedset import get_descendants_of def execute(filters=None): filters = frappe._dict(filters or {}) + if filters.from_date > filters.to_date: + frappe.throw(_('From Date cannot be greater than To Date')) + columns = get_columns(filters) data = get_data(filters) From 9c25101d9b13e793432f6ff260a54a44f22d8dc2 Mon Sep 17 00:00:00 2001 From: Rohan Date: Tue, 23 Jun 2020 17:39:37 +0530 Subject: [PATCH 06/14] feat: add ability for a contract to be authorised internally (#22095) * Added ability for a contract to be signed by a company user before being sent out * feat: contract signed by stays even after reload (#402) * format: use new JSON format Co-authored-by: Neil Lasrado Co-authored-by: nehasacher143 <45919049+nehasacher143@users.noreply.github.com> Co-authored-by: Marica --- erpnext/crm/doctype/contract/contract.json | 23 +- erpnext/crm/doctype/contract/contract.py | 3 + .../contract_template/contract_template.json | 374 ++++-------------- 3 files changed, 112 insertions(+), 288 deletions(-) diff --git a/erpnext/crm/doctype/contract/contract.json b/erpnext/crm/doctype/contract/contract.json index e04ad30ea7..0026e4a02e 100755 --- a/erpnext/crm/doctype/contract/contract.json +++ b/erpnext/crm/doctype/contract/contract.json @@ -29,6 +29,9 @@ "requires_fulfilment", "fulfilment_deadline", "fulfilment_terms", + "authorised_by_section", + "signee_company", + "signed_by_company", "sb_references", "document_type", "cb_links", @@ -223,10 +226,28 @@ "options": "Contract", "print_hide": 1, "read_only": 1 + }, + { + "fieldname": "signee_company", + "fieldtype": "Signature", + "label": "Signee (Company)" + }, + { + "fieldname": "signed_by_company", + "fieldtype": "Link", + "label": "Signed By (Company)", + "options": "User", + "read_only": 1 + }, + { + "fieldname": "authorised_by_section", + "fieldtype": "Section Break", + "label": "Authorised By" } ], "is_submittable": 1, - "modified": "2019-09-30 00:56:41.559681", + "links": [], + "modified": "2020-03-30 06:56:07.257932", "modified_by": "Administrator", "module": "CRM", "name": "Contract", diff --git a/erpnext/crm/doctype/contract/contract.py b/erpnext/crm/doctype/contract/contract.py index 18444cc7e6..c39397bf4b 100644 --- a/erpnext/crm/doctype/contract/contract.py +++ b/erpnext/crm/doctype/contract/contract.py @@ -29,6 +29,9 @@ class Contract(Document): self.update_contract_status() self.update_fulfilment_status() + def before_submit(self): + self.signed_by_company = frappe.session.user + def before_update_after_submit(self): self.update_contract_status() self.update_fulfilment_status() diff --git a/erpnext/crm/doctype/contract_template/contract_template.json b/erpnext/crm/doctype/contract_template/contract_template.json index b883ce20c9..ef9974f863 100644 --- a/erpnext/crm/doctype/contract_template/contract_template.json +++ b/erpnext/crm/doctype/contract_template/contract_template.json @@ -1,306 +1,106 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "field:title", - "beta": 0, - "creation": "2018-04-16 06:44:48.791312", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "actions": [], + "allow_rename": 1, + "autoname": "field:title", + "creation": "2018-04-16 06:44:48.791312", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "title", + "contract_terms", + "sb_fulfilment", + "requires_fulfilment", + "fulfilment_terms" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "title", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Title", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, + "fieldname": "title", + "fieldtype": "Data", + "label": "Title", + "unique": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sb_terms", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, + "fieldname": "contract_terms", + "fieldtype": "Text Editor", + "label": "Contract Terms and Conditions", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "contract_terms", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Contract Terms and Conditions", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, + "fieldname": "sb_fulfilment", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sb_fulfilment", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "requires_fulfilment", + "fieldtype": "Check", + "label": "Requires Fulfilment" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "requires_fulfilment", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Requires Fulfilment", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.requires_fulfilment==1", - "fieldname": "fulfilment_terms", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Fulfilment Terms and Conditions", - "length": 0, - "no_copy": 0, - "options": "Contract Template Fulfilment Terms", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 + "depends_on": "eval:doc.requires_fulfilment==1", + "fieldname": "fulfilment_terms", + "fieldtype": "Table", + "label": "Fulfilment Terms and Conditions", + "options": "Contract Template Fulfilment Terms" } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-04-17 07:36:05.217599", - "modified_by": "Administrator", - "module": "CRM", - "name": "Contract Template", - "name_case": "", - "owner": "Administrator", + ], + "links": [], + "modified": "2020-06-03 00:24:58.179816", + "modified_by": "Administrator", + "module": "CRM", + "name": "Contract Template", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "share": 1, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "share": 1, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, "write": 1 } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0 + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 } \ No newline at end of file From 7af7bb8311b7d3f376d3299fe3e542401c1af63d Mon Sep 17 00:00:00 2001 From: Marica Date: Tue, 23 Jun 2020 17:51:02 +0530 Subject: [PATCH 07/14] fix: Insert Supplier Group via List View (#22403) --- erpnext/setup/doctype/customer_group/customer_group.js | 5 +++-- erpnext/setup/doctype/item_group/item_group.js | 2 +- erpnext/setup/doctype/sales_person/sales_person.js | 4 ++-- erpnext/setup/doctype/supplier_group/supplier_group.js | 5 +++-- erpnext/setup/doctype/territory/territory.js | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js index c199a8e57f..44a5019120 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.js +++ b/erpnext/setup/doctype/customer_group/customer_group.js @@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root customer group - if(!doc.parent_customer_group) { + if(!doc.parent_customer_group && !doc.__islocal) { cur_frm.set_read_only(); cur_frm.set_intro(__("This is a root customer group and cannot be edited.")); } else { @@ -20,7 +20,8 @@ cur_frm.cscript.set_root_readonly = function(doc) { cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) { return { filters: { - 'is_group': 1 + 'is_group': 1, + 'name': ['!=', cur_frm.doc.customer_group_name] } } } diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index df2223192b..9892dc3dcc 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -66,7 +66,7 @@ frappe.ui.form.on("Item Group", { set_root_readonly: function(frm) { // read-only for root item group frm.set_intro(""); - if(!frm.doc.parent_item_group) { + if(!frm.doc.parent_item_group && !frm.doc.__islocal) { frm.set_read_only(); frm.set_intro(__("This is a root item group and cannot be edited."), true); } diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js index 89ca4a9dd7..8f7593d6ee 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.js +++ b/erpnext/setup/doctype/sales_person/sales_person.js @@ -19,7 +19,7 @@ frappe.ui.form.on('Sales Person', { } } }; - + frm.make_methods = { 'Sales Order': () => frappe.new_doc("Sales Order") .then(() => frm.add_child("sales_team", {"sales_person": frm.doc.name})) @@ -33,7 +33,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root - if(!doc.parent_sales_person) { + if(!doc.parent_sales_person && !doc.__islocal) { cur_frm.set_read_only(); cur_frm.set_intro(__("This is a root sales person and cannot be edited.")); } else { diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js index ac5bda6e2c..e75030d441 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root customer group - if(!doc.parent_supplier_group) { + if(!doc.parent_supplier_group && !doc.__islocal) { cur_frm.set_read_only(); cur_frm.set_intro(__("This is a root supplier group and cannot be edited.")); } else { @@ -20,7 +20,8 @@ cur_frm.cscript.set_root_readonly = function(doc) { cur_frm.fields_dict['parent_supplier_group'].get_query = function() { return { filters: { - 'is_group': 1 + 'is_group': 1, + 'name': ['!=', cur_frm.doc.supplier_group_name] } }; }; diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js index 1eb9958ce7..ceec47ae8c 100644 --- a/erpnext/setup/doctype/territory/territory.js +++ b/erpnext/setup/doctype/territory/territory.js @@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root territory - if(!doc.parent_territory) { + if(!doc.parent_territory && !doc.__islocal) { cur_frm.set_read_only(); cur_frm.set_intro(__("This is a root territory and cannot be edited.")); } else { From 3ab8d865dd3fa470cfd14f0368b3631ac554b331 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 24 Jun 2020 15:50:06 +0530 Subject: [PATCH 08/14] feat: added search to support page (#22376) * feat: added search to support page * style: add styles in style block --- erpnext/www/support/index.html | 45 +++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html index 93da503dbb..12b4c2c081 100644 --- a/erpnext/www/support/index.html +++ b/erpnext/www/support/index.html @@ -9,6 +9,33 @@

    {{ greeting_subtitle }}

    {% endif %} +
    + + +
    @@ -54,5 +81,21 @@ {% endif %} +{% endblock %} -{% endblock %} \ No newline at end of file +{%- block script -%} + +{%- endblock -%} + +{%- block style -%} + +{%- endblock -%} From 10c7faf090b6cbf91ef94e02b654382a90ed6cb2 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Wed, 24 Jun 2020 17:34:52 +0530 Subject: [PATCH 09/14] updating education report modified time (#22418) Co-authored-by: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> --- .../absent_student_report.json | 33 ++++++++--------- .../assessment_plan_status.json | 33 ++++++++--------- .../course_wise_assessment_report.json | 36 ++++++++++--------- .../final_assessment_grades.json | 35 +++++++++--------- .../student_and_guardian_contact_details.json | 35 +++++++++--------- .../student_batch_wise_attendance.json | 33 ++++++++--------- .../student_fee_collection.json | 35 +++++++++--------- .../student_monthly_attendance_sheet.json | 33 ++++++++--------- 8 files changed, 141 insertions(+), 132 deletions(-) diff --git a/erpnext/education/report/absent_student_report/absent_student_report.json b/erpnext/education/report/absent_student_report/absent_student_report.json index 0d5eebabf8..92ad860cc6 100644 --- a/erpnext/education/report/absent_student_report/absent_student_report.json +++ b/erpnext/education/report/absent_student_report/absent_student_report.json @@ -1,20 +1,21 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2013-05-13 14:04:03", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 3, - "is_standard": "Yes", - "modified": "2017-11-10 19:42:36.457449", - "modified_by": "Administrator", - "module": "Education", - "name": "Absent Student Report", - "owner": "Administrator", - "ref_doctype": "Student Attendance", - "report_name": "Absent Student Report", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2013-05-13 14:04:03", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2020-06-24 17:16:40.251116", + "modified_by": "Administrator", + "module": "Education", + "name": "Absent Student Report", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Student Attendance", + "report_name": "Absent Student Report", + "report_type": "Script Report", "roles": [ { "role": "Academics User" diff --git a/erpnext/education/report/assessment_plan_status/assessment_plan_status.json b/erpnext/education/report/assessment_plan_status/assessment_plan_status.json index 3000bec1f8..cbca648d57 100644 --- a/erpnext/education/report/assessment_plan_status/assessment_plan_status.json +++ b/erpnext/education/report/assessment_plan_status/assessment_plan_status.json @@ -1,20 +1,21 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2017-11-09 15:07:30.404428", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "modified": "2017-11-28 18:35:44.903665", - "modified_by": "Administrator", - "module": "Education", - "name": "Assessment Plan Status", - "owner": "Administrator", - "ref_doctype": "Assessment Plan", - "report_name": "Assessment Plan Status", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2017-11-09 15:07:30.404428", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-06-24 17:16:02.027410", + "modified_by": "Administrator", + "module": "Education", + "name": "Assessment Plan Status", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Assessment Plan", + "report_name": "Assessment Plan Status", + "report_type": "Script Report", "roles": [ { "role": "Academics User" diff --git a/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.json b/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.json index 61976b4508..416db9d00f 100644 --- a/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.json +++ b/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.json @@ -1,24 +1,26 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2017-05-05 14:46:13.776133", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "modified": "2018-02-08 15:11:24.904628", - "modified_by": "Administrator", - "module": "Education", - "name": "Course wise Assessment Report", - "owner": "Administrator", - "ref_doctype": "Assessment Result", - "report_name": "Course wise Assessment Report", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2017-05-05 14:46:13.776133", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-06-24 17:15:15.477530", + "modified_by": "Administrator", + "module": "Education", + "name": "Course wise Assessment Report", + "owner": "Administrator", + "prepared_report": 0, + "query": "", + "ref_doctype": "Assessment Result", + "report_name": "Course wise Assessment Report", + "report_type": "Script Report", "roles": [ { "role": "Instructor" - }, + }, { "role": "Education Manager" } diff --git a/erpnext/education/report/final_assessment_grades/final_assessment_grades.json b/erpnext/education/report/final_assessment_grades/final_assessment_grades.json index 4d444b46ce..6a23494768 100644 --- a/erpnext/education/report/final_assessment_grades/final_assessment_grades.json +++ b/erpnext/education/report/final_assessment_grades/final_assessment_grades.json @@ -1,24 +1,25 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2018-01-22 17:04:43.412054", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "modified": "2019-02-08 15:11:35.339434", - "modified_by": "Administrator", - "module": "Education", - "name": "Final Assessment Grades", - "owner": "Administrator", - "ref_doctype": "Assessment Result", - "report_name": "Final Assessment Grades", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2018-01-22 17:04:43.412054", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-06-24 17:13:35.373756", + "modified_by": "Administrator", + "module": "Education", + "name": "Final Assessment Grades", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Assessment Result", + "report_name": "Final Assessment Grades", + "report_type": "Script Report", "roles": [ { "role": "Instructor" - }, + }, { "role": "Education Manager" } diff --git a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.json b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.json index fe7d1586c8..fa9be65681 100644 --- a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.json +++ b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.json @@ -1,24 +1,25 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2017-03-27 17:47:16.831433", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "modified": "2017-11-10 19:42:30.300729", - "modified_by": "Administrator", - "module": "Education", - "name": "Student and Guardian Contact Details", - "owner": "Administrator", - "ref_doctype": "Program Enrollment", - "report_name": "Student and Guardian Contact Details", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2017-03-27 17:47:16.831433", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-06-24 17:16:50.639488", + "modified_by": "Administrator", + "module": "Education", + "name": "Student and Guardian Contact Details", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Program Enrollment", + "report_name": "Student and Guardian Contact Details", + "report_type": "Script Report", "roles": [ { "role": "Instructor" - }, + }, { "role": "Academics User" } diff --git a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.json b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.json index eb547b7102..8baf8f9fe0 100644 --- a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.json +++ b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.json @@ -1,20 +1,21 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2016-11-28 22:07:03.859124", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 2, - "is_standard": "Yes", - "modified": "2017-11-10 19:41:12.328346", - "modified_by": "Administrator", - "module": "Education", - "name": "Student Batch-Wise Attendance", - "owner": "Administrator", - "ref_doctype": "Student Attendance", - "report_name": "Student Batch-Wise Attendance", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2016-11-28 22:07:03.859124", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 2, + "is_standard": "Yes", + "modified": "2020-06-24 17:16:59.823709", + "modified_by": "Administrator", + "module": "Education", + "name": "Student Batch-Wise Attendance", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Student Attendance", + "report_name": "Student Batch-Wise Attendance", + "report_type": "Script Report", "roles": [ { "role": "Academics User" diff --git a/erpnext/education/report/student_fee_collection/student_fee_collection.json b/erpnext/education/report/student_fee_collection/student_fee_collection.json index eb945cfffb..8deb865ebc 100644 --- a/erpnext/education/report/student_fee_collection/student_fee_collection.json +++ b/erpnext/education/report/student_fee_collection/student_fee_collection.json @@ -1,21 +1,22 @@ { - "add_total_row": 0, - "creation": "2016-06-22 02:58:41.024538", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 3, - "is_standard": "Yes", - "modified": "2018-12-17 16:46:46.176620", - "modified_by": "Administrator", - "module": "Education", - "name": "Student Fee Collection", - "owner": "Administrator", - "prepared_report": 0, - "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(grand_total) - sum(outstanding_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student", - "ref_doctype": "Fees", - "report_name": "Student Fee Collection", - "report_type": "Query Report", + "add_total_row": 0, + "creation": "2016-06-22 02:58:41.024538", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2020-06-24 17:14:39.452551", + "modified_by": "Administrator", + "module": "Education", + "name": "Student Fee Collection", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(grand_total) - sum(outstanding_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student", + "ref_doctype": "Fees", + "report_name": "Student Fee Collection", + "report_type": "Query Report", "roles": [ { "role": "Academics User" diff --git a/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json b/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json index e10f190e1c..1423d4fee1 100644 --- a/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json +++ b/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json @@ -1,20 +1,21 @@ { - "add_total_row": 0, - "apply_user_permissions": 1, - "creation": "2013-05-13 14:04:03", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 3, - "is_standard": "Yes", - "modified": "2017-11-10 19:42:43.376658", - "modified_by": "Administrator", - "module": "Education", - "name": "Student Monthly Attendance Sheet", - "owner": "Administrator", - "ref_doctype": "Student Attendance", - "report_name": "Student Monthly Attendance Sheet", - "report_type": "Script Report", + "add_total_row": 0, + "creation": "2013-05-13 14:04:03", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2020-06-24 17:16:13.307053", + "modified_by": "Administrator", + "module": "Education", + "name": "Student Monthly Attendance Sheet", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Student Attendance", + "report_name": "Student Monthly Attendance Sheet", + "report_type": "Script Report", "roles": [ { "role": "Academics User" From 2abd66da9dd1b258c33e14521c373a9f46b7c07c Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 24 Jun 2020 17:49:50 +0530 Subject: [PATCH 10/14] fix: Update journal entry account timesstamp --- .../doctype/journal_entry_account/journal_entry_account.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json index ad0ecc4a0d..774159d691 100644 --- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json +++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json @@ -280,7 +280,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2020-06-18 14:06:54.833738", + "modified": "2020-06-24 14:06:54.833738", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry Account", From 6fd1068af3a6c9b8fc3ec67709b1ce42e7b02ba6 Mon Sep 17 00:00:00 2001 From: John Clarke Date: Wed, 24 Jun 2020 07:31:21 -0600 Subject: [PATCH 11/14] Update stock_ageing.py --- erpnext/stock/report/stock_ageing/stock_ageing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py index 723ed5c1c4..d5878cb662 100644 --- a/erpnext/stock/report/stock_ageing/stock_ageing.py +++ b/erpnext/stock/report/stock_ageing/stock_ageing.py @@ -187,7 +187,7 @@ def get_fifo_queue(filters, sle=None): transferred_item_details[(d.voucher_no, d.name)].append(fifo_queue.pop(0)) else: # all from current batch - batch[0] -= qty_to_pop + batch[0] = flt(batch[0]) - qty_to_pop transferred_item_details[(d.voucher_no, d.name)].append([qty_to_pop, batch[1]]) qty_to_pop = 0 From da0385cd3982abe986018d62ff926abb4341f242 Mon Sep 17 00:00:00 2001 From: Michelle Alva <50285544+michellealva@users.noreply.github.com> Date: Thu, 25 Jun 2020 08:24:01 +0530 Subject: [PATCH 12/14] fix: change error messages in RFQ Before: 1. Row {0}: For supplier {0} Email Address is required to send email 2. Email sent to supplier 3. Request for Quotation is disabled to access from portal, for more check portal settings. 4. Supplier Quotation created. After: 1. Row {0}: For Supplier {0} Email Address is Required to Send Email 2. Email sent to Supplier 3. The Access to Request for Quotation From Portal is Disabled. To Allow Access, Enable it in Portal Settings. 4. Supplier Quotation Created. --- .../request_for_quotation/request_for_quotation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py index dfdb487f9e..56af4d9027 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -51,7 +51,7 @@ class RequestforQuotation(BuyingController): def validate_email_id(self, args): if not args.email_id: - frappe.throw(_("Row {0}: For supplier {0} Email Address is required to send email").format(args.idx, args.supplier)) + frappe.throw(_("Row {0}: For Supplier {0}, Email Address is Required to Send Email").format(args.idx, args.supplier)) def on_submit(self): frappe.db.set(self, 'status', 'Submitted') @@ -154,7 +154,7 @@ class RequestforQuotation(BuyingController): sender=sender,attachments = attachments, send_email=True, doctype=self.doctype, name=self.name)["name"] - frappe.msgprint(_("Email sent to supplier {0}").format(data.supplier)) + frappe.msgprint(_("Email Sent to Supplier {0}").format(data.supplier)) def get_attachments(self): attachments = [d.name for d in get_attachments(self.doctype, self.name)] @@ -193,7 +193,7 @@ def send_supplier_emails(rfq_name): def check_portal_enabled(reference_doctype): if not frappe.db.get_value('Portal Menu Item', {'reference_doctype': reference_doctype}, 'enabled'): - frappe.throw(_("Request for Quotation is disabled to access from portal, for more check portal settings.")) + frappe.throw(_("The Access to Request for Quotation From Portal is Disabled. To Allow Access, Enable it in Portal Settings.")) def get_list_context(context=None): from erpnext.controllers.website_list_for_contact import get_list_context @@ -259,7 +259,7 @@ def create_supplier_quotation(doc): sq_doc.flags.ignore_permissions = True sq_doc.run_method("set_missing_values") sq_doc.save() - frappe.msgprint(_("Supplier Quotation {0} created").format(sq_doc.name)) + frappe.msgprint(_("Supplier Quotation {0} Created").format(sq_doc.name)) return sq_doc.name except Exception: return None From 53346217d2e23836c010c2d25e69cafa716e1623 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 25 Jun 2020 11:12:09 +0530 Subject: [PATCH 13/14] Revert "feat: added search to support page (#22376)" (#22431) This reverts commit 3ab8d865dd3fa470cfd14f0368b3631ac554b331. --- erpnext/www/support/index.html | 45 +--------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html index 12b4c2c081..93da503dbb 100644 --- a/erpnext/www/support/index.html +++ b/erpnext/www/support/index.html @@ -9,33 +9,6 @@

    {{ greeting_subtitle }}

    {% endif %} -
    - - -
    @@ -81,21 +54,5 @@ {% endif %} -{% endblock %} -{%- block script -%} - -{%- endblock -%} - -{%- block style -%} - -{%- endblock -%} +{% endblock %} \ No newline at end of file From 7b3700b3ece495af116b79094d46e2fa81211d38 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Thu, 25 Jun 2020 13:29:14 +0530 Subject: [PATCH 14/14] fix: handle custom statuses for the pause SLA configuration (#22349) * fix: handle hold time for custom statuses * fix: set total hold time only if hold configurations are enabled Co-authored-by: Himanshu --- erpnext/support/doctype/issue/issue.py | 67 ++++++++++++++------------ 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py index 883e603fd3..87168e151e 100644 --- a/erpnext/support/doctype/issue/issue.py +++ b/erpnext/support/doctype/issue/issue.py @@ -79,47 +79,52 @@ class Issue(Document): def handle_hold_time(self, status): if self.service_level_agreement: - # set response and resolution variance as None as the issue is on Hold for status as Replied + # set response and resolution variance as None as the issue is on Hold pause_sla_on = frappe.db.get_all("Pause SLA On Status", fields=["status"], filters={"parent": self.service_level_agreement}) hold_statuses = [entry.status for entry in pause_sla_on] update_values = {} - if self.status in hold_statuses and status not in hold_statuses: - update_values['on_hold_since'] = frappe.flags.current_time or now_datetime() - if not self.first_responded_on: - update_values['response_by'] = None - update_values['response_by_variance'] = 0 - update_values['resolution_by'] = None - update_values['resolution_by_variance'] = 0 + if hold_statuses: + if self.status in hold_statuses and status not in hold_statuses: + update_values['on_hold_since'] = frappe.flags.current_time or now_datetime() + if not self.first_responded_on: + update_values['response_by'] = None + update_values['response_by_variance'] = 0 + update_values['resolution_by'] = None + update_values['resolution_by_variance'] = 0 - # calculate hold time when status is changed from Replied to any other status - if self.status not in hold_statuses and status in hold_statuses: - hold_time = self.total_hold_time if self.total_hold_time else 0 - now_time = frappe.flags.current_time or now_datetime() - update_values['total_hold_time'] = hold_time + time_diff_in_seconds(now_time, self.on_hold_since) + # calculate hold time when status is changed from any hold status to any non-hold status + if self.status not in hold_statuses and status in hold_statuses: + hold_time = self.total_hold_time if self.total_hold_time else 0 + now_time = frappe.flags.current_time or now_datetime() + last_hold_time = 0 + if self.on_hold_since: + # last_hold_time will be added to the sla variables + last_hold_time = time_diff_in_seconds(now_time, self.on_hold_since) + update_values['total_hold_time'] = hold_time + last_hold_time - # re-calculate SLA variables after issue changes from Replied to Open - # add hold time to SLA variables - if self.status == "Open" and status in hold_statuses: - start_date_time = get_datetime(self.service_level_agreement_creation) - priority = get_priority(self) - now_time = frappe.flags.current_time or now_datetime() - hold_time = time_diff_in_seconds(now_time, self.on_hold_since) + # re-calculate SLA variables after issue changes from any hold status to any non-hold status + # add hold time to SLA variables + start_date_time = get_datetime(self.service_level_agreement_creation) + priority = get_priority(self) + now_time = frappe.flags.current_time or now_datetime() - if not self.first_responded_on: - response_by = get_expected_time_for(parameter="response", service_level=priority, start_date_time=start_date_time) - update_values['response_by'] = add_to_date(response_by, seconds=round(hold_time)) - response_by_variance = round(time_diff_in_hours(self.response_by, now_time)) - update_values['response_by_variance'] = response_by_variance + (hold_time // 3600) + if not self.first_responded_on: + response_by = get_expected_time_for(parameter="response", service_level=priority, start_date_time=start_date_time) + response_by = add_to_date(response_by, seconds=round(last_hold_time)) + response_by_variance = round(time_diff_in_hours(response_by, now_time)) + update_values['response_by'] = response_by + update_values['response_by_variance'] = response_by_variance + (last_hold_time // 3600) - resolution_by = get_expected_time_for(parameter="resolution", service_level=priority, start_date_time=start_date_time) - update_values['resolution_by'] = add_to_date(resolution_by, seconds=round(hold_time)) - resolution_by_variance = round(time_diff_in_hours(self.resolution_by, now_time)) - update_values['resolution_by_variance'] = resolution_by_variance + (hold_time // 3600) - update_values['on_hold_since'] = None + resolution_by = get_expected_time_for(parameter="resolution", service_level=priority, start_date_time=start_date_time) + resolution_by = add_to_date(resolution_by, seconds=round(last_hold_time)) + resolution_by_variance = round(time_diff_in_hours(resolution_by, now_time)) + update_values['resolution_by'] = resolution_by + update_values['resolution_by_variance'] = resolution_by_variance + (last_hold_time // 3600) + update_values['on_hold_since'] = None - self.db_set(update_values) + self.db_set(update_values) def update_agreement_status(self): if self.service_level_agreement and self.agreement_fulfilled == "Ongoing":