Merge branch 'hotfix'
This commit is contained in:
commit
b09c87bd0f
@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.27.21'
|
||||
__version__ = '6.27.22'
|
||||
|
@ -193,9 +193,6 @@ class Account(Document):
|
||||
|
||||
def validate_trash(self):
|
||||
"""checks gl entries and if child exists"""
|
||||
if not self.parent_account:
|
||||
throw(_("Root account can not be deleted"))
|
||||
|
||||
if self.check_gle_exists():
|
||||
throw(_("Account with existing transaction can not be deleted"))
|
||||
if self.check_if_child_exists():
|
||||
|
@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
|
||||
app_description = """ERP made simple"""
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "6.27.21"
|
||||
app_version = "6.27.22"
|
||||
app_email = "info@erpnext.com"
|
||||
app_license = "GNU General Public License (v3)"
|
||||
source_link = "https://github.com/frappe/erpnext"
|
||||
|
@ -15,13 +15,21 @@ form_grid_templates = {
|
||||
|
||||
class BOM(Document):
|
||||
def autoname(self):
|
||||
last_name = frappe.db.sql("""select max(name) from `tabBOM`
|
||||
where name like "BOM/{0}/%%" and item=%s
|
||||
""".format(frappe.db.escape(self.item, percent=False)), self.item)
|
||||
if last_name:
|
||||
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
|
||||
names = frappe.db.sql_list("""select name from `tabBOM` where item=%s""", self.item)
|
||||
|
||||
if names:
|
||||
# name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1
|
||||
|
||||
# split by item
|
||||
names = [name.split(self.item)[-1][1:] for name in names]
|
||||
|
||||
# split by (-) if cancelled
|
||||
names = [cint(name.split('-')[-1]) for name in names]
|
||||
|
||||
idx = max(names) + 1
|
||||
else:
|
||||
idx = 1
|
||||
|
||||
self.name = 'BOM/' + self.item + ('/%.3i' % idx)
|
||||
|
||||
def validate(self):
|
||||
|
Loading…
Reference in New Issue
Block a user