Merge branch 'develop'

This commit is contained in:
Nabin Hait 2016-02-25 11:59:39 +05:30
commit 7f8a5fe6d2
10 changed files with 66 additions and 126 deletions

View File

@ -1,2 +1,2 @@
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '6.23.0' __version__ = '6.23.1'

View File

@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple""" app_description = """ERP made simple"""
app_icon = "icon-th" app_icon = "icon-th"
app_color = "#e74c3c" app_color = "#e74c3c"
app_version = "6.23.0" app_version = "6.23.1"
app_email = "info@erpnext.com" app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)" app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext" source_link = "https://github.com/frappe/erpnext"

View File

@ -23,6 +23,10 @@ class BOMReplaceTool(Document):
def validate_bom(self): def validate_bom(self):
if cstr(self.current_bom) == cstr(self.new_bom): if cstr(self.current_bom) == cstr(self.new_bom):
frappe.throw(_("Current BOM and New BOM can not be same")) frappe.throw(_("Current BOM and New BOM can not be same"))
if frappe.db.get_value("BOM", self.current_bom, "item") \
!= frappe.db.get_value("BOM", self.new_bom, "item"):
frappe.throw(_("The selected BOMs are not for the same item"))
def update_new_bom(self): def update_new_bom(self):
current_bom_unitcost = frappe.db.sql("""select total_cost/quantity current_bom_unitcost = frappe.db.sql("""select total_cost/quantity

View File

@ -9,43 +9,8 @@ frappe.pages['setup-wizard'].on_page_load = function(wrapper) {
function load_erpnext_slides() { function load_erpnext_slides() {
$.extend(erpnext.wiz, { $.extend(erpnext.wiz, {
user: {
title: __("The First User: You"),
icon: "icon-user",
fields: [
{"fieldname": "first_name", "label": __("First Name"), "fieldtype": "Data",
reqd:1},
{"fieldname": "last_name", "label": __("Last Name"), "fieldtype": "Data"},
{"fieldname": "email", "label": __("Email Address"), "fieldtype": "Data",
reqd:1, "description": __("You will use it to Login"), "options":"Email"},
{"fieldname": "password", "label": __("Password"), "fieldtype": "Password",
reqd:1},
{fieldtype:"Attach Image", fieldname:"attach_user",
label: __("Attach Your Picture"), is_private: 0},
],
help: __('The first user will become the System Manager (you can change this later).'),
onload: function(slide) {
if(user!=="Administrator") {
slide.form.fields_dict.password.$wrapper.toggle(false);
slide.form.fields_dict.email.$wrapper.toggle(false);
slide.form.fields_dict.first_name.set_input(frappe.boot.user.first_name);
slide.form.fields_dict.last_name.set_input(frappe.boot.user.last_name);
var user_image = frappe.get_cookie("user_image");
if(user_image) {
var $attach_user = slide.form.fields_dict.attach_user.$wrapper;
$attach_user.find(".missing-image").toggle(false);
$attach_user.find("img").attr("src", decodeURIComponent(user_image)).toggle(true);
}
delete slide.form.fields_dict.email;
delete slide.form.fields_dict.password;
}
},
css_class: "single-column"
},
org: { org: {
app_name: "erpnext",
title: __("The Organization"), title: __("The Organization"),
icon: "icon-building", icon: "icon-building",
fields: [ fields: [
@ -160,6 +125,7 @@ function load_erpnext_slides() {
}, },
branding: { branding: {
app_name: "erpnext",
icon: "icon-bookmark", icon: "icon-bookmark",
title: __("The Brand"), title: __("The Brand"),
help: __('Upload your letter head and logo. (you can edit them later).'), help: __('Upload your letter head and logo. (you can edit them later).'),
@ -181,10 +147,11 @@ function load_erpnext_slides() {
}, },
users: { users: {
app_name: "erpnext",
icon: "icon-money", icon: "icon-money",
"title": __("Add Users"), title: __("Add Users"),
"help": __("Add users to your organization, other than yourself"), help: __("Add users to your organization, other than yourself"),
"fields": [], fields: [],
before_load: function(slide) { before_load: function(slide) {
slide.fields = []; slide.fields = [];
for(var i=1; i<5; i++) { for(var i=1; i<5; i++) {
@ -209,9 +176,10 @@ function load_erpnext_slides() {
}, },
taxes: { taxes: {
app_name: "erpnext",
icon: "icon-money", icon: "icon-money",
"title": __("Add Taxes"), title: __("Add Taxes"),
"help": __("List your tax heads (e.g. VAT, Customs etc; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."), help: __("List your tax heads (e.g. VAT, Customs etc; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."),
"fields": [], "fields": [],
before_load: function(slide) { before_load: function(slide) {
slide.fields = []; slide.fields = [];
@ -229,10 +197,11 @@ function load_erpnext_slides() {
}, },
customers: { customers: {
app_name: "erpnext",
icon: "icon-group", icon: "icon-group",
"title": __("Your Customers"), title: __("Your Customers"),
"help": __("List a few of your customers. They could be organizations or individuals."), help: __("List a few of your customers. They could be organizations or individuals."),
"fields": [], fields: [],
before_load: function(slide) { before_load: function(slide) {
slide.fields = []; slide.fields = [];
for(var i=1; i<6; i++) { for(var i=1; i<6; i++) {
@ -251,10 +220,11 @@ function load_erpnext_slides() {
}, },
suppliers: { suppliers: {
app_name: "erpnext",
icon: "icon-group", icon: "icon-group",
"title": __("Your Suppliers"), title: __("Your Suppliers"),
"help": __("List a few of your suppliers. They could be organizations or individuals."), help: __("List a few of your suppliers. They could be organizations or individuals."),
"fields": [], fields: [],
before_load: function(slide) { before_load: function(slide) {
slide.fields = []; slide.fields = [];
for(var i=1; i<6; i++) { for(var i=1; i<6; i++) {
@ -273,10 +243,11 @@ function load_erpnext_slides() {
}, },
items: { items: {
app_name: "erpnext",
icon: "icon-barcode", icon: "icon-barcode",
"title": __("Your Products or Services"), title: __("Your Products or Services"),
"help": __("List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start."), help: __("List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
"fields": [], fields: [],
before_load: function(slide) { before_load: function(slide) {
slide.fields = []; slide.fields = [];
for(var i=1; i<6; i++) { for(var i=1; i<6; i++) {
@ -336,7 +307,6 @@ function load_erpnext_slides() {
frappe.wiz.on("before_load", function() { frappe.wiz.on("before_load", function() {
load_erpnext_slides(); load_erpnext_slides();
frappe.wiz.add_slide(erpnext.wiz.user);
frappe.wiz.add_slide(erpnext.wiz.org); frappe.wiz.add_slide(erpnext.wiz.org);
frappe.wiz.add_slide(erpnext.wiz.branding); frappe.wiz.add_slide(erpnext.wiz.branding);
frappe.wiz.add_slide(erpnext.wiz.users); frappe.wiz.add_slide(erpnext.wiz.users);

View File

@ -17,7 +17,7 @@ def get_funnel_data(from_date, to_date):
and status != "Passive" """, (from_date, to_date))[0][0] and status != "Passive" """, (from_date, to_date))[0][0]
opportunities = frappe.db.sql("""select count(*) from `tabOpportunity` opportunities = frappe.db.sql("""select count(*) from `tabOpportunity`
where docstatus = 1 and (date(`creation`) between %s and %s) where (date(`creation`) between %s and %s)
and status != "Lost" """, (from_date, to_date))[0][0] and status != "Lost" """, (from_date, to_date))[0][0]
quotations = frappe.db.sql("""select count(*) from `tabQuotation` quotations = frappe.db.sql("""select count(*) from `tabQuotation`

View File

@ -16,7 +16,8 @@ class ItemGroup(NestedSet, WebsiteGenerator):
website = frappe._dict( website = frappe._dict(
condition_field = "show_in_website", condition_field = "show_in_website",
template = "templates/generators/item_group.html", template = "templates/generators/item_group.html",
parent_website_route_field = "parent_item_group" parent_website_route_field = "parent_item_group",
no_cache = 1
) )
def autoname(self): def autoname(self):
@ -52,8 +53,11 @@ class ItemGroup(NestedSet, WebsiteGenerator):
frappe.throw(frappe._("An item exists with same name ({0}), please change the item group name or rename the item").format(self.name)) frappe.throw(frappe._("An item exists with same name ({0}), please change the item group name or rename the item").format(self.name))
def get_context(self, context): def get_context(self, context):
start = int(frappe.form_dict.start or 0)
if start < 0:
start = 0
context.update({ context.update({
"items": get_product_list_for_group(product_group = self.name, limit=100), "items": get_product_list_for_group(product_group = self.name, start=start, limit=24),
"parent_groups": get_parent_item_groups(self.name), "parent_groups": get_parent_item_groups(self.name),
"title": self.name "title": self.name
}) })
@ -63,6 +67,7 @@ class ItemGroup(NestedSet, WebsiteGenerator):
return context return context
@frappe.whitelist(allow_guest=True)
def get_product_list_for_group(product_group=None, start=0, limit=10): def get_product_list_for_group(product_group=None, start=0, limit=10):
child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)]) child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)])
@ -122,4 +127,4 @@ def invalidate_cache_for(doc, item_group=None):
d = frappe.get_doc("Item Group", d.name) d = frappe.get_doc("Item Group", d.name)
route = d.get_route() route = d.get_route()
if route: if route:
clear_cache(route) clear_cache(route)

View File

@ -12,7 +12,7 @@ def after_install():
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert() frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
set_single_defaults() set_single_defaults()
feature_setup() feature_setup()
from erpnext.setup.setup_wizard.setup_wizard import add_all_roles_to from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
add_all_roles_to("Administrator") add_all_roles_to("Administrator")
add_web_forms() add_web_forms()
frappe.db.commit() frappe.db.commit()

View File

@ -19,8 +19,7 @@ def setup_complete(args=None):
frappe.throw(_("Setup Already Complete!!")) frappe.throw(_("Setup Already Complete!!"))
install_fixtures.install(args.get("country")) install_fixtures.install(args.get("country"))
update_user_name(args)
create_fiscal_year_and_company(args) create_fiscal_year_and_company(args)
create_users(args) create_users(args)
set_defaults(args) set_defaults(args)
@ -54,67 +53,32 @@ def setup_complete(args=None):
pass pass
def update_user_name(args):
if args.get("email"):
args['name'] = args.get("email")
_mute_emails, frappe.flags.mute_emails = frappe.flags.mute_emails, True
doc = frappe.get_doc({
"doctype":"User",
"email": args.get("email"),
"first_name": args.get("first_name"),
"last_name": args.get("last_name")
})
doc.flags.no_welcome_mail = True
doc.insert()
frappe.flags.mute_emails = _mute_emails
from frappe.auth import _update_password
_update_password(args.get("email"), args.get("password"))
else:
args['name'] = frappe.session.user
# Update User
if not args.get('last_name') or args.get('last_name')=='None':
args['last_name'] = None
frappe.db.sql("""update `tabUser` SET first_name=%(first_name)s,
last_name=%(last_name)s WHERE name=%(name)s""", args)
if args.get("attach_user"):
attach_user = args.get("attach_user").split(",")
if len(attach_user)==3:
filename, filetype, content = attach_user
fileurl = save_file(filename, content, "User", args.get("name"), decode=True).file_url
frappe.db.set_value("User", args.get("name"), "user_image", fileurl)
add_all_roles_to(args.get("name"))
def create_fiscal_year_and_company(args): def create_fiscal_year_and_company(args):
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date')) if (args.get('fy_start_date')):
frappe.get_doc({ curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
frappe.get_doc({
"doctype":"Fiscal Year", "doctype":"Fiscal Year",
'year': curr_fiscal_year, 'year': curr_fiscal_year,
'year_start_date': args.get('fy_start_date'), 'year_start_date': args.get('fy_start_date'),
'year_end_date': args.get('fy_end_date'), 'year_end_date': args.get('fy_end_date'),
}).insert() }).insert()
args["curr_fiscal_year"] = curr_fiscal_year
# Company # Company
frappe.get_doc({ if (args.get('company_name')):
"doctype":"Company", frappe.get_doc({
'domain': args.get("industry"), "doctype":"Company",
'company_name':args.get('company_name').strip(), 'domain': args.get("industry"),
'abbr':args.get('company_abbr'), 'company_name':args.get('company_name').strip(),
'default_currency':args.get('currency'), 'abbr':args.get('company_abbr'),
'country': args.get('country'), 'default_currency':args.get('currency'),
'chart_of_accounts': args.get(('chart_of_accounts')), 'country': args.get('country'),
}).insert() 'chart_of_accounts': args.get(('chart_of_accounts')),
}).insert()
# Bank Account
create_bank_account(args)
args["curr_fiscal_year"] = curr_fiscal_year
# Bank Account
create_bank_account(args)
def create_bank_account(args): def create_bank_account(args):
if args.get("bank_account"): if args.get("bank_account"):
company_name = args.get('company_name').strip() company_name = args.get('company_name').strip()
@ -440,14 +404,6 @@ def create_logo(args):
frappe.db.set_value("Website Settings", "Website Settings", "brand_html", frappe.db.set_value("Website Settings", "Website Settings", "brand_html",
"<img src='{0}' style='max-width: 40px; max-height: 25px;'> {1}".format(fileurl, args.get("company_name").strip())) "<img src='{0}' style='max-width: 40px; max-height: 25px;'> {1}".format(fileurl, args.get("company_name").strip()))
def add_all_roles_to(name):
user = frappe.get_doc("User", name)
for role in frappe.db.sql("""select name from tabRole"""):
if role[0] not in ["Administrator", "Guest", "All", "Customer", "Supplier", "Partner", "Employee"]:
d = user.append("user_roles")
d.role = role[0]
user.save()
def create_territories(): def create_territories():
"""create two default territories, one for home country and one named Rest of the World""" """create two default territories, one for home country and one named Rest of the World"""
from frappe.utils.nestedset import get_root_of from frappe.utils.nestedset import get_root_of

View File

@ -25,9 +25,14 @@
{{ item }} {{ item }}
{% endfor %} {% endfor %}
</div> </div>
{% if (items|length)==100 %} <div class="text-center">
<div class="text-muted info">Showing top 100 items.</div> {% if frappe.form_dict.start|int > 0 %}
{% endif %} <a class="btn btn-default" href="{{ pathname }}?start={{ frappe.form_dict.start|int - 24 }}">Prev</a>
{% endif %}
{% if items|length == 24 %}
<a class="btn btn-default" href="{{ pathname }}?start={{ frappe.form_dict.start|int + 24 }}">Next</a>
{% endif %}
</div>
{% else %} {% else %}
<div class="text-muted">No items listed.</div> <div class="text-muted">No items listed.</div>
{% endif %} {% endif %}

View File

@ -1,7 +1,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
from pip.req import parse_requirements from pip.req import parse_requirements
version = "6.23.0" version = "6.23.1"
requirements = parse_requirements("requirements.txt", session="") requirements = parse_requirements("requirements.txt", session="")
setup( setup(