Merge branch 'develop' into FIX-35014
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 07761c7..2843824 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -904,7 +904,7 @@
function(d) { return flt(d.amount) }));
frm.set_value("difference_amount", difference_amount - total_deductions +
- frm.doc.base_total_taxes_and_charges);
+ flt(frm.doc.base_total_taxes_and_charges));
frm.events.hide_unhide_fields(frm);
},
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 5c9168b..ab7884d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -303,7 +303,7 @@
apply_tds(frm) {
var me = this;
-
+ me.frm.set_value("tax_withheld_vouchers", []);
if (!me.frm.doc.apply_tds) {
me.frm.set_value("tax_withholding_category", '');
me.frm.set_df_property("tax_withholding_category", "hidden", 1);
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index c987231..dd9c073 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -19,14 +19,19 @@
return _execute(filters)
-def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
+def _execute(
+ filters=None,
+ additional_table_columns=None,
+ additional_query_columns=None,
+ additional_conditions=None,
+):
if not filters:
filters = {}
columns = get_columns(additional_table_columns, filters)
company_currency = frappe.get_cached_value("Company", filters.get("company"), "default_currency")
- item_list = get_items(filters, additional_query_columns)
+ item_list = get_items(filters, additional_query_columns, additional_conditions)
if item_list:
itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency)
@@ -328,7 +333,7 @@
return columns
-def get_conditions(filters):
+def get_conditions(filters, additional_conditions=None):
conditions = ""
for opts in (
@@ -341,6 +346,9 @@
if filters.get(opts[0]):
conditions += opts[1]
+ if additional_conditions:
+ conditions += additional_conditions
+
if filters.get("mode_of_payment"):
conditions += """ and exists(select name from `tabSales Invoice Payment`
where parent=`tabSales Invoice`.name
@@ -376,8 +384,8 @@
return "ORDER BY `tab{0}`.{1}".format(doctype, frappe.scrub(filters.get("group_by")))
-def get_items(filters, additional_query_columns):
- conditions = get_conditions(filters)
+def get_items(filters, additional_query_columns, additional_conditions=None):
+ conditions = get_conditions(filters, additional_conditions)
if additional_query_columns:
additional_query_columns = ", " + ", ".join(additional_query_columns)
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 3d930d6..78bb056 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -1682,6 +1682,9 @@
d.base_payment_amount = flt(
d.payment_amount * self.get("conversion_rate"), d.precision("base_payment_amount")
)
+ else:
+ self.fetch_payment_terms_from_order(po_or_so, doctype)
+ self.ignore_default_payment_terms_template = 1
def get_order_details(self):
if self.doctype == "Sales Invoice":
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 09089be..befde71 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -770,6 +770,9 @@
}
)
+ if self.docstatus == 2:
+ force = True
+
if force or future_sle_exists(args) or repost_required_for_queue(self):
item_based_reposting = cint(
frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting")
diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py
index 0575429..c3fa894 100644
--- a/erpnext/controllers/subcontracting_controller.py
+++ b/erpnext/controllers/subcontracting_controller.py
@@ -741,7 +741,7 @@
sco_doc = frappe.get_doc("Subcontracting Order", sco)
sco_doc.update_status()
- def set_missing_values_in_additional_costs(self):
+ def calculate_additional_costs(self):
self.total_additional_costs = sum(flt(item.amount) for item in self.get("additional_costs"))
if self.total_additional_costs:
diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py
index 0e6fe95..4ea4fd1 100644
--- a/erpnext/controllers/tests/test_subcontracting_controller.py
+++ b/erpnext/controllers/tests/test_subcontracting_controller.py
@@ -36,7 +36,7 @@
sco.remove_empty_rows()
self.assertEqual((len_before - 1), len(sco.service_items))
- def test_set_missing_values_in_additional_costs(self):
+ def test_calculate_additional_costs(self):
sco = get_subcontracting_order(do_not_submit=1)
rate_without_additional_cost = sco.items[0].rate
diff --git a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
index e37f291..64170ed 100644
--- a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
+++ b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
@@ -7,4 +7,6 @@
frappe.reload_doc("manufacturing", "doctype", "work_order")
frappe.reload_doc("manufacturing", "doctype", "work_order_item")
- frappe.db.sql("""UPDATE `tabWork Order Item` SET amount = rate * required_qty""")
+ frappe.db.sql(
+ """UPDATE `tabWork Order Item` SET amount = ifnull(rate, 0.0) * ifnull(required_qty, 0.0)"""
+ )
diff --git a/erpnext/setup/doctype/employee/employee.py b/erpnext/setup/doctype/employee/employee.py
index ece5a7d..566392c 100755
--- a/erpnext/setup/doctype/employee/employee.py
+++ b/erpnext/setup/doctype/employee/employee.py
@@ -257,7 +257,9 @@
def get_holiday_list_for_employee(employee, raise_exception=True):
if employee:
- holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"])
+ holiday_list, company = frappe.get_cached_value(
+ "Employee", employee, ["holiday_list", "company"]
+ )
else:
holiday_list = ""
company = frappe.db.get_single_value("Global Defaults", "default_company")
diff --git a/erpnext/setup/doctype/holiday_list/holiday_list.py b/erpnext/setup/doctype/holiday_list/holiday_list.py
index fad827a..84d0d35 100644
--- a/erpnext/setup/doctype/holiday_list/holiday_list.py
+++ b/erpnext/setup/doctype/holiday_list/holiday_list.py
@@ -115,6 +115,8 @@
if date is None:
date = today()
if holiday_list:
- return bool(frappe.get_all("Holiday List", dict(name=holiday_list, holiday_date=date)))
+ return bool(
+ frappe.db.exists("Holiday", {"parent": holiday_list, "holiday_date": date}, cache=True)
+ )
else:
return False
diff --git a/erpnext/setup/module_onboarding/home/home.json b/erpnext/setup/module_onboarding/home/home.json
index f02fc45..516f122 100644
--- a/erpnext/setup/module_onboarding/home/home.json
+++ b/erpnext/setup/module_onboarding/home/home.json
@@ -22,25 +22,19 @@
"creation": "2021-11-22 12:19:15.888642",
"docstatus": 0,
"doctype": "Module Onboarding",
- "documentation_url": "https://docs.erpnext.com/docs/v13/user/manual/en/setting-up/company-setup",
+ "documentation_url": "https://docs.erpnext.com/docs/v14/user/manual/en/setting-up/company-setup",
"idx": 0,
"is_complete": 0,
- "modified": "2022-06-07 14:31:00.575193",
+ "modified": "2023-05-16 13:13:24.043792",
"modified_by": "Administrator",
"module": "Setup",
"name": "Home",
"owner": "Administrator",
"steps": [
{
- "step": "Company Set Up"
- },
- {
"step": "Navigation Help"
},
{
- "step": "Data import"
- },
- {
"step": "Create an Item"
},
{
@@ -51,12 +45,9 @@
},
{
"step": "Create a Quotation"
- },
- {
- "step": "Letterhead"
}
],
- "subtitle": "Company, Item, Customer, Supplier, Navigation Help, Data Import, Letter Head, Quotation",
- "success_message": "Masters are all set up!",
- "title": "Let's Set Up Some Masters"
+ "subtitle": "Item, Customer, Supplier, Navigation Help and Quotation",
+ "success_message": "You're ready to start your journey with ERPNext",
+ "title": "Let's begin your journey with ERPNext"
}
\ No newline at end of file
diff --git a/erpnext/setup/onboarding_step/company_set_up/company_set_up.json b/erpnext/setup/onboarding_step/company_set_up/company_set_up.json
index 6f65832..fae2de0 100644
--- a/erpnext/setup/onboarding_step/company_set_up/company_set_up.json
+++ b/erpnext/setup/onboarding_step/company_set_up/company_set_up.json
@@ -5,11 +5,11 @@
"description": "# Set Up a Company\n\nA company is a legal entity for which you will set up your books of account and create accounting transactions. In ERPNext, you can create multiple companies, and establish relationships (group/subsidiary) among them.\n\nWithin the company master, you can capture various default accounts for that Company and set crucial settings related to the accounting methodology followed for a company.\n",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2021-12-15 14:22:18.317423",
+ "modified": "2023-05-15 09:18:42.895537",
"modified_by": "Administrator",
"name": "Company Set Up",
"owner": "Administrator",
diff --git a/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json b/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json
index f74d745..e1a8f90 100644
--- a/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json
+++ b/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json
@@ -5,17 +5,17 @@
"description": "# Create a Customer\n\nThe Customer master is at the heart of your sales transactions. Customers are linked in Quotations, Sales Orders, Invoices, and Payments. Customers can be either numbered or identified by name (you would typically do this based on the number of customers you have).\n\nThrough Customer\u2019s master, you can effectively track essentials like:\n - Customer\u2019s multiple address and contacts\n - Account Receivables\n - Credit Limit and Credit Period\n",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2021-12-15 14:20:31.197564",
+ "modified": "2023-05-16 12:54:54.112364",
"modified_by": "Administrator",
"name": "Create a Customer",
"owner": "Administrator",
"reference_document": "Customer",
"show_form_tour": 0,
"show_full_form": 0,
- "title": "Manage Customers",
+ "title": "Create a Customer",
"validate_action": 1
}
\ No newline at end of file
diff --git a/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json b/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json
index 8bdb621..92b45b4 100644
--- a/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json
+++ b/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json
@@ -5,11 +5,11 @@
"description": "# Create a Quotation\n\nLet\u2019s get started with business transactions by creating your first Quotation. You can create a Quotation for an existing customer or a prospect. It will be an approved document, with items you sell and the proposed price + taxes applied. After completing the instructions, you will get a Quotation in a ready to share print format.",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2021-12-15 14:21:31.675330",
+ "modified": "2023-05-15 09:18:42.984170",
"modified_by": "Administrator",
"name": "Create a Quotation",
"owner": "Administrator",
diff --git a/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json b/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json
index 9574141..ef493fe 100644
--- a/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json
+++ b/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json
@@ -5,17 +5,17 @@
"description": "# Create a Supplier\n\nAlso known as Vendor, is a master at the center of your purchase transactions. Suppliers are linked in Request for Quotation, Purchase Orders, Receipts, and Payments. Suppliers can be either numbered or identified by name.\n\nThrough Supplier\u2019s master, you can effectively track essentials like:\n - Supplier\u2019s multiple address and contacts\n - Account Receivables\n - Credit Limit and Credit Period\n",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2021-12-15 14:21:23.518301",
+ "modified": "2023-05-16 12:55:08.610113",
"modified_by": "Administrator",
"name": "Create a Supplier",
"owner": "Administrator",
"reference_document": "Supplier",
"show_form_tour": 0,
"show_full_form": 0,
- "title": "Manage Suppliers",
+ "title": "Create a Supplier",
"validate_action": 1
}
\ No newline at end of file
diff --git a/erpnext/setup/onboarding_step/create_an_item/create_an_item.json b/erpnext/setup/onboarding_step/create_an_item/create_an_item.json
index cd29683..15f36be 100644
--- a/erpnext/setup/onboarding_step/create_an_item/create_an_item.json
+++ b/erpnext/setup/onboarding_step/create_an_item/create_an_item.json
@@ -6,18 +6,18 @@
"docstatus": 0,
"doctype": "Onboarding Step",
"form_tour": "Item General",
- "idx": 0,
+ "idx": 1,
"intro_video_url": "",
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2021-12-15 14:19:56.297772",
+ "modified": "2023-05-16 12:56:40.355878",
"modified_by": "Administrator",
"name": "Create an Item",
"owner": "Administrator",
"reference_document": "Item",
"show_form_tour": 1,
- "show_full_form": 1,
- "title": "Manage Items",
+ "show_full_form": 0,
+ "title": "Create an Item",
"validate_action": 1
}
\ No newline at end of file
diff --git a/erpnext/setup/onboarding_step/data_import/data_import.json b/erpnext/setup/onboarding_step/data_import/data_import.json
index 4999a36..e5dd7da 100644
--- a/erpnext/setup/onboarding_step/data_import/data_import.json
+++ b/erpnext/setup/onboarding_step/data_import/data_import.json
@@ -5,11 +5,11 @@
"description": "# Import Data from Spreadsheet\n\nIn ERPNext, you can easily migrate your historical data using spreadsheets. You can use it for migrating not just masters (like Customer, Supplier, Items), but also for transactions like (outstanding invoices, opening stock and accounting entries, etc).",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2022-06-07 14:28:51.390813",
+ "modified": "2023-05-15 09:18:42.962231",
"modified_by": "Administrator",
"name": "Data import",
"owner": "Administrator",
diff --git a/erpnext/setup/onboarding_step/letterhead/letterhead.json b/erpnext/setup/onboarding_step/letterhead/letterhead.json
index 8e1bb8c..584fd48 100644
--- a/erpnext/setup/onboarding_step/letterhead/letterhead.json
+++ b/erpnext/setup/onboarding_step/letterhead/letterhead.json
@@ -5,11 +5,11 @@
"description": "# Create a Letter Head\n\nA Letter Head contains your organization's name, logo, address, etc which appears at the header and footer portion in documents. You can learn more about Setting up Letter Head in ERPNext here.\n",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2021-12-15 14:21:39.037742",
+ "modified": "2023-05-15 09:18:42.995184",
"modified_by": "Administrator",
"name": "Letterhead",
"owner": "Administrator",
diff --git a/erpnext/setup/onboarding_step/navigation_help/navigation_help.json b/erpnext/setup/onboarding_step/navigation_help/navigation_help.json
index cf07968..f57818b 100644
--- a/erpnext/setup/onboarding_step/navigation_help/navigation_help.json
+++ b/erpnext/setup/onboarding_step/navigation_help/navigation_help.json
@@ -2,14 +2,14 @@
"action": "Watch Video",
"action_label": "Learn about Navigation options",
"creation": "2021-11-22 12:09:52.233872",
- "description": "# Navigation in ERPNext\n\nEase of navigating and browsing around the ERPNext is one of our core strengths. In the following video, you will learn how to reach a specific feature in ERPNext via module page or awesome bar\u2019s shortcut.\n",
+ "description": "# Navigation in ERPNext\n\nEase of navigating and browsing around the ERPNext is one of our core strengths. In the following video, you will learn how to reach a specific feature in ERPNext via module page or AwesomeBar.",
"docstatus": 0,
"doctype": "Onboarding Step",
- "idx": 0,
+ "idx": 1,
"is_complete": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2022-06-07 14:28:00.901082",
+ "modified": "2023-05-16 12:53:25.939908",
"modified_by": "Administrator",
"name": "Navigation Help",
"owner": "Administrator",
diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js
index 534b341..22d38e8 100644
--- a/erpnext/stock/doctype/item/item_list.js
+++ b/erpnext/stock/doctype/item/item_list.js
@@ -1,5 +1,5 @@
frappe.listview_settings['Item'] = {
- add_fields: ["item_name", "stock_uom", "item_group", "image", "variant_of",
+ add_fields: ["item_name", "stock_uom", "item_group", "image",
"has_variants", "end_of_life", "disabled"],
filters: [["disabled", "=", "0"]],
diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
index 96ac435..9c4d997 100644
--- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
@@ -376,3 +376,19 @@
accounts_settings.acc_frozen_upto = ""
accounts_settings.save()
+
+ def test_create_repost_entry_for_cancelled_document(self):
+ pr = make_purchase_receipt(
+ company="_Test Company with perpetual inventory",
+ warehouse="Stores - TCP1",
+ get_multiple_items=True,
+ )
+
+ self.assertTrue(pr.docstatus == 1)
+ self.assertFalse(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name}))
+
+ pr.load_from_db()
+
+ pr.cancel()
+ self.assertTrue(pr.docstatus == 2)
+ self.assertTrue(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name}))
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 103ed4a..6106809 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -781,13 +781,21 @@
d.db_update()
def update_rate_on_subcontracting_receipt(self, sle, outgoing_rate):
- if frappe.db.exists(sle.voucher_type + " Item", sle.voucher_detail_no):
- frappe.db.set_value(sle.voucher_type + " Item", sle.voucher_detail_no, "rate", outgoing_rate)
+ if frappe.db.exists("Subcontracting Receipt Item", sle.voucher_detail_no):
+ frappe.db.set_value("Subcontracting Receipt Item", sle.voucher_detail_no, "rate", outgoing_rate)
else:
frappe.db.set_value(
- "Subcontracting Receipt Supplied Item", sle.voucher_detail_no, "rate", outgoing_rate
+ "Subcontracting Receipt Supplied Item",
+ sle.voucher_detail_no,
+ {"rate": outgoing_rate, "amount": abs(sle.actual_qty) * outgoing_rate},
)
+ scr = frappe.get_doc("Subcontracting Receipt", sle.voucher_no, for_update=True)
+ scr.calculate_items_qty_and_amount()
+ scr.db_update()
+ for d in scr.items:
+ d.db_update()
+
def get_serialized_values(self, sle):
incoming_rate = flt(sle.incoming_rate)
actual_qty = flt(sle.actual_qty)
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
index e6de72d..3919733 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
+++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
@@ -77,22 +77,22 @@
frappe.throw(_(msg))
def set_missing_values(self):
- self.set_missing_values_in_additional_costs()
- self.set_missing_values_in_service_items()
- self.set_missing_values_in_supplied_items()
- self.set_missing_values_in_items()
+ self.calculate_additional_costs()
+ self.calculate_service_costs()
+ self.calculate_supplied_items_qty_and_amount()
+ self.calculate_items_qty_and_amount()
- def set_missing_values_in_service_items(self):
+ def calculate_service_costs(self):
for idx, item in enumerate(self.get("service_items")):
self.items[idx].service_cost_per_qty = item.amount / self.items[idx].qty
- def set_missing_values_in_supplied_items(self):
+ def calculate_supplied_items_qty_and_amount(self):
for item in self.get("items"):
bom = frappe.get_doc("BOM", item.bom)
rm_cost = sum(flt(rm_item.amount) for rm_item in bom.items)
item.rm_cost_per_qty = rm_cost / flt(bom.quantity)
- def set_missing_values_in_items(self):
+ def calculate_items_qty_and_amount(self):
total_qty = total = 0
for item in self.items:
item.rate = item.rm_cost_per_qty + item.service_cost_per_qty + flt(item.additional_cost_per_qty)
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
index 45289b1..4bf008a 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
@@ -76,26 +76,14 @@
}
});
- let batch_no_field = frm.get_docfield("items", "batch_no");
+ let batch_no_field = frm.get_docfield('items', 'batch_no');
if (batch_no_field) {
batch_no_field.get_route_options_for_new_doc = function(row) {
return {
- "item": row.doc.item_code
+ 'item': row.doc.item_code
}
};
}
-
- frappe.db.get_single_value('Buying Settings', 'backflush_raw_materials_of_subcontract_based_on').then(val => {
- if (val == 'Material Transferred for Subcontract') {
- frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => {
- grid_row.docfields.forEach((df) => {
- if (df.fieldname == 'consumed_qty') {
- df.read_only = 0;
- }
- });
- });
- }
- });
},
refresh: (frm) => {
@@ -157,6 +145,8 @@
}
});
}, __('Get Items From'));
+
+ frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty', 'read_only', frm.doc.__onload && frm.doc.__onload.backflush_based_on === 'BOM');
}
},
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
index 4f8e045..416f4f8 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
@@ -28,6 +28,14 @@
},
]
+ def onload(self):
+ self.set_onload(
+ "backflush_based_on",
+ frappe.db.get_single_value(
+ "Buying Settings", "backflush_raw_materials_of_subcontract_based_on"
+ ),
+ )
+
def update_status_updater_args(self):
if cint(self.is_return):
self.status_updater.extend(
@@ -113,9 +121,9 @@
@frappe.whitelist()
def set_missing_values(self):
- self.set_missing_values_in_additional_costs()
- self.set_missing_values_in_supplied_items()
- self.set_missing_values_in_items()
+ self.calculate_additional_costs()
+ self.calculate_supplied_items_qty_and_amount()
+ self.calculate_items_qty_and_amount()
def set_available_qty_for_consumption(self):
supplied_items_details = {}
@@ -147,13 +155,13 @@
item.rm_item_code, 0
)
- def set_missing_values_in_supplied_items(self):
+ def calculate_supplied_items_qty_and_amount(self):
for item in self.get("supplied_items") or []:
item.amount = item.rate * item.consumed_qty
self.set_available_qty_for_consumption()
- def set_missing_values_in_items(self):
+ def calculate_items_qty_and_amount(self):
rm_supp_cost = {}
for item in self.get("supplied_items") or []:
if item.reference_name in rm_supp_cost:
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
index 72ed4d4..dfb72c3 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
@@ -6,7 +6,7 @@
import frappe
from frappe.tests.utils import FrappeTestCase
-from frappe.utils import cint, flt
+from frappe.utils import add_days, cint, cstr, flt, today
import erpnext
from erpnext.accounts.doctype.account.test_account import get_inventory_account
@@ -26,6 +26,9 @@
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+)
from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import (
make_subcontracting_receipt,
)
@@ -528,6 +531,69 @@
# consumed_qty should be (accepted_qty * qty_consumed_per_unit) = (6 * 1) = 6
self.assertEqual(scr.supplied_items[0].consumed_qty, 6)
+ def test_supplied_items_cost_after_reposting(self):
+ # Set Backflush Based On as "BOM"
+ set_backflush_based_on("BOM")
+
+ # Create Material Receipt for RM's
+ make_stock_entry(
+ item_code="_Test Item",
+ qty=100,
+ target="_Test Warehouse 1 - _TC",
+ basic_rate=100,
+ posting_date=add_days(today(), -2),
+ )
+ make_stock_entry(
+ item_code="_Test Item Home Desktop 100",
+ qty=100,
+ target="_Test Warehouse 1 - _TC",
+ basic_rate=100,
+ )
+
+ service_items = [
+ {
+ "warehouse": "_Test Warehouse - _TC",
+ "item_code": "Subcontracted Service Item 1",
+ "qty": 10,
+ "rate": 100,
+ "fg_item": "_Test FG Item",
+ "fg_item_qty": 10,
+ },
+ ]
+
+ # Create Subcontracting Order
+ sco = get_subcontracting_order(service_items=service_items)
+
+ # Transfer RM's
+ rm_items = get_rm_items(sco.supplied_items)
+
+ itemwise_details = make_stock_in_entry(rm_items=rm_items)
+ make_stock_transfer_entry(
+ sco_no=sco.name,
+ rm_items=rm_items,
+ itemwise_details=copy.deepcopy(itemwise_details),
+ )
+
+ # Create Subcontracting Receipt
+ scr = make_subcontracting_receipt(sco.name)
+ scr.save()
+ scr.submit()
+
+ # Create Backdated Stock Reconciliation
+ sr = create_stock_reconciliation(
+ item_code=rm_items[0].get("item_code"),
+ warehouse="_Test Warehouse 1 - _TC",
+ qty=100,
+ rate=50,
+ posting_date=add_days(today(), -1),
+ )
+
+ # Cost should be updated in Subcontracting Receipt after reposting
+ prev_cost = scr.supplied_items[0].rate
+ scr.load_from_db()
+ self.assertNotEqual(scr.supplied_items[0].rate, prev_cost)
+ self.assertEqual(scr.supplied_items[0].rate, sr.items[0].valuation_rate)
+
def make_return_subcontracting_receipt(**args):
args = frappe._dict(args)
diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv
index 57556f3..b4fd76d 100644
--- a/erpnext/translations/de.csv
+++ b/erpnext/translations/de.csv
@@ -7638,20 +7638,19 @@
Served,Serviert,
Restaurant Reservation,Restaurant Reservierung,
Waitlisted,Auf der Warteliste,
-No Show,Keine Show,
-No of People,Nein von Menschen,
+No Show,Nicht angetreten,
+No of People,Anzahl von Personen,
Reservation Time,Reservierungszeit,
Reservation End Time,Reservierungsendzeit,
No of Seats,Anzahl der Sitze,
Minimum Seating,Mindestbestuhlung,
"Keep Track of Sales Campaigns. Keep track of Leads, Quotations, Sales Order etc from Campaigns to gauge Return on Investment. ","Verkaufskampagne verfolgen: Leads, Angebote, Aufträge usw. von Kampagnen beobachten um die Kapitalverzinsung (RoI) zu messen.",
-SAL-CAM-.YYYY.-,SAL-CAM-.YYYY.-,
Campaign Schedules,Kampagnenpläne,
Buyer of Goods and Services.,Käufer von Waren und Dienstleistungen.,
-CUST-.YYYY.-,CUST-.YYYY.-,
Default Company Bank Account,Standard-Bankkonto des Unternehmens,
From Lead,Aus Lead,
-Account Manager,Buchhalter,
+Account Manager,Kundenberater,
+Accounts Manager,Buchhalter,
Allow Sales Invoice Creation Without Sales Order,Ermöglichen Sie die Erstellung von Kundenrechnungen ohne Auftrag,
Allow Sales Invoice Creation Without Delivery Note,Ermöglichen Sie die Erstellung einer Ausgangsrechnung ohne Lieferschein,
Default Price List,Standardpreisliste,
@@ -7692,7 +7691,6 @@
"Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the aggregate **Item**. \n\nThe package **Item** will have ""Is Stock Item"" as ""No"" and ""Is Sales Item"" as ""Yes"".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Product Bundle Item.\n\nNote: BOM = Bill of Materials","Fassen Sie eine Gruppe von Artikeln zu einem neuen Artikel zusammen. Dies ist nützlich, wenn Sie bestimmte Artikel zu einem Paket bündeln und einen Bestand an Artikel-Bündeln erhalten und nicht einen Bestand der einzelnen Artikel. Das Artikel-Bündel erhält für das Attribut ""Ist Lagerartikel"" den Wert ""Nein"" und für das Attribut ""Ist Verkaufsartikel"" den Wert ""Ja"". Beispiel: Wenn Sie Laptops und Tragetaschen getrennt verkaufen und einen bestimmten Preis anbieten, wenn der Kunde beides zusammen kauft, dann wird der Laptop mit der Tasche zusammen ein neuer Bündel-Artikel. Anmerkung: BOM = Stückliste",
Parent Item,Übergeordneter Artikel,
List items that form the package.,"Die Artikel auflisten, die das Paket bilden.",
-SAL-QTN-.YYYY.-,SAL-QTN-.YYYY.-,
Quotation To,Angebot für,
Rate at which customer's currency is converted to company's base currency,"Kurs, zu dem die Währung des Kunden in die Basiswährung des Unternehmens umgerechnet wird",
Rate at which Price list currency is converted to company's base currency,"Kurs, zu dem die Währung der Preisliste in die Basiswährung des Unternehmens umgerechnet wird",
@@ -7704,7 +7702,6 @@
Against Doctype,Zu DocType,
Against Docname,Zu Dokumentenname,
Additional Notes,Zusätzliche Bemerkungen,
-SAL-ORD-.YYYY.-,SAL-ORD-.YYYY.-,
Skip Delivery Note,Lieferschein überspringen,
In Words will be visible once you save the Sales Order.,"""In Worten"" wird sichtbar, sobald Sie den Auftrag speichern.",
Track this Sales Order against any Project,Diesen Auftrag in jedem Projekt nachverfolgen,
@@ -7935,7 +7932,7 @@
Territory Targets,Ziele für die Region,
Set Item Group-wise budgets on this Territory. You can also include seasonality by setting the Distribution.,Artikelgruppenbezogene Budgets für diese Region erstellen. Durch Setzen der Auslieferungseinstellungen können auch saisonale Aspekte mit einbezogen werden.,
UOM Name,Maßeinheit-Name,
-Check this to disallow fractions. (for Nos),"Hier aktivieren, um keine Bruchteile zuzulassen (für Nr.)",
+Check this to disallow fractions. (for Nos),"Hier aktivieren, um keine Bruchteile zuzulassen (für Anzahl)",
Website Item Group,Webseiten-Artikelgruppe,
Cross Listing of Item in multiple groups,Kreuzweise Auflistung des Artikels in mehreren Gruppen,
Default settings for Shopping Cart,Standardeinstellungen für den Warenkorb,
@@ -8016,7 +8013,6 @@
Email sent to,E-Mail versandt an,
Dispatch Information,Versandinformationen,
Estimated Arrival,Voraussichtliche Ankunft,
-MAT-DT-.YYYY.-,MAT-DT-.YYYY.-,
Initial Email Notification Sent,Erste E-Mail-Benachrichtigung gesendet,
Delivery Details,Lieferdetails,
Driver Email,Fahrer-E-Mail,
@@ -8176,7 +8172,6 @@
Landed Cost Purchase Receipt,Einstandspreis-Kaufbeleg,
Landed Cost Taxes and Charges,Einstandspreis Steuern und Gebühren,
Landed Cost Voucher,Beleg über Einstandskosten,
-MAT-LCV-.YYYY.-,MAT-LCV-.YYYY.-,
Purchase Receipts,Kaufbelege,
Purchase Receipt Items,Kaufbeleg-Artikel,
Get Items From Purchase Receipts,Artikel vom Kaufbeleg übernehmen,
@@ -8184,7 +8179,6 @@
Landed Cost Help,Hilfe zum Einstandpreis,
Manufacturers used in Items,Hersteller im Artikel verwendet,
Limited to 12 characters,Limitiert auf 12 Zeichen,
-MAT-MR-.YYYY.-,MAT-MR-.YYYY.-,
Partially Ordered,Teilweise bestellt,
Transferred,Übergeben,
% Ordered,% bestellt,
@@ -8199,7 +8193,6 @@
Parent Detail docname,Übergeordnetes Detail Dokumentenname,
"Generate packing slips for packages to be delivered. Used to notify package number, package contents and its weight.","Packzettel für zu liefernde Pakete generieren. Wird verwendet, um Paketnummer, Packungsinhalt und das Gewicht zu dokumentieren.",
Indicates that the package is a part of this delivery (Only Draft),"Zeigt an, dass das Paket ein Teil dieser Lieferung ist (nur Entwurf)",
-MAT-PAC-.YYYY.-,MAT-PAC-.YYYY.-,
From Package No.,Von Paket Nr.,
Identification of the package for the delivery (for print),Kennzeichnung des Paketes für die Lieferung (für den Druck),
To Package No.,Bis Paket Nr.,
@@ -8290,7 +8283,6 @@
Out of AMC,Außerhalb des jährlichen Wartungsvertrags,
Warranty Period (Days),Garantiefrist (Tage),
Serial No Details,Details zur Seriennummer,
-MAT-STE-.YYYY.-,MAT-STE-.JJJJ.-,
Stock Entry Type,Bestandsbuchungsart,
Stock Entry (Outward GIT),Bestandsbuchung (Outward GIT),
Material Consumption for Manufacture,Materialverbrauch für die Herstellung,
@@ -8336,7 +8328,6 @@
Is Cancelled,Ist storniert,
Stock Reconciliation,Bestandsabgleich,
This tool helps you to update or fix the quantity and valuation of stock in the system. It is typically used to synchronise the system values and what actually exists in your warehouses.,"Dieses Werkzeug hilft Ihnen dabei, die Menge und die Bewertung von Bestand im System zu aktualisieren oder zu ändern. Es wird in der Regel verwendet, um die Systemwerte und den aktuellen Bestand Ihrer Lager zu synchronisieren.",
-MAT-RECO-.YYYY.-,MAT-RECO-.YYYY.-,
Reconciliation JSON,Abgleich JSON (JavaScript Object Notation),
Stock Reconciliation Item,Bestandsabgleich-Artikel,
Before reconciliation,Vor Ausgleich,
@@ -8796,8 +8787,7 @@
Availed ITC Cess,ITC Cess verfügbar,
Is Nil Rated or Exempted,Ist gleich Null oder ausgenommen,
Is Non GST,Ist nicht GST,
-ACC-SINV-RET-.YYYY.-,ACC-SINV-RET-.YYYY.-,
-E-Way Bill No.,E-Way Bill No.,
+E-Way Bill No.,E-Way Bill Nr.,
Is Consolidated,Ist konsolidiert,
Billing Address GSTIN,Rechnungsadresse GSTIN,
Customer GSTIN,Kunde GSTIN,
@@ -9216,7 +9206,7 @@
Time Required (In Mins),Erforderliche Zeit (in Minuten),
From Posting Date,Ab dem Buchungsdatum,
To Posting Date,Zum Buchungsdatum,
-No records found,Keine Aufzeichnungen gefunden,
+No records found,Keine Einträge gefunden,
Customer/Lead Name,Name des Kunden / Lead,
Unmarked Days,Nicht markierte Tage,
Jan,Jan.,
@@ -9275,7 +9265,7 @@
Group by Sales Order,Nach Auftrag gruppieren,
Sales Value,Verkaufswert,
Stock Qty vs Serial No Count,Lagermenge vs Seriennummer,
-Serial No Count,Seriennummer nicht gezählt,
+Serial No Count,Seriennummern gezählt,
Work Order Summary,Arbeitsauftragsübersicht,
Produce Qty,Menge produzieren,
Lead Time (in mins),Vorlaufzeit (in Minuten),
@@ -9569,7 +9559,7 @@
You can alternatively disable selling price validation in {} to bypass this validation.,"Alternativ können Sie die Validierung des Verkaufspreises in {} deaktivieren, um diese Validierung zu umgehen.",
Invalid Selling Price,Ungültiger Verkaufspreis,
Address needs to be linked to a Company. Please add a row for Company in the Links table.,Die Adresse muss mit einem Unternehmen verknüpft sein. Bitte fügen Sie eine Zeile für Firma in die Tabelle Links ein.,
-Company Not Linked,Firma nicht verbunden,
+Company Not Linked,Firma nicht verknüpft,
Import Chart of Accounts from CSV / Excel files,Kontenplan aus CSV / Excel-Dateien importieren,
Completed Qty cannot be greater than 'Qty to Manufacture',Die abgeschlossene Menge darf nicht größer sein als die Menge bis zur Herstellung.,
"Row {0}: For Supplier {1}, Email Address is Required to send an email","Zeile {0}: Für Lieferant {1} ist eine E-Mail-Adresse erforderlich, um eine E-Mail zu senden",
@@ -9656,7 +9646,7 @@
Action If Quality Inspection Is Not Submitted,Maßnahme Wenn keine Qualitätsprüfung eingereicht wird,
Auto Insert Price List Rate If Missing,"Preisliste automatisch einfügen, falls fehlt",
Automatically Set Serial Nos Based on FIFO,Seriennummern basierend auf FIFO automatisch einstellen,
-Set Qty in Transactions Based on Serial No Input,Stellen Sie die Menge in Transaktionen basierend auf Seriennummer ohne Eingabe ein,
+Set Qty in Transactions Based on Serial No Input,Setze die Anzahl in der Transaktion basierend auf den Seriennummern,
Raise Material Request When Stock Reaches Re-order Level,"Erhöhen Sie die Materialanforderung, wenn der Lagerbestand die Nachbestellmenge erreicht",
Notify by Email on Creation of Automatic Material Request,Benachrichtigen Sie per E-Mail über die Erstellung einer automatischen Materialanforderung,
Allow Material Transfer from Delivery Note to Sales Invoice,Materialübertragung vom Lieferschein zur Ausgangsrechnung zulassen,
@@ -9765,7 +9755,7 @@
POS invoice {0} created succesfully,POS-Rechnung {0} erfolgreich erstellt,
Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2}.,Lagermenge nicht ausreichend für Artikelcode: {0} unter Lager {1}. Verfügbare Menge {2}.,
Serial No: {0} has already been transacted into another POS Invoice.,Seriennummer: {0} wurde bereits in eine andere POS-Rechnung übertragen.,
-Balance Serial No,Balance Seriennr,
+Balance Serial No,Stand Seriennummern,
Warehouse: {0} does not belong to {1},Lager: {0} gehört nicht zu {1},
Please select batches for batched item {0},Bitte wählen Sie Chargen für Chargenartikel {0} aus,
Please select quantity on row {0},Bitte wählen Sie die Menge in Zeile {0},