feat: option to select reposting method
In current implementation selecting Item-Warehouse based reposting is
better for few users, who don't use depenent SLEs but have frequent
transactions involving same items.
This change lets them switch to item-warehouse based reposting if
required.
Only use this if you understand technicalities of stock reposting. This
is experimental but will become mainstream in coming days.
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index fe5d0c7..ca567fd 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -544,7 +544,12 @@
"company": self.company
})
if future_sle_exists(args):
- create_item_wise_repost_entries(voucher_type=self.doctype, voucher_no=self.name)
+ item_based_reposting = cint(frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting"))
+ if item_based_reposting:
+ create_item_wise_repost_entries(voucher_type=self.doctype, voucher_no=self.name)
+ else:
+ create_repost_item_valuation_entry(args)
+
@frappe.whitelist()
def make_quality_inspections(doctype, docname, items):
diff --git a/erpnext/stock/doctype/stock_reposting_settings/stock_reposting_settings.json b/erpnext/stock/doctype/stock_reposting_settings/stock_reposting_settings.json
index 2474059..0facae8 100644
--- a/erpnext/stock/doctype/stock_reposting_settings/stock_reposting_settings.json
+++ b/erpnext/stock/doctype/stock_reposting_settings/stock_reposting_settings.json
@@ -1,6 +1,7 @@
{
"actions": [],
"allow_rename": 1,
+ "beta": 1,
"creation": "2021-10-01 10:56:30.814787",
"doctype": "DocType",
"editable_grid": 1,
@@ -10,7 +11,8 @@
"limit_reposting_timeslot",
"start_time",
"end_time",
- "limits_dont_apply_on"
+ "limits_dont_apply_on",
+ "item_based_reposting"
],
"fields": [
{
@@ -44,12 +46,18 @@
"fieldname": "limit_reposting_timeslot",
"fieldtype": "Check",
"label": "Limit timeslot for Stock Reposting"
+ },
+ {
+ "default": "0",
+ "fieldname": "item_based_reposting",
+ "fieldtype": "Check",
+ "label": "Use Item based reposting"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2021-10-01 11:27:28.981594",
+ "modified": "2021-11-02 01:22:45.155841",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reposting Settings",