Merge branch 'master' into customer-login

This commit is contained in:
Anand Doshi
2013-09-03 16:42:21 +05:30
134 changed files with 281 additions and 137 deletions

View File

@@ -17,10 +17,7 @@ class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def onload(self):
self.add_communication_list()
def autoname(self):
cust_master_name = webnotes.defaults.get_global_default('cust_master_name')
if cust_master_name == 'Customer Name':
@@ -43,8 +40,7 @@ class DocType(TransactionBase):
def validate_values(self):
if webnotes.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.doc.naming_series:
msgprint("Series is Mandatory.")
raise Exception
webnotes.throw("Series is Mandatory.", webnotes.MandatoryError)
def validate(self):
self.validate_values()

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-06-11 14:26:44",
"docstatus": 0,
"modified": "2013-08-08 14:22:13",
"modified": "2013-09-02 16:25:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -348,6 +348,15 @@
"options": "Customer Discount",
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "communications",
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication",
"permlevel": 0
},
{
"amend": 0,
"cancel": 0,

View File

@@ -25,12 +25,15 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
lead.insert()
lead_name = lead.doc.name
parent_doctype = "Contact" if contact_name else "Lead"
parent_name = contact_name or lead_name
message = make(content=content, sender=sender, subject=subject,
lead=lead_name, contact=contact_name, date=date)
doctype = parent_doctype, name = parent_name, date=date)
if mail:
# save attachments to parent if from mail
bean = webnotes.bean("Contact" if contact_name else "Lead", contact_name or lead_name)
bean = webnotes.bean(parent_doctype, parent_name)
mail.save_attachments_in_doc(bean.doc)
class SalesMailbox(POP3Mailbox):

View File

@@ -14,12 +14,12 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
onload: function() {
if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) {
cur_frm.fields_dict.lead_owner.get_query = function(doc,cdt,cdn) {
return { query:"controllers.queries.profile_query" } }
return { query:"core.doctype.profile.profile.profile_query" } }
}
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) {
return { query:"controllers.queries.profile_query" } }
return { query:"core.doctype.profile.profile.profile_query" } }
}
if(in_list(user_roles,'System Manager')) {
@@ -51,7 +51,7 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
}
cur_frm.communication_view = new wn.views.CommunicationList({
list: wn.model.get("Communication", {"lead": this.frm.doc.name}),
list: wn.model.get("Communication", {"parenttype": "Lead", "parent":this.frm.doc.name}),
parent: this.frm.fields_dict.communication_html.wrapper,
doc: this.frm.doc,
recipients: this.frm.doc.email_id

View File

@@ -24,7 +24,6 @@ class DocType(SellingController):
})
def onload(self):
self.add_communication_list()
customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
if customer:
self.doc.fields["__is_customer"] = customer

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-10 11:45:37",
"docstatus": 0,
"modified": "2013-08-08 14:22:14",
"modified": "2013-09-02 17:25:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -410,6 +410,14 @@
"fieldtype": "Check",
"label": "Blog Subscriber"
},
{
"doctype": "DocField",
"fieldname": "communications",
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
},
{
"cancel": 1,
"doctype": "DocPerm",

View File

@@ -25,9 +25,6 @@ class DocType(TransactionBase):
"contact_by": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_by") if \
(not cint(self.doc.fields.get("__islocal"))) else None,
})
def onload(self):
self.add_communication_list()
def get_item_details(self, item_code):
item = sql("""select item_name, stock_uom, description_html, description, item_group, brand

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
"modified": "2013-08-08 14:22:15",
"modified": "2013-09-02 16:27:33",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -442,6 +442,14 @@
"read_only": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "communications",
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
},
{
"doctype": "DocPerm",
"role": "Sales User"

View File

@@ -7,7 +7,7 @@ import webnotes
from webnotes.utils import cstr, getdate
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
from webnotes import _, msgprint
sql = webnotes.conn.sql
@@ -20,9 +20,6 @@ class DocType(SellingController):
self.doclist = doclist
self.tname = 'Quotation Item'
self.fname = 'quotation_details'
def onload(self):
self.add_communication_list()
# Get contact person details based on customer selected
# ------------------------------------------------------
@@ -281,3 +278,7 @@ def _make_customer(source_name, ignore_permissions=False):
return customer
else:
raise e
except webnotes.MandatoryError:
from webnotes.utils import get_url_to_form
webnotes.throw(_("Before proceeding, please create Customer from Lead") + \
(" - %s" % get_url_to_form("Lead", lead_name)))

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
"modified": "2013-08-09 14:46:11",
"modified": "2013-09-02 16:25:01",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -835,6 +835,14 @@
"read_only": 0,
"width": "40px"
},
{
"doctype": "DocField",
"fieldname": "communications",
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
},
{
"amend": 1,
"cancel": 1,

View File

@@ -161,7 +161,7 @@ def _get_item_discount(item_group, customer):
FROM `tabItem Group` AS node, `tabItem Group` AS parent
WHERE parent.lft <= node.lft and parent.rgt >= node.rgt and node.name = %s
GROUP BY parent.name
ORDER BY parent.lft desc""", item_group)]
ORDER BY parent.lft desc""", (item_group,))]
discount = 0
for d in parent_item_groups: