diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 7d858a9dc4..dc17071308 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -482,6 +482,9 @@ class DocType(TransactionBase): def on_submit(self): + purchase_controller = webnotes.get_obj("Purchase Common") + purchase_controller.is_item_table_empty(self) + self.check_prev_docstatus() # Check for Approving Authority @@ -492,8 +495,7 @@ class DocType(TransactionBase): self.make_gl_entries() self.update_against_document_in_jv() - - get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 1) + purchase_controller.update_prevdoc_detail(self, is_submit = 1) def make_gl_entries(self, is_cancel = 0): diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index f4cfc299d6..519905a010 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -280,21 +280,8 @@ cur_frm.cscript.import_ref_rate = function(doc, cdt, cdn) { cur_frm.cscript.calc_amount(doc, 5); } -//==================== check if item table is blank ============================================== -var is_item_table = function(doc,cdt,cdn) { - // Step 1 :=>Get all childrens/ rows from Detail Table - var cl = getchildren(tname, doc.name, fname); - // Step 2 :=> If there are no rows then set validated = false, this will stop further execution of code. - if (cl.length == 0) { - alert("There is no item in table"); validated = false; - } -} - //==================== Validate ==================================================================== cur_frm.cscript.validate = function(doc, cdt, cdn) { - // Step 1:=> check if item table is blank - is_item_table(doc,cdt,cdn); - // Step 2:=> Calculate Amount cur_frm.cscript.calc_amount(doc, 1); // calculate advances if pv diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index e8b725ed92..bb342287e4 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -22,14 +22,14 @@ from webnotes.model import db_exists from webnotes.model.doc import Document, addchild from webnotes.model.wrapper import getlist, copy_doclist from webnotes.model.code import get_obj -from webnotes import form, msgprint +from webnotes import form, msgprint, _ sql = webnotes.conn.sql from utilities.transaction_base import TransactionBase class DocType(TransactionBase): - def __init__(self, doc, doclist=[]): + def __init__(self, doc, doclist=None): self.doc = doc self.doclist = doclist @@ -64,6 +64,11 @@ class DocType(TransactionBase): self.msg = [] + def is_item_table_empty(self, obj): + if not len(obj.doclist.get({"parentfield": obj.fname})): + msgprint(_("Hey there! You need to put at least one item in \ + the item table."), raise_exception=True) + def get_default_schedule_date( self, obj): for d in getlist( obj.doclist, obj.fname): diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py index 812f59c740..85a11ed813 100644 --- a/buying/doctype/purchase_order/purchase_order.py +++ b/buying/doctype/purchase_order/purchase_order.py @@ -220,10 +220,11 @@ class DocType(TransactionBase): # On Submit def on_submit(self): - pc_obj = get_obj(dt ='Purchase Common') + purchase_controller = webnotes.get_obj("Purchase Common") + purchase_controller.is_item_table_empty(self) # Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly - pc_obj.update_prevdoc_detail(self, is_submit = 1) + purchase_controller.update_prevdoc_detail(self, is_submit = 1) # Step 2 :=> Update Bin self.update_bin(is_submit = 1, is_stopped = 0) @@ -236,7 +237,7 @@ class DocType(TransactionBase): "last_purchase_order", self.doc.name) # Step 5 :=> Update last purchase rate - pc_obj.update_last_purchase_rate(self, is_submit = 1) + purchase_controller.update_last_purchase_rate(self, is_submit = 1) # Step 6 :=> Set Status webnotes.conn.set(self.doc,'status','Submitted') diff --git a/buying/doctype/purchase_request/purchase_request.js b/buying/doctype/purchase_request/purchase_request.js index 510762a0f2..f46518f0bf 100644 --- a/buying/doctype/purchase_request/purchase_request.js +++ b/buying/doctype/purchase_request/purchase_request.js @@ -50,22 +50,19 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { erpnext.hide_naming_series(); if(doc.docstatus == 1 && doc.status != 'Stopped'){ + cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation); if(flt(doc.per_ordered, 2) < 100) { cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']); cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']); } cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); - cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation); + } if(doc.docstatus == 1 && doc.status == 'Stopped') cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request']) } -//======================= validation =================================== -cur_frm.cscript.validate = function(doc,cdt,cdn){ - is_item_table(doc,cdt,cdn); -} //======================= transaction date ============================= cur_frm.cscript.transaction_date = function(doc,cdt,cdn){ if(doc.__islocal){ diff --git a/buying/doctype/purchase_request/purchase_request.py b/buying/doctype/purchase_request/purchase_request.py index 7d0e08e440..3f7f932c25 100644 --- a/buying/doctype/purchase_request/purchase_request.py +++ b/buying/doctype/purchase_request/purchase_request.py @@ -178,6 +178,9 @@ class DocType: get_obj('Warehouse', d.warehouse).update_bin(args) def on_submit(self): + purchase_controller = webnotes.get_obj("Purchase Common") + purchase_controller.is_item_table_empty(self) + webnotes.conn.set(self.doc,'status','Submitted') self.update_bin(is_submit = 1, is_stopped = 0) diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js index e527dbee23..3834bda92c 100644 --- a/buying/doctype/supplier/supplier.js +++ b/buying/doctype/supplier/supplier.js @@ -17,17 +17,7 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); cur_frm.cscript.onload = function(doc,dt,dn){ - - // history doctypes and scripts - cur_frm.history_dict = { - 'Purchase Order' : 'cur_frm.cscript.make_po_list(this.body, this.doc)', - 'Purchase Receipt' : 'cur_frm.cscript.make_pr_list(this.body, this.doc)', - 'Purchase Invoice' : 'cur_frm.cscript.make_pi_list(this.body, this.doc)' - } - // make contact, history list body - //cur_frm.cscript.make_cl_body(); - cur_frm.cscript.make_hl_body(); } cur_frm.cscript.refresh = function(doc,dt,dn) { @@ -44,7 +34,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) { // make lists cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn); - cur_frm.cscript.make_history(doc,dt,dn); cur_frm.communication_view = new wn.views.CommunicationList({ list: wn.model.get("Communication", {"supplier": doc.name}), @@ -60,6 +49,19 @@ cur_frm.cscript.make_address = function() { parent: cur_frm.fields_dict['address_html'].wrapper, page_length: 2, new_doctype: "Address", + custom_new_doc: function(doctype) { + var address = wn.model.make_new_doc_and_get_name('Address'); + address = locals['Address'][address]; + address.supplier = cur_frm.doc.name; + address.supplier_name = cur_frm.doc.supplier_name; + address.address_title = cur_frm.doc.supplier_name; + + if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) { + address.address_type = "Office"; + } + + wn.set_route("Form", "Address", address.name); + }, get_query: function() { return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc" }, @@ -95,94 +97,4 @@ cur_frm.cscript.make_contact = function() { // note: render_contact_row is defined in contact_control.js } cur_frm.contact_list.run(); -} - - -// Transaction History - -cur_frm.cscript.make_po_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tabPurchase Order`.status", - "`tabPurchase Order`.currency", - "ifnull(`tabPurchase Order`.grand_total_import, 0) as grand_total_import", - - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '20%', content: 'name'}, - {width: '30%', content: 'status', - css: {'text-align': 'right', 'color': '#777'}}, - {width: '35%', content: 'grand_total_import', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Purchase Order', parent, ListView); -} - -cur_frm.cscript.make_pr_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tabPurchase Receipt`.status", - "`tabPurchase Receipt`.currency", - "ifnull(`tabPurchase Receipt`.grand_total_import, 0) as grand_total_import", - "ifnull(`tabPurchase Receipt`.per_billed, 0) as per_billed", - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '20%', content: 'name'}, - {width: '20%', content: 'status', - css: {'text-align': 'right', 'color': '#777'}}, - {width: '35%', content: 'grand_total_import', css: {'text-align': 'right'}}, - {width: '10%', content: 'per_billed', type: 'bar-graph', label: 'Billed'}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Purchase Receipt', parent, ListView); -} - -cur_frm.cscript.make_pi_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tabPurchase Invoice`.currency", - "ifnull(`tabPurchase Invoice`.grand_total_import, 0) as grand_total_import", - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '30%', content: 'name'}, - {width: '55%', content: 'grand_total_import', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Purchase Invoice', parent, ListView); } \ No newline at end of file diff --git a/buying/doctype/supplier/supplier.txt b/buying/doctype/supplier/supplier.txt index 318316e646..b1ab5b4fdc 100644 --- a/buying/doctype/supplier/supplier.txt +++ b/buying/doctype/supplier/supplier.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-12-03 10:31:02", + "creation": "2012-12-07 15:15:23", "modified_by": "Administrator", - "modified": "2012-12-03 17:10:41" + "modified": "2012-12-27 14:02:18" }, { "autoname": "naming_series:", @@ -38,7 +38,6 @@ { "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Basic Info", "fieldname": "basic_info", @@ -95,7 +94,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Address Desc", "options": "Addresses will appear only when you save the supplier", @@ -104,7 +102,6 @@ "permlevel": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Address HTML", "fieldname": "address_html", @@ -120,7 +117,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Desc", "options": "Contact Details will appear only when you save the supplier", @@ -159,7 +155,6 @@ { "description": "Enter the company name under which Account Head will be created for this Supplier", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Company", "oldfieldname": "company", @@ -174,7 +169,6 @@ { "description": "This currency will get fetched in Purchase transactions of this supplier", "no_copy": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Default Currency", "options": "link:Currency", @@ -185,7 +179,6 @@ { "description": "Statutory info and other general information about your Supplier", "oldfieldtype": "Code", - "colour": "White:FFF", "doctype": "DocField", "label": "Supplier Details", "oldfieldname": "supplier_details", @@ -216,35 +209,6 @@ "fieldtype": "Data", "permlevel": 0 }, - { - "oldfieldtype": "Section Break", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Transaction History", - "fieldname": "transaction_history", - "fieldtype": "Section Break", - "depends_on": "eval:!doc.__islocal", - "permlevel": 0 - }, - { - "oldfieldtype": "HTML", - "colour": "White:FFF", - "doctype": "DocField", - "label": "History HTML", - "fieldname": "history_html", - "fieldtype": "HTML", - "depends_on": "eval:!doc.__islocal", - "permlevel": 0 - }, - { - "oldfieldtype": "Small Text", - "doctype": "DocField", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "permlevel": 1 - }, { "amend": 0, "create": 0, diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py index e5861e5389..cac4bab5f3 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/buying/doctype/supplier_quotation/supplier_quotation.py @@ -36,6 +36,9 @@ class DocType(TransactionBase): self.doc.status = "Draft" def on_submit(self): + purchase_controller = webnotes.get_obj("Purchase Common") + purchase_controller.is_item_table_empty(self) + webnotes.conn.set(self.doc, "status", "Submitted") def on_cancel(self): diff --git a/home/__init__.py b/home/__init__.py index 436e8eca20..e508ac70fb 100644 --- a/home/__init__.py +++ b/home/__init__.py @@ -21,6 +21,7 @@ from webnotes import msgprint feed_dict = { # Project 'Project': ['[%(status)s]', '#000080'], + 'Task': ['[%(status)s] %(subject)s', '#000080'], # Sales 'Lead': ['%(lead_name)s', '#000080'], @@ -81,8 +82,9 @@ def make_feed(feedtype, doctype, name, owner, subject, color): f.full_name = get_fullname(owner) f.save() -def update_feed(doc, method=None): +def update_feed(controller, method=None): "adds a new feed" + doc = controller.doc if method in ['on_update', 'on_submit']: subject, color = feed_dict.get(doc.doctype, [None, None]) if subject: diff --git a/hr/doctype/employee/employee.txt b/hr/doctype/employee/employee.txt index 826df842d2..0c48287afd 100644 --- a/hr/doctype/employee/employee.txt +++ b/hr/doctype/employee/employee.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-11-30 11:49:12", + "creation": "2012-12-03 10:13:46", "modified_by": "Administrator", - "modified": "2012-11-30 11:54:31" + "modified": "2012-12-27 14:45:31" }, { "autoname": "naming_series:", @@ -51,10 +51,17 @@ "fieldtype": "Column Break", "permlevel": 0 }, + { + "doctype": "DocField", + "label": "Image View", + "options": "image", + "fieldname": "image_view", + "fieldtype": "Image", + "permlevel": 0 + }, { "print_hide": 1, "no_copy": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Employee", "fieldname": "employee", @@ -67,32 +74,28 @@ "description": "To setup, please go to Setup > Naming Series", "no_copy": 1, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Naming Series", "oldfieldname": "naming_series", - "permlevel": 0, + "options": "EMP/", "fieldname": "naming_series", "fieldtype": "Select", "reqd": 0, - "options": "EMP/" + "permlevel": 0 }, { "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Salutation", "oldfieldname": "salutation", - "trigger": "Client", + "options": "\nMr\nMs", "fieldname": "salutation", "fieldtype": "Select", "search_index": 0, - "options": "\nMr\nMs", "permlevel": 0 }, { "oldfieldtype": "Data", - "colour": "White:FFF", "doctype": "DocField", "label": "Full Name", "oldfieldname": "employee_name", @@ -101,6 +104,30 @@ "reqd": 1, "permlevel": 0 }, + { + "doctype": "DocField", + "label": "Image", + "options": "attach_files:", + "fieldname": "image", + "fieldtype": "Select", + "permlevel": 0 + }, + { + "doctype": "DocField", + "width": "50%", + "fieldname": "column_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "description": "System User (login) ID. If set, it will become default for all HR forms.", + "doctype": "DocField", + "label": "User ID", + "options": "Profile", + "fieldname": "user_id", + "fieldtype": "Link", + "permlevel": 0 + }, { "oldfieldtype": "Data", "doctype": "DocField", @@ -112,26 +139,8 @@ "permlevel": 0, "in_filter": 1 }, - { - "description": "System User (login) ID. If set, it will become default for all HR forms.", - "colour": "White:FFF", - "doctype": "DocField", - "label": "User ID", - "options": "Profile", - "fieldname": "user_id", - "fieldtype": "Link", - "permlevel": 0 - }, - { - "doctype": "DocField", - "width": "50%", - "fieldname": "column_break1", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", "label": "Date of Joining", "oldfieldname": "date_of_joining", @@ -142,11 +151,9 @@ }, { "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", "label": "Date of Birth", "oldfieldname": "date_of_birth", - "trigger": "Client", "fieldname": "date_of_birth", "fieldtype": "Date", "search_index": 0, @@ -194,7 +201,6 @@ { "default": "Active", "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Status", "oldfieldname": "status", @@ -221,7 +227,6 @@ { "description": "Applicable Holiday List", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Holiday List", "oldfieldname": "holiday_list", @@ -249,7 +254,6 @@ }, { "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", "label": "Final Confirmation Date", "oldfieldname": "final_confirmation_date", @@ -294,7 +298,6 @@ }, { "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Branch", "oldfieldname": "branch", @@ -307,7 +310,6 @@ }, { "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Department", "oldfieldname": "department", @@ -320,21 +322,19 @@ }, { "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Designation", "oldfieldname": "designation", - "permlevel": 0, + "options": "Designation", "fieldname": "designation", "fieldtype": "Link", "search_index": 1, "reqd": 0, - "options": "Designation", + "permlevel": 0, "in_filter": 1 }, { "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Grade", "oldfieldname": "grade", @@ -378,33 +378,29 @@ }, { "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Salary Mode", "oldfieldname": "salary_mode", - "trigger": "Client", + "options": "\nBank\nCash\nCheque", "fieldname": "salary_mode", "fieldtype": "Select", - "options": "\nBank\nCash\nCheque", "permlevel": 0 }, { "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Bank Name", "oldfieldname": "bank_name", - "permlevel": 0, + "options": "Suggest", "fieldname": "bank_name", "fieldtype": "Data", "depends_on": "eval:doc.salary_mode == 'Bank'", "hidden": 0, - "options": "Suggest", + "permlevel": 0, "in_filter": 1 }, { "oldfieldtype": "Data", - "colour": "White:FFF", "doctype": "DocField", "label": "Bank A/C No.", "oldfieldname": "bank_ac_no", @@ -544,6 +540,21 @@ "fieldtype": "Small Text", "permlevel": 0 }, + { + "doctype": "DocField", + "label": "Bio", + "fieldname": "sb53", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "description": "Short biography for website and other publications.", + "doctype": "DocField", + "label": "Bio", + "fieldname": "bio", + "fieldtype": "Text Editor", + "permlevel": 0 + }, { "doctype": "DocField", "label": "Personal Details", @@ -588,10 +599,8 @@ }, { "oldfieldtype": "Button", - "colour": "White:FFF", "doctype": "DocField", "label": "Salary Structure", - "trigger": "Client", "fieldname": "salary_structure", "fieldtype": "Button", "hidden": 1, @@ -629,7 +638,6 @@ }, { "description": "Here you can maintain family details like name and occupation of parent, spouse and children", - "colour": "White:FFF", "doctype": "DocField", "label": "Family Background", "fieldname": "family_background", @@ -638,7 +646,6 @@ }, { "description": "Here you can maintain height, weight, allergies, medical concerns etc", - "colour": "White:FFF", "doctype": "DocField", "label": "Health Details", "fieldname": "health_details", diff --git a/patches/december_2012/address_title.py b/patches/december_2012/address_title.py new file mode 100644 index 0000000000..554d5d4271 --- /dev/null +++ b/patches/december_2012/address_title.py @@ -0,0 +1,13 @@ +import webnotes + +def execute(): + webnotes.reload_doc("utilities", "doctype", "address") + + webnotes.conn.sql("""update tabAddress set address_title = customer_name where ifnull(customer_name,'')!=''""") + webnotes.conn.sql("""update tabAddress set address_title = supplier_name where ifnull(supplier_name,'')!=''""") + webnotes.conn.sql("""update tabAddress set address_title = sales_partner where ifnull(sales_partner,'')!=''""") + webnotes.reset_perms("Product Settings") + + # move code to new doctype + webnotes.conn.set_value("Website Script", None, "javascript", + webnotes.conn.get_value("Website Settings", None, "startup_code")) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 7a347ff6a0..c9a4294bfb 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -558,6 +558,10 @@ patch_list = [ 'patch_module': 'patches.december_2012', 'patch_file': 'rebuild_item_group_tree', }, + { + 'patch_module': 'patches.december_2012', + 'patch_file': 'address_title', + }, { 'patch_module': 'patches.december_2012', 'patch_file': 'delete_form16_print_format', diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index 9c748e6e8c..403b83f582 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -17,17 +17,6 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); cur_frm.cscript.onload = function(doc,dt,dn){ - // history doctypes and scripts - cur_frm.history_dict = { - 'Quotation' : 'cur_frm.cscript.make_qtn_list(this.body, this.doc)', - 'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)', - 'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)', - 'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)' - } - // make address, contact, shipping, history list body - cur_frm.cscript.make_hl_body(); - //cur_frm.cscript.make_sl_body(); - cur_frm.cscript.load_defaults(doc, dt, dn); } @@ -55,7 +44,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) { // make lists cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn); - cur_frm.cscript.make_history(doc,dt,dn); cur_frm.communication_view = new wn.views.CommunicationList({ list: wn.model.get("Communication", {"customer": doc.name}), @@ -71,6 +59,19 @@ cur_frm.cscript.make_address = function() { parent: cur_frm.fields_dict['address_html'].wrapper, page_length: 2, new_doctype: "Address", + custom_new_doc: function(doctype) { + var address = wn.model.make_new_doc_and_get_name('Address'); + address = locals['Address'][address]; + address.customer = cur_frm.doc.name; + address.customer_name = cur_frm.doc.customer_name; + address.address_title = cur_frm.doc.customer_name; + + if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) { + address.address_type = "Office"; + } + + wn.set_route("Form", "Address", address.name); + }, get_query: function() { return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc" }, @@ -118,84 +119,3 @@ cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) { cur_frm.fields_dict.lead_name.get_query = erpnext.utils.lead_query; - - -cur_frm.cscript.make_qtn_list = function(parent, doc) { - cur_frm.cscript.get_common_list_view(parent, doc, 'Quotation'); -} - -cur_frm.cscript.make_so_list = function(parent, doc) { - cur_frm.cscript.get_common_list_view(parent, doc, 'Sales Order'); -} - -cur_frm.cscript.make_dn_list = function(parent, doc) { - cur_frm.cscript.get_common_list_view(parent, doc, 'Delivery Note'); -} - -cur_frm.cscript.get_common_list_view = function(parent, doc, doctype) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tab" + doctype + "`.status", - "`tab" + doctype + "`.currency", - "ifnull(`tab" + doctype + "`.grand_total_export, 0) as grand_total_export", - - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export) - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '25%', content: 'name'}, - {width: '25%', content: 'status'}, - {width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, doctype, parent, ListView); -} - -cur_frm.cscript.make_si_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "ifnull(`tabSales Invoice`.outstanding_amount, 0) as outstanding_amount", - "`tabSales Invoice`.currency", - "ifnull(`tabSales Invoice`.conversion_rate, 0) as conversion_rate", - "ifnull(`tabSales Invoice`.grand_total_export, 0) as grand_total_export", - - ]); - }, - - prepare_data: function(data) { - this._super(data); - if (data.outstanding_amount) { - data.outstanding_amount = data.currency + " " + - fmt_money(flt(data.outstanding_amount)/flt(data.conversion_rate)) + - " [outstanding]"; - - } else { - data.outstanding_amount = ''; - } - data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '25%', content: 'name'}, - {width: '25%', content: 'outstanding_amount', - css: {'text-align': 'right', 'color': '#777'}}, - {width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Sales Invoice', parent, ListView); -} \ No newline at end of file diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt index 1ef77cef4e..600693d4b2 100644 --- a/selling/doctype/customer/customer.txt +++ b/selling/doctype/customer/customer.txt @@ -2,20 +2,20 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-12-03 10:31:05", + "creation": "2012-12-07 15:15:26", "modified_by": "Administrator", - "modified": "2012-12-03 17:10:41" + "modified": "2012-12-27 14:02:01" }, { + "autoname": "naming_series:", "description": "Buyer of Goods and Services.", + "allow_rename": 1, "allow_print": 0, "search_fields": "customer_name,customer_group,country,territory", "module": "Selling", + "doctype": "DocType", "document_type": "Master", - "autoname": "naming_series:", - "name": "__common__", - "allow_rename": 1, - "doctype": "DocType" + "name": "__common__" }, { "name": "__common__", @@ -39,7 +39,6 @@ { "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Basic Info", "fieldname": "basic_info", @@ -89,12 +88,10 @@ "description": "Fetch lead which will be converted into customer.", "no_copy": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Lead Ref", "oldfieldname": "lead_name", "permlevel": 0, - "trigger": "Client", "fieldname": "lead_name", "fieldtype": "Link", "hidden": 0, @@ -113,12 +110,10 @@ "print_hide": 0, "description": "To manage Customer Groups, click here", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Group", "oldfieldname": "customer_group", "permlevel": 0, - "trigger": "Client", "fieldname": "customer_group", "fieldtype": "Link", "search_index": 1, @@ -131,19 +126,16 @@ "print_hide": 1, "description": "To manage Territory, click here", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Territory", "oldfieldname": "territory", - "permlevel": 0, - "trigger": "Client", + "options": "Territory", "fieldname": "territory", "fieldtype": "Link", "reqd": 1, - "options": "Territory" + "permlevel": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Address & Contacts", "fieldname": "address_contacts", @@ -152,7 +144,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Address Desc", "options": "Addresses will appear only when you save the customer", @@ -161,7 +152,6 @@ "permlevel": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Address HTML", "fieldname": "address_html", @@ -177,7 +167,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Desc", "options": "Contact Details will appear only when you save the customer", @@ -187,7 +176,6 @@ }, { "oldfieldtype": "HTML", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact HTML", "fieldname": "contact_html", @@ -209,7 +197,6 @@ }, { "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "More Info", "fieldname": "more_info", @@ -226,7 +213,6 @@ { "description": "To create an Account Head under a different company, select the company and save customer.", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Company", "oldfieldname": "company", @@ -249,7 +235,6 @@ { "description": "This currency will get fetched in Sales transactions of this customer", "no_copy": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Default Currency", "options": "link:Currency", @@ -260,7 +245,6 @@ { "description": "Your Customer's TAX registration numbers (if applicable) or any general information", "oldfieldtype": "Code", - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Details", "oldfieldname": "customer_details", @@ -337,34 +321,6 @@ "fieldtype": "Table", "permlevel": 0 }, - { - "depends_on": "eval:!doc.__islocal", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Transaction History", - "fieldname": "transaction_history", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "depends_on": "eval:!doc.__islocal", - "colour": "White:FFF", - "doctype": "DocField", - "label": "History HTML", - "fieldname": "history_html", - "fieldtype": "HTML", - "permlevel": 0 - }, - { - "oldfieldtype": "Small Text", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "permlevel": 1 - }, { "amend": 0, "create": 0, diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js index fd08062a0e..79e9de70da 100755 --- a/setup/doctype/contact_control/contact_control.js +++ b/setup/doctype/contact_control/contact_control.js @@ -2,56 +2,6 @@ // ========================= -// make history list body -// ----------------------- -cur_frm.cscript.make_hl_body = function(){ - cur_frm.fields_dict['history_html'].wrapper.innerHTML = ''; - cur_frm.history_html = $a(cur_frm.fields_dict['history_html'].wrapper,'div'); - $(cur_frm.history_html).css({ - 'min-height': '320px', - }); -} - -// make history -// ------------- -cur_frm.cscript.make_history = function(doc,dt,dn){ - cur_frm.history_html.innerHTML = ''; - cur_frm.cscript.make_history_list(cur_frm.history_html,doc); -} - -// make history list -// ------------------ -cur_frm.cscript.make_history_list = function(parent,doc){ - - var sel = $a(parent,'select'); - - var ls = ['Select Transaction..']; - for(d in cur_frm.history_dict){ - ls.push(d); - } - - add_sel_options(sel,ls,'Select..'); - - var body = $a(parent,'div'); - body.innerHTML = '
Please select a transaction type to see History
'; - - sel.body = body; - sel.doc = doc; - - sel.onchange = function(){ - for(d in cur_frm.history_dict){ - if(sel_val(this) == d){ - this.body.innerHTML = ''; - eval(cur_frm.history_dict[d]); - return; - } - else{ - // pass - } - } - } -} - // get sates on country trigger // ----------------------------- cur_frm.cscript.get_states=function(doc,dt,dn){ diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py index b2a0843af4..3f3cb1a539 100644 --- a/setup/doctype/item_group/item_group.py +++ b/setup/doctype/item_group/item_group.py @@ -54,4 +54,7 @@ class DocType(DocTypeNestedSet): self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20) self.parent_groups = get_parent_item_groups(self.doc.name) - \ No newline at end of file + + if self.doc.slideshow: + from website.helpers.slideshow import get_slideshow + get_slideshow(self) \ No newline at end of file diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt index 72b83aaaf7..2b95965092 100644 --- a/setup/doctype/item_group/item_group.txt +++ b/setup/doctype/item_group/item_group.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-12-07 15:15:28", "modified_by": "Administrator", - "modified": "2012-12-20 16:11:15" + "modified": "2012-12-27 10:38:02" }, { "in_create": 1, @@ -102,6 +102,15 @@ "fieldname": "show_in_website", "fieldtype": "Check" }, + { + "description": "Show this slideshow at the top of the page", + "depends_on": "show_in_website", + "doctype": "DocField", + "label": "Slideshow", + "fieldname": "slideshow", + "fieldtype": "Link", + "options": "Website Slideshow" + }, { "description": "HTML / Banner that will show on the top of product list.", "depends_on": "show_in_website", diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js index a0f138c5a4..c5f0dba7dd 100644 --- a/setup/doctype/sales_partner/sales_partner.js +++ b/setup/doctype/sales_partner/sales_partner.js @@ -17,31 +17,19 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); cur_frm.cscript.onload = function(doc,dt,dn){ - // history doctypes and scripts - cur_frm.history_dict = { - 'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)', - 'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)', - 'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)' - } - - // make contact, history list body - //cur_frm.cscript.make_cl_body(); - cur_frm.cscript.make_hl_body(); + } cur_frm.cscript.refresh = function(doc,dt,dn){ if(doc.__islocal){ hide_field(['address_html', 'contact_html']); - //cur_frm.cscript.set_cl_msg(doc); - //cur_frm.cscript.set_hl_msg(doc); } else{ unhide_field(['address_html', 'contact_html']); // make lists cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn); - cur_frm.cscript.make_history(doc,dt,dn); } } @@ -51,7 +39,15 @@ cur_frm.cscript.make_address = function() { cur_frm.address_list = new wn.ui.Listing({ parent: cur_frm.fields_dict['address_html'].wrapper, page_length: 2, - new_doctype: "Address", + new_doctype: "Address", + custom_new_doc: function(doctype) { + var address = wn.model.make_new_doc_and_get_name('Address'); + address = locals['Address'][address]; + address.sales_partner = cur_frm.doc.name; + address.address_title = cur_frm.doc.name; + address.address_type = "Office"; + wn.set_route("Form", "Address", address.name); + }, get_query: function() { return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc" }, @@ -102,5 +98,4 @@ cur_frm.cscript.make_contact = function() { cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) { return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' -} - +} \ No newline at end of file diff --git a/setup/doctype/sales_partner/sales_partner.txt b/setup/doctype/sales_partner/sales_partner.txt index adeb1b7830..a0cfd16ddc 100644 --- a/setup/doctype/sales_partner/sales_partner.txt +++ b/setup/doctype/sales_partner/sales_partner.txt @@ -2,26 +2,19 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-03 13:30:54", + "creation": "2012-07-12 23:29:44", "modified_by": "Administrator", - "modified": "2012-07-12 11:22:15" + "modified": "2012-12-27 14:03:00" }, { - "section_style": "Tabbed", - "description": "A **Sales Partner** is a third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission. This is useful if you make the end sale to the **Customer**, involving your **Sales Partner**.\n\nIf you sell to your **Sales Partner** who in-turn sells it to the **Customer**, then you must make a **Customer** instead.", - "module": "Setup", - "server_code_error": " ", - "allow_trash": 1, - "document_type": "Master", - "in_create": 0, "read_only": 0, - "_last_update": "1322549700", "autoname": "field:partner_name", + "in_create": 0, "name": "__common__", - "colour": "White:FFF", "doctype": "DocType", - "show_in_menu": 0, - "version": 1 + "module": "Setup", + "document_type": "Master", + "description": "A third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission." }, { "name": "__common__", @@ -42,85 +35,9 @@ "name": "Sales Partner", "doctype": "DocType" }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Manager", - "cancel": 0, - "permlevel": 1 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Manager", - "cancel": 0, - "permlevel": 0 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales User", - "cancel": 0, - "permlevel": 1 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales User", - "cancel": 0, - "permlevel": 0 - }, - { - "amend": 0, - "create": 1, - "doctype": "DocPerm", - "submit": 0, - "write": 1, - "role": "Sales Master Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Master Manager", - "cancel": 0, - "permlevel": 1 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "System Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "create": 0, - "doctype": "DocPerm", - "write": 0, - "role": "System Manager", - "permlevel": 1 - }, { "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Sales Partner Details", "fieldname": "basic_info", @@ -128,27 +45,27 @@ "permlevel": 0 }, { - "search_index": 1, + "oldfieldtype": "Data", "doctype": "DocField", "label": "Sales Partner Name", "oldfieldname": "partner_name", "fieldname": "partner_name", "fieldtype": "Data", - "oldfieldtype": "Data", + "search_index": 1, "reqd": 1, "permlevel": 0, "in_filter": 1 }, { - "search_index": 0, + "oldfieldtype": "Select", "doctype": "DocField", "label": "Partner Type", "oldfieldname": "partner_type", - "permlevel": 0, + "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller", "fieldname": "partner_type", "fieldtype": "Select", - "oldfieldtype": "Select", - "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller", + "search_index": 0, + "permlevel": 0, "in_filter": 1 }, { @@ -187,13 +104,12 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Address Desc", - "permlevel": 0, + "options": "Addresses will appear only when you save the customer", "fieldname": "address_desc", "fieldtype": "HTML", - "options": "Addresses will appear only when you save the customer" + "permlevel": 0 }, { "doctype": "DocField", @@ -210,13 +126,12 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Desc", - "permlevel": 0, + "options": "Contact Details will appear only when you save the customer", "fieldname": "contact_desc", "fieldtype": "HTML", - "options": "Contact Details will appear only when you save the customer" + "permlevel": 0 }, { "doctype": "DocField", @@ -238,31 +153,96 @@ "doctype": "DocField", "label": "Partner Target Detail", "oldfieldname": "partner_target_details", - "permlevel": 0, + "options": "Target Detail", "fieldname": "partner_target_details", "fieldtype": "Table", "reqd": 0, - "options": "Target Detail" + "permlevel": 0 }, { "description": "Select Budget Distribution to unevenly distribute targets across months.", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Target Distribution", "oldfieldname": "distribution_id", - "permlevel": 0, + "options": "Budget Distribution", "fieldname": "distribution_id", "fieldtype": "Link", - "options": "Budget Distribution" + "permlevel": 0 }, { - "oldfieldtype": "Small Text", - "doctype": "DocField", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales Manager", + "cancel": 0, + "permlevel": 1 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales Manager", + "cancel": 0, + "permlevel": 0 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales User", + "cancel": 0, + "permlevel": 1 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales User", + "cancel": 0, + "permlevel": 0 + }, + { + "amend": 0, + "create": 1, + "doctype": "DocPerm", + "submit": 0, + "write": 1, + "role": "Sales Master Manager", + "cancel": 1, + "permlevel": 0 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales Master Manager", + "cancel": 0, + "permlevel": 1 + }, + { + "create": 1, + "doctype": "DocPerm", + "write": 1, + "role": "System Manager", + "cancel": 1, + "permlevel": 0 + }, + { + "create": 0, + "doctype": "DocPerm", + "write": 0, + "role": "System Manager", "permlevel": 1 } ] \ No newline at end of file diff --git a/startup/event_handlers.py b/startup/event_handlers.py index 4808298368..16fb523de3 100644 --- a/startup/event_handlers.py +++ b/startup/event_handlers.py @@ -46,10 +46,6 @@ def comment_added(doc): """add comment to feed""" home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by, '"' + doc.comment + '"', '#6B24B3') - -def doclist_all(doc, method): - """doclist trigger called from webnotes.model.wrapper on any event""" - home.update_feed(doc, method) def boot_session(bootinfo): """boot session - send website info if guest""" @@ -131,7 +127,7 @@ def check_if_expired(): def get_web_script(): """returns web startup script""" - return webnotes.conn.get_value('Website Settings', None, 'startup_code') or '' + return webnotes.conn.get_value('Website Script', None, 'javascript') or '' def get_web_style(): """returns web css""" diff --git a/startup/observers.py b/startup/observers.py new file mode 100644 index 0000000000..7dad77afc8 --- /dev/null +++ b/startup/observers.py @@ -0,0 +1,20 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +observer_map = { + "*:on_update": "home.update_feed", + "*:on_submit": "home.update_feed", +} \ No newline at end of file diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 7db903d9a3..5b00643843 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -205,5 +205,10 @@ class DocType: clear_cache(self.doc.page_name) def prepare_template_args(self): - from website.helpers.product import get_parent_item_groups + from website.helpers.product import get_parent_item_groups, url_for_website self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}] + self.doc.website_image = url_for_website(self.doc.website_image) + + if self.doc.slideshow: + from website.helpers.slideshow import get_slideshow + get_slideshow(self) \ No newline at end of file diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt index cdc3ae5de5..d1fc4fcb93 100644 --- a/stock/doctype/item/item.txt +++ b/stock/doctype/item/item.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-12-17 14:56:32", "modified_by": "Administrator", - "modified": "2012-12-25 13:52:47" + "modified": "2012-12-27 10:36:56" }, { "allow_attach": 1, @@ -781,6 +781,17 @@ "permlevel": 0 }, { + "description": "Show a slideshow at the top of the page", + "depends_on": "show_in_website", + "doctype": "DocField", + "label": "Slideshow", + "options": "Website Slideshow", + "fieldname": "slideshow", + "fieldtype": "Link", + "permlevel": 0 + }, + { + "description": "Item Image (if not slideshow)", "depends_on": "show_in_website", "doctype": "DocField", "label": "Image", diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index e5e1fe110e..5e60753a18 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -284,15 +284,17 @@ class DocType(TransactionBase): # on submit def on_submit(self): + purchase_controller = webnotes.get_obj("Purchase Common") + purchase_controller.is_item_table_empty(self) + # Check for Approving Authority get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total) # Set status as Submitted webnotes.conn.set(self.doc,'status', 'Submitted') - pc_obj = get_obj('Purchase Common') # Update Previous Doc i.e. update pending_qty and Status accordingly - pc_obj.update_prevdoc_detail(self, is_submit = 1) + purchase_controller.update_prevdoc_detail(self, is_submit = 1) # Update Serial Record get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1) @@ -301,7 +303,7 @@ class DocType(TransactionBase): self.update_stock(is_submit = 1) # Update last purchase rate - pc_obj.update_last_purchase_rate(self, 1) + purchase_controller.update_last_purchase_rate(self, 1) diff --git a/utilities/doctype/address/address.js b/utilities/doctype/address/address.js index 147f768210..a11dd05b6d 100644 --- a/utilities/doctype/address/address.js +++ b/utilities/doctype/address/address.js @@ -20,26 +20,4 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query; - - var route = wn.get_route(); - if(route[1]=='Supplier') { - var supplier = wn.container.page.frm.doc; - doc.supplier = supplier.name; - doc.supplier_name = supplier.supplier_name; - doc.address_type = 'Office'; - } else if(route[1]=='Customer') { - var customer = wn.container.page.frm.doc; - doc.customer = customer.name; - doc.customer_name = customer.customer_name; - doc.address_type = 'Office'; - } else if(route[1]=='Sales Partner') { - var sp = wn.container.page.frm.doc; - doc.sales_partner = sp.name; - doc.address_type = 'Office'; - } -} - -cur_frm.cscript.hide_dialog = function() { - if(cur_frm.address_list) - cur_frm.address_list.run(); } \ No newline at end of file diff --git a/utilities/doctype/address/address.py b/utilities/doctype/address/address.py index 08bf5cdbec..ae0f2177b6 100644 --- a/utilities/doctype/address/address.py +++ b/utilities/doctype/address/address.py @@ -31,7 +31,8 @@ class DocType: self.doc.name = self.doc.supplier + '-' + self.doc.address_type elif self.doc.sales_partner: self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type - + elif self.doc.address_title: + self.doc.address_title = self.doc.address_title + "-" + self.doc.address_type def validate(self): self.validate_for_whom() diff --git a/utilities/doctype/address/address.txt b/utilities/doctype/address/address.txt index 4a3fe7fa1d..f77f3975b9 100644 --- a/utilities/doctype/address/address.txt +++ b/utilities/doctype/address/address.txt @@ -2,23 +2,17 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-02 19:57:47", + "creation": "2012-07-03 13:30:41", "modified_by": "Administrator", - "modified": "2012-07-02 20:24:15" + "modified": "2012-12-27 11:31:37" }, { - "section_style": "Simple", + "name": "__common__", "search_fields": "customer, supplier, sales_partner, country, state", "module": "Utilities", - "_last_update": "1319016431", - "allow_trash": 1, - "in_dialog": 1, - "document_type": "Master", - "name": "__common__", - "colour": "White:FFF", "doctype": "DocType", - "show_in_menu": 0, - "version": 1 + "in_dialog": 0, + "document_type": "Master" }, { "name": "__common__", @@ -39,6 +33,187 @@ "name": "Address", "doctype": "DocType" }, + { + "doctype": "DocField", + "label": "Address Details", + "fieldname": "address_details", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "description": "e.g. Office, Billing, Shipping", + "doctype": "DocField", + "label": "Address Type", + "fieldname": "address_type", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "description": "Name of person or organization that this address belongs to.", + "doctype": "DocField", + "label": "Address Title", + "fieldname": "address_title", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Address Line1", + "fieldname": "address_line1", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Address Line2", + "fieldname": "address_line2", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "search_index": 1, + "doctype": "DocField", + "label": "City/Town", + "fieldname": "city", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0, + "in_filter": 1 + }, + { + "search_index": 1, + "doctype": "DocField", + "label": "Pincode", + "fieldname": "pincode", + "fieldtype": "Data", + "permlevel": 0, + "in_filter": 1 + }, + { + "search_index": 1, + "doctype": "DocField", + "label": "Country", + "options": "link:Country", + "fieldname": "country", + "fieldtype": "Select", + "reqd": 1, + "permlevel": 0, + "in_filter": 1 + }, + { + "search_index": 0, + "doctype": "DocField", + "label": "State", + "options": "Suggest", + "fieldname": "state", + "fieldtype": "Data", + "permlevel": 0, + "in_filter": 1 + }, + { + "print_hide": 0, + "doctype": "DocField", + "width": "50%", + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Phone", + "fieldname": "phone", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Email Id", + "fieldname": "email_id", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Fax", + "fieldname": "fax", + "fieldtype": "Data", + "permlevel": 0, + "in_filter": 1 + }, + { + "description": "Check to make primary address", + "default": "0", + "doctype": "DocField", + "label": "Is Primary Address", + "fieldname": "is_primary_address", + "fieldtype": "Check", + "permlevel": 0 + }, + { + "description": "Check to make Shipping Address", + "default": "0", + "doctype": "DocField", + "label": "Is Shipping Address", + "fieldname": "is_shipping_address", + "fieldtype": "Check", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Linked With", + "fieldname": "linked_with", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "doctype": "DocField", + "label": "Customer", + "options": "Customer", + "fieldname": "customer", + "fieldtype": "Link", + "permlevel": 0 + }, + { + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "doctype": "DocField", + "label": "Customer Name", + "fieldname": "customer_name", + "fieldtype": "Data", + "permlevel": 1, + "in_filter": 1 + }, + { + "depends_on": "eval:!doc.customer && !doc.sales_partner", + "doctype": "DocField", + "label": "Supplier", + "options": "Supplier", + "fieldname": "supplier", + "fieldtype": "Link", + "permlevel": 0 + }, + { + "depends_on": "eval:!doc.customer && !doc.sales_partner", + "doctype": "DocField", + "label": "Supplier Name", + "fieldname": "supplier_name", + "fieldtype": "Data", + "search_index": 0, + "permlevel": 1, + "in_filter": 1 + }, + { + "depends_on": "eval:!doc.customer && !doc.supplier", + "doctype": "DocField", + "label": "Sales Partner", + "options": "Sales Partner", + "fieldname": "sales_partner", + "fieldtype": "Link", + "permlevel": 0 + }, { "create": 1, "doctype": "DocPerm", @@ -128,192 +303,5 @@ "role": "All", "cancel": 0, "permlevel": 1 - }, - { - "colour": "White:FFF", - "doctype": "DocField", - "label": "Address Details", - "fieldname": "address_details", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "description": "e.g. Office, Billing, Shipping", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Address Type", - "fieldname": "address_type", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, - { - "colour": "White:FFF", - "doctype": "DocField", - "label": "Address Line1", - "fieldname": "address_line1", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Address Line2", - "fieldname": "address_line2", - "fieldtype": "Data", - "permlevel": 0 - }, - { - "search_index": 1, - "colour": "White:FFF", - "doctype": "DocField", - "label": "City/Town", - "fieldname": "city", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0, - "in_filter": 1 - }, - { - "search_index": 1, - "doctype": "DocField", - "label": "Pincode", - "fieldname": "pincode", - "fieldtype": "Data", - "permlevel": 0, - "in_filter": 1 - }, - { - "search_index": 1, - "colour": "White:FFF", - "doctype": "DocField", - "label": "Country", - "trigger": "Client", - "fieldname": "country", - "fieldtype": "Select", - "reqd": 1, - "options": "link:Country", - "permlevel": 0, - "in_filter": 1 - }, - { - "search_index": 0, - "colour": "White:FFF", - "doctype": "DocField", - "label": "State", - "permlevel": 0, - "fieldname": "state", - "fieldtype": "Data", - "options": "Suggest", - "in_filter": 1 - }, - { - "print_hide": 0, - "doctype": "DocField", - "width": "50%", - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Phone", - "fieldname": "phone", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Email Id", - "fieldname": "email_id", - "fieldtype": "Data", - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Fax", - "fieldname": "fax", - "fieldtype": "Data", - "permlevel": 0, - "in_filter": 1 - }, - { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Customer", - "permlevel": 0, - "fieldname": "customer", - "fieldtype": "Link", - "options": "Customer" - }, - { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Customer Name", - "fieldname": "customer_name", - "fieldtype": "Data", - "permlevel": 1, - "in_filter": 1 - }, - { - "depends_on": "eval:!doc.customer && !doc.sales_partner", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Supplier", - "permlevel": 0, - "fieldname": "supplier", - "fieldtype": "Link", - "options": "Supplier" - }, - { - "search_index": 0, - "colour": "White:FFF", - "doctype": "DocField", - "label": "Supplier Name", - "fieldname": "supplier_name", - "fieldtype": "Data", - "depends_on": "eval:!doc.customer && !doc.sales_partner", - "permlevel": 1, - "in_filter": 1 - }, - { - "depends_on": "eval:!doc.customer && !doc.supplier", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Sales Partner", - "permlevel": 0, - "fieldname": "sales_partner", - "fieldtype": "Link", - "options": "Sales Partner" - }, - { - "description": "Check to make primary address", - "default": "0", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Is Primary Address", - "fieldname": "is_primary_address", - "fieldtype": "Check", - "permlevel": 0 - }, - { - "description": "Check to make Shipping Address", - "default": "0", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Is Shipping Address", - "fieldname": "is_shipping_address", - "fieldtype": "Check", - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Trash Reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "permlevel": 0 } ] \ No newline at end of file diff --git a/website/css/website.css b/website/css/website.css index b392f5e79a..daf0318994 100644 --- a/website/css/website.css +++ b/website/css/website.css @@ -65,14 +65,6 @@ p, li { float: left; } -.website-missing-image { - background-color: #eee; - padding: 40px; - width: 32px; - font-size: 32px; - color: #888; -} - .clear { clear: both; } diff --git a/website/doctype/about_us_settings/__init__.py b/website/doctype/about_us_settings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website/doctype/about_us_settings/about_us_settings.py b/website/doctype/about_us_settings/about_us_settings.py new file mode 100644 index 0000000000..a0e8726372 --- /dev/null +++ b/website/doctype/about_us_settings/about_us_settings.py @@ -0,0 +1,18 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes +from website.utils import url_for_website + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl + + def onload(self): + """load employee""" + emp_list = [] + for d in self.doclist.get({"doctype":"About Us Team Member"}): + emp = webnotes.doc("Employee", d.employee) + emp.image = url_for_website(emp.image) + emp_list.append(emp) + self.doclist += emp_list \ No newline at end of file diff --git a/website/doctype/about_us_settings/about_us_settings.txt b/website/doctype/about_us_settings/about_us_settings.txt new file mode 100644 index 0000000000..9facfbb4a1 --- /dev/null +++ b/website/doctype/about_us_settings/about_us_settings.txt @@ -0,0 +1,98 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2012-12-27 14:24:35", + "modified_by": "Administrator", + "modified": "2012-12-27 15:51:11" + }, + { + "issingle": 1, + "description": "Settings for the About Us Page", + "doctype": "DocType", + "module": "Website", + "document_type": "Master", + "name": "__common__" + }, + { + "name": "__common__", + "parent": "About Us Settings", + "doctype": "DocField", + "parenttype": "DocType", + "permlevel": 0, + "parentfield": "fields" + }, + { + "parent": "About Us Settings", + "read": 1, + "name": "__common__", + "create": 1, + "doctype": "DocPerm", + "write": 1, + "parenttype": "DocType", + "role": "Website Manager", + "permlevel": 0, + "parentfield": "permissions" + }, + { + "name": "About Us Settings", + "doctype": "DocType" + }, + { + "description": "Introduce your company to the website visitor.", + "doctype": "DocField", + "label": "Company Introduction", + "fieldname": "company_introduction", + "fieldtype": "Text Editor" + }, + { + "doctype": "DocField", + "label": "Company History", + "fieldname": "sb0", + "fieldtype": "Section Break" + }, + { + "description": "\"Company History\"", + "doctype": "DocField", + "label": "Company History Heading", + "fieldname": "company_history_heading", + "fieldtype": "Data" + }, + { + "doctype": "DocField", + "label": "Company History", + "fieldname": "company_history", + "fieldtype": "Table", + "options": "Company History" + }, + { + "doctype": "DocField", + "label": "Team Members", + "fieldname": "sb1", + "fieldtype": "Section Break" + }, + { + "description": "\"Team Members\" or \"Management\"", + "doctype": "DocField", + "label": "Team Members Heading", + "fieldname": "team_members_heading", + "fieldtype": "Data" + }, + { + "doctype": "DocField", + "label": "Team Members", + "fieldname": "team_members", + "fieldtype": "Table", + "options": "About Us Team Member" + }, + { + "description": "More content for the bottom of the page.", + "doctype": "DocField", + "label": "Footer", + "fieldname": "footer", + "fieldtype": "Text Editor" + }, + { + "doctype": "DocPerm" + } +] \ No newline at end of file diff --git a/website/doctype/about_us_team_member/__init__.py b/website/doctype/about_us_team_member/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website/doctype/about_us_team_member/about_us_team_member.py b/website/doctype/about_us_team_member/about_us_team_member.py new file mode 100644 index 0000000000..928aa9ff9f --- /dev/null +++ b/website/doctype/about_us_team_member/about_us_team_member.py @@ -0,0 +1,8 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/website/doctype/about_us_team_member/about_us_team_member.txt b/website/doctype/about_us_team_member/about_us_team_member.txt new file mode 100644 index 0000000000..a68ddcfb4d --- /dev/null +++ b/website/doctype/about_us_team_member/about_us_team_member.txt @@ -0,0 +1,35 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2012-12-27 14:28:45", + "modified_by": "Administrator", + "modified": "2012-12-27 14:49:44" + }, + { + "istable": 1, + "name": "__common__", + "doctype": "DocType", + "module": "Website" + }, + { + "parent": "About Us Team Member", + "doctype": "DocField", + "name": "__common__", + "label": "Employee", + "width": "300px", + "parenttype": "DocType", + "options": "Employee", + "fieldname": "employee", + "fieldtype": "Link", + "permlevel": 0, + "parentfield": "fields" + }, + { + "name": "About Us Team Member", + "doctype": "DocType" + }, + { + "doctype": "DocField" + } +] \ No newline at end of file diff --git a/website/doctype/company_history/__init__.py b/website/doctype/company_history/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website/doctype/company_history/company_history.py b/website/doctype/company_history/company_history.py new file mode 100644 index 0000000000..928aa9ff9f --- /dev/null +++ b/website/doctype/company_history/company_history.py @@ -0,0 +1,8 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/website/doctype/company_history/company_history.txt b/website/doctype/company_history/company_history.txt new file mode 100644 index 0000000000..64fe6c2128 --- /dev/null +++ b/website/doctype/company_history/company_history.txt @@ -0,0 +1,40 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2012-12-27 14:25:38", + "modified_by": "Administrator", + "modified": "2012-12-27 14:25:38" + }, + { + "istable": 1, + "name": "__common__", + "doctype": "DocType", + "module": "Website" + }, + { + "name": "__common__", + "parent": "Company History", + "doctype": "DocField", + "parenttype": "DocType", + "permlevel": 0, + "parentfield": "fields" + }, + { + "name": "Company History", + "doctype": "DocType" + }, + { + "doctype": "DocField", + "label": "Year", + "fieldname": "year", + "fieldtype": "Data" + }, + { + "doctype": "DocField", + "label": "Highlight", + "width": "300px", + "fieldname": "highlight", + "fieldtype": "Text" + } +] \ No newline at end of file diff --git a/website/doctype/web_page/web_page.py b/website/doctype/web_page/web_page.py index 324893dcc6..d90274409d 100644 --- a/website/doctype/web_page/web_page.py +++ b/website/doctype/web_page/web_page.py @@ -42,9 +42,5 @@ class DocType(): def prepare_template_args(self): if self.doc.slideshow: - slideshow = webnotes.model_wrapper("Website Slideshow", self.doc.slideshow) - self.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"}) - self.doc.slideshow_header = slideshow.doc.header or "" - for s in self.slides: - if s.image and not s.image.lower().startswith("http"): - s.image = "files/" + s.image + from website.helpers.slideshow import get_slideshow + get_slideshow(self) diff --git a/website/doctype/website_script/__init__.py b/website/doctype/website_script/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website/doctype/website_script/website_script.py b/website/doctype/website_script/website_script.py new file mode 100644 index 0000000000..928aa9ff9f --- /dev/null +++ b/website/doctype/website_script/website_script.py @@ -0,0 +1,8 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/website/doctype/website_script/website_script.txt b/website/doctype/website_script/website_script.txt new file mode 100644 index 0000000000..cf22537bf8 --- /dev/null +++ b/website/doctype/website_script/website_script.txt @@ -0,0 +1,51 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2012-12-27 11:51:24", + "modified_by": "Administrator", + "modified": "2012-12-27 12:25:04" + }, + { + "issingle": 1, + "description": "Script to attach to all web pages.", + "doctype": "DocType", + "module": "Website", + "document_type": "Other", + "name": "__common__" + }, + { + "parent": "Website Script", + "doctype": "DocField", + "name": "__common__", + "label": "Javascript", + "parenttype": "DocType", + "options": "Javascript", + "fieldname": "javascript", + "fieldtype": "Code", + "permlevel": 0, + "parentfield": "fields" + }, + { + "parent": "Website Script", + "read": 1, + "name": "__common__", + "create": 1, + "doctype": "DocPerm", + "write": 1, + "parenttype": "DocType", + "role": "Website Manager", + "permlevel": 0, + "parentfield": "permissions" + }, + { + "name": "Website Script", + "doctype": "DocType" + }, + { + "doctype": "DocField" + }, + { + "doctype": "DocPerm" + } +] \ No newline at end of file diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt index 4ef8addde5..78e9336488 100644 --- a/website/doctype/website_settings/website_settings.txt +++ b/website/doctype/website_settings/website_settings.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-07-12 23:29:36", "modified_by": "Administrator", - "modified": "2012-12-25 15:41:48" + "modified": "2012-12-27 12:27:02" }, { "issingle": 1, @@ -80,6 +80,15 @@ "fieldtype": "Section Break", "permlevel": 0 }, + { + "description": "Background shade of the top menu bar", + "doctype": "DocField", + "label": "Top Bar Background", + "options": "Black\nWhite", + "fieldname": "top_bar_background", + "fieldtype": "Select", + "permlevel": 0 + }, { "description": "Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag. Keep size as 200px x 30px", "doctype": "DocField", @@ -171,22 +180,6 @@ "hidden": 1, "permlevel": 0 }, - { - "doctype": "DocField", - "label": "Startup", - "fieldname": "analytics", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "description": "Bind events on startup and page change", - "doctype": "DocField", - "label": "Startup Code", - "options": "Javascript", - "fieldname": "startup_code", - "fieldtype": "Code", - "permlevel": 0 - }, { "create": 1, "doctype": "DocPerm", diff --git a/website/helpers/product.py b/website/helpers/product.py index 0497124c17..1e8257a7a7 100644 --- a/website/helpers/product.py +++ b/website/helpers/product.py @@ -2,7 +2,10 @@ # License: GNU General Public License (v3). For more information see license.txt from __future__ import unicode_literals + import webnotes +from webnotes.utils import cstr +from website.utils import build_html, url_for_website, delete_page_cache @webnotes.whitelist(allow_guest=True) @@ -26,8 +29,6 @@ def get_product_info(item_code): @webnotes.whitelist(allow_guest=True) def get_product_list(search=None, product_group=None, start=0, limit=10): - from webnotes.utils import cstr - # base query query = """select name, item_name, page_name, website_image, item_group, web_long_description as website_description @@ -81,7 +82,6 @@ def get_group_item_count(item_group): where item_group in (%s))) """ % (child_groups, child_groups))[0][0] def get_item_for_list_in_html(r): - from website.utils import build_html scrub_item_for_list(r) r.template = "html/product_in_list.html" return build_html(r) @@ -91,8 +91,7 @@ def scrub_item_for_list(r): r.website_description = "No description given" if len(r.website_description.split(" ")) > 24: r.website_description = " ".join(r.website_description.split(" ")[:24]) + "..." - if r.website_image and not r.website_image.lower().startswith("http"): - r.website_image = "files/" + r.website_image + r.website_image = url_for_website(r.website_image) def get_parent_item_groups(item_group_name): item_group = webnotes.doc("Item Group", item_group_name) @@ -102,6 +101,5 @@ def get_parent_item_groups(item_group_name): order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True) def invalidate_cache_for(item_group): - from website.utils import delete_page_cache for i in get_parent_item_groups(item_group): delete_page_cache(i.page_name) \ No newline at end of file diff --git a/website/helpers/slideshow.py b/website/helpers/slideshow.py new file mode 100644 index 0000000000..2c2ae4ba05 --- /dev/null +++ b/website/helpers/slideshow.py @@ -0,0 +1,26 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import webnotes + +def get_slideshow(obj): + slideshow = webnotes.model_wrapper("Website Slideshow", obj.doc.slideshow) + obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"}) + obj.doc.slideshow_header = slideshow.doc.header or "" + for s in obj.slides: + if s.image and not s.image.lower().startswith("http"): + s.image = "files/" + s.image + \ No newline at end of file diff --git a/website/page/website_home/website_home.html b/website/page/website_home/website_home.html index 8c986cc697..e4c86b00c6 100644 --- a/website/page/website_home/website_home.html +++ b/website/page/website_home/website_home.html @@ -20,27 +20,24 @@
Product Settings

Settings for Product Catalog on the website.

+
+
About Us Settings
+

Settings for About Us Page.

-
-

Reports

-
-

Create website with static pages and blogs

-
    -
  • "Website Settings" - to setup header and footers. -
  • "Web Page" - for static web page. -
  • "Blog" - for blog entry. -
-

Notes:

-
    -
  • All pages are accessible via `#` + page name appended to your url. -
  • Product catalogue is updated from Item Master (set Show in Website = 'Yes', in - Sales Settings). -
+
Advanced
+
+ +
+
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html index aef91a9d55..322ce60489 100644 --- a/website/templates/html/outer.html +++ b/website/templates/html/outer.html @@ -9,7 +9,7 @@