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

@@ -30,7 +30,6 @@ prob = {
}
def make(reset=False, simulate=True):
webnotes.connect()
#webnotes.print_messages = True
webnotes.mute_emails = True
webnotes.rollback_on_exception = True
@@ -38,7 +37,7 @@ def make(reset=False, simulate=True):
if reset:
setup()
if simulate:
simulate()
_simulate()
def setup():
install()
@@ -50,7 +49,7 @@ def setup():
# make_opening_stock()
# make_opening_accounts()
def simulate():
def _simulate():
global runs_for
current_date = webnotes.utils.getdate(start_date)
@@ -411,7 +410,4 @@ def import_data(dt, submit=False):
if submit:
webnotes.form_dict["params"] = json.dumps({"_submit": 1})
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
upload()
if __name__=="__main__":
make()
upload()

View File

@@ -6,7 +6,14 @@ import webnotes, os
import utilities.demo.make_demo
def make_demo_app():
webnotes.mute_emails = 1
webnotes.connect()
utilities.demo.make_demo.make(reset=True, simulate=False)
# setup demo user etc so that the site it up faster, while the data loads
make_demo_user()
make_demo_login_page()
make_demo_on_login_script()
utilities.demo.make_demo.make(reset=False, simulate=True)
def make_demo_user():
roles = ["Accounts Manager", "Analytics", "Expense Approver", "Accounts User",
@@ -111,11 +118,4 @@ def make_demo_on_login_script():
webnotes.conn.commit()
if __name__=="__main__":
# webnotes.connect()
webnotes.mute_emails = 1
utilities.demo.make_demo.make(reset=True, simulate=False)
# setup demo user etc so that the site it up faster, while the data loads
make_demo_user()
make_demo_login_page()
make_demo_on_login_script()
utilities.demo.make_demo.make(reset=False, simulate=True)
make_demo_app()

View File

@@ -12,9 +12,6 @@ class DocType(TransactionBase):
self.doc = doc
self.doclist = doclist
def onload(self):
self.add_communication_list()
def on_communication_sent(self, comm):
webnotes.conn.set(self.doc, 'status', 'Replied')

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:32",
"docstatus": 0,
"modified": "2013-07-05 14:32:19",
"modified": "2013-09-02 16:26:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -225,6 +225,14 @@
"oldfieldtype": "Small Text",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "communications",
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
},
{
"cancel": 1,
"doctype": "DocPerm",

View File

@@ -87,7 +87,7 @@ class TransactionBase(StatusUpdater):
if self.meta.get_field(fieldname):
self.doc.fields[fieldname] = val
if self.meta.get_field("sales_team"):
if self.meta.get_field("sales_team") and self.doc.customer:
self.set_sales_team_for_customer()
def set_sales_team_for_customer(self):
@@ -229,20 +229,7 @@ class TransactionBase(StatusUpdater):
if int(webnotes.conn.get_value("Notification Control", None, dt) or 0):
self.doc.fields["__notification_message"] = \
webnotes.conn.get_value("Notification Control", None, dt + "_message")
def add_communication_list(self):
# remove communications if present
self.doclist = webnotes.doclist(self.doclist).get({
"doctype": ["!=", "Communcation"]})
comm_list = webnotes.conn.sql("""select * from tabCommunication
where %s=%s order by modified desc limit 20""" \
% (self.doc.doctype.replace(" ", "_").lower(), "%s"),
self.doc.name, as_dict=1, update={"doctype":"Communication"})
self.doclist.extend(webnotes.doclist([webnotes.doc(fielddata=d) \
for d in comm_list]))
def validate_posting_time(self):
if not self.doc.posting_time:
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')