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",
|
"fieldname": "serial_no_series",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Serial Number Series",
|
"label": "Serial Number Series",
|
||||||
|
"no_copy": 1,
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -728,6 +729,7 @@
|
|||||||
"fieldname": "page_name",
|
"fieldname": "page_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Page Name",
|
"label": "Page Name",
|
||||||
|
"no_copy": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
@ -825,6 +827,7 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"ignore_restrictions": 1,
|
"ignore_restrictions": 1,
|
||||||
"label": "Parent Website Route",
|
"label": "Parent Website Route",
|
||||||
|
"no_copy": 1,
|
||||||
"options": "Website Route",
|
"options": "Website Route",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
}
|
}
|
||||||
@ -832,7 +835,7 @@
|
|||||||
"icon": "icon-tag",
|
"icon": "icon-tag",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2014-05-12 07:54:58.118118",
|
"modified": "2014-05-21 15:37:30.124881",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
|
@ -119,6 +119,10 @@ class Item(WebsiteGenerator):
|
|||||||
if self.has_serial_no == 'Yes' and self.is_stock_item == 'No':
|
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)
|
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):
|
def check_for_active_boms(self):
|
||||||
if self.is_purchase_item != "Yes":
|
if self.is_purchase_item != "Yes":
|
||||||
bom_mat = frappe.db.sql("""select distinct t1.parent
|
bom_mat = frappe.db.sql("""select distinct t1.parent
|
||||||
|
@ -248,7 +248,8 @@ def validate_serial_no(sle, item_det):
|
|||||||
SerialNoRequiredError)
|
SerialNoRequiredError)
|
||||||
|
|
||||||
def update_serial_nos(sle, item_det):
|
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
|
from frappe.model.naming import make_autoname
|
||||||
serial_nos = []
|
serial_nos = []
|
||||||
for i in xrange(cint(sle.actual_qty)):
|
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)))
|
frappe.throw(_("{0} is required").format(self.meta.get_label(k)))
|
||||||
|
|
||||||
def validate_item(self):
|
def validate_item(self):
|
||||||
item_det = frappe.db.sql("""select name, has_batch_no, docstatus,
|
item_det = frappe.db.sql("""select name, has_batch_no, docstatus, is_stock_item
|
||||||
is_stock_item, has_serial_no, serial_no_series
|
from tabItem where name=%s""", self.item_code, as_dict=True)[0]
|
||||||
from tabItem where name=%s""",
|
|
||||||
self.item_code, as_dict=True)[0]
|
|
||||||
|
|
||||||
if item_det.is_stock_item != 'Yes':
|
if item_det.is_stock_item != 'Yes':
|
||||||
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
|
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
|
||||||
|
Loading…
Reference in New Issue
Block a user