Merge branch 'develop'
This commit is contained in:
commit
7f8a5fe6d2
@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.23.0'
|
||||
__version__ = '6.23.1'
|
||||
|
@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
|
||||
app_description = """ERP made simple"""
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "6.23.0"
|
||||
app_version = "6.23.1"
|
||||
app_email = "info@erpnext.com"
|
||||
app_license = "GNU General Public License (v3)"
|
||||
source_link = "https://github.com/frappe/erpnext"
|
||||
|
@ -23,6 +23,10 @@ class BOMReplaceTool(Document):
|
||||
def validate_bom(self):
|
||||
if cstr(self.current_bom) == cstr(self.new_bom):
|
||||
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):
|
||||
current_bom_unitcost = frappe.db.sql("""select total_cost/quantity
|
||||
|
@ -9,43 +9,8 @@ frappe.pages['setup-wizard'].on_page_load = function(wrapper) {
|
||||
|
||||
function load_erpnext_slides() {
|
||||
$.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: {
|
||||
app_name: "erpnext",
|
||||
title: __("The Organization"),
|
||||
icon: "icon-building",
|
||||
fields: [
|
||||
@ -160,6 +125,7 @@ function load_erpnext_slides() {
|
||||
},
|
||||
|
||||
branding: {
|
||||
app_name: "erpnext",
|
||||
icon: "icon-bookmark",
|
||||
title: __("The Brand"),
|
||||
help: __('Upload your letter head and logo. (you can edit them later).'),
|
||||
@ -181,10 +147,11 @@ function load_erpnext_slides() {
|
||||
},
|
||||
|
||||
users: {
|
||||
app_name: "erpnext",
|
||||
icon: "icon-money",
|
||||
"title": __("Add Users"),
|
||||
"help": __("Add users to your organization, other than yourself"),
|
||||
"fields": [],
|
||||
title: __("Add Users"),
|
||||
help: __("Add users to your organization, other than yourself"),
|
||||
fields: [],
|
||||
before_load: function(slide) {
|
||||
slide.fields = [];
|
||||
for(var i=1; i<5; i++) {
|
||||
@ -209,9 +176,10 @@ function load_erpnext_slides() {
|
||||
},
|
||||
|
||||
taxes: {
|
||||
app_name: "erpnext",
|
||||
icon: "icon-money",
|
||||
"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."),
|
||||
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."),
|
||||
"fields": [],
|
||||
before_load: function(slide) {
|
||||
slide.fields = [];
|
||||
@ -229,10 +197,11 @@ function load_erpnext_slides() {
|
||||
},
|
||||
|
||||
customers: {
|
||||
app_name: "erpnext",
|
||||
icon: "icon-group",
|
||||
"title": __("Your Customers"),
|
||||
"help": __("List a few of your customers. They could be organizations or individuals."),
|
||||
"fields": [],
|
||||
title: __("Your Customers"),
|
||||
help: __("List a few of your customers. They could be organizations or individuals."),
|
||||
fields: [],
|
||||
before_load: function(slide) {
|
||||
slide.fields = [];
|
||||
for(var i=1; i<6; i++) {
|
||||
@ -251,10 +220,11 @@ function load_erpnext_slides() {
|
||||
},
|
||||
|
||||
suppliers: {
|
||||
app_name: "erpnext",
|
||||
icon: "icon-group",
|
||||
"title": __("Your Suppliers"),
|
||||
"help": __("List a few of your suppliers. They could be organizations or individuals."),
|
||||
"fields": [],
|
||||
title: __("Your Suppliers"),
|
||||
help: __("List a few of your suppliers. They could be organizations or individuals."),
|
||||
fields: [],
|
||||
before_load: function(slide) {
|
||||
slide.fields = [];
|
||||
for(var i=1; i<6; i++) {
|
||||
@ -273,10 +243,11 @@ function load_erpnext_slides() {
|
||||
},
|
||||
|
||||
items: {
|
||||
app_name: "erpnext",
|
||||
icon: "icon-barcode",
|
||||
"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."),
|
||||
"fields": [],
|
||||
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."),
|
||||
fields: [],
|
||||
before_load: function(slide) {
|
||||
slide.fields = [];
|
||||
for(var i=1; i<6; i++) {
|
||||
@ -336,7 +307,6 @@ function load_erpnext_slides() {
|
||||
|
||||
frappe.wiz.on("before_load", function() {
|
||||
load_erpnext_slides();
|
||||
frappe.wiz.add_slide(erpnext.wiz.user);
|
||||
frappe.wiz.add_slide(erpnext.wiz.org);
|
||||
frappe.wiz.add_slide(erpnext.wiz.branding);
|
||||
frappe.wiz.add_slide(erpnext.wiz.users);
|
||||
|
@ -17,7 +17,7 @@ def get_funnel_data(from_date, to_date):
|
||||
and status != "Passive" """, (from_date, to_date))[0][0]
|
||||
|
||||
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]
|
||||
|
||||
quotations = frappe.db.sql("""select count(*) from `tabQuotation`
|
||||
|
@ -16,7 +16,8 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
website = frappe._dict(
|
||||
condition_field = "show_in_website",
|
||||
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):
|
||||
@ -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))
|
||||
|
||||
def get_context(self, context):
|
||||
start = int(frappe.form_dict.start or 0)
|
||||
if start < 0:
|
||||
start = 0
|
||||
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),
|
||||
"title": self.name
|
||||
})
|
||||
@ -63,6 +67,7 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
|
||||
return context
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
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)])
|
||||
|
||||
@ -122,4 +127,4 @@ def invalidate_cache_for(doc, item_group=None):
|
||||
d = frappe.get_doc("Item Group", d.name)
|
||||
route = d.get_route()
|
||||
if route:
|
||||
clear_cache(route)
|
||||
clear_cache(route)
|
@ -12,7 +12,7 @@ def after_install():
|
||||
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
|
||||
set_single_defaults()
|
||||
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_web_forms()
|
||||
frappe.db.commit()
|
||||
|
@ -19,8 +19,7 @@ def setup_complete(args=None):
|
||||
frappe.throw(_("Setup Already Complete!!"))
|
||||
|
||||
install_fixtures.install(args.get("country"))
|
||||
|
||||
update_user_name(args)
|
||||
|
||||
create_fiscal_year_and_company(args)
|
||||
create_users(args)
|
||||
set_defaults(args)
|
||||
@ -54,67 +53,32 @@ def setup_complete(args=None):
|
||||
|
||||
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):
|
||||
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
|
||||
frappe.get_doc({
|
||||
if (args.get('fy_start_date')):
|
||||
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
|
||||
frappe.get_doc({
|
||||
"doctype":"Fiscal Year",
|
||||
'year': curr_fiscal_year,
|
||||
'year_start_date': args.get('fy_start_date'),
|
||||
'year_end_date': args.get('fy_end_date'),
|
||||
}).insert()
|
||||
|
||||
}).insert()
|
||||
args["curr_fiscal_year"] = curr_fiscal_year
|
||||
|
||||
# Company
|
||||
frappe.get_doc({
|
||||
"doctype":"Company",
|
||||
'domain': args.get("industry"),
|
||||
'company_name':args.get('company_name').strip(),
|
||||
'abbr':args.get('company_abbr'),
|
||||
'default_currency':args.get('currency'),
|
||||
'country': args.get('country'),
|
||||
'chart_of_accounts': args.get(('chart_of_accounts')),
|
||||
}).insert()
|
||||
|
||||
# Bank Account
|
||||
create_bank_account(args)
|
||||
|
||||
args["curr_fiscal_year"] = curr_fiscal_year
|
||||
if (args.get('company_name')):
|
||||
frappe.get_doc({
|
||||
"doctype":"Company",
|
||||
'domain': args.get("industry"),
|
||||
'company_name':args.get('company_name').strip(),
|
||||
'abbr':args.get('company_abbr'),
|
||||
'default_currency':args.get('currency'),
|
||||
'country': args.get('country'),
|
||||
'chart_of_accounts': args.get(('chart_of_accounts')),
|
||||
}).insert()
|
||||
|
||||
# Bank Account
|
||||
create_bank_account(args)
|
||||
|
||||
def create_bank_account(args):
|
||||
if args.get("bank_account"):
|
||||
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",
|
||||
"<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():
|
||||
"""create two default territories, one for home country and one named Rest of the World"""
|
||||
from frappe.utils.nestedset import get_root_of
|
||||
|
@ -25,9 +25,14 @@
|
||||
{{ item }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if (items|length)==100 %}
|
||||
<div class="text-muted info">Showing top 100 items.</div>
|
||||
{% endif %}
|
||||
<div class="text-center">
|
||||
{% if frappe.form_dict.start|int > 0 %}
|
||||
<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 %}
|
||||
<div class="text-muted">No items listed.</div>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user