Merge pull request #37435 from rtdany10/sp-gp-fix
fix(gp): wrong `allocated_amount` when grouped by Sales Person
diff --git a/.github/helper/install.sh b/.github/helper/install.sh
index d1a97f8..915a463 100644
--- a/.github/helper/install.sh
+++ b/.github/helper/install.sh
@@ -4,7 +4,9 @@
cd ~ || exit
-sudo apt update && sudo apt install redis-server libcups2-dev
+sudo apt update
+sudo apt remove mysql-server mysql-client
+sudo apt install libcups2-dev redis-server mariadb-client-10.6
pip install frappe-bench
@@ -25,14 +27,14 @@
if [ "$DB" == "mariadb" ];then
- mysql --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
- mysql --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
+ mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
+ mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
- mysql --host 127.0.0.1 --port 3306 -u root -proot -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"
- mysql --host 127.0.0.1 --port 3306 -u root -proot -e "CREATE DATABASE test_frappe"
- mysql --host 127.0.0.1 --port 3306 -u root -proot -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"
+ mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"
+ mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "CREATE DATABASE test_frappe"
+ mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"
- mysql --host 127.0.0.1 --port 3306 -u root -proot -e "FLUSH PRIVILEGES"
+ mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "FLUSH PRIVILEGES"
fi
if [ "$DB" == "postgres" ];then
diff --git a/.github/workflows/initiate_release.yml b/.github/workflows/initiate_release.yml
index ee60bad..7034773 100644
--- a/.github/workflows/initiate_release.yml
+++ b/.github/workflows/initiate_release.yml
@@ -30,23 +30,3 @@
head: version-${{ matrix.version }}-hotfix
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
-
- beta-release:
- name: Release
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
-
- steps:
- - uses: octokit/request-action@v2.x
- with:
- route: POST /repos/{owner}/{repo}/pulls
- owner: frappe
- repo: erpnext
- title: |-
- "chore: release v15 beta"
- body: "Automated beta release."
- base: version-15-beta
- head: develop
- env:
- GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml
index 07b8de7..21dd3d4 100644
--- a/.github/workflows/patch.yml
+++ b/.github/workflows/patch.yml
@@ -28,7 +28,7 @@
MARIADB_ROOT_PASSWORD: 'root'
ports:
- 3306:3306
- options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
+ options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Clone
diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml
index 559be06..ccdfc8c 100644
--- a/.github/workflows/server-tests-mariadb.yml
+++ b/.github/workflows/server-tests-mariadb.yml
@@ -47,7 +47,7 @@
MARIADB_ROOT_PASSWORD: 'root'
ports:
- 3306:3306
- options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
+ options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Clone
diff --git a/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py b/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py
index e75af70..d06bd83 100644
--- a/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py
+++ b/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py
@@ -37,6 +37,7 @@
}
)
cle.flags.ignore_permissions = True
+ cle.flags.ignore_links = True
cle.submit()
diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
index 2a18830..ace751b 100644
--- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
+++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
@@ -43,6 +43,7 @@
def create_loan_masters():
create_loan_product(
"Clearance Loan",
+ "Clearance Loan",
2000000,
13.5,
25,
diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
index 2a504f6..4a6491d 100644
--- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
+++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
@@ -422,6 +422,7 @@
create_loan_product(
"Personal Loan",
+ "Personal Loan",
500000,
8.4,
is_term_loan=1,
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
index 1e22c64..02c2c67 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
@@ -218,6 +218,7 @@
"territory": "All Territories",
}
)
+
if not frappe.db.exists("Customer", customer_name):
customer.insert(ignore_permissions=True)
return customer.name
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 38a5209..e6403fd 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -271,16 +271,18 @@
# if no payment template is used by invoice and has a custom term(no `payment_term`), then invoice outstanding will be in 'None' key
latest = latest.get(d.payment_term) or latest.get(None)
-
# The reference has already been fully paid
if not latest:
frappe.throw(
_("{0} {1} has already been fully paid.").format(_(d.reference_doctype), d.reference_name)
)
# The reference has already been partly paid
- elif latest.outstanding_amount < latest.invoice_amount and flt(
- d.outstanding_amount, d.precision("outstanding_amount")
- ) != flt(latest.outstanding_amount, d.precision("outstanding_amount")):
+ elif (
+ latest.outstanding_amount < latest.invoice_amount
+ and flt(d.outstanding_amount, d.precision("outstanding_amount"))
+ != flt(latest.outstanding_amount, d.precision("outstanding_amount"))
+ and d.payment_term == ""
+ ):
frappe.throw(
_(
"{0} {1} has already been partly paid. Please use the 'Get Outstanding Invoice' or the 'Get Outstanding Orders' button to get the latest outstanding amounts."
@@ -1751,11 +1753,10 @@
"voucher_type": d.voucher_type,
"posting_date": d.posting_date,
"invoice_amount": flt(d.invoice_amount),
- "outstanding_amount": flt(d.outstanding_amount),
- "payment_term_outstanding": payment_term_outstanding,
- "allocated_amount": payment_term_outstanding
+ "outstanding_amount": payment_term_outstanding
if payment_term_outstanding
else d.outstanding_amount,
+ "payment_term_outstanding": payment_term_outstanding,
"payment_amount": payment_term.payment_amount,
"payment_term": payment_term.payment_term,
"account": d.account,
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 11d6d5f..df4f1b2 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -249,7 +249,7 @@
if (
party_account_currency == ref_doc.company_currency and party_account_currency != self.currency
):
- party_amount = ref_doc.base_grand_total
+ party_amount = ref_doc.get("base_rounded_total") or ref_doc.get("base_grand_total")
else:
party_amount = self.grand_total
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 85ed126..2433268 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -539,8 +539,9 @@
]
child_tables = {"items": ("expense_account",), "taxes": ("account_head",)}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
- self.validate_for_repost()
- self.db_set("repost_required", self.needs_repost)
+ if self.needs_repost:
+ self.validate_for_repost()
+ self.db_set("repost_required", self.needs_repost)
def make_gl_entries(self, gl_entries=None, from_repost=False):
if not gl_entries:
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 0aaea06..aa3d1b3 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -1916,6 +1916,32 @@
pi.load_from_db()
self.assertFalse(pi.repost_required)
+ @change_settings("Buying Settings", {"supplier_group": None})
+ def test_purchase_invoice_without_supplier_group(self):
+ # Create a Supplier
+ test_supplier_name = "_Test Supplier Without Supplier Group"
+ if not frappe.db.exists("Supplier", test_supplier_name):
+ supplier = frappe.get_doc(
+ {
+ "doctype": "Supplier",
+ "supplier_name": test_supplier_name,
+ }
+ ).insert(ignore_permissions=True)
+
+ self.assertEqual(supplier.supplier_group, None)
+
+ po = create_purchase_order(
+ supplier=test_supplier_name,
+ rate=3000,
+ item="_Test Non Stock Item",
+ posting_date="2021-09-15",
+ )
+
+ pi = make_purchase_invoice(supplier=test_supplier_name)
+
+ self.assertEqual(po.docstatus, 1)
+ self.assertEqual(pi.docstatus, 1)
+
def set_advance_flag(company, flag, default_account):
frappe.db.set_value(
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index f380825..f6d9c93 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -536,8 +536,9 @@
"taxes": ("account_head",),
}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
- self.validate_for_repost()
- self.db_set("repost_required", self.needs_repost)
+ if self.needs_repost:
+ self.validate_for_repost()
+ self.db_set("repost_required", self.needs_repost)
def set_paid_amount(self):
paid_amount = 0.0
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 84b0149..8aa1f4c 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -26,6 +26,7 @@
from erpnext.controllers.accounts_controller import update_invoice_status
from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
+from erpnext.selling.doctype.customer.test_customer import get_customer_dict
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
from erpnext.stock.doctype.item.test_item import create_item
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
@@ -3400,6 +3401,24 @@
set_advance_flag(company="_Test Company", flag=0, default_account="")
+ @change_settings("Selling Settings", {"customer_group": None, "territory": None})
+ def test_sales_invoice_without_customer_group_and_territory(self):
+ # create a customer
+ if not frappe.db.exists("Customer", "_Test Simple Customer"):
+ customer_dict = get_customer_dict("_Test Simple Customer")
+ customer_dict.pop("customer_group")
+ customer_dict.pop("territory")
+ customer = frappe.get_doc(customer_dict).insert(ignore_permissions=True)
+
+ self.assertEqual(customer.customer_group, None)
+ self.assertEqual(customer.territory, None)
+
+ # create a sales invoice
+ si = create_sales_invoice(customer="_Test Simple Customer")
+ self.assertEqual(si.docstatus, 1)
+ self.assertEqual(si.customer_group, None)
+ self.assertEqual(si.territory, None)
+
@change_settings("Selling Settings", {"allow_negative_rates_for_items": 0})
def test_sales_return_negative_rate(self):
si = create_sales_invoice(is_return=1, qty=-2, rate=-10, do_not_save=True)
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index abeaab1..5d2764b 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -157,7 +157,6 @@
"oldfieldname": "description",
"oldfieldtype": "Text",
"print_width": "200px",
- "reqd": 1,
"width": "200px"
},
{
@@ -912,4 +911,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.js b/erpnext/accounts/report/balance_sheet/balance_sheet.js
index ecc13d7..c2b57f7 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.js
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.js
@@ -1,25 +1,23 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function () {
- frappe.query_reports["Balance Sheet"] = $.extend(
- {},
- erpnext.financial_statements
- );
+frappe.query_reports["Balance Sheet"] = $.extend(
+ {},
+ erpnext.financial_statements
+);
- erpnext.utils.add_dimensions("Balance Sheet", 10);
+erpnext.utils.add_dimensions("Balance Sheet", 10);
- frappe.query_reports["Balance Sheet"]["filters"].push({
- fieldname: "accumulated_values",
- label: __("Accumulated Values"),
- fieldtype: "Check",
- default: 1,
- });
+frappe.query_reports["Balance Sheet"]["filters"].push({
+ fieldname: "accumulated_values",
+ label: __("Accumulated Values"),
+ fieldtype: "Check",
+ default: 1,
+});
- frappe.query_reports["Balance Sheet"]["filters"].push({
- fieldname: "include_default_book_entries",
- label: __("Include Default Book Entries"),
- fieldtype: "Check",
- default: 1,
- });
+frappe.query_reports["Balance Sheet"]["filters"].push({
+ fieldname: "include_default_book_entries",
+ label: __("Include Default Book Entries"),
+ fieldtype: "Check",
+ default: 1,
});
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.js b/erpnext/accounts/report/cash_flow/cash_flow.js
index a2c34c6..6b8ed27 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.js
+++ b/erpnext/accounts/report/cash_flow/cash_flow.js
@@ -1,24 +1,24 @@
// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Cash Flow"] = $.extend({},
- erpnext.financial_statements);
+frappe.query_reports["Cash Flow"] = $.extend(
+ {},
+ erpnext.financial_statements
+);
- erpnext.utils.add_dimensions('Cash Flow', 10);
+erpnext.utils.add_dimensions('Cash Flow', 10);
- // The last item in the array is the definition for Presentation Currency
- // filter. It won't be used in cash flow for now so we pop it. Please take
- // of this if you are working here.
+// The last item in the array is the definition for Presentation Currency
+// filter. It won't be used in cash flow for now so we pop it. Please take
+// of this if you are working here.
- frappe.query_reports["Cash Flow"]["filters"].splice(8, 1);
+frappe.query_reports["Cash Flow"]["filters"].splice(8, 1);
- frappe.query_reports["Cash Flow"]["filters"].push(
- {
- "fieldname": "include_default_book_entries",
- "label": __("Include Default Book Entries"),
- "fieldtype": "Check",
- "default": 1
- }
- );
-});
+frappe.query_reports["Cash Flow"]["filters"].push(
+ {
+ "fieldname": "include_default_book_entries",
+ "label": __("Include Default Book Entries"),
+ "fieldtype": "Check",
+ "default": 1
+ }
+);
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
index 1afa8d5..590408c 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
@@ -2,152 +2,150 @@
// For license information, please see license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Consolidated Financial Statement"] = {
- "filters": [
- {
- "fieldname":"company",
- "label": __("Company"),
- "fieldtype": "Link",
- "options": "Company",
- "default": frappe.defaults.get_user_default("Company"),
- "reqd": 1
- },
- {
- "fieldname":"filter_based_on",
- "label": __("Filter Based On"),
- "fieldtype": "Select",
- "options": ["Fiscal Year", "Date Range"],
- "default": ["Fiscal Year"],
- "reqd": 1,
- on_change: function() {
- let filter_based_on = frappe.query_report.get_filter_value('filter_based_on');
- frappe.query_report.toggle_filter_display('from_fiscal_year', filter_based_on === 'Date Range');
- frappe.query_report.toggle_filter_display('to_fiscal_year', filter_based_on === 'Date Range');
- frappe.query_report.toggle_filter_display('period_start_date', filter_based_on === 'Fiscal Year');
- frappe.query_report.toggle_filter_display('period_end_date', filter_based_on === 'Fiscal Year');
-
- frappe.query_report.refresh();
- }
- },
- {
- "fieldname":"period_start_date",
- "label": __("Start Date"),
- "fieldtype": "Date",
- "hidden": 1,
- "reqd": 1
- },
- {
- "fieldname":"period_end_date",
- "label": __("End Date"),
- "fieldtype": "Date",
- "hidden": 1,
- "reqd": 1
- },
- {
- "fieldname":"from_fiscal_year",
- "label": __("Start Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
- "reqd": 1,
- on_change: () => {
- frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), function(r) {
- let year_start_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), "year_start_date");
- frappe.query_report.set_filter_value({
- period_start_date: year_start_date
- });
- });
- }
- },
- {
- "fieldname":"to_fiscal_year",
- "label": __("End Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
- "reqd": 1,
- on_change: () => {
- frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), function(r) {
- let year_end_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), "year_end_date");
- frappe.query_report.set_filter_value({
- period_end_date: year_end_date
- });
- });
- }
- },
- {
- "fieldname":"finance_book",
- "label": __("Finance Book"),
- "fieldtype": "Link",
- "options": "Finance Book"
- },
- {
- "fieldname":"report",
- "label": __("Report"),
- "fieldtype": "Select",
- "options": ["Profit and Loss Statement", "Balance Sheet", "Cash Flow"],
- "default": "Balance Sheet",
- "reqd": 1
- },
- {
- "fieldname": "presentation_currency",
- "label": __("Currency"),
- "fieldtype": "Select",
- "options": erpnext.get_presentation_currency_list(),
- "default": frappe.defaults.get_user_default("Currency")
- },
- {
- "fieldname":"accumulated_in_group_company",
- "label": __("Accumulated Values in Group Company"),
- "fieldtype": "Check",
- "default": 0
- },
- {
- "fieldname": "include_default_book_entries",
- "label": __("Include Default Book Entries"),
- "fieldtype": "Check",
- "default": 1
- },
- {
- "fieldname": "show_zero_values",
- "label": __("Show zero values"),
- "fieldtype": "Check"
- }
- ],
- "formatter": function(value, row, column, data, default_formatter) {
- if (data && column.fieldname=="account") {
- value = data.account_name || value;
-
- column.link_onclick =
- "erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")";
- column.is_tree = true;
- }
-
- if (data && data.account && column.apply_currency_formatter) {
- data.currency = erpnext.get_currency(column.company_name);
- }
-
- value = default_formatter(value, row, column, data);
- if (!data.parent_account) {
- value = $(`<span>${value}</span>`);
-
- var $value = $(value).css("font-weight", "bold");
-
- value = $value.wrap("<p></p>").parent().html();
- }
- return value;
+frappe.query_reports["Consolidated Financial Statement"] = {
+ "filters": [
+ {
+ "fieldname":"company",
+ "label": __("Company"),
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": frappe.defaults.get_user_default("Company"),
+ "reqd": 1
},
- onload: function() {
- let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
+ {
+ "fieldname":"filter_based_on",
+ "label": __("Filter Based On"),
+ "fieldtype": "Select",
+ "options": ["Fiscal Year", "Date Range"],
+ "default": ["Fiscal Year"],
+ "reqd": 1,
+ on_change: function() {
+ let filter_based_on = frappe.query_report.get_filter_value('filter_based_on');
+ frappe.query_report.toggle_filter_display('from_fiscal_year', filter_based_on === 'Date Range');
+ frappe.query_report.toggle_filter_display('to_fiscal_year', filter_based_on === 'Date Range');
+ frappe.query_report.toggle_filter_display('period_start_date', filter_based_on === 'Fiscal Year');
+ frappe.query_report.toggle_filter_display('period_end_date', filter_based_on === 'Fiscal Year');
- frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
- var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
- frappe.query_report.set_filter_value({
- period_start_date: fy.year_start_date,
- period_end_date: fy.year_end_date
+ frappe.query_report.refresh();
+ }
+ },
+ {
+ "fieldname":"period_start_date",
+ "label": __("Start Date"),
+ "fieldtype": "Date",
+ "hidden": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname":"period_end_date",
+ "label": __("End Date"),
+ "fieldtype": "Date",
+ "hidden": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname":"from_fiscal_year",
+ "label": __("Start Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
+ "reqd": 1,
+ on_change: () => {
+ frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), function(r) {
+ let year_start_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), "year_start_date");
+ frappe.query_report.set_filter_value({
+ period_start_date: year_start_date
+ });
});
- });
+ }
+ },
+ {
+ "fieldname":"to_fiscal_year",
+ "label": __("End Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
+ "reqd": 1,
+ on_change: () => {
+ frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), function(r) {
+ let year_end_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), "year_end_date");
+ frappe.query_report.set_filter_value({
+ period_end_date: year_end_date
+ });
+ });
+ }
+ },
+ {
+ "fieldname":"finance_book",
+ "label": __("Finance Book"),
+ "fieldtype": "Link",
+ "options": "Finance Book"
+ },
+ {
+ "fieldname":"report",
+ "label": __("Report"),
+ "fieldtype": "Select",
+ "options": ["Profit and Loss Statement", "Balance Sheet", "Cash Flow"],
+ "default": "Balance Sheet",
+ "reqd": 1
+ },
+ {
+ "fieldname": "presentation_currency",
+ "label": __("Currency"),
+ "fieldtype": "Select",
+ "options": erpnext.get_presentation_currency_list(),
+ "default": frappe.defaults.get_user_default("Currency")
+ },
+ {
+ "fieldname":"accumulated_in_group_company",
+ "label": __("Accumulated Values in Group Company"),
+ "fieldtype": "Check",
+ "default": 0
+ },
+ {
+ "fieldname": "include_default_book_entries",
+ "label": __("Include Default Book Entries"),
+ "fieldtype": "Check",
+ "default": 1
+ },
+ {
+ "fieldname": "show_zero_values",
+ "label": __("Show zero values"),
+ "fieldtype": "Check"
}
+ ],
+ "formatter": function(value, row, column, data, default_formatter) {
+ if (data && column.fieldname=="account") {
+ value = data.account_name || value;
+
+ column.link_onclick =
+ "erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")";
+ column.is_tree = true;
+ }
+
+ if (data && data.account && column.apply_currency_formatter) {
+ data.currency = erpnext.get_currency(column.company_name);
+ }
+
+ value = default_formatter(value, row, column, data);
+ if (!data.parent_account) {
+ value = $(`<span>${value}</span>`);
+
+ var $value = $(value).css("font-weight", "bold");
+
+ value = $value.wrap("<p></p>").parent().html();
+ }
+ return value;
+ },
+ onload: function() {
+ let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
+
+ frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+ var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+ frappe.query_report.set_filter_value({
+ period_start_date: fy.year_start_date,
+ period_end_date: fy.year_end_date
+ });
+ });
}
-});
+}
diff --git a/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js b/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
index 79e5a09..51fa8c8 100644
--- a/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
+++ b/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
@@ -2,83 +2,81 @@
// For license information, please see license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Dimension-wise Accounts Balance Report"] = {
- "filters": [
- {
- "fieldname": "company",
- "label": __("Company"),
- "fieldtype": "Link",
- "options": "Company",
- "default": frappe.defaults.get_user_default("Company"),
- "reqd": 1
- },
- {
- "fieldname": "fiscal_year",
- "label": __("Fiscal Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
- "reqd": 1,
- "on_change": function(query_report) {
- var fiscal_year = query_report.get_values().fiscal_year;
- if (!fiscal_year) {
- return;
- }
- frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
- var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
- frappe.query_report.set_filter_value({
- from_date: fy.year_start_date,
- to_date: fy.year_end_date
- });
- });
+frappe.query_reports["Dimension-wise Accounts Balance Report"] = {
+ "filters": [
+ {
+ "fieldname": "company",
+ "label": __("Company"),
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": frappe.defaults.get_user_default("Company"),
+ "reqd": 1
+ },
+ {
+ "fieldname": "fiscal_year",
+ "label": __("Fiscal Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
+ "reqd": 1,
+ "on_change": function(query_report) {
+ var fiscal_year = query_report.get_values().fiscal_year;
+ if (!fiscal_year) {
+ return;
}
- },
- {
- "fieldname": "from_date",
- "label": __("From Date"),
- "fieldtype": "Date",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
- "reqd": 1
- },
- {
- "fieldname": "to_date",
- "label": __("To Date"),
- "fieldtype": "Date",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
- "reqd": 1
- },
- {
- "fieldname": "finance_book",
- "label": __("Finance Book"),
- "fieldtype": "Link",
- "options": "Finance Book",
- },
- {
- "fieldname": "dimension",
- "label": __("Select Dimension"),
- "fieldtype": "Select",
- "default": "Cost Center",
- "options": get_accounting_dimension_options(),
- "reqd": 1,
- },
- ],
- "formatter": erpnext.financial_statements.formatter,
- "tree": true,
- "name_field": "account",
- "parent_field": "parent_account",
- "initial_depth": 3
- }
+ frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+ var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+ frappe.query_report.set_filter_value({
+ from_date: fy.year_start_date,
+ to_date: fy.year_end_date
+ });
+ });
+ }
+ },
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
+ "reqd": 1
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
+ "reqd": 1
+ },
+ {
+ "fieldname": "finance_book",
+ "label": __("Finance Book"),
+ "fieldtype": "Link",
+ "options": "Finance Book",
+ },
+ {
+ "fieldname": "dimension",
+ "label": __("Select Dimension"),
+ "fieldtype": "Select",
+ "default": "Cost Center",
+ "options": get_accounting_dimension_options(),
+ "reqd": 1,
+ },
+ ],
+ "formatter": erpnext.financial_statements.formatter,
+ "tree": true,
+ "name_field": "account",
+ "parent_field": "parent_account",
+ "initial_depth": 3
+}
-});
function get_accounting_dimension_options() {
let options =["Cost Center", "Project"];
frappe.db.get_list('Accounting Dimension',
- {fields:['document_type']}).then((res) => {
- res.forEach((dimension) => {
- options.push(dimension.document_type);
- });
- });
+ {fields:['document_type']}).then((res) => {
+ res.forEach((dimension) => {
+ options.push(dimension.document_type);
+ });
+ });
return options
}
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js
index f6b0b8c..40d4259 100644
--- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js
@@ -2,20 +2,15 @@
// For license information, please see license.txt
-frappe.query_reports["Gross and Net Profit Report"] = {
- "filters": [
+frappe.query_reports["Gross and Net Profit Report"] = $.extend(
+ {},
+ erpnext.financial_statements
+);
- ]
-}
-frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Gross and Net Profit Report"] = $.extend({},
- erpnext.financial_statements);
-
- frappe.query_reports["Gross and Net Profit Report"]["filters"].push(
- {
- "fieldname": "accumulated_values",
- "label": __("Accumulated Values"),
- "fieldtype": "Check"
- }
- );
-});
+frappe.query_reports["Gross and Net Profit Report"]["filters"].push(
+ {
+ "fieldname": "accumulated_values",
+ "label": __("Accumulated Values"),
+ "fieldtype": "Check"
+ }
+);
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
index 9fe93b9..e5898bf 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
@@ -1,18 +1,16 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function () {
- frappe.query_reports["Profit and Loss Statement"] = $.extend(
- {},
- erpnext.financial_statements
- );
+frappe.query_reports["Profit and Loss Statement"] = $.extend(
+ {},
+ erpnext.financial_statements
+);
- erpnext.utils.add_dimensions("Profit and Loss Statement", 10);
+erpnext.utils.add_dimensions("Profit and Loss Statement", 10);
- frappe.query_reports["Profit and Loss Statement"]["filters"].push({
- fieldname: "accumulated_values",
- label: __("Accumulated Values"),
- fieldtype: "Check",
- default: 1,
- });
+frappe.query_reports["Profit and Loss Statement"]["filters"].push({
+ fieldname: "accumulated_values",
+ label: __("Accumulated Values"),
+ fieldtype: "Check",
+ default: 1,
});
diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js
index ebd0ec1..4a3d9bb 100644
--- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js
+++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js
@@ -1,133 +1,131 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Profitability Analysis"] = {
- "filters": [
- {
- "fieldname": "company",
- "label": __("Company"),
- "fieldtype": "Link",
- "options": "Company",
- "default": frappe.defaults.get_user_default("Company"),
- "reqd": 1
- },
- {
- "fieldname": "based_on",
- "label": __("Based On"),
- "fieldtype": "Select",
- "options": ["Cost Center", "Project", "Accounting Dimension"],
- "default": "Cost Center",
- "reqd": 1,
- "on_change": function(query_report){
- let based_on = query_report.get_values().based_on;
- if(based_on!='Accounting Dimension'){
- frappe.query_report.set_filter_value({
- accounting_dimension: ''
- });
- }
- }
- },
- {
- "fieldname": "accounting_dimension",
- "label": __("Accounting Dimension"),
- "fieldtype": "Link",
- "options": "Accounting Dimension",
- "get_query": () =>{
- return {
- filters: {
- "disabled": 0
- }
- }
- }
- },
- {
- "fieldname": "fiscal_year",
- "label": __("Fiscal Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
- "reqd": 1,
- "on_change": function(query_report) {
- var fiscal_year = query_report.get_values().fiscal_year;
- if (!fiscal_year) {
- return;
- }
- frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
- var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
- frappe.query_report.set_filter_value({
- from_date: fy.year_start_date,
- to_date: fy.year_end_date
- });
+frappe.query_reports["Profitability Analysis"] = {
+ "filters": [
+ {
+ "fieldname": "company",
+ "label": __("Company"),
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": frappe.defaults.get_user_default("Company"),
+ "reqd": 1
+ },
+ {
+ "fieldname": "based_on",
+ "label": __("Based On"),
+ "fieldtype": "Select",
+ "options": ["Cost Center", "Project", "Accounting Dimension"],
+ "default": "Cost Center",
+ "reqd": 1,
+ "on_change": function(query_report){
+ let based_on = query_report.get_values().based_on;
+ if(based_on!='Accounting Dimension'){
+ frappe.query_report.set_filter_value({
+ accounting_dimension: ''
});
}
- },
- {
- "fieldname": "from_date",
- "label": __("From Date"),
- "fieldtype": "Date",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
- },
- {
- "fieldname": "to_date",
- "label": __("To Date"),
- "fieldtype": "Date",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
- },
- {
- "fieldname": "show_zero_values",
- "label": __("Show zero values"),
- "fieldtype": "Check"
}
- ],
- "formatter": function(value, row, column, data, default_formatter) {
- if (column.fieldname=="account") {
- value = data.account_name;
-
- column.link_onclick =
- "frappe.query_reports['Profitability Analysis'].open_profit_and_loss_statement(" + JSON.stringify(data) + ")";
- column.is_tree = true;
- }
-
- value = default_formatter(value, row, column, data);
-
- if (!data.parent_account && data.based_on != 'project') {
- value = $(`<span>${value}</span>`);
- var $value = $(value).css("font-weight", "bold");
- if (data.warn_if_negative && data[column.fieldname] < 0) {
- $value.addClass("text-danger");
+ },
+ {
+ "fieldname": "accounting_dimension",
+ "label": __("Accounting Dimension"),
+ "fieldtype": "Link",
+ "options": "Accounting Dimension",
+ "get_query": () =>{
+ return {
+ filters: {
+ "disabled": 0
+ }
}
+ }
+ },
+ {
+ "fieldname": "fiscal_year",
+ "label": __("Fiscal Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
+ "reqd": 1,
+ "on_change": function(query_report) {
+ var fiscal_year = query_report.get_values().fiscal_year;
+ if (!fiscal_year) {
+ return;
+ }
+ frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+ var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+ frappe.query_report.set_filter_value({
+ from_date: fy.year_start_date,
+ to_date: fy.year_end_date
+ });
+ });
+ }
+ },
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
+ },
+ {
+ "fieldname": "show_zero_values",
+ "label": __("Show zero values"),
+ "fieldtype": "Check"
+ }
+ ],
+ "formatter": function(value, row, column, data, default_formatter) {
+ if (column.fieldname=="account") {
+ value = data.account_name;
- value = $value.wrap("<p></p>").parent().html();
+ column.link_onclick =
+ "frappe.query_reports['Profitability Analysis'].open_profit_and_loss_statement(" + JSON.stringify(data) + ")";
+ column.is_tree = true;
+ }
+
+ value = default_formatter(value, row, column, data);
+
+ if (!data.parent_account && data.based_on != 'project') {
+ value = $(`<span>${value}</span>`);
+ var $value = $(value).css("font-weight", "bold");
+ if (data.warn_if_negative && data[column.fieldname] < 0) {
+ $value.addClass("text-danger");
}
- return value;
- },
- "open_profit_and_loss_statement": function(data) {
- if (!data.account) return;
+ value = $value.wrap("<p></p>").parent().html();
+ }
- frappe.route_options = {
- "company": frappe.query_report.get_filter_value('company'),
- "from_fiscal_year": data.fiscal_year,
- "to_fiscal_year": data.fiscal_year
- };
+ return value;
+ },
+ "open_profit_and_loss_statement": function(data) {
+ if (!data.account) return;
- if(data.based_on == 'Cost Center'){
- frappe.route_options["cost_center"] = data.account
- } else {
- frappe.route_options["project"] = data.account
- }
+ frappe.route_options = {
+ "company": frappe.query_report.get_filter_value('company'),
+ "from_fiscal_year": data.fiscal_year,
+ "to_fiscal_year": data.fiscal_year
+ };
- frappe.set_route("query-report", "Profit and Loss Statement");
- },
- "tree": true,
- "name_field": "account",
- "parent_field": "parent_account",
- "initial_depth": 3
- }
+ if(data.based_on == 'Cost Center'){
+ frappe.route_options["cost_center"] = data.account
+ } else {
+ frappe.route_options["project"] = data.account
+ }
- erpnext.dimension_filters.forEach((dimension) => {
- frappe.query_reports["Profitability Analysis"].filters[1].options.push(dimension["document_type"]);
- });
+ frappe.set_route("query-report", "Profit and Loss Statement");
+ },
+ "tree": true,
+ "name_field": "account",
+ "parent_field": "parent_account",
+ "initial_depth": 3
+}
+erpnext.dimension_filters.forEach((dimension) => {
+ frappe.query_reports["Profitability Analysis"].filters[1].options.push(dimension["document_type"]);
});
+
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js
index c12ab0f..edd40b6 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.js
+++ b/erpnext/accounts/report/trial_balance/trial_balance.js
@@ -1,118 +1,116 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Trial Balance"] = {
- "filters": [
- {
- "fieldname": "company",
- "label": __("Company"),
- "fieldtype": "Link",
- "options": "Company",
- "default": frappe.defaults.get_user_default("Company"),
- "reqd": 1
- },
- {
- "fieldname": "fiscal_year",
- "label": __("Fiscal Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
- "reqd": 1,
- "on_change": function(query_report) {
- var fiscal_year = query_report.get_values().fiscal_year;
- if (!fiscal_year) {
- return;
- }
- frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
- var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
- frappe.query_report.set_filter_value({
- from_date: fy.year_start_date,
- to_date: fy.year_end_date
- });
+frappe.query_reports["Trial Balance"] = {
+ "filters": [
+ {
+ "fieldname": "company",
+ "label": __("Company"),
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": frappe.defaults.get_user_default("Company"),
+ "reqd": 1
+ },
+ {
+ "fieldname": "fiscal_year",
+ "label": __("Fiscal Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
+ "reqd": 1,
+ "on_change": function(query_report) {
+ var fiscal_year = query_report.get_values().fiscal_year;
+ if (!fiscal_year) {
+ return;
+ }
+ frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+ var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+ frappe.query_report.set_filter_value({
+ from_date: fy.year_start_date,
+ to_date: fy.year_end_date
});
- }
- },
- {
- "fieldname": "from_date",
- "label": __("From Date"),
- "fieldtype": "Date",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
- },
- {
- "fieldname": "to_date",
- "label": __("To Date"),
- "fieldtype": "Date",
- "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
- },
- {
- "fieldname": "cost_center",
- "label": __("Cost Center"),
- "fieldtype": "Link",
- "options": "Cost Center",
- "get_query": function() {
- var company = frappe.query_report.get_filter_value('company');
- return {
- "doctype": "Cost Center",
- "filters": {
- "company": company,
- }
+ });
+ }
+ },
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
+ },
+ {
+ "fieldname": "cost_center",
+ "label": __("Cost Center"),
+ "fieldtype": "Link",
+ "options": "Cost Center",
+ "get_query": function() {
+ var company = frappe.query_report.get_filter_value('company');
+ return {
+ "doctype": "Cost Center",
+ "filters": {
+ "company": company,
}
}
- },
- {
- "fieldname": "project",
- "label": __("Project"),
- "fieldtype": "Link",
- "options": "Project"
- },
- {
- "fieldname": "finance_book",
- "label": __("Finance Book"),
- "fieldtype": "Link",
- "options": "Finance Book",
- },
- {
- "fieldname": "presentation_currency",
- "label": __("Currency"),
- "fieldtype": "Select",
- "options": erpnext.get_presentation_currency_list()
- },
- {
- "fieldname": "with_period_closing_entry",
- "label": __("Period Closing Entry"),
- "fieldtype": "Check",
- "default": 1
- },
- {
- "fieldname": "show_zero_values",
- "label": __("Show zero values"),
- "fieldtype": "Check"
- },
- {
- "fieldname": "show_unclosed_fy_pl_balances",
- "label": __("Show unclosed fiscal year's P&L balances"),
- "fieldtype": "Check"
- },
- {
- "fieldname": "include_default_book_entries",
- "label": __("Include Default Book Entries"),
- "fieldtype": "Check",
- "default": 1
- },
- {
- "fieldname": "show_net_values",
- "label": __("Show net values in opening and closing columns"),
- "fieldtype": "Check",
- "default": 1
}
- ],
- "formatter": erpnext.financial_statements.formatter,
- "tree": true,
- "name_field": "account",
- "parent_field": "parent_account",
- "initial_depth": 3
- }
+ },
+ {
+ "fieldname": "project",
+ "label": __("Project"),
+ "fieldtype": "Link",
+ "options": "Project"
+ },
+ {
+ "fieldname": "finance_book",
+ "label": __("Finance Book"),
+ "fieldtype": "Link",
+ "options": "Finance Book",
+ },
+ {
+ "fieldname": "presentation_currency",
+ "label": __("Currency"),
+ "fieldtype": "Select",
+ "options": erpnext.get_presentation_currency_list()
+ },
+ {
+ "fieldname": "with_period_closing_entry",
+ "label": __("Period Closing Entry"),
+ "fieldtype": "Check",
+ "default": 1
+ },
+ {
+ "fieldname": "show_zero_values",
+ "label": __("Show zero values"),
+ "fieldtype": "Check"
+ },
+ {
+ "fieldname": "show_unclosed_fy_pl_balances",
+ "label": __("Show unclosed fiscal year's P&L balances"),
+ "fieldtype": "Check"
+ },
+ {
+ "fieldname": "include_default_book_entries",
+ "label": __("Include Default Book Entries"),
+ "fieldtype": "Check",
+ "default": 1
+ },
+ {
+ "fieldname": "show_net_values",
+ "label": __("Show net values in opening and closing columns"),
+ "fieldtype": "Check",
+ "default": 1
+ }
+ ],
+ "formatter": erpnext.financial_statements.formatter,
+ "tree": true,
+ "name_field": "account",
+ "parent_field": "parent_account",
+ "initial_depth": 3
+}
- erpnext.utils.add_dimensions('Trial Balance', 6);
-});
+erpnext.utils.add_dimensions('Trial Balance', 6);
diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js
index 5395f15..f0e4c82 100644
--- a/erpnext/assets/doctype/asset/asset.js
+++ b/erpnext/assets/doctype/asset/asset.js
@@ -337,7 +337,7 @@
item_code: function(frm) {
- if(frm.doc.item_code && frm.doc.calculate_depreciation) {
+ if(frm.doc.item_code && frm.doc.calculate_depreciation && frm.doc.gross_purchase_amount) {
frm.trigger('set_finance_book');
} else {
frm.set_value('finance_books', []);
@@ -490,7 +490,7 @@
calculate_depreciation: function(frm) {
frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation);
- if (frm.doc.item_code && frm.doc.calculate_depreciation ) {
+ if (frm.doc.item_code && frm.doc.calculate_depreciation && frm.doc.gross_purchase_amount) {
frm.trigger("set_finance_book");
} else {
frm.set_value("finance_books", []);
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index f79b622..6b29984 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -180,7 +180,6 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -916,4 +915,4 @@
"sort_order": "DESC",
"states": [],
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
index e07f462..82fcfa2 100644
--- a/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
+++ b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
@@ -84,7 +84,6 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -270,4 +269,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 19972ca..f37db5f 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -167,8 +167,7 @@
"label": "Supplier Group",
"oldfieldname": "supplier_type",
"oldfieldtype": "Link",
- "options": "Supplier Group",
- "reqd": 1
+ "options": "Supplier Group"
},
{
"default": "Company",
@@ -486,7 +485,7 @@
"link_fieldname": "party"
}
],
- "modified": "2023-09-21 12:24:20.398889",
+ "modified": "2023-09-25 12:48:21.869563",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",
diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py
index ee2ada3..350a25f 100644
--- a/erpnext/buying/doctype/supplier/test_supplier.py
+++ b/erpnext/buying/doctype/supplier/test_supplier.py
@@ -207,11 +207,14 @@
"doctype": "Supplier",
"supplier_name": args.supplier_name,
"default_currency": args.default_currency,
- "supplier_group": args.supplier_group or "Services",
"supplier_type": args.supplier_type or "Company",
"tax_withholding_category": args.tax_withholding_category,
}
- ).insert()
+ )
+ if not args.without_supplier_group:
+ doc.supplier_group = args.supplier_group or "Services"
+
+ doc.insert()
return doc
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
index 638cde0..8d491fb 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -126,7 +126,6 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -569,4 +568,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 6812940..e170044 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -13,6 +13,7 @@
add_days,
add_months,
cint,
+ comma_and,
flt,
fmt_money,
formatdate,
@@ -181,6 +182,17 @@
self.validate_party_account_currency()
if self.doctype in ["Purchase Invoice", "Sales Invoice"]:
+ if invalid_advances := [
+ x for x in self.advances if not x.reference_type or not x.reference_name
+ ]:
+ frappe.throw(
+ _(
+ "Rows: {0} in {1} section are Invalid. Reference Name should point to a valid Payment Entry or Journal Entry."
+ ).format(
+ frappe.bold(comma_and([x.idx for x in invalid_advances])), frappe.bold(_("Advance Payments"))
+ )
+ )
+
pos_check_field = "is_pos" if self.doctype == "Sales Invoice" else "is_paid"
if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
self.set_advances()
diff --git a/erpnext/crm/report/lead_details/lead_details.py b/erpnext/crm/report/lead_details/lead_details.py
index 7b8c43b..98dfbec 100644
--- a/erpnext/crm/report/lead_details/lead_details.py
+++ b/erpnext/crm/report/lead_details/lead_details.py
@@ -4,6 +4,7 @@
import frappe
from frappe import _
+from frappe.query_builder.functions import Concat_ws, Date
def execute(filters=None):
@@ -69,53 +70,41 @@
def get_data(filters):
- return frappe.db.sql(
- """
- SELECT
- `tabLead`.name,
- `tabLead`.lead_name,
- `tabLead`.status,
- `tabLead`.lead_owner,
- `tabLead`.territory,
- `tabLead`.source,
- `tabLead`.email_id,
- `tabLead`.mobile_no,
- `tabLead`.phone,
- `tabLead`.owner,
- `tabLead`.company,
- concat_ws(', ',
- trim(',' from `tabAddress`.address_line1),
- trim(',' from tabAddress.address_line2)
- ) AS address,
- `tabAddress`.state,
- `tabAddress`.pincode,
- `tabAddress`.country
- FROM
- `tabLead` left join `tabDynamic Link` on (
- `tabLead`.name = `tabDynamic Link`.link_name and
- `tabDynamic Link`.parenttype = 'Address')
- left join `tabAddress` on (
- `tabAddress`.name=`tabDynamic Link`.parent)
- WHERE
- company = %(company)s
- AND DATE(`tabLead`.creation) BETWEEN %(from_date)s AND %(to_date)s
- {conditions}
- ORDER BY
- `tabLead`.creation asc """.format(
- conditions=get_conditions(filters)
- ),
- filters,
- as_dict=1,
+ lead = frappe.qb.DocType("Lead")
+ address = frappe.qb.DocType("Address")
+ dynamic_link = frappe.qb.DocType("Dynamic Link")
+
+ query = (
+ frappe.qb.from_(lead)
+ .left_join(dynamic_link)
+ .on((lead.name == dynamic_link.link_name) & (dynamic_link.parenttype == "Address"))
+ .left_join(address)
+ .on(address.name == dynamic_link.parent)
+ .select(
+ lead.name,
+ lead.lead_name,
+ lead.status,
+ lead.lead_owner,
+ lead.territory,
+ lead.source,
+ lead.email_id,
+ lead.mobile_no,
+ lead.phone,
+ lead.owner,
+ lead.company,
+ (Concat_ws(", ", address.address_line1, address.address_line2)).as_("address"),
+ address.state,
+ address.pincode,
+ address.country,
+ )
+ .where(lead.company == filters.company)
+ .where(Date(lead.creation).between(filters.from_date, filters.to_date))
)
-
-def get_conditions(filters):
- conditions = []
-
if filters.get("territory"):
- conditions.append(" and `tabLead`.territory=%(territory)s")
+ query = query.where(lead.territory == filters.get("territory"))
if filters.get("status"):
- conditions.append(" and `tabLead`.status=%(status)s")
+ query = query.where(lead.status == filters.get("status"))
- return " ".join(conditions) if conditions else ""
+ return query.run(as_dict=1)
diff --git a/erpnext/e_commerce/shopping_cart/test_shopping_cart.py b/erpnext/e_commerce/shopping_cart/test_shopping_cart.py
index 951039d..8210f97 100644
--- a/erpnext/e_commerce/shopping_cart/test_shopping_cart.py
+++ b/erpnext/e_commerce/shopping_cart/test_shopping_cart.py
@@ -17,7 +17,6 @@
request_for_quotation,
update_cart,
)
-from erpnext.tests.utils import create_test_contact_and_address
class TestShoppingCart(unittest.TestCase):
@@ -28,7 +27,6 @@
def setUp(self):
frappe.set_user("Administrator")
- create_test_contact_and_address()
self.enable_shopping_cart()
if not frappe.db.exists("Website Item", {"item_code": "_Test Item"}):
make_website_item(frappe.get_cached_doc("Item", "_Test Item"))
@@ -46,48 +44,57 @@
frappe.db.sql("delete from `tabTax Rule`")
def test_get_cart_new_user(self):
- self.login_as_new_user()
-
+ self.login_as_customer(
+ "test_contact_two_customer@example.com", "_Test Contact 2 For _Test Customer"
+ )
+ create_address_and_contact(
+ address_title="_Test Address for Customer 2",
+ first_name="_Test Contact for Customer 2",
+ email="test_contact_two_customer@example.com",
+ customer="_Test Customer 2",
+ )
# test if lead is created and quotation with new lead is fetched
- quotation = _get_cart_quotation()
+ customer = frappe.get_doc("Customer", "_Test Customer 2")
+ quotation = _get_cart_quotation(party=customer)
self.assertEqual(quotation.quotation_to, "Customer")
self.assertEqual(
quotation.contact_person,
- frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com")),
+ frappe.db.get_value("Contact", dict(email_id="test_contact_two_customer@example.com")),
)
self.assertEqual(quotation.contact_email, frappe.session.user)
return quotation
- def test_get_cart_customer(self):
- def validate_quotation():
+ def test_get_cart_customer(self, customer="_Test Customer 2"):
+ def validate_quotation(customer_name):
# test if quotation with customer is fetched
- quotation = _get_cart_quotation()
+ party = frappe.get_doc("Customer", customer_name)
+ quotation = _get_cart_quotation(party=party)
self.assertEqual(quotation.quotation_to, "Customer")
- self.assertEqual(quotation.party_name, "_Test Customer")
+ self.assertEqual(quotation.party_name, customer_name)
self.assertEqual(quotation.contact_email, frappe.session.user)
return quotation
- self.login_as_customer(
- "test_contact_two_customer@example.com", "_Test Contact 2 For _Test Customer"
- )
- validate_quotation()
-
- self.login_as_customer()
- quotation = validate_quotation()
-
+ quotation = validate_quotation(customer)
return quotation
def test_add_to_cart(self):
- self.login_as_customer()
-
+ self.login_as_customer(
+ "test_contact_two_customer@example.com", "_Test Contact 2 For _Test Customer"
+ )
+ create_address_and_contact(
+ address_title="_Test Address for Customer 2",
+ first_name="_Test Contact for Customer 2",
+ email="test_contact_two_customer@example.com",
+ customer="_Test Customer 2",
+ )
# clear existing quotations
self.clear_existing_quotations()
# add first item
update_cart("_Test Item", 1)
- quotation = self.test_get_cart_customer()
+ quotation = self.test_get_cart_customer("_Test Customer 2")
self.assertEqual(quotation.get("items")[0].item_code, "_Test Item")
self.assertEqual(quotation.get("items")[0].qty, 1)
@@ -95,7 +102,7 @@
# add second item
update_cart("_Test Item 2", 1)
- quotation = self.test_get_cart_customer()
+ quotation = self.test_get_cart_customer("_Test Customer 2")
self.assertEqual(quotation.get("items")[1].item_code, "_Test Item 2")
self.assertEqual(quotation.get("items")[1].qty, 1)
self.assertEqual(quotation.get("items")[1].amount, 20)
@@ -108,7 +115,7 @@
# update first item
update_cart("_Test Item", 5)
- quotation = self.test_get_cart_customer()
+ quotation = self.test_get_cart_customer("_Test Customer 2")
self.assertEqual(quotation.get("items")[0].item_code, "_Test Item")
self.assertEqual(quotation.get("items")[0].qty, 5)
self.assertEqual(quotation.get("items")[0].amount, 50)
@@ -121,7 +128,7 @@
# remove first item
update_cart("_Test Item", 0)
- quotation = self.test_get_cart_customer()
+ quotation = self.test_get_cart_customer("_Test Customer 2")
self.assertEqual(quotation.get("items")[0].item_code, "_Test Item 2")
self.assertEqual(quotation.get("items")[0].qty, 1)
@@ -132,7 +139,17 @@
@unittest.skip("Flaky in CI")
def test_tax_rule(self):
self.create_tax_rule()
- self.login_as_customer()
+
+ self.login_as_customer(
+ "test_contact_two_customer@example.com", "_Test Contact 2 For _Test Customer"
+ )
+ create_address_and_contact(
+ address_title="_Test Address for Customer 2",
+ first_name="_Test Contact for Customer 2",
+ email="test_contact_two_customer@example.com",
+ customer="_Test Customer 2",
+ )
+
quotation = self.create_quotation()
from erpnext.accounts.party import set_taxes
@@ -320,7 +337,7 @@
if frappe.db.exists("User", email):
return
- frappe.get_doc(
+ user = frappe.get_doc(
{
"doctype": "User",
"user_type": "Website User",
@@ -330,6 +347,40 @@
}
).insert(ignore_permissions=True)
+ user.add_roles("Customer")
+
+
+def create_address_and_contact(**kwargs):
+ if not frappe.db.get_value("Address", {"address_title": kwargs.get("address_title")}):
+ frappe.get_doc(
+ {
+ "doctype": "Address",
+ "address_title": kwargs.get("address_title"),
+ "address_type": kwargs.get("address_type") or "Office",
+ "address_line1": kwargs.get("address_line1") or "Station Road",
+ "city": kwargs.get("city") or "_Test City",
+ "state": kwargs.get("state") or "Test State",
+ "country": kwargs.get("country") or "India",
+ "links": [
+ {"link_doctype": "Customer", "link_name": kwargs.get("customer") or "_Test Customer"}
+ ],
+ }
+ ).insert()
+
+ if not frappe.db.get_value("Contact", {"first_name": kwargs.get("first_name")}):
+ contact = frappe.get_doc(
+ {
+ "doctype": "Contact",
+ "first_name": kwargs.get("first_name"),
+ "links": [
+ {"link_doctype": "Customer", "link_name": kwargs.get("customer") or "_Test Customer"}
+ ],
+ }
+ )
+ contact.add_email(kwargs.get("email") or "test_contact_customer@example.com", is_primary=True)
+ contact.add_phone(kwargs.get("phone") or "+91 0000000000", is_primary_phone=True)
+ contact.insert()
+
test_dependencies = [
"Sales Taxes and Charges Template",
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index deef020..ddd9375 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -8,7 +8,6 @@
import frappe
from frappe import _, msgprint
from frappe.model.document import Document
-from frappe.query_builder import Case
from frappe.query_builder.functions import IfNull, Sum
from frappe.utils import (
add_days,
@@ -1618,21 +1617,13 @@
table = frappe.qb.DocType("Production Plan")
child = frappe.qb.DocType("Material Request Plan Item")
- completed_production_plans = get_completed_production_plans()
+ non_completed_production_plans = get_non_completed_production_plans()
- case = Case()
query = (
frappe.qb.from_(table)
.inner_join(child)
.on(table.name == child.parent)
- .select(
- Sum(
- child.quantity
- * IfNull(
- case.when(child.material_request_type == "Purchase", child.conversion_factor).else_(1.0), 1.0
- )
- )
- )
+ .select(Sum(child.required_bom_qty))
.where(
(table.docstatus == 1)
& (child.item_code == item_code)
@@ -1641,8 +1632,8 @@
)
)
- if completed_production_plans:
- query = query.where(table.name.notin(completed_production_plans))
+ if non_completed_production_plans:
+ query = query.where(table.name.isin(non_completed_production_plans))
query = query.run()
@@ -1653,7 +1644,7 @@
reserved_qty_for_production = flt(
get_reserved_qty_for_production(
- item_code, warehouse, completed_production_plans, check_production_plan=True
+ item_code, warehouse, non_completed_production_plans, check_production_plan=True
)
)
@@ -1663,7 +1654,7 @@
return reserved_qty_for_production_plan - reserved_qty_for_production
-def get_completed_production_plans():
+def get_non_completed_production_plans():
table = frappe.qb.DocType("Production Plan")
child = frappe.qb.DocType("Production Plan Item")
@@ -1675,7 +1666,7 @@
.where(
(table.docstatus == 1)
& (table.status.notin(["Completed", "Closed"]))
- & (child.ordered_qty >= child.planned_qty)
+ & (child.planned_qty > child.ordered_qty)
)
).run(as_dict=True)
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index 4ff9d29..6ab9232 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -6,8 +6,8 @@
from erpnext.controllers.item_variant import create_variant
from erpnext.manufacturing.doctype.production_plan.production_plan import (
- get_completed_production_plans,
get_items_for_material_requests,
+ get_non_completed_production_plans,
get_sales_orders,
get_warehouse_list,
)
@@ -1143,9 +1143,9 @@
self.assertEqual(after_qty, before_qty)
- completed_plans = get_completed_production_plans()
+ completed_plans = get_non_completed_production_plans()
for plan in plans:
- self.assertTrue(plan in completed_plans)
+ self.assertFalse(plan in completed_plans)
def test_resered_qty_for_production_plan_for_material_requests_with_multi_UOM(self):
from erpnext.stock.utils import get_or_make_bin
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 3dc33ac..f9fddcb 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -1515,7 +1515,7 @@
def get_reserved_qty_for_production(
item_code: str,
warehouse: str,
- completed_production_plans: list = None,
+ non_completed_production_plans: list = None,
check_production_plan: bool = False,
) -> float:
"""Get total reserved quantity for any item in specified warehouse"""
@@ -1538,19 +1538,22 @@
& (wo_item.parent == wo.name)
& (wo.docstatus == 1)
& (wo_item.source_warehouse == warehouse)
- & (wo.status.notin(["Stopped", "Completed", "Closed"]))
- & (
- (wo_item.required_qty > wo_item.transferred_qty)
- | (wo_item.required_qty > wo_item.consumed_qty)
- )
)
)
if check_production_plan:
query = query.where(wo.production_plan.isnotnull())
+ else:
+ query = query.where(
+ (wo.status.notin(["Stopped", "Completed", "Closed"]))
+ & (
+ (wo_item.required_qty > wo_item.transferred_qty)
+ | (wo_item.required_qty > wo_item.consumed_qty)
+ )
+ )
- if completed_production_plans:
- query = query.where(wo.production_plan.notin(completed_production_plans))
+ if non_completed_production_plans:
+ query = query.where(wo.production_plan.isin(non_completed_production_plans))
return query.run()[0][0] or 0.0
diff --git a/erpnext/projects/doctype/task_depends_on/task_depends_on.json b/erpnext/projects/doctype/task_depends_on/task_depends_on.json
index dbbe9d3..5102986 100644
--- a/erpnext/projects/doctype/task_depends_on/task_depends_on.json
+++ b/erpnext/projects/doctype/task_depends_on/task_depends_on.json
@@ -1,156 +1,52 @@
{
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2015-04-29 04:52:48.868079",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "",
- "editable_grid": 1,
+ "actions": [],
+ "creation": "2015-04-29 04:52:48.868079",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "task",
+ "column_break_2",
+ "subject",
+ "project"
+ ],
"fields": [
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "task",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Task",
- "length": 0,
- "no_copy": 0,
- "options": "Task",
- "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": "task",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Task",
+ "options": "Task"
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "column_break_2",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break"
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "subject",
- "fieldtype": "Text",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Subject",
- "length": 0,
- "no_copy": 0,
- "options": "",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
+ "fetch_from": "task.subject",
+ "fieldname": "subject",
+ "fieldtype": "Text",
+ "in_list_view": 1,
+ "label": "Subject",
+ "read_only": 1
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "project",
- "fieldtype": "Text",
- "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": "Project",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
+ "fetch_from": "task.project",
+ "fieldname": "project",
+ "fieldtype": "Text",
+ "label": "Project",
+ "read_only": 1
}
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
-
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2017-02-24 04:56:04.862502",
- "modified_by": "Administrator",
- "module": "Projects",
- "name": "Task Depends On",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 0,
- "track_seen": 0
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2023-10-09 11:34:14.335853",
+ "modified_by": "Administrator",
+ "module": "Projects",
+ "name": "Task Depends On",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
}
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js
index a2e4bda..3545521 100644
--- a/erpnext/public/js/controllers/accounts.js
+++ b/erpnext/public/js/controllers/accounts.js
@@ -116,7 +116,7 @@
account_head: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
- if (doc.docstatus == 1) {
+ if (d.docstatus == 1) {
// Should not trigger any changes on change post submit
return;
}
diff --git a/erpnext/public/js/erpnext.bundle.js b/erpnext/public/js/erpnext.bundle.js
index 0e1b23b..dee9a06 100644
--- a/erpnext/public/js/erpnext.bundle.js
+++ b/erpnext/public/js/erpnext.bundle.js
@@ -30,5 +30,6 @@
import "./utils/sales_common.js";
import "./controllers/buying.js";
import "./utils/demo.js";
+import "./financial_statements.js";
// import { sum } from 'frappe/public/utils/util.js'
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index 0f42def..40cab9f 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -181,7 +181,6 @@
"oldfieldname": "customer_group",
"oldfieldtype": "Link",
"options": "Customer Group",
- "reqd": 1,
"search_index": 1
},
{
@@ -193,8 +192,7 @@
"oldfieldname": "territory",
"oldfieldtype": "Link",
"options": "Territory",
- "print_hide": 1,
- "reqd": 1
+ "print_hide": 1
},
{
"fieldname": "tax_id",
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index d351c3c..a7a1aa2 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -15,14 +15,9 @@
from frappe.model.naming import set_name_by_naming_series, set_name_from_naming_options
from frappe.model.utils.rename_doc import update_linked_doctypes
from frappe.utils import cint, cstr, flt, get_formatted_email, today
-from frappe.utils.nestedset import get_root_of
from frappe.utils.user import get_users_with_role
-from erpnext.accounts.party import ( # noqa
- get_dashboard_info,
- get_timeline_data,
- validate_party_accounts,
-)
+from erpnext.accounts.party import get_dashboard_info, validate_party_accounts # noqa
from erpnext.controllers.website_list_for_contact import add_role_for_portal_user
from erpnext.utilities.transaction_base import TransactionBase
@@ -81,7 +76,6 @@
validate_party_accounts(self)
self.validate_credit_limit_on_change()
self.set_loyalty_program()
- self.set_territory_and_group()
self.check_customer_group_change()
self.validate_default_bank_account()
self.validate_internal_customer()
@@ -140,12 +134,6 @@
_("{0} is not a company bank account").format(frappe.bold(self.default_bank_account))
)
- def set_territory_and_group(self):
- if not self.territory:
- self.territory = get_root_of("Territory")
- if not self.customer_group:
- self.customer_group = get_root_of("Customer Group")
-
def validate_internal_customer(self):
if not self.is_internal_customer:
self.represents_company = ""
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index dde2f9b..5016f1f 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -132,7 +132,6 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -677,4 +676,4 @@
"sort_order": "DESC",
"states": [],
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index 07565c3..e6f7456 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -162,7 +162,6 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -906,4 +905,4 @@
"sort_order": "DESC",
"states": [],
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index d3236ba..612d674 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -165,7 +165,6 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -903,4 +902,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index bf3301f..9673a70 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -102,6 +102,12 @@
if (frm.doc.docstatus == 1 && frm.doc.status != 'Stopped') {
let precision = frappe.defaults.get_default("float_precision");
+
+ if (flt(frm.doc.per_received, precision) < 100) {
+ frm.add_custom_button(__('Stop'),
+ () => frm.events.update_status(frm, 'Stopped'));
+ }
+
if (flt(frm.doc.per_ordered, precision) < 100) {
let add_create_pick_list_button = () => {
frm.add_custom_button(__('Pick List'),
@@ -148,11 +154,6 @@
}
frm.page.set_inner_btn_group_as_primary(__('Create'));
-
- // stop
- frm.add_custom_button(__('Stop'),
- () => frm.events.update_status(frm, 'Stopped'));
-
}
}
diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json
index 770dacd..c585d6c 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.json
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.json
@@ -104,7 +104,6 @@
"oldfieldname": "description",
"oldfieldtype": "Text",
"print_width": "250px",
- "reqd": 1,
"width": "250px"
},
{
@@ -472,4 +471,4 @@
"sort_order": "DESC",
"states": [],
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index d7419dc..d93d21c 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -187,7 +187,6 @@
"oldfieldname": "description",
"oldfieldtype": "Text",
"print_width": "300px",
- "reqd": 1,
"width": "300px"
},
{
@@ -1079,4 +1078,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json
index 4fbc0eb..2052daa 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.json
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.json
@@ -428,7 +428,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2023-09-01 16:16:34.018947",
+ "modified": "2023-10-01 14:22:36.136111",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Settings",
@@ -442,6 +442,10 @@
"role": "Stock Manager",
"share": 1,
"write": 1
+ },
+ {
+ "read": 1,
+ "role": "Sales User"
}
],
"quick_entry": 1,
@@ -449,4 +453,4 @@
"sort_order": "ASC",
"states": [],
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html
index 72d498c..a498ba0 100644
--- a/erpnext/templates/includes/transaction_row.html
+++ b/erpnext/templates/includes/transaction_row.html
@@ -15,10 +15,14 @@
{{ doc.items_preview }}
</div>
</div>
- {% if doc.get('grand_total') %}
+ {% if doc.is_rounded_total_disabled() and doc.get('grand_total') %}
<div class="col-sm-3 text-right font-weight-bold item-total">
{{ doc.get_formatted("grand_total") }}
</div>
+ {% elif doc.get('rounded_total') %}
+ <div class="col-sm-3 text-right font-weight-bold item-total">
+ {{ doc.get_formatted("rounded_total") }}
+ </div>
{% endif %}
</div>
<a class="transaction-item-link" href="/{{ pathname }}/{{ doc.name }}">Link</a>
diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv
index 79777f2..79b9574 100644
--- a/erpnext/translations/de.csv
+++ b/erpnext/translations/de.csv
@@ -4586,7 +4586,7 @@
Tax Withholding Category,Steuereinbehalt Kategorie,
Edit Posting Date and Time,Buchungsdatum und -uhrzeit bearbeiten,
Is Paid,Ist bezahlt,
-Is Return (Debit Note),ist Rücklieferung (Lastschrift),
+Is Return (Debit Note),Ist Rechnungskorrektur (Retoure),
Apply Tax Withholding Amount,Steuereinbehaltungsbetrag anwenden,
Accounting Dimensions ,Buchhaltung Dimensionen,
Supplier Invoice Details,Lieferant Rechnungsdetails,
@@ -4710,7 +4710,7 @@
ACC-SINV-.YYYY.-,ACC-SINV-.JJJJ.-,
Include Payment (POS),(POS) Zahlung einschließen,
Offline POS Name,Offline-Verkaufsstellen-Name,
-Is Return (Credit Note),ist Rücklieferung (Gutschrift),
+Is Return (Credit Note),Ist Rechnungskorrektur (Retoure),
Update Billed Amount in Sales Order,Aktualisierung des Rechnungsbetrags im Auftrag,
Customer PO Details,Auftragsdetails,
Customer's Purchase Order,Bestellung des Kunden,
@@ -6998,7 +6998,7 @@
Tariff Number,Tarifnummer,
Delivery To,Lieferung an,
MAT-DN-.YYYY.-,MAT-DN-.YYYY.-,
-Is Return,Ist Rückgabe,
+Is Return,Ist Retoure,
Issue Credit Note,Gutschrift ausgeben,
Return Against Delivery Note,Zurück zum Lieferschein,
Customer's Purchase Order No,Bestellnummer des Kunden,