Merge pull request #1675 from nabinhait/v4-hotfix
Create serial no based on series only if item is serialized
This commit is contained in:
commit
53142f125b
@ -277,6 +277,7 @@
|
||||
"fieldname": "serial_no_series",
|
||||
"fieldtype": "Data",
|
||||
"label": "Serial Number Series",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
@ -728,6 +729,7 @@
|
||||
"fieldname": "page_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Page Name",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
@ -825,6 +827,7 @@
|
||||
"fieldtype": "Link",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Parent Website Route",
|
||||
"no_copy": 1,
|
||||
"options": "Website Route",
|
||||
"permlevel": 0
|
||||
}
|
||||
@ -832,7 +835,7 @@
|
||||
"icon": "icon-tag",
|
||||
"idx": 1,
|
||||
"max_attachments": 1,
|
||||
"modified": "2014-05-12 07:54:58.118118",
|
||||
"modified": "2014-05-21 15:37:30.124881",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
@ -119,6 +119,10 @@ class Item(WebsiteGenerator):
|
||||
if self.has_serial_no == 'Yes' and self.is_stock_item == 'No':
|
||||
msgprint(_("'Has Serial No' can not be 'Yes' for non-stock item"), raise_exception=1)
|
||||
|
||||
if self.has_serial_no == "No" and self.serial_no_series:
|
||||
self.serial_no_series = None
|
||||
|
||||
|
||||
def check_for_active_boms(self):
|
||||
if self.is_purchase_item != "Yes":
|
||||
bom_mat = frappe.db.sql("""select distinct t1.parent
|
||||
|
@ -248,7 +248,8 @@ def validate_serial_no(sle, item_det):
|
||||
SerialNoRequiredError)
|
||||
|
||||
def update_serial_nos(sle, item_det):
|
||||
if sle.is_cancelled == "No" and not sle.serial_no and sle.actual_qty > 0 and item_det.serial_no_series:
|
||||
if sle.is_cancelled == "No" and not sle.serial_no and sle.actual_qty > 0 \
|
||||
and item_det.has_serial_no == "Yes" and item_det.serial_no_series:
|
||||
from frappe.model.naming import make_autoname
|
||||
serial_nos = []
|
||||
for i in xrange(cint(sle.actual_qty)):
|
||||
|
@ -50,10 +50,8 @@ class StockLedgerEntry(Document):
|
||||
frappe.throw(_("{0} is required").format(self.meta.get_label(k)))
|
||||
|
||||
def validate_item(self):
|
||||
item_det = frappe.db.sql("""select name, has_batch_no, docstatus,
|
||||
is_stock_item, has_serial_no, serial_no_series
|
||||
from tabItem where name=%s""",
|
||||
self.item_code, as_dict=True)[0]
|
||||
item_det = frappe.db.sql("""select name, has_batch_no, docstatus, is_stock_item
|
||||
from tabItem where name=%s""", self.item_code, as_dict=True)[0]
|
||||
|
||||
if item_det.is_stock_item != 'Yes':
|
||||
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
|
||||
|
Loading…
Reference in New Issue
Block a user