fix to product, blog
diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py
index d41b262..bec99d4 100644
--- a/erpnext/home/__init__.py
+++ b/erpnext/home/__init__.py
@@ -34,8 +34,8 @@
'Support Ticket': ['[%(status)s] %(subject)s', '#000080'],
# Website
- 'Web Page': ['%(title)s', '#00080'],
- 'Blog': ['%(title)s', '#00080']
+ 'Web Page': ['%(title)s', '#000080'],
+ 'Blog': ['%(title)s', '#000080']
}
def make_feed(feedtype, doctype, name, owner, subject, color):
diff --git a/erpnext/patches/jan_mar_2012/latest/__init__.py b/erpnext/patches/jan_mar_2012/website/__init__.py
similarity index 100%
rename from erpnext/patches/jan_mar_2012/latest/__init__.py
rename to erpnext/patches/jan_mar_2012/website/__init__.py
diff --git a/erpnext/patches/jan_mar_2012/latest/cleanups.py b/erpnext/patches/jan_mar_2012/website/cleanups.py
similarity index 100%
rename from erpnext/patches/jan_mar_2012/latest/cleanups.py
rename to erpnext/patches/jan_mar_2012/website/cleanups.py
diff --git a/erpnext/patches/jan_mar_2012/latest/feed.py b/erpnext/patches/jan_mar_2012/website/feed.py
similarity index 100%
rename from erpnext/patches/jan_mar_2012/latest/feed.py
rename to erpnext/patches/jan_mar_2012/website/feed.py
diff --git a/erpnext/patches/jan_mar_2012/latest/login.py b/erpnext/patches/jan_mar_2012/website/login.py
similarity index 100%
rename from erpnext/patches/jan_mar_2012/latest/login.py
rename to erpnext/patches/jan_mar_2012/website/login.py
diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/website/website.py
similarity index 97%
rename from erpnext/patches/jan_mar_2012/latest/website.py
rename to erpnext/patches/jan_mar_2012/website/website.py
index 9c930e2..4ffb441 100644
--- a/erpnext/patches/jan_mar_2012/latest/website.py
+++ b/erpnext/patches/jan_mar_2012/website/website.py
@@ -12,6 +12,7 @@
delete_doc('Website', 'Module Def', 'Website')
reload_doc('website', 'Module Def', 'Website')
reload_doc('website', 'Role', 'Website Manager')
+ reload_doc('website', 'Role', 'Blogger')
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
d = Document('Module Def Role')
diff --git a/erpnext/website/Role/Blogger/Blogger.txt b/erpnext/website/Role/Blogger/Blogger.txt
new file mode 100644
index 0000000..a380d4c
--- /dev/null
+++ b/erpnext/website/Role/Blogger/Blogger.txt
@@ -0,0 +1,26 @@
+# Role, Blogger
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 12:22:24',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 12:22:24',
+ 'modified_by': u'Administrator',
+ 'owner': u'Administrator'
+ },
+
+ # These values are common for all Role
+ {
+ 'doctype': 'Role',
+ 'module': u'Website',
+ 'name': '__common__',
+ 'role_name': u'Blogger'
+ },
+
+ # Role, Blogger
+ {
+ 'doctype': 'Role',
+ 'name': u'Blogger'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index c0e70a6..c83b922 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -18,6 +18,7 @@
def validate(self):
"""write/update 'Page' with the blog"""
p = website.utils.add_page(self.doc.title)
+ self.doc.name = p.name
from jinja2 import Template
import markdown2
diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt
index 2471c2d..59444f8 100644
--- a/erpnext/website/doctype/blog/blog.txt
+++ b/erpnext/website/doctype/blog/blog.txt
@@ -5,21 +5,23 @@
{
'creation': '2012-01-27 12:24:03',
'docstatus': 0,
- 'modified': '2012-02-07 12:59:01',
+ 'modified': '2012-02-07 13:55:17',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
- '_last_update': u'1327647244',
+ '_last_update': u'1328599743',
+ 'allow_attach': 1,
'colour': u'White:FFF',
'doctype': 'DocType',
+ 'max_attachments': 5,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
- 'version': 2
+ 'version': 3
},
# These values are common for all DocField
@@ -106,5 +108,17 @@
'fieldtype': u'Text',
'label': u'Preview',
'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'file_list',
+ 'fieldtype': u'Text',
+ 'hidden': 1,
+ 'label': u'File List',
+ 'no_copy': 1,
+ 'permlevel': 0,
+ 'print_hide': 1
}
]
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py
index 5880d34..223a790 100644
--- a/erpnext/website/doctype/product/product.py
+++ b/erpnext/website/doctype/product/product.py
@@ -14,6 +14,7 @@
import markdown2
import os
+ self.doc.item_group = webnotes.conn.get_value('Item', self.doc.item, 'item_group')
self.doc.long_description_html = markdown2.markdown(self.doc.long_description or '')
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
@@ -26,14 +27,15 @@
website.utils.add_guest_access_to_page(p.name)
self.doc.page_name = p.name
- del self.doc.fields['long_description_html']
self.make_item_group_active()
+ del self.doc.fields['long_description_html']
+ del self.doc.fields['item_group']
def make_item_group_active(self):
"""show item group in website"""
if self.doc.published:
from webnotes.model.doc import Document
- ig = Document('Item Group', webnotes.conn.get_value('Item', self.doc.item, 'item_group'))
+ ig = Document('Item Group', self.doc.item_group)
ig.show_in_website = 1
ig.save()
diff --git a/erpnext/website/doctype/product/product_page.js b/erpnext/website/doctype/product/product_page.js
index 7d031ef..35359cc 100644
--- a/erpnext/website/doctype/product/product_page.js
+++ b/erpnext/website/doctype/product/product_page.js
@@ -1,6 +1,8 @@
wn.require('erpnext/website/js/product_category.js');
pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
+ wrapper.product_group = "{{ doc.item_group }}";
+ wrapper.product_name = "{{ doc.name }}";
erpnext.make_product_categories(wrapper);
$(wrapper).find('.product-inquiry').click(function() {
loadpage('contact', function() {
@@ -9,5 +11,37 @@
My contact details are:\n\nThank you!\
");
})
- })
+ });
+
+ // similar products
+ wrapper.similar = new wn.widgets.Listing({
+ parent: $(wrapper).find('.similar-products').get(0),
+ hide_refresh: true,
+ page_length: 5,
+ get_query: function() {
+ args = {
+ cat: wrapper.product_group,
+ name: wrapper.product_name
+ };
+ return repl('select t1.name, t1.title, t1.thumbnail_image, \
+ t1.page_name, t1.short_description \
+ from tabProduct t1, tabItem t2 \
+ where t1.item = t2.name \
+ and ifnull(t1.published,0)=1 \
+ and t1.name != "%(name)s" \
+ and t2.item_group="%(cat)s" order by t1.modified desc', args)
+ },
+ render_row: function(parent, data) {
+ if(data.short_description.length > 100) {
+ data.short_description = data.short_description.substr(0,100) + '...';
+ }
+ parent.innerHTML = repl('<div style="float:left; width: 60px;">\
+ <img src="files/%(thumbnail_image)s" style="width:55px;"></div>\
+ <div style="float:left; width: 180px">\
+ <b><a href="#!%(page_name)s">%(title)s</a></b>\
+ <p>%(short_description)s</p></div>\
+ <div style="clear: both; margin-bottom: 15px;"></div>', data);
+ }
+ });
+ wrapper.similar.run();
}
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/template.html b/erpnext/website/doctype/product/template.html
index 8c7f918..926b650 100644
--- a/erpnext/website/doctype/product/template.html
+++ b/erpnext/website/doctype/product/template.html
@@ -22,6 +22,10 @@
</div>
<br>
<h4>More Categories</h4>
+ <div class="more-categories"></div>
+ <br>
+ <h4>Similar Products</h4>
+ <div class="similar-products"></div>
</div>
<div style="clear: both"></div>
</div>
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js
index 5296029..076578a 100644
--- a/erpnext/website/js/product_category.js
+++ b/erpnext/website/js/product_category.js
@@ -3,7 +3,7 @@
erpnext.make_product_categories = function(wrapper) {
wrapper.category_list = new wn.widgets.Listing({
- parent: $(wrapper).find('.web-side-section').get(0),
+ parent: $(wrapper).find('.more-categories').get(0),
query: 'select label, count(t2.name) as items, t1.item_group \
from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\
where t1.parent="Products Settings" \
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
index d12004e..7ca7495 100644
--- a/erpnext/website/page/products/products.html
+++ b/erpnext/website/page/products/products.html
@@ -7,6 +7,7 @@
</div>
<div class="web-side-section">
<h3>Categories</h3>
+ <div class="more-categories"></div>
</div>
<div style="clear:both;">
</div>
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
index 6284d18..b9fa167 100644
--- a/erpnext/website/page/products/products.js
+++ b/erpnext/website/page/products/products.js
@@ -70,7 +70,6 @@
<div style="clear: both; margin-bottom: 15px; border-bottom: 1px solid #AAA"></div>', data);
}
});
-
}
erpnext.products.set_group = function() {
diff --git a/version.num b/version.num
index 4f36264..e24b797 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-360
\ No newline at end of file
+361
\ No newline at end of file
diff --git a/wnf.py b/wnf.py
index 355474f..52308d0 100755
--- a/wnf.py
+++ b/wnf.py
@@ -52,6 +52,8 @@
help="Apply the patches on given db")
parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname",
help="reload doc")
+ parser.add_option('--export_doc', nargs=2, metavar = "doctype docname",
+ help="export doc")
return parser.parse_args()
@@ -121,6 +123,10 @@
{"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]})
print '\n'.join(webnotes.modules.patch_handler.log_list)
+ elif options.export_doc:
+ from webnotes.modules import export_doc
+ export_doc(options.export_doc[0], options.export_doc[1])
+
# run all pending
elif options.run_latest:
webnotes.modules.patch_handler.run_all()