本文整理汇总了Python中webnotes.model.doc.Document.naming_series方法的典型用法代码示例。如果您正苦于以下问题:Python Document.naming_series方法的具体用法?Python Document.naming_series怎么用?Python Document.naming_series使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.naming_series方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_auto_indent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
""" Create indent on reaching reorder level """
indent = Document('Purchase Request')
indent.transaction_date = nowdate()
indent.naming_series = 'IDT'
indent.company = get_defaults()['company']
indent.fiscal_year = get_defaults()['fiscal_year']
indent.remark = "This is an auto generated Purchase Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
indent.save(1)
indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item',0)
indent_details_child.item_code = self.doc.item_code
indent_details_child.uom = self.doc.stock_uom
indent_details_child.warehouse = self.doc.warehouse
indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
indent_details_child.item_name = i['item_name']
indent_details_child.description = i['description']
indent_details_child.item_group = i['item_group']
indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty))
indent_details_child.brand = i['brand']
indent_details_child.save()
indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
indent_obj.validate()
set(indent_obj.doc,'docstatus',1)
indent_obj.on_submit()
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Purchase Request %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
if(i['email_notify']):
send_email_notification(doc_type,doc_name)
示例2: reorder_indent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify=1):
indent = Document('Indent')
indent.transaction_date = nowdate()
indent.naming_series = 'IDT'
indent.company = get_defaults()['company']
indent.fiscal_year = get_defaults()['fiscal_year']
indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level when %s %s was created"%(doc_type,doc_name)
indent.save(1)
indent_obj = get_obj('Indent',indent.name,with_children=1)
indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
indent_details_child.item_code = self.doc.item_code
indent_details_child.uom = self.doc.stock_uom
indent_details_child.warehouse = self.doc.warehouse
indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
indent_details_child.item_name = i['item_name']
indent_details_child.description = i['description']
indent_details_child.item_group = i['item_group']
if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
else:
indent_details_child.qty = i['min_order_qty']
indent_details_child.brand = i['brand']
indent_details_child.save()
indent_obj = get_obj('Indent',indent.name,with_children=1)
indent_obj.validate()
set(indent_obj.doc,'docstatus',1)
indent_obj.on_submit()
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
if(email_notify):
send_email_notification(doc_type,doc_name)
示例3: create_material_request
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def create_material_request(self,args):
mr=Document('Material Request')
mr.material_request_type='Purchase'
mr.naming_series='MREQ-'
mr.company='InnoWorth'
mr.transaction_date=nowdate()
mr.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
mr.status='Submitted'
mr.docstatus=1
mr.save()
mrc=Document('Material Request Item')
mrc.parent=mr.name
mrc.item_code=args[0][0]
mrc.qty=args[0][1]
mrc.schedule_date=args[0][2]
mrc.docstatus=1
mrc.warehouse=args[0][3]
mrc.item_name=args[0][4]
mrc.uom=args[0][5]
mrc.description=args[0][6]
mrc.parentfield='indent_details'
mrc.parenttype='Material Request'
mrc.save()
child_data=[]
child_data.append([mrc.item_code,mrc.qty,mrc.schedule_date,mr.name,mrc.warehouse,mrc.item_name,mrc.uom,mrc.description,mrc.name,args[0][7]])
data=[]
data.append({"item_code":mrc.item_code,"so_qty":cstr(mrc.qty),"proj_qty":('+'+cstr(mrc.qty)),"warehouse":mrc.warehouse,"bin_iqty":"Bin.indented_qty","bin_pqty":"Bin.projected_qty","type":"po"})
self.update_bin(data)
import_amount=self.create_child_po(child_data)
return import_amount
示例4: upload_accounts_transactions
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def upload_accounts_transactions(self):
import csv
data = csv.reader(self.get_csv_data().splitlines())
abbr = sql("select concat(' - ',abbr) as abbr from tabCompany where name=%s", self.doc.company)
updated = 0
jv_name = ""
# jv = Document('Journal Voucher')
global line, jv, name, jv_go
for line in data:
if len(line) >= 7: # Minimum no of fields
if line[3] != jv_name: # Create JV
if jv_name != "":
jv_go = get_obj("Journal Voucher", name, with_children=1)
jv_go.validate()
jv_go.on_submit()
jv_name = line[3]
jv = Document("Journal Voucher")
jv.voucher_type = line[0]
jv.naming_series = line[1]
jv.voucher_date = formatdate(line[2])
jv.posting_date = formatdate(line[2])
# jv.name = line[3]
jv.fiscal_year = self.doc.fiscal_year
jv.company = self.doc.company
jv.remark = len(line) == 8 and line[3] + " " + line[7] or line[3] + " Uploaded Record"
jv.docstatus = 1
jv.save(1)
name = jv.name
jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
jc.account = line[4] + abbr[0][0]
jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
if line[5] != "":
jc.debit = line[5]
else:
jc.credit = line[6]
jc.save()
else: # Create JV Child
jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
jc.account = line[4] + abbr[0][0]
jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
if line[5] != "":
jc.debit = line[5]
else:
jc.credit = line[6]
jc.save()
else:
msgprint("[Ignored] Incorrect format: %s" % str(line))
if jv_name != "":
jv_go = get_obj("Journal Voucher", name, with_children=1)
jv_go.validate()
jv_go.on_submit()
msgprint("<b>%s</b> items updated" % updated)
示例5: create_lead
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def create_lead(email):
"""create a lead if it does not exist"""
lead = Document("Lead")
lead.fields["__islocal"] = 1
lead.lead_name = email
lead.email_id = email
lead.status = "Open"
lead.naming_series = lead_naming_series or get_lead_naming_series()
lead.company = webnotes.conn.get_default("company")
lead.source = "Email"
lead.save()
示例6: create_lead
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def create_lead(email_id):
"""create a lead if it does not exist"""
from email.utils import parseaddr
real_name, email_id = parseaddr(email_id)
lead = Document("Lead")
lead.fields["__islocal"] = 1
lead.lead_name = real_name or email_id
lead.email_id = email_id
lead.status = "Open"
lead.naming_series = lead_naming_series or get_lead_naming_series()
lead.company = webnotes.conn.get_default("company")
lead.source = "Email"
lead.save()
示例7: create_auto_indent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def create_auto_indent(self, i, doc_type, doc_name, cur_qty):
""" Create indent on reaching reorder level """
indent = Document("Purchase Request")
indent.transaction_date = nowdate()
indent.naming_series = "IDT"
indent.company = get_defaults()["company"]
indent.fiscal_year = get_defaults()["fiscal_year"]
indent.remark = (
"This is an auto generated Purchase Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"
% (doc_type, doc_name)
)
indent.save(1)
indent_obj = get_obj("Purchase Request", indent.name, with_children=1)
indent_details_child = addchild(indent_obj.doc, "indent_details", "Purchase Request Item", 0)
indent_details_child.item_code = self.doc.item_code
indent_details_child.uom = self.doc.stock_uom
indent_details_child.warehouse = self.doc.warehouse
indent_details_child.schedule_date = add_days(nowdate(), cint(i["lead_time_days"]))
indent_details_child.item_name = i["item_name"]
indent_details_child.description = i["description"]
indent_details_child.item_group = i["item_group"]
indent_details_child.qty = i["re_order_qty"] or (flt(i["re_order_level"]) - flt(cur_qty))
indent_details_child.brand = i["brand"]
indent_details_child.save()
indent_obj = get_obj("Purchase Request", indent.name, with_children=1)
indent_obj.validate()
set(indent_obj.doc, "docstatus", 1)
indent_obj.on_submit()
msgprint(
"Item: "
+ self.doc.item_code
+ " is to be re-ordered. Purchase Request %s raised. It was generated from %s %s"
% (indent.name, doc_type, doc_name)
)
if i["email_notify"]:
self.send_email_notification(doc_type, doc_name)
示例8: post_jv
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def post_jv(data):
jv = Document('Journal Voucher')
jv.voucher_type = data.get('voucher_type')
jv.naming_series = data.get('naming_series')
jv.voucher_date = data.get('cheque_date')
jv.posting_date = data.get('cheque_date')
jv.cheque_no = data.get('cheque_number')
jv.cheque_date = data.get('cheque_date')
jv.fiscal_year = data.get('fiscal_year') # To be modified to take care
jv.company = data.get('company')
jv.save(1)
jc = addchild(jv,'entries','Journal Voucher Detail',0)
jc.account = data.get('debit_account')
jc.debit = data.get('amount')
jc.save()
jc = addchild(jv,'entries','Journal Voucher Detail',0)
jc.account = data.get('credit_account')
jc.credit = data.get('amount')
jc.save()
return jv.name
示例9: post_jv
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def post_jv(data):
jv = Document("Journal Voucher")
jv.voucher_type = data.get("voucher_type")
jv.naming_series = data.get("naming_series")
jv.voucher_date = data.get("cheque_date")
jv.posting_date = data.get("cheque_date")
jv.cheque_no = data.get("cheque_number")
jv.cheque_date = data.get("cheque_date")
jv.fiscal_year = data.get("fiscal_year") # To be modified to take care
jv.company = data.get("company")
jv.save(1)
jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
jc.account = data.get("debit_account")
jc.debit = data.get("amount")
jc.save()
jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
jc.account = data.get("credit_account")
jc.credit = data.get("amount")
jc.save()
return jv.name
示例10: process_message
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def process_message(self, mail):
"""
Updates message from support email as either new or reply
"""
from home import update_feed
content, content_type = '[Blank Email]', 'text/plain'
if mail.text_content:
content, content_type = mail.text_content, 'text/plain'
else:
content, content_type = mail.html_content, 'text/html'
thread_list = mail.get_thread_id()
email_id = mail.mail['From']
if "<" in mail.mail['From']:
import re
re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
if re_result and re_result[0]: email_id = re_result[0]
from webnotes.utils import decode_email_header
full_email_id = decode_email_header(mail.mail['From'])
for thread_id in thread_list:
exists = webnotes.conn.sql("""\
SELECT name
FROM `tabSupport Ticket`
WHERE name=%s AND raised_by REGEXP %s
""" , (thread_id, '(' + email_id + ')'))
if exists and exists[0] and exists[0][0]:
from webnotes.model.code import get_obj
st = get_obj('Support Ticket', thread_id)
st.make_response_record(content, full_email_id, content_type)
# to update modified date
#webnotes.conn.set(st.doc, 'status', 'Open')
st.doc.status = 'Open'
st.doc.save()
update_feed(st.doc, 'on_update')
webnotes.conn.commit()
# extract attachments
self.save_attachments(st.doc, mail.attachments)
webnotes.conn.begin()
return
from webnotes.model.doctype import get_property
opts = get_property('Support Ticket', 'options', 'naming_series')
# new ticket
from webnotes.model.doc import Document
d = Document('Support Ticket')
d.description = content
d.subject = decode_email_header(mail.mail['Subject'])
d.raised_by = full_email_id
d.content_type = content_type
d.status = 'Open'
d.naming_series = opts and opts.split("\n")[0] or 'SUP'
try:
d.save(1)
except:
d.description = 'Unable to extract message'
d.save(1)
else:
# update feed
update_feed(d, 'on_update')
# send auto reply
if cint(self.email_settings.send_autoreply):
self.send_auto_reply(d)
webnotes.conn.commit()
# extract attachments
self.save_attachments(d, mail.attachments)
webnotes.conn.begin()
示例11: process_message
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def process_message(self, mail):
"""
Updates message from support email as either new or reply
"""
from home import update_feed
content, content_type = '[Blank Email]', 'text/plain'
if mail.text_content:
content, content_type = mail.text_content, 'text/plain'
else:
content, content_type = mail.html_content, 'text/html'
thread_list = mail.get_thread_id()
email_id = mail.mail['From']
if "<" in mail.mail['From']:
import re
re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
if re_result and re_result[0]: email_id = re_result[0]
for thread_id in thread_list:
exists = webnotes.conn.sql("""\
SELECT name
FROM `tabSupport Ticket`
WHERE name=%s AND raised_by REGEXP %s
""" , (thread_id, '(' + email_id + ')'))
if exists and exists[0] and exists[0][0]:
from webnotes.model.code import get_obj
st = get_obj('Support Ticket', thread_id)
st.make_response_record(content, mail.mail['From'], content_type)
webnotes.conn.set(st.doc, 'status', 'Open')
update_feed(st.doc)
# extract attachments
self.save_attachments(st.doc, mail.attachments)
return
opts = webnotes.conn.sql("""\
SELECT options FROM tabDocField
WHERE parent='Support Ticket' AND fieldname='naming_series'""")
# new ticket
from webnotes.model.doc import Document
d = Document('Support Ticket')
d.description = content
d.subject = mail.mail['Subject']
d.raised_by = mail.mail['From']
d.content_type = content_type
d.status = 'Open'
d.naming_series = (opts and opts[0] and opts[0][0] and opts[0][0].split("\n")[0]) or 'SUP'
try:
d.save(1)
# update feed
update_feed(d)
# send auto reply
self.send_auto_reply(d)
except:
d.description = 'Unable to extract message'
d.save(1)
else:
# extract attachments
self.save_attachments(d, mail.attachments)
示例12: process_message
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import naming_series [as 别名]
def process_message(self, mail):
"""
Updates message from support email as either new or reply
"""
from home import update_feed
content, content_type = "[Blank Email]", "text/plain"
if mail.text_content:
content, content_type = mail.text_content, "text/plain"
else:
content, content_type = mail.html_content, "text/html"
thread_list = mail.get_thread_id()
email_id = mail.mail["From"]
if "<" in mail.mail["From"]:
import re
re_result = re.findall("(?<=\<)(\S+)(?=\>)", mail.mail["From"])
if re_result and re_result[0]:
email_id = re_result[0]
from webnotes.utils import decode_email_header
full_email_id = decode_email_header(mail.mail["From"])
for thread_id in thread_list:
exists = webnotes.conn.sql(
"""\
SELECT name
FROM `tabSupport Ticket`
WHERE name=%s AND raised_by REGEXP %s
""",
(thread_id, "(" + email_id + ")"),
)
if exists and exists[0] and exists[0][0]:
st = webnotes.get_obj("Support Ticket", thread_id)
from core.doctype.communication.communication import make
make(
content=content,
sender=full_email_id,
doctype="Support Ticket",
name=thread_id,
lead=st.doc.lead,
contact=st.doc.contact,
)
st.doc.status = "Open"
st.doc.save()
update_feed(st, "on_update")
# extract attachments
self.save_attachments(st.doc, mail.attachments)
return
from webnotes.model.doctype import get_property
opts = get_property("Support Ticket", "options", "naming_series")
# new ticket
from webnotes.model.doc import Document
d = Document("Support Ticket")
d.description = content
d.subject = decode_email_header(mail.mail["Subject"])
d.raised_by = full_email_id
d.content_type = content_type
d.status = "Open"
d.naming_series = opts and opts.split("\n")[0] or "SUP"
try:
d.save(1)
try:
# extract attachments
self.save_attachments(d, mail.attachments)
except Exception, e:
self.description += "\n\n[Did not pull attachment]"
except:
d.description = "Unable to extract message"
d.save(1)
else:
# send auto reply
if cint(self.email_settings.send_autoreply):
if "mailer-daemon" not in d.raised_by.lower():
self.send_auto_reply(d)