Get valuation rate from Item while not found based on SLE
This commit is contained in:
parent
bfcacbf2ca
commit
a0b967f2cd
@ -87,9 +87,8 @@ class StockController(AccountsController):
|
||||
|
||||
def validate_negative_stock(self, sle):
|
||||
if sle.qty_after_transaction < 0 and sle.actual_qty < 0:
|
||||
frappe.throw(_("For the Item {0}, valuation rate not found for warehouse {1}. To be able to do accounting entries (for booking expenses), we need valuation rate for item {2}. Please create an incoming stock transaction, on or before {3} {4}, and then try submiting {5}")
|
||||
.format(sle.item_code, sle.warehouse,
|
||||
sle.item_code, sle.posting_date, sle.posting_time, self.name))
|
||||
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries (for booking expenses). Please create an incoming stock transaction or mention valuation rate in Item record, and then try submiting {1} {2}")
|
||||
.format(sle.item_code, sle.voucher_type, sle.voucher_no))
|
||||
|
||||
def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
|
||||
if self.doctype == "Stock Reconciliation":
|
||||
|
@ -26,6 +26,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -54,6 +55,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Series",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -82,6 +84,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Code",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -112,6 +115,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Variant Of",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -140,6 +144,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -168,6 +173,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Barcode",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -195,6 +201,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Item Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -225,6 +232,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Unit of Measure",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -254,6 +262,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@ -279,6 +288,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Disabled",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -308,6 +318,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Maintain Stock",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -338,6 +349,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Opening Stock",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -353,39 +365,40 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:(doc.__islocal && doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no && doc.opening_stock)",
|
||||
"fieldname": "valuation_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Valuation Rate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:(doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
|
||||
"fieldname": "valuation_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Valuation Rate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "standard_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
@ -393,6 +406,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Standard Selling Rate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -420,6 +434,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Fixed Asset",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -448,6 +463,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Asset Category",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -476,6 +492,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Image",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -504,6 +521,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -531,6 +549,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Brand",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -560,6 +579,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -590,6 +610,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Inventory",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -620,6 +641,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -651,6 +673,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "End of Life",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -681,6 +704,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Has Batch No",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -713,6 +737,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Has Serial No",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -744,6 +769,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Serial Number Series",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -771,6 +797,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Material Request Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -800,6 +827,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
@ -829,6 +857,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Allow over delivery or receipt upto this percent",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -858,6 +887,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Valuation Method",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -886,6 +916,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Warranty Period (in days)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -916,6 +947,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Net Weight",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -943,6 +975,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Weight UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -972,6 +1005,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Auto re-order",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1001,6 +1035,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reorder level based on Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1030,6 +1065,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Variants",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1060,6 +1096,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Has Variants",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -1089,6 +1126,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Attributes",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -1117,6 +1155,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Purchase Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1146,6 +1185,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Purchase Item",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1176,6 +1216,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Minimum Order Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1204,6 +1245,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Safety Stock",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1233,6 +1275,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Lead Time in days",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1263,6 +1306,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Buying Cost Center",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1294,6 +1338,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Expense Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1324,6 +1369,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Unit of Measure Conversion",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1353,6 +1399,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "UOMs",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -1383,6 +1430,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Last Purchase Rate",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -1412,6 +1460,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1440,6 +1489,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Supplier",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1467,6 +1517,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Delivered by Supplier (Drop Ship)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1495,6 +1546,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Manufacturer",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1523,6 +1575,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Manufacturer Part Number",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1550,6 +1603,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Code for Suppliers",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1579,6 +1633,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier Items",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1606,6 +1661,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1635,6 +1691,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Sales Item",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1664,6 +1721,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Publish in Hub",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1692,6 +1750,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Synced With Hub",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1720,6 +1779,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Income Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1748,6 +1808,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Selling Cost Center",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1776,6 +1837,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer Item Codes",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1806,6 +1868,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer Items",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1834,6 +1897,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Max Discount (%)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1862,6 +1926,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Tax",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1891,6 +1956,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Taxes",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1920,6 +1986,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Inspection Criteria",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1949,6 +2016,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Inspection Required before Purchase",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -1978,6 +2046,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Inspection Required before Delivery",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2007,6 +2076,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Quality Parameters",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2037,6 +2107,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Manufacturing",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2066,6 +2137,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default BOM",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -2097,6 +2169,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supply Raw Materials for Purchase",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2126,6 +2199,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@ -2152,6 +2226,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer Code",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@ -2178,6 +2253,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Website",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2206,6 +2282,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Show in Website",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2233,6 +2310,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Show in Website (Variant)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2261,6 +2339,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Route",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2290,6 +2369,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Weightage",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2318,6 +2398,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Slideshow",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2347,6 +2428,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Image",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2374,6 +2456,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Thumbnail",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2401,6 +2484,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@ -2428,6 +2512,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Website Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2457,6 +2542,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Website Item Groups",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2486,6 +2572,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Website Specifications",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2513,6 +2600,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Copy From Item Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2540,6 +2628,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Website Specifications",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2568,6 +2657,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Website Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2594,6 +2684,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Projected Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -2622,7 +2713,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"modified": "2017-01-10 12:02:51.807965",
|
||||
"modified": "2017-01-18 17:43:20.262925",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
@ -259,6 +259,9 @@ class update_entries_after(object):
|
||||
if not self.valuation_rate and actual_qty > 0:
|
||||
self.valuation_rate = sle.incoming_rate
|
||||
|
||||
if not self.valuation_rate:
|
||||
self.valuation_rate = get_valuation_rate(sle, self.allow_zero_rate)
|
||||
|
||||
def get_fifo_values(self, sle):
|
||||
incoming_rate = flt(sle.incoming_rate)
|
||||
actual_qty = flt(sle.actual_qty)
|
||||
@ -281,10 +284,8 @@ class update_entries_after(object):
|
||||
qty_to_pop = abs(actual_qty)
|
||||
while qty_to_pop:
|
||||
if not self.stock_queue:
|
||||
if self.qty_after_transaction > 0:
|
||||
_rate = get_valuation_rate(sle.item_code, sle.warehouse, self.allow_zero_rate)
|
||||
else:
|
||||
_rate = 0
|
||||
# Get valuation rate from last sle if exists or from valuation rate field in item master
|
||||
_rate = get_valuation_rate(sle, self.allow_zero_rate)
|
||||
self.stock_queue.append([0, _rate])
|
||||
|
||||
index = None
|
||||
@ -404,25 +405,32 @@ def get_stock_ledger_entries(previous_sle, operator=None, order="desc", limit=No
|
||||
"order": order
|
||||
}, previous_sle, as_dict=1, debug=debug)
|
||||
|
||||
def get_valuation_rate(item_code, warehouse, allow_zero_rate=False):
|
||||
def get_valuation_rate(sle, allow_zero_rate=False):
|
||||
# Get valuation rate from last sle for the same item and warehouse
|
||||
last_valuation_rate = frappe.db.sql("""select valuation_rate
|
||||
from `tabStock Ledger Entry`
|
||||
where item_code = %s and warehouse = %s
|
||||
and valuation_rate > 0
|
||||
order by posting_date desc, posting_time desc, name desc limit 1""", (item_code, warehouse))
|
||||
order by posting_date desc, posting_time desc, name desc limit 1""", (sle.item_code, sle.warehouse))
|
||||
|
||||
if not last_valuation_rate:
|
||||
# Get valuation rate from last sle for the item against any warehouse
|
||||
last_valuation_rate = frappe.db.sql("""select valuation_rate
|
||||
from `tabStock Ledger Entry`
|
||||
where item_code = %s and valuation_rate > 0
|
||||
order by posting_date desc, posting_time desc, name desc limit 1""", item_code)
|
||||
order by posting_date desc, posting_time desc, name desc limit 1""", sle.item_code)
|
||||
|
||||
valuation_rate = flt(last_valuation_rate[0][0]) if last_valuation_rate else 0
|
||||
|
||||
if not valuation_rate:
|
||||
valuation_rate = frappe.db.get_value("Item Price", {"item_code": item_code, "buying": 1}, "price_list_rate")
|
||||
# If negative stock allowed, and item delivered without any incoming entry,
|
||||
# syste does not found any SLE, then take valuation rate from Item
|
||||
valuation_rate = frappe.db.get_value("Item", sle.item_code, "valuation_rate")
|
||||
|
||||
if not allow_zero_rate and not valuation_rate and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
||||
frappe.throw(_("Purchase rate for item: {0} not found, which is required to book accounting entry (expense). Please mention item price against a buying price list.").format(item_code))
|
||||
if not allow_zero_rate and not valuation_rate \
|
||||
and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
||||
|
||||
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries (for booking expenses). Please create an incoming stock transaction or mention valuation rate in Item record, and then try submiting {1} {2}")
|
||||
.format(sle.item_code, sle.voucher_type, sle.voucher_no))
|
||||
|
||||
return valuation_rate
|
||||
|
Loading…
x
Reference in New Issue
Block a user