[cleanup] homepage
This commit is contained in:
parent
825070e504
commit
4b9238a03b
@ -264,3 +264,4 @@ erpnext.patches.v7_0.update_party_status
|
|||||||
erpnext.patches.v7_0.update_item_projected
|
erpnext.patches.v7_0.update_item_projected
|
||||||
erpnext.patches.v7_0.fix_duplicate_icons
|
erpnext.patches.v7_0.fix_duplicate_icons
|
||||||
erpnext.patches.v7_0.remove_features_setup
|
erpnext.patches.v7_0.remove_features_setup
|
||||||
|
erpnext.patches.v7_0.update_home_page
|
@ -1,11 +1,13 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from erpnext.setup.install import create_compact_item_print_custom_field
|
from erpnext.setup.install import create_compact_item_print_custom_field
|
||||||
|
from frappe.utils import cint
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
if not frappe.db.get_value("Features Setup", None, "fs_item_barcode"):
|
frappe.reload_doctype('Stock Settings')
|
||||||
# hide barcode fields
|
stock_settings = frappe.get_doc('Stock Settings', 'Stock Settings')
|
||||||
frappe.make_property_setter(dict(fieldname='barcode', property='hidden', value=1))
|
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()
|
create_compact_item_print_custom_field()
|
||||||
|
|
||||||
|
18
erpnext/patches/v7_0/update_home_page.py
Normal file
18
erpnext/patches/v7_0/update_home_page.py
Normal file
@ -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("<div class='hero text-center'>"):
|
||||||
|
homepage = frappe.get_doc('Homepage', 'Homepage')
|
||||||
|
homepage.company = erpnext.get_default_company()
|
||||||
|
homepage.tagline = header.split('<h1>')[1].split('</h1>')[0]
|
||||||
|
homepage.setup_items()
|
||||||
|
homepage.save()
|
||||||
|
|
||||||
|
website_settings.home_page = 'home'
|
||||||
|
website_settings.save()
|
||||||
|
|
@ -135,7 +135,7 @@
|
|||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0,
|
"unique": 0,
|
||||||
@ -151,7 +151,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-05-02 18:03:13.165280",
|
"modified": "2016-05-12 14:19:41.689519",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Portal",
|
"module": "Portal",
|
||||||
"name": "Homepage",
|
"name": "Homepage",
|
||||||
|
@ -7,4 +7,19 @@ import frappe
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class Homepage(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))
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center top;
|
background-position: center top;
|
||||||
border-radius: 4px;
|
border-radius-top: 4px;
|
||||||
|
border-radius-right: 4px;
|
||||||
}
|
}
|
||||||
.product-image.missing-image {
|
.product-image.missing-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -32,7 +33,8 @@
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center top;
|
background-position: center top;
|
||||||
border-radius: 4px;
|
border-radius-top: 4px;
|
||||||
|
border-radius-right: 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
background-color: #EBEFF2;
|
background-color: #EBEFF2;
|
||||||
}
|
}
|
||||||
@ -124,6 +126,12 @@
|
|||||||
border-top: 1px solid #d1d8dd;
|
border-top: 1px solid #d1d8dd;
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
.order-container .tax-grand-total {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
.cart-container {
|
.cart-container {
|
||||||
margin: 50px 0px;
|
margin: 50px 0px;
|
||||||
}
|
}
|
||||||
@ -228,7 +236,7 @@
|
|||||||
height: 75px;
|
height: 75px;
|
||||||
}
|
}
|
||||||
.product-image-wrapper {
|
.product-image-wrapper {
|
||||||
padding-bottom: 30px;
|
padding-bottom: 40px;
|
||||||
}
|
}
|
||||||
.featured-product-heading,
|
.featured-product-heading,
|
||||||
.all-products {
|
.all-products {
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center top;
|
background-position: center top;
|
||||||
border-radius: 4px;
|
border-radius-top: 4px;
|
||||||
|
border-radius-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-image.missing-image {
|
.product-image.missing-image {
|
||||||
@ -157,6 +158,13 @@
|
|||||||
border-top: 1px solid @border-color;
|
border-top: 1px solid @border-color;
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tax-grand-total {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-container {
|
.cart-container {
|
||||||
@ -200,7 +208,7 @@
|
|||||||
border-top: 1px solid @border-color;
|
border-top: 1px solid @border-color;
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-addresses {
|
.cart-addresses {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
}
|
}
|
||||||
@ -209,43 +217,43 @@
|
|||||||
.cart-items .cart-dropdown,
|
.cart-items .cart-dropdown,
|
||||||
.item_name_dropdown {
|
.item_name_dropdown {
|
||||||
display:none;
|
display:none;
|
||||||
|
|
||||||
}
|
}
|
||||||
.cart-dropdown-container {
|
.cart-dropdown-container {
|
||||||
width: 320px;
|
width: 320px;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|
||||||
.item-price {
|
.item-price {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-item-header {
|
.cart-item-header {
|
||||||
border-bottom: 1px solid #d1d8dd;
|
border-bottom: 1px solid #d1d8dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-items .cart-dropdown {
|
.cart-items .cart-dropdown {
|
||||||
display:block;
|
display:block;
|
||||||
margin-top:15px;
|
margin-top:15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item_name_dropdown {
|
.item_name_dropdown {
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-description,
|
.item-description,
|
||||||
.cart-items .checkout,
|
.cart-items .checkout,
|
||||||
.item_name_and_description {
|
.item_name_and_description {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkout-btn {
|
.checkout-btn {
|
||||||
padding-top:25px;
|
padding-top:25px;
|
||||||
}
|
}
|
||||||
.col-name-description {
|
.col-name-description {
|
||||||
margin-bottom:8px;
|
margin-bottom:8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-list-link {
|
.product-list-link {
|
||||||
@ -281,20 +289,20 @@
|
|||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-image-img {
|
.product-image-img {
|
||||||
border: 1px solid @light-border-color;
|
border: 1px solid @light-border-color;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-text {
|
.product-text {
|
||||||
border-top: 1px solid @light-border-color;
|
border-top: 1px solid @light-border-color;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
height: 75px;
|
height: 75px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-image-wrapper {
|
.product-image-wrapper {
|
||||||
padding-bottom: 30px;
|
padding-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -302,11 +310,11 @@
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.all-products {
|
.all-products {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
padding-left: 25px;
|
padding-left: 25px;
|
||||||
padding-right: 25px;
|
padding-right: 25px;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
|
@ -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)])
|
child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)])
|
||||||
|
|
||||||
# base query
|
# 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,
|
description, web_long_description as website_description,
|
||||||
concat(parent_website_route, "/", page_name) as route
|
concat(parent_website_route, "/", page_name) as route
|
||||||
from `tabItem`
|
from `tabItem`
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li><a class="text-muted" href="#">{%= __("Go to the Desktop and start using ERPNext") %}</a></li>
|
<li><a class="text-muted" href="#">{%= __("Go to the Desktop and start using ERPNext") %}</a></li>
|
||||||
<li><a class="text-muted" href="#modules/Learn">{%= __("View a list of all the help videos") %}</a></li>
|
<li><a class="text-muted" href="#modules/Learn">{%= __("View a list of all the help videos") %}</a></li>
|
||||||
<li><a class="text-muted" href="https://manual.erpnext.com" target="_blank">{%= __("Read the ERPNext Manual") %}</a></li>
|
<li><a class="text-muted" href="https://frappe.github.io/erpnext/user" target="_blank">{%= __("Read the ERPNext Manual") %}</a></li>
|
||||||
<li><a class="text-muted" href="https://discuss.erpnext.com" target="_blank">{%= __("Community Forum") %}</a></li>
|
<li><a class="text-muted" href="https://discuss.erpnext.com" target="_blank">{%= __("Community Forum") %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<div class="slides">
|
|
||||||
<div class="row slide">
|
|
||||||
<h2 class="text-center">{{ _("Awesome Products") }}</h2>
|
|
||||||
<div class="col-md-6 text-center">
|
|
||||||
<div class="img-wrapper">
|
|
||||||
<i class="icon-wrench text-muted" style="font-size: 100px;"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<p>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.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row slide alt">
|
|
||||||
<h2 class="text-center">{{ _("Awesome Services") }}</h2>
|
|
||||||
<div class="col-md-6 text-center">
|
|
||||||
<div class="img-wrapper">
|
|
||||||
<i class="icon-phone text-muted" style="font-size: 100px;"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<p>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.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p class="text-center" style="margin-bottom: 50px;">
|
|
||||||
<a href="/products" class="btn btn-success">Explore <i class="icon-chevron-right"></i></a>
|
|
||||||
</p>
|
|
||||||
<!-- no-sidebar -->
|
|
@ -8,34 +8,27 @@ from frappe import _
|
|||||||
from frappe.utils import nowdate
|
from frappe.utils import nowdate
|
||||||
|
|
||||||
class website_maker(object):
|
class website_maker(object):
|
||||||
def __init__(self, company, tagline, user):
|
def __init__(self, args):
|
||||||
self.company = company
|
self.args = args
|
||||||
self.tagline = tagline
|
self.company = args.company_name
|
||||||
self.user = user
|
self.tagline = args.company_tagline
|
||||||
|
self.user = args.name
|
||||||
self.make_web_page()
|
self.make_web_page()
|
||||||
self.make_website_settings()
|
self.make_website_settings()
|
||||||
self.make_blog()
|
self.make_blog()
|
||||||
|
|
||||||
def make_web_page(self):
|
def make_web_page(self):
|
||||||
# home page
|
# home page
|
||||||
self.webpage = frappe.get_doc({
|
homepage = frappe.get_doc('Homepage', 'Homepage')
|
||||||
"doctype": "Web Page",
|
homepage.company = self.company
|
||||||
"title": self.company,
|
homepage.tag_line = self.tagline
|
||||||
"published": 1,
|
homepage.setup_items()
|
||||||
"header": "<div class='hero text-center'><h1>{0}</h1>".format(self.tagline or "Headline")+\
|
homepage.save()
|
||||||
'<p>'+_("This is an example website auto-generated from ERPNext")+"</p>"+\
|
|
||||||
'<p><a class="btn btn-primary" href="/login">Login</a></p></div>',
|
|
||||||
"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()
|
|
||||||
|
|
||||||
def make_website_settings(self):
|
def make_website_settings(self):
|
||||||
# update in home page in settings
|
# update in home page in settings
|
||||||
website_settings = frappe.get_doc("Website Settings", "Website 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.brand_html = self.company
|
||||||
website_settings.copyright = self.company
|
website_settings.copyright = self.company
|
||||||
website_settings.top_bar_items = []
|
website_settings.top_bar_items = []
|
||||||
@ -88,5 +81,5 @@ def test():
|
|||||||
frappe.delete_doc("Blog Post", "welcome")
|
frappe.delete_doc("Blog Post", "welcome")
|
||||||
frappe.delete_doc("Blogger", "administrator")
|
frappe.delete_doc("Blogger", "administrator")
|
||||||
frappe.delete_doc("Blog Category", "general")
|
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()
|
frappe.db.commit()
|
||||||
|
@ -22,7 +22,9 @@ domains = {
|
|||||||
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
|
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Maintenance User'],
|
||||||
'properties': [
|
'properties': [
|
||||||
{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
|
{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
|
||||||
{'fieldname': 'barcode', 'property': 'hidden', 'value': 1}
|
],
|
||||||
|
'set_value': [
|
||||||
|
['Stock Settings', 'show_barcode', 0]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ def setup_complete(args=None):
|
|||||||
frappe.local.message_log = []
|
frappe.local.message_log = []
|
||||||
setup_domain(args.get('domain'))
|
setup_domain(args.get('domain'))
|
||||||
|
|
||||||
website_maker(args.company_name.strip(), args.company_tagline, args.name)
|
website_maker(args)
|
||||||
create_logo(args)
|
create_logo(args)
|
||||||
|
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
@ -144,22 +144,22 @@ class Item(WebsiteGenerator):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# find if website image url exists as public
|
# 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
|
"file_url": self.website_image
|
||||||
}, fields=["name", "is_private"], order_by="is_private asc", limit_page_length=1)
|
}, 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:
|
if not auto_set_website_image:
|
||||||
frappe.msgprint(_("Website Image {0} attached to Item {1} cannot be found")
|
frappe.msgprint(_("Website Image {0} attached to Item {1} cannot be found")
|
||||||
.format(self.website_image, self.name))
|
.format(self.website_image, self.name))
|
||||||
|
|
||||||
self.website_image = None
|
self.website_image = None
|
||||||
|
|
||||||
elif file.is_private:
|
elif file_doc.is_private:
|
||||||
if not auto_set_website_image:
|
if not auto_set_website_image:
|
||||||
frappe.msgprint(_("Website Image should be a public file or website URL"))
|
frappe.msgprint(_("Website Image should be a public file or website URL"))
|
||||||
|
|
||||||
@ -508,21 +508,21 @@ class Item(WebsiteGenerator):
|
|||||||
clear_cache(self.page_name)
|
clear_cache(self.page_name)
|
||||||
|
|
||||||
frappe.db.set_value("Item", newdn, "item_code", newdn)
|
frappe.db.set_value("Item", newdn, "item_code", newdn)
|
||||||
|
|
||||||
if merge:
|
if merge:
|
||||||
self.set_last_purchase_rate(newdn)
|
self.set_last_purchase_rate(newdn)
|
||||||
self.recalculate_bin_qty(newdn)
|
self.recalculate_bin_qty(newdn)
|
||||||
|
|
||||||
for dt in ("Sales Taxes and Charges", "Purchase Taxes and Charges"):
|
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):
|
where ifnull(item_wise_tax_detail, '') != ''""".format(dt), as_dict=1):
|
||||||
|
|
||||||
item_wise_tax_detail = json.loads(d.item_wise_tax_detail)
|
item_wise_tax_detail = json.loads(d.item_wise_tax_detail)
|
||||||
if olddn in 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[newdn] = item_wise_tax_detail[olddn]
|
||||||
item_wise_tax_detail.pop(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)
|
json.dumps(item_wise_tax_detail), update_modified=False)
|
||||||
|
|
||||||
def set_last_purchase_rate(self, newdn):
|
def set_last_purchase_rate(self, newdn):
|
||||||
@ -620,8 +620,8 @@ class Item(WebsiteGenerator):
|
|||||||
variant = get_variant(self.variant_of, args, self.name)
|
variant = get_variant(self.variant_of, args, self.name)
|
||||||
if variant:
|
if variant:
|
||||||
frappe.throw(_("Item variant {0} exists with same attributes")
|
frappe.throw(_("Item variant {0} exists with same attributes")
|
||||||
.format(variant), ItemVariantExistsError)
|
.format(variant), ItemVariantExistsError)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_dashboard_data(name):
|
def get_dashboard_data(name):
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
|
"beta": 0,
|
||||||
"creation": "2013-06-24 16:37:54",
|
"creation": "2013-06-24 16:37:54",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"description": "Settings",
|
"description": "Settings",
|
||||||
@ -184,6 +185,32 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 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,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -487,7 +514,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-04-15 06:51:47.497431",
|
"modified": "2016-05-12 12:28:29.374452",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Settings",
|
"name": "Stock Settings",
|
||||||
@ -517,5 +544,6 @@
|
|||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0,
|
"read_only_onload": 0,
|
||||||
|
"sort_order": "ASC",
|
||||||
"track_seen": 0
|
"track_seen": 0
|
||||||
}
|
}
|
@ -6,11 +6,9 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cint
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class StockSettings(Document):
|
class StockSettings(Document):
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
for key in ["item_naming_by", "item_group", "stock_uom", "allow_negative_stock"]:
|
for key in ["item_naming_by", "item_group", "stock_uom", "allow_negative_stock"]:
|
||||||
frappe.db.set_default(key, self.get(key, ""))
|
frappe.db.set_default(key, self.get(key, ""))
|
||||||
@ -25,4 +23,6 @@ class StockSettings(Document):
|
|||||||
self.stock_frozen_upto_days = stock_frozen_limit
|
self.stock_frozen_upto_days = stock_frozen_limit
|
||||||
frappe.msgprint (_("`Freeze Stocks Older Than` should be smaller than %d 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})
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6" style="padding-left:20px;">
|
<div class="col-sm-6" style="padding-left:20px;">
|
||||||
<h2 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h2>
|
<h2 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h2>
|
||||||
|
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
{{ _("Item Code") }}: <span itemprop="productID">{{ variant and variant.name or name }}</span></p>
|
{{ _("Item Code") }}: <span itemprop="productID">{{ variant and variant.name or name }}</span></p>
|
||||||
<br>
|
<br>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
||||||
<h4 class="item-price" itemprop="price"></h4>
|
<h4 class="item-price" itemprop="price"></h4>
|
||||||
<div class="item-stock" itemprop="availability"></div>
|
<div class="item-stock" itemprop="availability"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-cart hide">
|
<div class="item-cart hide">
|
||||||
<div id="item-add-to-cart">
|
<div id="item-add-to-cart">
|
||||||
<button class="btn btn-primary btn-sm">
|
<button class="btn btn-primary btn-sm">
|
||||||
@ -79,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if website_specifications -%}
|
{% if website_specifications -%}
|
||||||
<div class="row item-website-specification" style="margin-top: 40px">
|
<div class="row item-website-specification" style="margin-top: 40px">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
@ -9,15 +9,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-xs-8 col-sm-10">
|
<div class="col-xs-8 col-sm-10">
|
||||||
{{ d.item_code }}
|
{{ d.item_code }}
|
||||||
<p class="text-muted small item-description">{{ d.description }}</p>
|
<div class="text-muted small item-description">{{ d.description }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row item_name_dropdown">
|
<div class="row item_name_dropdown">
|
||||||
<div class="col-xs-4 col-sm-4 order-image-col">
|
<div class="col-xs-4 col-sm-4 order-image-col">
|
||||||
<div class="order-image">
|
<div class="order-image">
|
||||||
<span class="cart-count-badge pull-right small"> {{ d.get_formatted('qty') }} </span>{{ product_image_square(d.image) }}
|
<span class="cart-count-badge pull-right small"> {{ d.get_formatted('qty') }} </span>{{ product_image_square(d.image) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-8 col-sm-8">
|
<div class="col-xs-8 col-sm-8">
|
||||||
{{ d.item_code }}
|
{{ d.item_code }}
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="row tax-grand-total-row">
|
<div class="row tax-grand-total-row">
|
||||||
<div class="col-xs-8 text-right">{{ _("Grand Total") }}</div>
|
<div class="col-xs-8 text-right text-uppercase h6 text-muted">{{ _("Grand Total") }}</div>
|
||||||
<div class="col-xs-4 text-right">
|
<div class="col-xs-4 text-right">
|
||||||
<span class="tax-grand-total">
|
<span class="tax-grand-total bold">
|
||||||
{{ doc.get_formatted("grand_total") }}
|
{{ doc.get_formatted("grand_total") }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<span class="indicator small {{ doc.indicator_color or "darkgrey" }}">
|
<span class="indicator small {{ doc.indicator_color or "darkgrey" }}">
|
||||||
{{ doc.name }}</span>
|
{{ doc.name }}</span>
|
||||||
<div class="small text-muted transaction-time"
|
<div class="small text-muted transaction-time"
|
||||||
title="{{ frappe.utils.format_datetime(doc.modified, "medium") }}">
|
title="{{ frappe.utils.format_datetime(doc.modified, "medium") }}">
|
||||||
{{ frappe.utils.format_datetime(doc.modified, "medium") }}
|
{{ frappe.utils.format_datetime(doc.modified, "medium") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 items-preview text-ellipsis">
|
<div class="col-sm-4 items-preview text-ellipsis">
|
||||||
{{ doc.items_preview }}
|
{{ doc.items_preview }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3 text-right">
|
<div class="col-sm-3 text-right bold">
|
||||||
{{ doc.get_formatted("grand_total") }}
|
{{ doc.get_formatted("grand_total") }}
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-sm-3 text-right">
|
<!-- <div class="col-sm-3 text-right">
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO: remove hardcoding of /products -->
|
<!-- TODO: remove hardcoding of /products -->
|
||||||
<div class=" text-center text-uppercase"><a href="/products" class="btn btn-primary all-products"> {{ _("View All Products") }}</a></div>
|
<div class="text-center"><a href="/products" class="btn btn-primary all-products"> {{ _("View All Products") }}</a></div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
.btn-login {
|
.btn-login {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -3,19 +3,27 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
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_cache = 1
|
||||||
no_sitemap = 1
|
no_sitemap = 1
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
homepage = frappe.get_doc('Homepage')
|
homepage = frappe.get_doc('Homepage')
|
||||||
|
|
||||||
for item in homepage.products:
|
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 {
|
return {
|
||||||
'homepage': homepage
|
'homepage': homepage
|
||||||
}
|
}
|
@ -59,7 +59,7 @@
|
|||||||
<div class="col-sm-2 col-xs-3 text-right">
|
<div class="col-sm-2 col-xs-3 text-right">
|
||||||
{{ d.get_formatted("amount") }}
|
{{ d.get_formatted("amount") }}
|
||||||
<p class="text-muted small">{{
|
<p class="text-muted small">{{
|
||||||
_("Rate: {0}").format(d.get_formatted("rate")) }}</p>
|
_("@ {0}").format(d.get_formatted("rate")) }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user