mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 17:04:47 +00:00
[autoname] [cleanup] strip blank spaces and remove autoname where naming_series: can be set in doctype
This commit is contained in:
@@ -17,28 +17,16 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import addchild, make_autoname
|
||||
from webnotes.model.bean import copy_doclist
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
from webnotes.model.doc import addchild
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
def get_item_specification_details(self):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
|
||||
specification = sql("select specification, value from `tabItem Quality Inspection Parameter` \
|
||||
specification = webnotes.conn.sql("select specification, value from `tabItem Quality Inspection Parameter` \
|
||||
where parent = '%s' order by idx" % (self.doc.item_code))
|
||||
for d in specification:
|
||||
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist)
|
||||
@@ -48,13 +36,13 @@ class DocType:
|
||||
|
||||
def on_submit(self):
|
||||
if self.doc.purchase_receipt_no:
|
||||
sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
|
||||
webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
|
||||
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
||||
% (self.doc.name, self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
if self.doc.purchase_receipt_no:
|
||||
sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
|
||||
webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
|
||||
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
||||
% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:11",
|
||||
"creation": "2013-04-30 13:13:03",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-22 14:57:21",
|
||||
"modified": "2013-05-09 14:34:10",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "QAI/.######",
|
||||
"autoname": "naming_series:",
|
||||
"doctype": "DocType",
|
||||
"is_submittable": 1,
|
||||
"module": "Buying",
|
||||
|
||||
Reference in New Issue
Block a user