Set Qty in transactions based on serial no via Stock Settings (#13897)
This commit is contained in:
parent
7461806b1c
commit
ed376cacc8
@ -500,3 +500,4 @@ erpnext.patches.v10_0.set_student_party_type
|
|||||||
erpnext.patches.v10_0.update_project_in_sle
|
erpnext.patches.v10_0.update_project_in_sle
|
||||||
erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract
|
erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract
|
||||||
erpnext.patches.v10_0.taxes_issue_with_pos
|
erpnext.patches.v10_0.taxes_issue_with_pos
|
||||||
|
erpnext.patches.v10_0.set_qty_in_transactions_based_on_serial_no_input
|
@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) 2017, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc("stock", "doctype", "stock_settings")
|
||||||
|
|
||||||
|
ss = frappe.get_doc("Stock Settings")
|
||||||
|
ss.set_qty_in_transactions_based_on_serial_no_input = 1
|
||||||
|
ss.save()
|
@ -401,7 +401,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
item.serial_no = valid_serial_nos.join('\n');
|
item.serial_no = valid_serial_nos.join('\n');
|
||||||
|
|
||||||
refresh_field("serial_no", item.name, item.parentfield);
|
refresh_field("serial_no", item.name, item.parentfield);
|
||||||
if(!doc.is_return) {
|
if(!doc.is_return && cint(user_defaults.set_qty_in_transactions_based_on_serial_no_input)) {
|
||||||
frappe.model.set_value(item.doctype, item.name,
|
frappe.model.set_value(item.doctype, item.name,
|
||||||
"qty", valid_serial_nos.length / item.conversion_factor);
|
"qty", valid_serial_nos.length / item.conversion_factor);
|
||||||
frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
|
frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
|
||||||
|
@ -37,6 +37,7 @@ def set_default_settings(args):
|
|||||||
stock_settings.auto_indent = 1
|
stock_settings.auto_indent = 1
|
||||||
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
||||||
stock_settings.automatically_set_serial_nos_based_on_fifo = 1
|
stock_settings.automatically_set_serial_nos_based_on_fifo = 1
|
||||||
|
stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1
|
||||||
stock_settings.save()
|
stock_settings.save()
|
||||||
|
|
||||||
selling_settings = frappe.get_doc("Selling Settings")
|
selling_settings = frappe.get_doc("Selling Settings")
|
||||||
|
@ -198,7 +198,7 @@ def validate_serial_no(sle, item_det):
|
|||||||
frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty))
|
frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty))
|
||||||
|
|
||||||
if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)):
|
if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)):
|
||||||
frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(sle.actual_qty, sle.item_code, len(serial_nos)),
|
frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(abs(sle.actual_qty), sle.item_code, len(serial_nos)),
|
||||||
SerialNoQtyError)
|
SerialNoQtyError)
|
||||||
|
|
||||||
if len(serial_nos) != len(set(serial_nos)):
|
if len(serial_nos) != len(set(serial_nos)):
|
||||||
|
@ -463,6 +463,37 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"default": "1",
|
||||||
|
"fieldname": "set_qty_in_transactions_based_on_serial_no_input",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Set Qty in Transactions based on Serial No Input",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -679,7 +710,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-11-17 01:35:49.562613",
|
"modified": "2018-05-03 12:37:12.905394",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Settings",
|
"name": "Stock Settings",
|
||||||
|
@ -11,8 +11,9 @@ from frappe.utils.html_utils import clean_html
|
|||||||
|
|
||||||
class StockSettings(Document):
|
class StockSettings(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
for key in ["item_naming_by", "item_group", "stock_uom", "allow_negative_stock", "default_warehouse"]:
|
for key in ["item_naming_by", "item_group", "stock_uom",
|
||||||
frappe.db.set_default(key, self.get(key, ""))
|
"allow_negative_stock", "default_warehouse", "set_qty_in_transactions_based_on_serial_no_input"]:
|
||||||
|
frappe.db.set_default(key, self.get(key, ""))
|
||||||
|
|
||||||
from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
|
from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
|
||||||
set_by_naming_series("Item", "item_code",
|
set_by_naming_series("Item", "item_code",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user