commonified naming_series

This commit is contained in:
Rushabh Mehta 2012-11-26 11:58:22 +05:30
parent 78ba38106b
commit de91a21946
18 changed files with 5054 additions and 6038 deletions

View File

@ -39,11 +39,6 @@ class DocType:
self.doc = doc
self.doclist = doclist
# Autoname
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
#check status of lead
#------------------------
def check_status(self):

View File

@ -4,9 +4,10 @@
"docstatus": 0,
"creation": "2012-11-02 17:16:46",
"modified_by": "Administrator",
"modified": "2012-11-24 15:09:56"
"modified": "2012-11-26 11:12:27"
},
{
"autoname": "naming_series:",
"name": "__common__",
"default_print_format": "Standard",
"search_fields": "lead_name,lead_owner,status",
@ -121,7 +122,7 @@
"search_index": 0,
"reqd": 0,
"in_filter": 1,
"options": "\nAdvertisement\nBlog\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite"
"options": "\nAdvertisement\nBlog\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite\nEmail"
},
{
"description": "Source of th",

View File

@ -20,7 +20,7 @@ import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, load_json
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doc import Document, addchild, getchildren
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, msgprint, errprint
@ -41,15 +41,6 @@ class DocType(TransactionBase):
self.doclist = doclist
self.tname = 'Quotation Item'
self.fname = 'quotation_details'
# Autoname
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
# DOCTYPE TRIGGER FUNCTIONS
# ==============================================================================
# Pull Opportunity Details
# --------------------

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doc import Document, addchild, getchildren
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, msgprint, errprint
@ -45,12 +45,6 @@ class DocType(TransactionBase):
self.person_tname = 'Target Detail'
self.partner_tname = 'Partner Target Detail'
self.territory_tname = 'Territory Target Detail'
# Autoname
# ===============
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
# DOCTYPE TRIGGER FUNCTIONS
# =============================

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doc import Document, addchild, getchildren
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, msgprint, errprint
@ -42,11 +42,6 @@ class DocType(TransactionBase):
self.tname = 'Delivery Note Item'
self.fname = 'delivery_note_details'
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
def validate_fiscal_year(self):
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists, delete_doc
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doc import Document, addchild, getchildren
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, msgprint, errprint
@ -40,12 +40,6 @@ class DocType(TransactionBase):
self.doclist = doclist
self.item_dict = {}
self.fname = 'mtn_details'
# Autoname
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
# get item details
# ----------------

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,3 @@ class DocType():
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')

View File

@ -4,13 +4,14 @@
"docstatus": 0,
"creation": "2012-11-14 12:25:16",
"modified_by": "Administrator",
"modified": "2012-11-24 15:22:32"
"modified": "2012-11-26 11:17:28"
},
{
"autoname": "naming_series:",
"allow_attach": 1,
"name": "__common__",
"doctype": "DocType",
"module": "Support",
"name": "__common__",
"in_dialog": 1,
"document_type": "Master",
"description": "Keep a track of all communications"

View File

@ -21,7 +21,7 @@ import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doc import Document, addchild, getchildren
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, msgprint, errprint
@ -40,9 +40,6 @@ class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series + '.######')
def check_maintenance_visit(self):
nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)

File diff suppressed because it is too large Load Diff

View File

@ -45,10 +45,6 @@ class DocType():
where ifnull(blog_subscriber,0) = 1 and ifnull(email_id, '') != '' """
}
def autoname(self):
from webnotes.model.doc import make_autoname
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
def send_emails(self):
"""send emails to leads and customers"""
# TODO: create unsubscribed check in customer

View File

@ -1,233 +1,184 @@
# DocType, Newsletter
[
# These values are common in all dictionaries
{
u'creation': '2012-08-23 18:49:12',
u'docstatus': 0,
u'modified': '2012-08-24 14:45:00',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
{
'description': u'Create and Send Newsletters',
u'doctype': u'DocType',
'document_type': u'Other',
'module': u'Support',
u'name': u'__common__',
'version': 1
},
# These values are common for all DocField
{
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'Newsletter',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Newsletter',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, Newsletter
{
u'doctype': u'DocType',
u'name': u'Newsletter'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'basic_info',
'fieldtype': u'Section Break',
'label': u'Basic Info',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'default': u'NL-',
u'doctype': u'DocField',
'fieldname': u'naming_series',
'fieldtype': u'Select',
'label': u'Naming Series',
'options': u'NL-',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'A Lead with this email id should exist',
u'doctype': u'DocField',
'fieldname': u'test_email_id',
'fieldtype': u'Data',
'label': u'Test Email Id',
'permlevel': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'test_send',
'fieldtype': u'Button',
'label': u'Test',
'options': u'test_send',
'permlevel': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'column_break1',
'fieldtype': u'Column Break',
'label': u'Send To',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'contacts',
'fieldtype': u'Check',
'label': u'All Contacts',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'customer_contacts',
'fieldtype': u'Check',
'label': u'All Customer Contacts',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'leads',
'fieldtype': u'Check',
'label': u'All Leads',
'permlevel': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'active_leads',
'fieldtype': u'Check',
'label': u'All Active Leads',
'permlevel': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'blog_subscribers',
'fieldtype': u'Check',
'label': u'All Blog Subscribers',
'permlevel': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'newsletter_content',
'fieldtype': u'Section Break',
'label': u'Newsletter Content',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'subject',
'fieldtype': u'Small Text',
'label': u'Subject',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'message',
'fieldtype': u'Code',
'label': u'Message',
'options': u'Markdown',
'permlevel': 0,
'reqd': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'newsletter_status',
'fieldtype': u'Section Break',
'label': u'Newsletter Status',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'email_sent',
'fieldtype': u'Check',
'label': u'Email Sent?',
'no_copy': 1,
'permlevel': 1
},
# DocPerm
{
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 1
},
# DocPerm
{
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Support Manager',
'write': 1
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager'
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Support Manager'
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-08-24 14:48:05",
"modified_by": "Administrator",
"modified": "2012-11-26 11:18:43"
},
{
"autoname": "naming_series:",
"description": "Create and Send Newsletters",
"doctype": "DocType",
"module": "Support",
"document_type": "Other",
"name": "__common__"
},
{
"name": "__common__",
"parent": "Newsletter",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Newsletter",
"read": 1,
"doctype": "DocPerm",
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Newsletter",
"doctype": "DocType"
},
{
"doctype": "DocField",
"label": "Basic Info",
"fieldname": "basic_info",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"default": "NL-",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Naming Series",
"options": "NL-",
"fieldname": "naming_series",
"fieldtype": "Select",
"reqd": 1,
"permlevel": 0
},
{
"description": "A Lead with this email id should exist",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Test Email Id",
"fieldname": "test_email_id",
"fieldtype": "Data",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Test",
"options": "test_send",
"fieldname": "test_send",
"fieldtype": "Button",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Send To",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "All Contacts",
"fieldname": "contacts",
"fieldtype": "Check",
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "All Customer Contacts",
"fieldname": "customer_contacts",
"fieldtype": "Check",
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "All Leads",
"fieldname": "leads",
"fieldtype": "Check",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "All Active Leads",
"fieldname": "active_leads",
"fieldtype": "Check",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "All Blog Subscribers",
"fieldname": "blog_subscribers",
"fieldtype": "Check",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Newsletter Content",
"fieldname": "newsletter_content",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "Subject",
"fieldname": "subject",
"fieldtype": "Small Text",
"reqd": 1,
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "Message",
"options": "Markdown",
"fieldname": "message",
"fieldtype": "Code",
"reqd": 0,
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Newsletter Status",
"fieldname": "newsletter_status",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"no_copy": 1,
"colour": "White:FFF",
"doctype": "DocField",
"label": "Email Sent?",
"fieldname": "email_sent",
"fieldtype": "Check",
"permlevel": 1
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "Sales Manager",
"cancel": 1,
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "Support Manager",
"cancel": 1,
"permlevel": 0
},
{
"doctype": "DocPerm",
"role": "Sales Manager",
"permlevel": 1
},
{
"doctype": "DocPerm",
"role": "Support Manager",
"permlevel": 1
}
]

View File

@ -26,9 +26,6 @@ class DocType(TransactionBase):
self.doc = doc
self.doclist = doclist
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
def onload(self):
self.add_communication_list()
@ -106,7 +103,6 @@ class DocType(TransactionBase):
import email.utils
d = webnotes.doc('Communication')
d.naming_series = "COMM-"
d.subject = self.doc.subject
d.email_address = from_email or webnotes.user.name
email_addr = email.utils.parseaddr(d.email_address)[1]
@ -117,6 +113,16 @@ class DocType(TransactionBase):
d.communication_medium = "Email"
d.save(1)
if not d.lead and not d.contact:
self.make_lead(d, email_addr[0])
def make_lead(self, d, real_name):
d = webnotes.doc("Lead")
d.lead_name = real_name or d.email_address
d.email_id = d.email_address
d.source = "Email"
d.save(1)
def close_ticket(self):
webnotes.conn.set(self.doc,'status','Closed')
update_feed(self.doc)

View File

@ -4,9 +4,10 @@
"docstatus": 0,
"creation": "2012-11-02 17:17:05",
"modified_by": "Administrator",
"modified": "2012-11-24 16:41:45"
"modified": "2012-11-26 11:17:10"
},
{
"autoname": "naming_series:",
"allow_attach": 1,
"default_print_format": "Standard",
"search_fields": "status,customer,allocated_to,subject,raised_by",