[communication] [setup wizard] [minor] [fixes]

This commit is contained in:
Rushabh Mehta 2013-10-09 16:08:54 +05:30
parent 26c5a585c7
commit ddca90ef7b
9 changed files with 156 additions and 54 deletions

View File

@ -37,7 +37,7 @@ class JobsMailbox(POP3Mailbox):
mail.save_attachments_in_doc(applicant.doc)
make(content=mail.content, sender=mail.from_email,
doctype="Job Applicant", name=applicant.doc.name)
doctype="Job Applicant", name=applicant.doc.name, sent_or_received="Received")
def get_job_applications():
if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')):

View File

@ -34,7 +34,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
cur_frm.cscript.make_contact(doc,dt,dn);
cur_frm.communication_view = new wn.views.CommunicationList({
list: wn.model.get("Communication", {"customer": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc,
});

View File

@ -29,7 +29,7 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
parent_name = contact_name or lead_name
message = make(content=content, sender=sender, subject=subject,
doctype = parent_doctype, name = parent_name, date=date)
doctype = parent_doctype, name = parent_name, date=date, sent_or_received="Received")
if mail:
# save attachments to parent if from mail

View File

@ -0,0 +1,8 @@
#page-setup-wizard .panel {
-webkit-box-shadow: 0px 1px 8px rgba(0,0,0,0.6);
box-shadow: 0px 1px 8px rgba(0,0,0,0.6);
}
#page-setup-wizard .col-md-6 .control-input .btn {
width: 100%;
}

View File

@ -19,7 +19,7 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
if(r.exc) {
var d = msgprint(wn._("There were errors."));
d.custom_onhide = function() {
wn.set_route(me.wiz.page_name, "0");
wn.set_route(erpnext.wiz.page_name, "0");
}
} else {
wiz.show_complete();
@ -61,8 +61,8 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
fields: [
{"fieldname": "first_name", "label": wn._("First Name"), "fieldtype": "Data", reqd:1},
{"fieldname": "last_name", "label": wn._("Last Name"), "fieldtype": "Data", reqd:1},
{"email_id": "email", "label": wn._("Email Id"), "fieldtype": "Data", reqd:1, "description":"Your Login Id"},
{"password": "password", "label": wn._("Password"), "fieldtype": "Password", reqd:1},
{"fieldname": "email", "label": wn._("Email Id"), "fieldtype": "Data", reqd:1, "description":"Your Login Id"},
{"fieldname": "password", "label": wn._("Password"), "fieldtype": "Password", reqd:1},
{fieldtype:"Attach Image", fieldname:"attach_profile", label:"Attach Your Profile..."},
],
help: wn._('The first user will become the System Manager (you can change that later).'),
@ -188,21 +188,51 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_1", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_group_1", options:["Products", "Services", "Raw Material", "Sub Assemblies"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_uom_1", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_2", label:"Item 2", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_2", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_group_2", options:["Products", "Services", "Raw Material", "Sub Assemblies"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_uom_2", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_3", label:"Item 3", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_3", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_group_3", options:["Products", "Services", "Raw Material", "Sub Assemblies"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_uom_3", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_4", label:"Item 4", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_4", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_group_4", options:["Products", "Services", "Raw Material", "Sub Assemblies"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_uom_4", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_5", label:"Item 5", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_5", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_group_5", options:["Products", "Services", "Raw Material", "Sub Assemblies"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_uom_5", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
],
},
@ -213,10 +243,44 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
"help": wn._("List a few products or services you buy from your suppliers or vendors. If these are same as your products, then do not add them."),
"fields": [
{fieldtype:"Data", fieldname:"item_buy_1", label:"Item 1", placeholder:"A Product or Service"},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_group_1", options:["Raw Material", "Consumable", "Sub Assemblies", "Services", "Products"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_uom_1", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_buy_2", label:"Item 2", placeholder:"A Product or Service"},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_group_2", options:["Raw Material", "Consumable", "Sub Assemblies", "Services", "Products"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_uom_2", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_buy_3", label:"Item 3", placeholder:"A Product or Service"},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_group_3", options:["Raw Material", "Consumable", "Sub Assemblies", "Services", "Products"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_uom_3", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_buy_4", label:"Item 4", placeholder:"A Product or Service"},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_group_4", options:["Raw Material", "Consumable", "Sub Assemblies", "Services", "Products"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_uom_4", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_buy_5", label:"Item 5", placeholder:"A Product or Service"},
{fieldtype:"Section Break"},
{fieldtype:"Column Break"},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_group_5", options:["Raw Material", "Consumable", "Sub Assemblies", "Services", "Products"]},
{fieldtype:"Column Break"},
{fieldtype:"Select", fieldname:"item_buy_uom_5", options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
],
},
@ -327,7 +391,7 @@ wn.wiz.Wizard = Class.extend({
},
show: function(id) {
if(!this.welcomed) {
wn.set_route(this.wiz.page_name);
wn.set_route(this.page_name);
return;
}
id = cint(id);

View File

@ -27,6 +27,7 @@ def setup_account(args=None):
create_price_lists(args)
create_feed_and_todo()
create_email_digest()
create_letter_head(args)
create_taxes(args)
create_items(args)
create_customers(args)
@ -234,16 +235,17 @@ def create_items(args):
for i in xrange(1,6):
item = args.get("item_" + str(i))
if item:
item_group = args.get("item_group_" + str(i))
webnotes.bean({
"doctype":"Item",
"item_code": item,
"item_name": item,
"description": item,
"is_sales_item": "Yes",
"is_stock_item": "Yes",
"item_group":"Products",
"stock_uom": "Unit",
"default_warehouse": "Finished Goods - " + args.get("company_abbr")
"is_stock_item": item_group!="Services" and "Yes" or "No",
"item_group": item_group,
"stock_uom": args.get("item_uom_" + str(i)),
"default_warehouse": item_group!="Service" and ("Finished Goods - " + args.get("company_abbr")) or ""
}).insert()
if args.get("item_img_" + str(i)):
@ -254,16 +256,17 @@ def create_items(args):
for i in xrange(1,6):
item = args.get("item_buy_" + str(i))
if item:
item_group = args.get("item_buy_group_" + str(i))
webnotes.bean({
"doctype":"Item",
"item_code": item,
"item_name": item,
"description": item,
"is_sales_item": "No",
"is_stock_item": "Yes",
"item_group":"Raw Material",
"stock_uom": "Unit",
"default_warehouse": "Stores - " + args.get("company_abbr")
"is_stock_item": item_group!="Services" and "Yes" or "No",
"item_group": item_group,
"stock_uom": args.get("item_buy_uom_" + str(i)),
"default_warehouse": item_group!="Service" and ("Stores - " + args.get("company_abbr")) or ""
}).insert()
if args.get("item_img_" + str(i)):
@ -314,20 +317,20 @@ def create_suppliers(args):
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
def create_profile(user_email, user_fname, user_lname, pwd=None):
pr = webnotes.doc('Profile')
pr.first_name = user_fname
pr.last_name = user_lname
pr.name = pr.email = user_email
pr.enabled = 1
pr.save(1)
if pwd:
webnotes.conn.sql("""insert into __Auth (user, `password`)
values (%s, password(%s))
on duplicate key update `password`=password(%s)""",
(user_email, pwd, pwd))
add_all_roles_to(pr.name)
def create_letter_head(args):
if args.get("attach_letterhead"):
lh = webnotes.bean({
"doctype":"Letter Head",
"letter_head_name": "Standard",
"is_default": 1
}).insert()
filename, filetype, content = args.get("attach_letterhead").split(",")
fileurl = save_file(filename, content, "Letter Head", "Standard", decode=True).file_name
webnotes.conn.set_value("Letter Head", "Standard", "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
def add_all_roles_to(name):
profile = webnotes.doc("Profile", name)

File diff suppressed because one or more lines are too long

View File

@ -71,6 +71,7 @@ def import_defaults():
{'doctype': 'Item Group', 'item_group_name': 'Raw Material', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
{'doctype': 'Item Group', 'item_group_name': 'Services', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
{'doctype': 'Item Group', 'item_group_name': 'Sub Assemblies', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
{'doctype': 'Item Group', 'item_group_name': 'Consumable', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
# deduction type
{'doctype': 'Deduction Type', 'name': 'Income Tax', 'description': 'Income Tax', 'deduction_name': 'Income Tax'},

View File

@ -81,7 +81,7 @@ def add_support_communication(subject, content, sender, docname=None, mail=None)
make(content=content, sender=sender, subject = subject,
doctype="Support Ticket", name=ticket.doc.name,
date=mail.date if mail else today())
date=mail.date if mail else today(), sent_or_received="Received")
if mail:
mail.save_attachments_in_doc(ticket.doc)