diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 47583251950..10af7b68122 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -264,3 +264,4 @@ erpnext.patches.v7_0.update_party_status erpnext.patches.v7_0.update_item_projected erpnext.patches.v7_0.fix_duplicate_icons erpnext.patches.v7_0.remove_features_setup +erpnext.patches.v7_0.update_home_page \ No newline at end of file diff --git a/erpnext/patches/v7_0/remove_features_setup.py b/erpnext/patches/v7_0/remove_features_setup.py index 2e7f893ae9d..60d19265a06 100644 --- a/erpnext/patches/v7_0/remove_features_setup.py +++ b/erpnext/patches/v7_0/remove_features_setup.py @@ -1,11 +1,13 @@ import frappe from erpnext.setup.install import create_compact_item_print_custom_field +from frappe.utils import cint def execute(): - if not frappe.db.get_value("Features Setup", None, "fs_item_barcode"): - # hide barcode fields - frappe.make_property_setter(dict(fieldname='barcode', property='hidden', value=1)) + frappe.reload_doctype('Stock Settings') + stock_settings = frappe.get_doc('Stock Settings', 'Stock Settings') + stock_settings.show_barcode_field = cint(frappe.db.get_value("Features Setup", None, "fs_item_barcode")) + stock_settings.save() create_compact_item_print_custom_field() diff --git a/erpnext/patches/v7_0/update_home_page.py b/erpnext/patches/v7_0/update_home_page.py new file mode 100644 index 00000000000..d13e28a3052 --- /dev/null +++ b/erpnext/patches/v7_0/update_home_page.py @@ -0,0 +1,18 @@ +import frappe +import erpnext + +def execute(): + website_settings = frappe.get_doc('Website Settings', 'Website Settings') + if frappe.db.exists('Web Page', website_settings.home_page): + header = frappe.db.get_value('Web Page', website_settings.home_page, 'header') + print header + if header and header.startswith("
"): + homepage = frappe.get_doc('Homepage', 'Homepage') + homepage.company = erpnext.get_default_company() + homepage.tagline = header.split('

')[1].split('

')[0] + homepage.setup_items() + homepage.save() + + website_settings.home_page = 'home' + website_settings.save() + diff --git a/erpnext/portal/doctype/homepage/homepage.json b/erpnext/portal/doctype/homepage/homepage.json index c927e31c07d..cbe58c7bf25 100644 --- a/erpnext/portal/doctype/homepage/homepage.json +++ b/erpnext/portal/doctype/homepage/homepage.json @@ -135,7 +135,7 @@ "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0, @@ -151,7 +151,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2016-05-02 18:03:13.165280", + "modified": "2016-05-12 14:19:41.689519", "modified_by": "Administrator", "module": "Portal", "name": "Homepage", diff --git a/erpnext/portal/doctype/homepage/homepage.py b/erpnext/portal/doctype/homepage/homepage.py index 6f55a59e62b..a8172303dae 100644 --- a/erpnext/portal/doctype/homepage/homepage.py +++ b/erpnext/portal/doctype/homepage/homepage.py @@ -7,4 +7,19 @@ import frappe from frappe.model.document import Document class Homepage(Document): - pass + def validate(self): + if not self.products: + self.setup_items() + if not self.description: + self.description = frappe._("This is an example website auto-generated from ERPNext") + + def setup_items(self): + for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'], + filters={'show_in_website': 1}, limit=3): + + # set missing routes (?) + doc = frappe.get_doc('Item', d.name) + doc.save() + self.append('products', dict(item_code=d.name, + item_name=d.item_name, description=d.description, image=d.image)) + diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css index de0b02bb310..6c239c57994 100644 --- a/erpnext/public/css/website.css +++ b/erpnext/public/css/website.css @@ -23,7 +23,8 @@ background-size: cover; background-repeat: no-repeat; background-position: center top; - border-radius: 4px; + border-radius-top: 4px; + border-radius-right: 4px; } .product-image.missing-image { width: 100%; @@ -32,7 +33,8 @@ background-size: cover; background-repeat: no-repeat; background-position: center top; - border-radius: 4px; + border-radius-top: 4px; + border-radius-right: 4px; position: relative; background-color: #EBEFF2; } @@ -124,6 +126,12 @@ border-top: 1px solid #d1d8dd; padding-top: 15px; } +.order-container .tax-grand-total { + display: inline-block; + font-size: 16px; + font-weight: bold; + margin-top: 5px; +} .cart-container { margin: 50px 0px; } @@ -228,7 +236,7 @@ height: 75px; } .product-image-wrapper { - padding-bottom: 30px; + padding-bottom: 40px; } .featured-product-heading, .all-products { diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less index 357bb8a2907..37e3616d35a 100644 --- a/erpnext/public/less/website.less +++ b/erpnext/public/less/website.less @@ -32,7 +32,8 @@ background-size: cover; background-repeat: no-repeat; background-position: center top; - border-radius: 4px; + border-radius-top: 4px; + border-radius-right: 4px; } .product-image.missing-image { @@ -157,6 +158,13 @@ border-top: 1px solid @border-color; padding-top: 15px; } + + .tax-grand-total { + display: inline-block; + font-size: 16px; + font-weight: bold; + margin-top: 5px; + } } .cart-container { @@ -200,7 +208,7 @@ border-top: 1px solid @border-color; padding-top: 15px; } - + .cart-addresses { margin-top: 50px; } @@ -209,43 +217,43 @@ .cart-items .cart-dropdown, .item_name_dropdown { display:none; - + } .cart-dropdown-container { width: 320px; padding: 15px; - + .item-price { display: block !important; padding-bottom: 10px; } - + .cart-item-header { border-bottom: 1px solid #d1d8dd; } - + .cart-items .cart-dropdown { display:block; margin-top:15px; } - + .item_name_dropdown { display:block; } - + .item-description, .cart-items .checkout, .item_name_and_description { display: none; } - + .checkout-btn { padding-top:25px; } .col-name-description { margin-bottom:8px; } - + } .product-list-link { @@ -281,20 +289,20 @@ margin-top: 30px; } -.product-image-img { +.product-image-img { border: 1px solid @light-border-color; border-radius: 3px; } -.product-text { +.product-text { border-top: 1px solid @light-border-color; padding: 15px; word-wrap: break-word; height: 75px; } -.product-image-wrapper { - padding-bottom: 30px; +.product-image-wrapper { + padding-bottom: 40px; } @@ -302,11 +310,11 @@ text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px; - font-weight: 500; + font-weight: 500; } .all-products { - font-weight: 300; + font-weight: 300; padding-left: 25px; padding-right: 25px; padding-top: 10px; diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index d7dae6809af..dc30de14f20 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -74,7 +74,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)]) # base query - query = """select name, item_name, item_code, page_name, website_image, thumbnail, item_group, + query = """select name, item_name, item_code, page_name, image, website_image, thumbnail, item_group, description, web_long_description as website_description, concat(parent_website_route, "/", page_name) as route from `tabItem` diff --git a/erpnext/setup/page/welcome_to_erpnext/welcome_to_erpnext.html b/erpnext/setup/page/welcome_to_erpnext/welcome_to_erpnext.html index fe8a963bc95..cd4d9771c4d 100644 --- a/erpnext/setup/page/welcome_to_erpnext/welcome_to_erpnext.html +++ b/erpnext/setup/page/welcome_to_erpnext/welcome_to_erpnext.html @@ -22,7 +22,7 @@ diff --git a/erpnext/setup/setup_wizard/data/sample_home_page.css b/erpnext/setup/setup_wizard/data/sample_home_page.css deleted file mode 100644 index 723bcb9203c..00000000000 --- a/erpnext/setup/setup_wizard/data/sample_home_page.css +++ /dev/null @@ -1,40 +0,0 @@ -.page-header { - color: white; - background: #263248; - text-align: center; - padding: 80px 0px; -} - -.page-header .page-header-left { - width: 100%; -} - -.page-header h1 { - color: white; -} - -.slide h2 { - margin-bottom: 30px; -} - -.slides { - margin-top: -15px; -} - -.slide { - padding: 30px 40px; - max-width: 800px; - margin: auto; -} - -.container { - max-width: 900px; -} - -.img-wrapper { - text-align: center; - padding: 30px; - background-color: #eee; - border-radius: 5px; - margin-bottom: 15px; -} diff --git a/erpnext/setup/setup_wizard/data/sample_home_page.html b/erpnext/setup/setup_wizard/data/sample_home_page.html deleted file mode 100644 index 990bc1eb296..00000000000 --- a/erpnext/setup/setup_wizard/data/sample_home_page.html +++ /dev/null @@ -1,28 +0,0 @@ -
-
-

{{ _("Awesome Products") }}

-
-
- -
-
-
-

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

-
-
-
-

{{ _("Awesome Services") }}

-
-
- -
-
-
-

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

-
-
-
-

- Explore -

- diff --git a/erpnext/setup/setup_wizard/default_website.py b/erpnext/setup/setup_wizard/default_website.py index e8d4eb43381..d13767648de 100644 --- a/erpnext/setup/setup_wizard/default_website.py +++ b/erpnext/setup/setup_wizard/default_website.py @@ -8,34 +8,27 @@ from frappe import _ from frappe.utils import nowdate class website_maker(object): - def __init__(self, company, tagline, user): - self.company = company - self.tagline = tagline - self.user = user + def __init__(self, args): + self.args = args + self.company = args.company_name + self.tagline = args.company_tagline + self.user = args.name self.make_web_page() self.make_website_settings() self.make_blog() def make_web_page(self): # home page - self.webpage = frappe.get_doc({ - "doctype": "Web Page", - "title": self.company, - "published": 1, - "header": "

{0}

".format(self.tagline or "Headline")+\ - '

'+_("This is an example website auto-generated from ERPNext")+"

"+\ - '

Login

', - "description": self.company + ":" + (self.tagline or ""), - "css": frappe.get_template("setup/setup_wizard/data/sample_home_page.css").render(), - "main_section": frappe.get_template("setup/setup_wizard/data/sample_home_page.html").render({ - "company": self.company, "tagline": (self.tagline or "") - }) - }).insert() + homepage = frappe.get_doc('Homepage', 'Homepage') + homepage.company = self.company + homepage.tag_line = self.tagline + homepage.setup_items() + homepage.save() def make_website_settings(self): # update in home page in settings website_settings = frappe.get_doc("Website Settings", "Website Settings") - website_settings.home_page = self.webpage.name + website_settings.home_page = 'home' website_settings.brand_html = self.company website_settings.copyright = self.company website_settings.top_bar_items = [] @@ -88,5 +81,5 @@ def test(): frappe.delete_doc("Blog Post", "welcome") frappe.delete_doc("Blogger", "administrator") frappe.delete_doc("Blog Category", "general") - website_maker("Test Company", "Better Tools for Everyone", "Administrator") + website_maker({'company':"Test Company", 'company_tagline': "Better Tools for Everyone", 'name': "Administrator"}) frappe.db.commit() diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py index df4afd427b8..8adcf85262a 100644 --- a/erpnext/setup/setup_wizard/domainify.py +++ b/erpnext/setup/setup_wizard/domainify.py @@ -22,7 +22,9 @@ domains = { 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'], 'properties': [ {'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0}, - {'fieldname': 'barcode', 'property': 'hidden', 'value': 1} + ], + 'set_value': [ + ['Stock Settings', 'show_barcode', 0] ] } } diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index a360d4f6898..48766bf0f55 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -35,7 +35,7 @@ def setup_complete(args=None): frappe.local.message_log = [] setup_domain(args.get('domain')) - website_maker(args.company_name.strip(), args.company_tagline, args.name) + website_maker(args) create_logo(args) frappe.db.commit() diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index d403b181962..9e48feda73c 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -144,22 +144,22 @@ class Item(WebsiteGenerator): return # find if website image url exists as public - file = frappe.get_all("File", filters={ + file_doc = frappe.get_all("File", filters={ "file_url": self.website_image }, fields=["name", "is_private"], order_by="is_private asc", limit_page_length=1) - - - if file: - file = file[0] - if not file: + + if file_doc: + file_doc = file_doc[0] + + if not file_doc: if not auto_set_website_image: frappe.msgprint(_("Website Image {0} attached to Item {1} cannot be found") .format(self.website_image, self.name)) self.website_image = None - elif file.is_private: + elif file_doc.is_private: if not auto_set_website_image: frappe.msgprint(_("Website Image should be a public file or website URL")) @@ -508,21 +508,21 @@ class Item(WebsiteGenerator): clear_cache(self.page_name) frappe.db.set_value("Item", newdn, "item_code", newdn) - + if merge: self.set_last_purchase_rate(newdn) self.recalculate_bin_qty(newdn) - + for dt in ("Sales Taxes and Charges", "Purchase Taxes and Charges"): - for d in frappe.db.sql("""select name, item_wise_tax_detail from `tab{0}` + for d in frappe.db.sql("""select name, item_wise_tax_detail from `tab{0}` where ifnull(item_wise_tax_detail, '') != ''""".format(dt), as_dict=1): - + item_wise_tax_detail = json.loads(d.item_wise_tax_detail) if olddn in item_wise_tax_detail: item_wise_tax_detail[newdn] = item_wise_tax_detail[olddn] item_wise_tax_detail.pop(olddn) - - frappe.db.set_value(dt, d.name, "item_wise_tax_detail", + + frappe.db.set_value(dt, d.name, "item_wise_tax_detail", json.dumps(item_wise_tax_detail), update_modified=False) def set_last_purchase_rate(self, newdn): @@ -620,8 +620,8 @@ class Item(WebsiteGenerator): variant = get_variant(self.variant_of, args, self.name) if variant: frappe.throw(_("Item variant {0} exists with same attributes") - .format(variant), ItemVariantExistsError) - + .format(variant), ItemVariantExistsError) + @frappe.whitelist() def get_dashboard_data(name): diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index d56daf56303..4a6e6e919ba 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -2,6 +2,7 @@ "allow_copy": 0, "allow_import": 0, "allow_rename": 0, + "beta": 0, "creation": "2013-06-24 16:37:54", "custom": 0, "description": "Settings", @@ -184,6 +185,32 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "1", + "fieldname": "show_barcode_field", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Show Barcode Field", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -487,7 +514,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2016-04-15 06:51:47.497431", + "modified": "2016-05-12 12:28:29.374452", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", @@ -517,5 +544,6 @@ "quick_entry": 1, "read_only": 0, "read_only_onload": 0, + "sort_order": "ASC", "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py index bd71d461e36..7c67a652d13 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/stock_settings.py @@ -6,11 +6,9 @@ from __future__ import unicode_literals import frappe from frappe import _ -from frappe.utils import cint from frappe.model.document import Document class StockSettings(Document): - def validate(self): for key in ["item_naming_by", "item_group", "stock_uom", "allow_negative_stock"]: frappe.db.set_default(key, self.get(key, "")) @@ -25,4 +23,6 @@ class StockSettings(Document): self.stock_frozen_upto_days = stock_frozen_limit frappe.msgprint (_("`Freeze Stocks Older Than` should be smaller than %d days.") %stock_frozen_limit) - + # show/hide barcode field + frappe.make_property_setter({'fieldname': 'barcode', 'property': 'hidden', + 'value': 0 if self.show_barcode_field else 1}) diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html index e074fa3cfa5..cf6f89bb925 100644 --- a/erpnext/templates/generators/item.html +++ b/erpnext/templates/generators/item.html @@ -20,7 +20,7 @@

{{ item_name }}

- +

{{ _("Item Code") }}: {{ variant and variant.name or name }}


@@ -55,7 +55,7 @@

-
+
- + {% if website_specifications -%}
diff --git a/erpnext/templates/includes/order/order_macros.html b/erpnext/templates/includes/order/order_macros.html index 1bb7b2cb61d..3f8affe142b 100644 --- a/erpnext/templates/includes/order/order_macros.html +++ b/erpnext/templates/includes/order/order_macros.html @@ -9,15 +9,15 @@
{{ d.item_code }} -

{{ d.description }}

+
{{ d.description }}
- +
{{ d.get_formatted('qty') }} {{ product_image_square(d.image) }} -
+
{{ d.item_code }} diff --git a/erpnext/templates/includes/order/order_taxes.html b/erpnext/templates/includes/order/order_taxes.html index 564e31ecf0a..24ae088c75b 100644 --- a/erpnext/templates/includes/order/order_taxes.html +++ b/erpnext/templates/includes/order/order_taxes.html @@ -13,9 +13,9 @@
{% endfor %}
-
{{ _("Grand Total") }}
+
{{ _("Grand Total") }}
- + {{ doc.get_formatted("grand_total") }}
diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html index 2165a0649ef..17f9b90939c 100644 --- a/erpnext/templates/includes/transaction_row.html +++ b/erpnext/templates/includes/transaction_row.html @@ -3,17 +3,17 @@
- {{ doc.name }} + {{ doc.name }}
{{ frappe.utils.format_datetime(doc.modified, "medium") }} -
+
{{ doc.items_preview }}
-
- {{ doc.get_formatted("grand_total") }} +
+ {{ doc.get_formatted("grand_total") }}
- +
{% endif %}
@@ -46,7 +46,7 @@ .btn-login { width: 80px; } - - + + {% endblock %} diff --git a/erpnext/templates/pages/home.py b/erpnext/templates/pages/home.py index e7ff2ce3b41..4440f7e1eae 100644 --- a/erpnext/templates/pages/home.py +++ b/erpnext/templates/pages/home.py @@ -3,19 +3,27 @@ from __future__ import unicode_literals import frappe -from frappe.utils import cstr, nowdate -from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html no_cache = 1 no_sitemap = 1 def get_context(context): homepage = frappe.get_doc('Homepage') - + for item in homepage.products: - item.route = '/' + '/'.join(frappe.db.get_value('Item', item.item_code, ['parent_website_route', 'page_name'])) - - + parent_website_route, page_name = frappe.db.get_value('Item', item.item_code, + ['parent_website_route', 'page_name']) + item.route = '/' + '/'.join(filter(None, [parent_website_route, page_name])) + + # show atleast 3 products + if len(homepage.products) < 3: + for i in xrange(3 - len(homepage.products)): + homepage.append('products', { + 'item_code': 'product-{0}'.format(i), + 'item_name': frappe._('Product {0}').format(i), + 'route': '#' + }) + return { 'homepage': homepage } \ No newline at end of file diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index 98f743139fc..61b4546d8f3 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -59,7 +59,7 @@
{{ d.get_formatted("amount") }}

{{ - _("Rate: {0}").format(d.get_formatted("rate")) }}

+ _("@ {0}").format(d.get_formatted("rate")) }}

{% endfor %}