From b743bb6c10e223873f2b35a608dcc080463dec98 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Apr 2012 14:03:07 +0530 Subject: [PATCH 01/24] ledger bal export format changed --- .../ledger_balance_export.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py b/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py index 88a31f2226..716283a799 100755 --- a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py +++ b/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py @@ -49,14 +49,14 @@ class DocType: def add_header(self): title = 'Ledger Balances Between ' + getdate(self.doc.from_date).strftime('%d-%m-%Y') + ' and ' + getdate(self.doc.to_date).strftime('%d-%m-%Y') - return [[title], ['Account', 'Opening(Dr)', 'Opening (Cr)', 'Debit', 'Credit', 'Closing(Dr)', 'Closing(Cr)'], ['', '', '', '', '', '', '', 'Posting Date', 'Voucher Type', 'Voucher No', 'Debit', 'Credit', 'Remarks']] + return [[title], ['Account', 'Posting Date', 'Voucher Type', 'Voucher No', 'Debit', 'Credit', 'Remarks']] def get_account_subtree(self, acc): return sql(""" SELECT - CONCAT(REPEAT(' ', COUNT(parent.name) - (sub_tree.depth + 1)), node.name) as account, + CONCAT(REPEAT(' ', COUNT(parent.name) - (sub_tree.depth + 1)), node.name) as account, node.lft AS lft, node.rgt AS rgt, node.debit_or_credit as dr_or_cr, node.group_or_ledger as group_or_ledger, node.is_pl_account as is_pl_account FROM tabAccount AS node, @@ -78,7 +78,7 @@ class DocType: - def show_acc_summary(self, glc, acc_det): + def get_acc_summary(self, glc, acc_det): from_date_year = self.get_year(add_days(self.doc.from_date, -1)) to_date_year = self.get_year(self.doc.to_date) acc = acc_det['account'].strip() @@ -104,8 +104,8 @@ class DocType: if acc_det['dr_or_cr'] == 'Credit': opening, closing = -1*opening, -1*closing - return [acc_det['account'], flt(opening>0 and opening or 0), flt(opening<0 and -opening or 0), - debit, credit, flt(closing>0.01 and closing or 0), flt(closing<-0.01 and -closing or 0)] + return flt(opening>0 and opening or 0), flt(opening<0 and -opening or 0), \ + debit, credit, flt(closing>0.01 and closing or 0), flt(closing<-0.01 and -closing or 0) def show_gl_entries(self, acc): @@ -113,7 +113,7 @@ class DocType: gle = sql("select posting_date, voucher_type, voucher_no, debit, credit, remarks from `tabGL Entry` WHERE account = %s and posting_date >= %s AND posting_date <= %s and ifnull(is_opening, 'No') = 'No' and ifnull(is_cancelled, 'No') = 'No'", (acc, self.doc.from_date, self.doc.to_date), as_dict=1) entries, dr, cr = [], 0, 0 for d in gle: - entries.append(['', '', '', '', '', '', '', d['posting_date'], d['voucher_type'], d['voucher_no'], d['debit'], d['credit'], d['remarks']]) + entries.append(['', d['posting_date'], d['voucher_type'], d['voucher_no'], d['debit'], d['credit'], d['remarks']]) return entries @@ -133,13 +133,17 @@ class DocType: sub_tree = self.get_account_subtree(d.account) for acc_det in sub_tree: - acc_summary = self.show_acc_summary(glc, acc_det) - res.append(acc_summary) - - # Show gl entries if account is ledger - if acc_det['group_or_ledger'] == 'Ledger' and (acc_summary[3] or acc_summary[4]): - gle = self.show_gl_entries(acc_det['account'].strip()) - res += gle - + acc_summary = self.get_acc_summary(glc, acc_det) + if acc_summary[2] or acc_summary[3]: + res.append([acc_det['account']]) + # Show gl entries if account is ledger + if acc_det['group_or_ledger'] == 'Ledger': + gle = self.show_gl_entries(acc_det['account'].strip()) + res += gle + + # Totals + res.append(['', '', '', 'Total Debit/Credit', acc_summary[2], acc_summary[3]]) + res.append(['', '', '', 'Opening Balance', acc_summary[0], acc_summary[1]]) + res.append(['', '', '', 'Closing Balance', acc_summary[4], acc_summary[5]]) return res From 2bbb086b100b225f6cd61fccd410b44d71157fdf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Apr 2012 17:57:18 +0530 Subject: [PATCH 02/24] Update erpnext/accounts/doctype/rv_detail/rv_detail.txt --- erpnext/accounts/doctype/rv_detail/rv_detail.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/accounts/doctype/rv_detail/rv_detail.txt b/erpnext/accounts/doctype/rv_detail/rv_detail.txt index 314dcd7dd3..aa459e506b 100644 --- a/erpnext/accounts/doctype/rv_detail/rv_detail.txt +++ b/erpnext/accounts/doctype/rv_detail/rv_detail.txt @@ -238,7 +238,6 @@ # DocField { 'colour': u'White:FFF', - 'default': u'Purchase - TC', 'doctype': u'DocField', 'fieldname': u'cost_center', 'fieldtype': u'Link', From a45f44d805a92955708193c7589e58d9a6d24374 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Apr 2012 18:26:08 +0530 Subject: [PATCH 03/24] remove def val from rv detail cost center --- erpnext/patches/april_2012/remove_default_from_rv_detail.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 erpnext/patches/april_2012/remove_default_from_rv_detail.py diff --git a/erpnext/patches/april_2012/remove_default_from_rv_detail.py b/erpnext/patches/april_2012/remove_default_from_rv_detail.py new file mode 100644 index 0000000000..cf81f6d2a7 --- /dev/null +++ b/erpnext/patches/april_2012/remove_default_from_rv_detail.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabDocField` set `default` = '' where fieldname = 'cost_center' and parent = 'RV Detail' and `default` = 'Purchase - TC'") From 69f6d797916691af731eb0edbdfa546fb73d05e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Apr 2012 18:27:53 +0530 Subject: [PATCH 04/24] patch list modified --- erpnext/patches/patch_list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index cd38480100..d07fd53cfa 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -227,5 +227,10 @@ patch_list = [ 'patch_file': 'reload_c_form', 'description': 'Added attchemnt option and total field' }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'remove_default_from_rv_detail', + 'description': '' + }, ] From 8f9a953931401bfa5a64f1cb795a8d55ca9f4adb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Apr 2012 19:00:39 +0530 Subject: [PATCH 05/24] Update erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py --- .../doctype/ledger_balance_export/ledger_balance_export.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py b/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py index 716283a799..79ccfa9d2d 100755 --- a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py +++ b/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py @@ -134,10 +134,10 @@ class DocType: for acc_det in sub_tree: acc_summary = self.get_acc_summary(glc, acc_det) - if acc_summary[2] or acc_summary[3]: + if acc_summary[0] or acc_summary[1] or acc_summary[2] or acc_summary[3] or acc_summary[4] or acc_summary[5]: res.append([acc_det['account']]) # Show gl entries if account is ledger - if acc_det['group_or_ledger'] == 'Ledger': + if acc_det['group_or_ledger'] == 'Ledger' and (acc_summary[2] or acc_summary[3]): gle = self.show_gl_entries(acc_det['account'].strip()) res += gle From 4c9525139d19690b9e596be004be7a2823f0b4d1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 10:38:37 +0530 Subject: [PATCH 06/24] Error fixed in stock ledger netry batch related --- .../stock/doctype/stock_ledger_entry/stock_ledger_entry.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index c9d23c69dd..58ad4c21c7 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -35,11 +35,12 @@ class DocType: def actual_amt_check(self): if self.doc.batch_no: batch_bal = flt(sql("select sum(actual_qty) from `tabStock Ledger Entry` where warehouse = '%s' and item_code = '%s' and batch_no = '%s'"%(self.doc.warehouse,self.doc.item_code,self.doc.batch_no))[0][0]) - + self.doc.fields.update({'batch_bal': batch_bal}) + if (batch_bal + self.doc.actual_qty) < 0: msgprint("""Not enough quantity (requested: %(actual_qty)s, current: %(batch_bal)s in Batch %(batch_no)s for Item %(item_code)s at Warehouse%(warehouse)s - as on %(posting_date)s %(posting_time)s""" % self.doc.fields.update({'batch_bal': batch_bal}), raise_exception = 1) + as on %(posting_date)s %(posting_time)s""" % self.doc.fields, raise_exception = 1) # mandatory From e6d808820ae72f84e3b2d3be8527dcd4b2c235c7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 11:06:48 +0530 Subject: [PATCH 07/24] Error fixed in notification control --- .../doctype/notification_control/notification_control.js | 8 ++++---- .../doctype/notification_control/notification_control.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js index 32919b6f9c..551269789e 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.js +++ b/erpnext/setup/doctype/notification_control/notification_control.js @@ -14,19 +14,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -cur_frm.cscript.select_transaction = function(doc, dt, dn) { +cur_frm.cscript.select_transaction = function(doc, cdt, cdn) { if(doc.select_transaction) { var callback = function(r,rt) { - var doc = locals[dt][dn]; + var doc = locals[cdt][cdn]; doc.custom_message = r.message; refresh_field('custom_message'); } - $c_obj('Notification Control','get_message',doc.select_transaction, callback) + $c_obj(make_doclist(cdt, cdn),'get_message',doc.select_transaction, callback) } } cur_frm.cscript.notify = function(doc, args) { - $c_obj('Notification Control', 'get_formatted_message', { + $c_obj(make_doclist(doc.doctype, doc.name), 'get_formatted_message', { type: args['type'], doctype: args['doctype'], contact_name: args['contact_name'] || doc.contact_display diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py index 9dc0076598..61f558765f 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.py +++ b/erpnext/setup/doctype/notification_control/notification_control.py @@ -39,7 +39,7 @@ class DocType: # set custom text # --------------- - def set_message(self, arg=''): + def set_message(self, arg = ''): fn = self.doc.select_transaction.lower().replace(' ', '_') + '_message' webnotes.conn.set(self.doc, fn, self.doc.custom_message) msgprint("Custom Message for %s updated!" % self.doc.select_transaction) From 663e971557c68f3f2da119f774ae121c2731d51a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 11:39:54 +0530 Subject: [PATCH 08/24] Make next document button hide/unhide --- erpnext/buying/doctype/indent/indent.js | 19 ++++--------------- .../doctype/purchase_order/purchase_order.js | 18 +++--------------- .../doctype/sales_order/sales_order.js | 1 - .../doctype/delivery_note/delivery_note.js | 8 +++----- .../purchase_receipt/purchase_receipt.js | 13 ++++--------- 5 files changed, 14 insertions(+), 45 deletions(-) diff --git a/erpnext/buying/doctype/indent/indent.js b/erpnext/buying/doctype/indent/indent.js index 570e06c1b8..089f8a76e9 100644 --- a/erpnext/buying/doctype/indent/indent.js +++ b/erpnext/buying/doctype/indent/indent.js @@ -47,32 +47,21 @@ cur_frm.cscript.get_item_defaults = function(doc) { //======================= Refresh ===================================== cur_frm.cscript.refresh = function(doc, cdt, cdn) { - - // Unhide Fields in Next Steps - // --------------------------------- - cur_frm.clear_custom_buttons(); if(doc.docstatus == 1 && doc.status != 'Stopped'){ - var ch = getchildren('Indent Detail',doc.name,'indent_details'); - var is_closed = 1; - for(var i in ch){ - if(flt(ch[i].qty) > flt(ch[i].ordered_qty)) is_closed = 0; - } - if(!is_closed) { + if(doc.per_ordered < 100) { cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']) cur_frm.add_custom_button('Stop ' + cur_frm.cscript.indent_doctype_label, cur_frm.cscript['Stop Purchase Requisition']) } cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); } - if(doc.docstatus == 1 && doc.status == 'Stopped') + if(doc.docstatus == 1 && doc.status == 'Stopped') cur_frm.add_custom_button('Unstop ' + cur_frm.cscript.indent_doctype_label, cur_frm.cscript['Unstop Purchase Requisition']) - if(doc.docstatus == 1) - unhide_field(['Repair Purchase Requisition']); - else - hide_field(['Repair Purchase Requisition']); + if(doc.docstatus == 1) unhide_field(['Repair Purchase Requisition']); + else hide_field(['Repair Purchase Requisition']); } //======================= validation =================================== diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 7af1204fa4..1b4cb37879 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -58,22 +58,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn); if(doc.docstatus == 1 && doc.status != 'Stopped'){ - var ch = getchildren('PO Detail',doc.name,'po_details'); - var allow_billing = 0; var allow_receipt = 0; cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); - - for(var i in ch){ - if(ch[i].qty > ch[i].received_qty) allow_receipt = 1; - if(ch[i].qty > ch[i].billed_qty) allow_billing = 1; - } - if(allow_receipt) - cur_frm.add_custom_button('Make Purchase Receipt', cur_frm.cscript['Make Purchase Receipt']); - - if(allow_billing) - cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Purchase Invoice']); - - if(allow_billing || allow_receipt) - cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']); + if(doc.per_received < 100) cur_frm.add_custom_button('Make Purchase Receipt', cur_frm.cscript['Make Purchase Receipt']); + if(doc.per_billed < 100) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Purchase Invoice']); + if(doc.per_billed < 100 || doc.per_received < 100) cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']); } if(doc.docstatus == 1 && doc.status == 'Stopped') diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index a2aaf8f00d..e87c4dc6b8 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -86,7 +86,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.per_delivered < 100 || doc.per_billed < 100) cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']); } else { - // un-stop cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']); } diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index d2b58f8fd6..6a9f0e19b4 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -62,12 +62,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']); - if (doc.docstatus!=1) { - hide_field(['SMS', 'Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']); - } else { + if (doc.docstatus==1) { cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); - unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']); - } + unhide_field('Repair Delivery Note'); + } else hide_field('Repair Delivery Note'); if(doc.docstatus==0 && !doc.__islocal) { cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 7ad9d91928..1490426cfe 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -62,15 +62,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.docstatus == 1){ - var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details'); - allow_billing = 0; - for(var i in ch){ - if(ch[i].qty > ch[i].billed_qty) allow_billing = 1; - } - cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']); - cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); - } - else{ + if (doc.per_billed < 100) cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']); + cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); + unhide_field(['Repair Purchase Receipt']); + } else{ hide_field(['Repair Purchase Receipt']); } } From 3fb741c3ef3e59959d31a24ae6af8af71f621f50 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 12:23:12 +0530 Subject: [PATCH 09/24] update role in address --- .../april_2012/update_role_in_address.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 erpnext/patches/april_2012/update_role_in_address.py diff --git a/erpnext/patches/april_2012/update_role_in_address.py b/erpnext/patches/april_2012/update_role_in_address.py new file mode 100644 index 0000000000..6917da422b --- /dev/null +++ b/erpnext/patches/april_2012/update_role_in_address.py @@ -0,0 +1,21 @@ +def execute(): + import webnotes + from webnotes.model.doc import addchild + from webnotes.model.code import get_obj + + webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and parent = 'Address'") + + role1 = ['Sales User', 'Purchase User', 'Accounts User', 'Maintenance User'] + role2 = ['Sales Manager', 'Sales Master Manager', 'Purchase Manager', 'Purchase Master Manager', 'Accounts Manager', 'Maintenance Manager'] + + addr = get_obj('DocType', 'Address', with_children=1) + for d in role1+role2: + ch = addchild(addr.doc, 'permissions', 'DocPerm', 0) + ch.role = d + ch.read = 1 + ch.write = 1 + ch.create = 1 + if d in role2: + ch.cancel = 1 + + ch.save() From dd828be432fbddb607150c5bd652fc1ca971f019 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 12:25:39 +0530 Subject: [PATCH 10/24] updated patch list --- erpnext/patches/patch_list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index d07fd53cfa..cce6330f11 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -232,5 +232,10 @@ patch_list = [ 'patch_file': 'remove_default_from_rv_detail', 'description': '' }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'update_role_in_address', + 'description': 'updated roles in address' + }, ] From 9a6dbfca8f8044af771256eb13ba08f0e1d2a46c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 12:40:50 +0530 Subject: [PATCH 11/24] updated permlevel in address --- erpnext/patches/april_2012/update_permlevel_in_address.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 erpnext/patches/april_2012/update_permlevel_in_address.py diff --git a/erpnext/patches/april_2012/update_permlevel_in_address.py b/erpnext/patches/april_2012/update_permlevel_in_address.py new file mode 100644 index 0000000000..f8deb2c4c3 --- /dev/null +++ b/erpnext/patches/april_2012/update_permlevel_in_address.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Address'") diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index cce6330f11..061aec1bf3 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -237,5 +237,10 @@ patch_list = [ 'patch_file': 'update_role_in_address', 'description': 'updated roles in address' }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'update_permlevel_in_address', + 'description': 'updated permlevel in address' + }, ] From 3afecb9e30ab304e5fee005e594fadd1a7959f98 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 13:32:26 +0530 Subject: [PATCH 12/24] update permission in appraisal --- .../april_2012/update_appraisal_permission.py | 14 ++++++++++++++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 erpnext/patches/april_2012/update_appraisal_permission.py diff --git a/erpnext/patches/april_2012/update_appraisal_permission.py b/erpnext/patches/april_2012/update_appraisal_permission.py new file mode 100644 index 0000000000..bd4578f5e4 --- /dev/null +++ b/erpnext/patches/april_2012/update_appraisal_permission.py @@ -0,0 +1,14 @@ +def execute(): + import webnotes + from webnotes.model.doc import addchild + from webnotes.model.code import get_obj + + webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and permlevel = 0 and parent in ('Appraisal', 'Ticket', 'Project')") + + appr = get_obj('DocType', 'Appraisal', with_children=1) + ch = addchild(appr.doc, 'permissions', 'DocPerm', 0) + ch.permlevel = 0 + ch.role = 'Employee' + ch.read = 1 + ch.write = 1 + ch.save() diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 061aec1bf3..987f0048f1 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -242,5 +242,10 @@ patch_list = [ 'patch_file': 'update_permlevel_in_address', 'description': 'updated permlevel in address' }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'update_appraisal_permission', + 'description': 'updated permission in appraisal' + }, ] From d98ca010824c344c1a6b6f2ce2cea0e66830ca46 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 14:07:04 +0530 Subject: [PATCH 13/24] fixed wrong serial no qty validation --- erpnext/stock/doctype/stock_ledger/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py index 577d2ef6e9..35b4f8882e 100644 --- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py +++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py @@ -211,7 +211,7 @@ class DocType: import datetime for d in getlist(obj.doclist, fname): if d.serial_no: - serial_nos = self.get_sr_no_list(d.serial_no, d.qty) + serial_nos = self.get_sr_no_list(d.serial_no) for a in serial_nos: serial_no = a.strip() if is_incoming: From ed7de5fee2fe34f0148379272711089211ba4b70 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 Apr 2012 15:07:46 +0530 Subject: [PATCH 14/24] posting time format validation --- erpnext/stock/doctype/bin/bin.py | 3 ++- .../doctype/stock_ledger_entry/stock_ledger_entry.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 8e1c949b6d..2b680e525d 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -44,6 +44,7 @@ class DocType: def update_stock(self, actual_qty=0, reserved_qty=0, ordered_qty=0, indented_qty=0, planned_qty=0, dt=None, sle_id='', posting_time='', serial_no = '', is_cancelled = 'No',doc_type='',doc_name='',is_amended='No'): if not dt: dt = nowdate() + # update the stock values (for current quantities) self.doc.actual_qty = flt(self.doc.actual_qty) + flt(actual_qty) self.doc.ordered_qty = flt(self.doc.ordered_qty) + flt(ordered_qty) @@ -298,7 +299,7 @@ class DocType: order by timestamp(posting_date, posting_time) asc, name asc""", \ (self.doc.item_code, self.doc.warehouse, \ prev_sle.get('posting_date','1900-01-01'), prev_sle.get('posting_time', '12:00')), as_dict = 1) - for sle in sll: + for sle in sll: # block if stock level goes negative on any date if val_method != 'Moving Average' or flt(allow_negative_stock) == 0: self.validate_negative_stock(cqty, sle) diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index 58ad4c21c7..dbc9d6c435 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -90,9 +90,17 @@ class DocType: if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles(): msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1) + def validate_posting_time(self): + """ Validate posting time format""" + if self.doc.posting_time and len(cstr(self.doc.posting_time)) == 8 and cstr(self.doc.posting_time)[-2:] != '00': + msgprint("Wrong format of posting time, can not complete the transaction. If you think \ + you entered posting time correctly, please contact ERPNext support team.") + raise Exception + def validate(self): self.validate_mandatory() + self.validate_posting_time() self.validate_item() self.actual_amt_check() self.check_stock_frozen_date() From 04a276c93491baca61eef120cc0d99abe403e9ce Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 Apr 2012 16:08:45 +0530 Subject: [PATCH 15/24] Error fixed in gl netry when negative entry and cancel event --- erpnext/accounts/doctype/gl_control/gl_control.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index fa98441258..2a1f2d4826 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -204,10 +204,17 @@ class DocType: # ---------------- def save_entries(self, cancel, adv_adj, update_outstanding): for le in self.entries: - # cancel - if cancel or flt(le.debit) < 0 or flt(le.credit) < 0: + #toggle debit, credit if negative entry + if flt(le.debit) < 0 or flt(le.credit) < 0: tmp=le.debit le.debit, le.credit = abs(flt(le.credit)), abs(flt(tmp)) + + # toggled debit/credit in two separate condition because both should be executed at the + # time of cancellation when there is negative amount (tax discount) + if cancel: + tmp=le.debit + le.debit, le.credit = abs(flt(le.credit)), abs(flt(tmp)) + le_obj = get_obj(doc=le) # validate except on_cancel From aa577ed82e82439074e623510cb243f84dc112f4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 Apr 2012 18:25:13 +0530 Subject: [PATCH 16/24] serial no fixes: sle creation through import data --- erpnext/patches/april_2012/serial_no_fixes.py | 6 + erpnext/patches/patch_list.py | 5 + erpnext/stock/doctype/serial_no/serial_no.py | 19 +- erpnext/stock/doctype/serial_no/serial_no.txt | 728 ++++++++++-------- .../doctype/stock_ledger/stock_ledger.py | 1 + 5 files changed, 414 insertions(+), 345 deletions(-) create mode 100644 erpnext/patches/april_2012/serial_no_fixes.py diff --git a/erpnext/patches/april_2012/serial_no_fixes.py b/erpnext/patches/april_2012/serial_no_fixes.py new file mode 100644 index 0000000000..b4fcf759bd --- /dev/null +++ b/erpnext/patches/april_2012/serial_no_fixes.py @@ -0,0 +1,6 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('stock', 'doctype', 'serial_no') + + webnotes.conn.sql("update `tabSerial No` set sle_exists = 1") diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 987f0048f1..65448859d2 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -247,5 +247,10 @@ patch_list = [ 'patch_file': 'update_appraisal_permission', 'description': 'updated permission in appraisal' }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'serial_no_fixes', + 'description': 'fixes for sle creation while import' + }, ] diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 2384171f6a..88f1bf21a6 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -71,10 +71,13 @@ class DocType(TransactionBase): self.validate_warehouse() self.validate_item() + def on_update(self): + if self.doc.warehouse and self.doc.status == 'In Store' and cint(self.doc.sle_exists) == 0 and \ + not sql("select name from `tabStock Ledger Entry` where serial_no = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name): + self.make_stock_ledger_entry(1) + webnotes.conn.set(self.doc, 'sle_exists', 1) + - # ------------------------ - # make stock ledger entry - # ------------------------ def make_stock_ledger_entry(self, qty): from webnotes.model.code import get_obj values = [{ @@ -91,21 +94,13 @@ class DocType(TransactionBase): 'incoming_rate' : self.doc.purchase_rate, 'company' : self.doc.company, 'fiscal_year' : self.doc.fiscal_year, - 'is_cancelled' : 'No', # is_cancelled is always 'No' because while deleted it can not find creation entry if it not created directly, voucher no != serial no. + 'is_cancelled' : 'No', # is_cancelled is always 'No' because while deleted it can not find creation entry if it not created directly, voucher no != serial no 'batch_no' : '', 'serial_no' : self.doc.name }] get_obj('Stock Ledger', 'Stock Ledger').update_stock(values) - # ---------- - # on update - # ---------- - def on_update(self): - if self.doc.localname and self.doc.warehouse and self.doc.status == 'In Store' and not sql("select name from `tabStock Ledger Entry` where serial_no = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name)): - self.make_stock_ledger_entry(1) - - # --------- # on trash # --------- diff --git a/erpnext/stock/doctype/serial_no/serial_no.txt b/erpnext/stock/doctype/serial_no/serial_no.txt index df42c7f1aa..4f2f265bfa 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.txt +++ b/erpnext/stock/doctype/serial_no/serial_no.txt @@ -3,113 +3,65 @@ # These values are common in all dictionaries { - 'creation': '2010-08-08 17:09:23', + 'creation': '2009-07-06 12:41:38', 'docstatus': 0, - 'modified': '2012-01-31 15:53:38', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-04-25 18:17:26', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1325570647', + '_last_update': u'1335356535', 'allow_trash': 1, - 'autoname': 'field:serial_no', - 'colour': 'White:FFF', - 'default_print_format': 'Standard', + 'autoname': u'field:serial_no', + 'colour': u'White:FFF', + 'default_print_format': u'Standard', 'doctype': 'DocType', - 'document_type': 'Master', - 'module': 'Stock', + 'document_type': u'Master', + 'module': u'Stock', 'name': '__common__', - 'search_fields': 'item_code,status', - 'section_style': 'Tabbed', - 'server_code_error': ' ', + 'search_fields': u'item_code,status', + 'section_style': u'Tabbed', + 'server_code_error': u' ', 'show_in_menu': 0, - 'subject': 'Item Code: %(item_code)s, Warehouse: %(warehouse)s', - 'tag_fields': 'status', - 'version': 191 + 'subject': u'Item Code: %(item_code)s, Warehouse: %(warehouse)s', + 'tag_fields': u'status', + 'version': 193 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Serial No', - 'parentfield': 'fields', - 'parenttype': 'DocType' + 'parent': u'Serial No', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Serial No', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Serial No', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, Serial No { 'doctype': 'DocType', - 'name': 'Serial No' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'permlevel': 1, - 'role': 'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'permlevel': 0, - 'role': 'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'permlevel': 1, - 'role': 'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'permlevel': 0, - 'role': 'Material User', - 'submit': 0, - 'write': 0 + 'name': u'Serial No' }, # DocPerm { 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'System Manager', + 'role': u'System Manager', 'write': 1 }, @@ -117,212 +69,275 @@ { 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material Master Manager', + 'role': u'Material Master Manager', 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'System Manager' + 'role': u'System Manager' }, # DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Sales Master Manager' + 'role': u'Sales Master Manager' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Details', - 'oldfieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Details', + 'oldfieldtype': u'Section Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0 }, # DocField { - 'default': 'In Store', - 'doctype': 'DocField', - 'fieldname': 'status', - 'fieldtype': 'Select', + 'default': u'In Store', + 'doctype': u'DocField', + 'fieldname': u'status', + 'fieldtype': u'Select', + 'hidden': 0, 'in_filter': 1, - 'label': 'Status', + 'label': u'Status', 'no_copy': 1, - 'oldfieldname': 'status', - 'oldfieldtype': 'Select', - 'options': '\nIn Store\nDelivered\nNot in Use\nPurchase Returned', + 'oldfieldname': u'status', + 'oldfieldtype': u'Select', + 'options': u'\nIn Store\nDelivered\nNot in Use\nPurchase Returned', 'permlevel': 1, + 'print_hide': 0, 'reqd': 1, 'search_index': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'serial_no', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'serial_no', + 'fieldtype': u'Data', + 'hidden': 0, 'in_filter': 0, - 'label': 'Serial No', + 'label': u'Serial No', 'no_copy': 1, - 'oldfieldname': 'serial_no', - 'oldfieldtype': 'Data', + 'oldfieldname': u'serial_no', + 'oldfieldtype': u'Data', 'permlevel': 0, + 'print_hide': 0, 'reqd': 1, 'search_index': 1 }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'item_code', - 'fieldtype': 'Link', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'item_code', + 'fieldtype': u'Link', + 'hidden': 0, 'in_filter': 1, - 'label': 'Item Code', - 'oldfieldname': 'item_code', - 'oldfieldtype': 'Link', - 'options': 'Item', + 'label': u'Item Code', + 'oldfieldname': u'item_code', + 'oldfieldtype': u'Link', + 'options': u'Item', 'permlevel': 0, + 'print_hide': 0, 'reqd': 1, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'item_name', - 'fieldtype': 'Data', - 'label': 'Item Name', + 'doctype': u'DocField', + 'fieldname': u'item_name', + 'fieldtype': u'Data', + 'label': u'Item Name', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'description', - 'fieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Text', + 'hidden': 0, 'in_filter': 1, - 'label': 'Description', - 'oldfieldname': 'description', - 'oldfieldtype': 'Text', + 'label': u'Description', + 'oldfieldname': u'description', + 'oldfieldtype': u'Text', 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, 'search_index': 0, - 'width': '300px' + 'width': u'300px' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'item_group', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'item_group', + 'fieldtype': u'Link', + 'hidden': 0, 'in_filter': 0, - 'label': 'Item Group', - 'oldfieldname': 'item_group', - 'oldfieldtype': 'Link', - 'options': 'Item Group', + 'label': u'Item Group', + 'oldfieldname': u'item_group', + 'oldfieldtype': u'Link', + 'options': u'Item Group', 'permlevel': 1, + 'print_hide': 0, 'reqd': 1, 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'brand', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'brand', + 'fieldtype': u'Link', + 'hidden': 0, 'in_filter': 0, - 'label': 'Brand', - 'oldfieldname': 'brand', - 'oldfieldtype': 'Link', - 'options': 'Brand', + 'label': u'Brand', + 'oldfieldname': u'brand', + 'oldfieldtype': u'Link', + 'options': u'Brand', 'permlevel': 1, + 'print_hide': 0, 'reqd': 0, 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Purchase Details', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Purchase Details', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'purchase_document_type', - 'fieldtype': 'Select', - 'label': 'Purchase Document Type', + 'doctype': u'DocField', + 'fieldname': u'purchase_document_type', + 'fieldtype': u'Select', + 'label': u'Purchase Document Type', 'no_copy': 1, - 'options': '\nPurchase Receipt\nStock Entry', + 'options': u'\nPurchase Receipt\nStock Entry', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'purchase_document_no', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'purchase_document_no', + 'fieldtype': u'Data', 'hidden': 0, - 'label': 'Purchase Document No', + 'label': u'Purchase Document No', 'no_copy': 1, 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'purchase_date', - 'fieldtype': 'Date', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'purchase_date', + 'fieldtype': u'Date', + 'hidden': 0, 'in_filter': 1, - 'label': 'Purchase Date', + 'label': u'Purchase Date', 'no_copy': 1, - 'oldfieldname': 'purchase_date', - 'oldfieldtype': 'Date', + 'oldfieldname': u'purchase_date', + 'oldfieldtype': u'Date', 'permlevel': 0, + 'print_hide': 0, 'reqd': 0, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'purchase_time', - 'fieldtype': 'Time', - 'label': 'Incoming Time', + 'doctype': u'DocField', + 'fieldname': u'purchase_time', + 'fieldtype': u'Time', + 'label': u'Incoming Time', 'no_copy': 1, 'permlevel': 0, 'reqd': 1 @@ -330,336 +345,367 @@ # DocField { - 'doctype': 'DocField', - 'fieldname': 'purchase_rate', - 'fieldtype': 'Currency', + 'doctype': u'DocField', + 'fieldname': u'purchase_rate', + 'fieldtype': u'Currency', + 'hidden': 0, 'in_filter': 0, - 'label': 'Incoming Rate', + 'label': u'Incoming Rate', 'no_copy': 1, - 'oldfieldname': 'purchase_rate', - 'oldfieldtype': 'Currency', + 'oldfieldname': u'purchase_rate', + 'oldfieldtype': u'Currency', 'permlevel': 0, + 'print_hide': 0, 'reqd': 1, 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'warehouse', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'warehouse', + 'fieldtype': u'Link', + 'hidden': 0, 'in_filter': 1, - 'label': 'Warehouse', + 'label': u'Warehouse', 'no_copy': 1, - 'oldfieldname': 'warehouse', - 'oldfieldtype': 'Link', - 'options': 'Warehouse', + 'oldfieldname': u'warehouse', + 'oldfieldtype': u'Link', + 'options': u'Warehouse', 'permlevel': 0, + 'print_hide': 0, 'reqd': 0, 'search_index': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'supplier', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'supplier', + 'fieldtype': u'Link', 'in_filter': 1, - 'label': 'Supplier', + 'label': u'Supplier', 'no_copy': 1, - 'options': 'Supplier', + 'options': u'Supplier', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'supplier_name', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'supplier_name', + 'fieldtype': u'Data', 'in_filter': 1, - 'label': 'Supplier Name', + 'label': u'Supplier Name', 'no_copy': 1, 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'address_display', - 'fieldtype': 'Text', - 'label': 'Supplier Address', + 'doctype': u'DocField', + 'fieldname': u'address_display', + 'fieldtype': u'Text', + 'label': u'Supplier Address', 'no_copy': 1, 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Delivery Details', - 'oldfieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Delivery Details', + 'oldfieldtype': u'Column Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'delivery_document_type', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'delivery_document_type', + 'fieldtype': u'Select', 'in_filter': 1, - 'label': 'Delivery Document Type', + 'label': u'Delivery Document Type', 'no_copy': 1, - 'options': '\nDelivery Note\nReceivable Voucher\nStock Entry', + 'options': u'\nDelivery Note\nReceivable Voucher\nStock Entry', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'delivery_document_no', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'delivery_document_no', + 'fieldtype': u'Data', 'in_filter': 1, - 'label': 'Delivery Document No', + 'label': u'Delivery Document No', 'no_copy': 1, 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'customer_address', - 'fieldtype': 'Text', - 'label': 'Customer Address', - 'oldfieldname': 'customer_address', - 'oldfieldtype': 'Text', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'delivery_date', - 'fieldtype': 'Date', - 'label': 'Delivery Date', - 'no_copy': 1, - 'oldfieldname': 'delivery_date', - 'oldfieldtype': 'Date', + 'doctype': u'DocField', + 'fieldname': u'customer_address', + 'fieldtype': u'Text', + 'hidden': 0, + 'label': u'Customer Address', + 'oldfieldname': u'customer_address', + 'oldfieldtype': u'Text', 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'delivery_date', + 'fieldtype': u'Date', + 'hidden': 0, + 'label': u'Delivery Date', + 'no_copy': 1, + 'oldfieldname': u'delivery_date', + 'oldfieldtype': u'Date', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'delivery_time', - 'fieldtype': 'Time', - 'label': 'Delivery Time', + 'doctype': u'DocField', + 'fieldname': u'delivery_time', + 'fieldtype': u'Time', + 'label': u'Delivery Time', 'no_copy': 1, 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'is_cancelled', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'is_cancelled', + 'fieldtype': u'Select', 'hidden': 1, - 'label': 'Is Cancelled', - 'oldfieldname': 'is_cancelled', - 'oldfieldtype': 'Select', - 'options': '\nYes\nNo', + 'label': u'Is Cancelled', + 'oldfieldname': u'is_cancelled', + 'oldfieldtype': u'Select', + 'options': u'\nYes\nNo', 'permlevel': 0, - 'report_hide': 1 + 'print_hide': 0, + 'report_hide': 1, + 'reqd': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'customer', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'customer', + 'fieldtype': u'Link', + 'hidden': 0, 'in_filter': 1, - 'label': 'Customer', + 'label': u'Customer', 'no_copy': 1, - 'oldfieldname': 'customer', - 'oldfieldtype': 'Link', - 'options': 'Customer', + 'oldfieldname': u'customer', + 'oldfieldtype': u'Link', + 'options': u'Customer', 'permlevel': 1, 'print_hide': 1, + 'reqd': 0, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'customer_name', - 'fieldtype': 'Data', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'customer_name', + 'fieldtype': u'Data', + 'hidden': 0, 'in_filter': 1, - 'label': 'Customer Name', + 'label': u'Customer Name', 'no_copy': 1, - 'oldfieldname': 'customer_name', - 'oldfieldtype': 'Data', + 'oldfieldname': u'customer_name', + 'oldfieldtype': u'Data', 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'delivery_address', - 'fieldtype': 'Text', - 'label': 'Delivery Address', + 'doctype': u'DocField', + 'fieldname': u'delivery_address', + 'fieldtype': u'Text', + 'label': u'Delivery Address', 'no_copy': 1, 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'territory', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'territory', + 'fieldtype': u'Link', + 'hidden': 0, 'in_filter': 1, - 'label': 'Territory', + 'label': u'Territory', 'no_copy': 1, - 'oldfieldname': 'territory', - 'oldfieldtype': 'Link', - 'options': 'Territory', + 'oldfieldname': u'territory', + 'oldfieldtype': u'Link', + 'options': u'Territory', 'permlevel': 1, 'print_hide': 1, - 'report_hide': 0 + 'report_hide': 0, + 'reqd': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Warranty / AMC Details', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Warranty / AMC Details', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'maintenance_status', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'maintenance_status', + 'fieldtype': u'Select', + 'hidden': 0, 'in_filter': 1, - 'label': 'Maintenance Status', + 'label': u'Maintenance Status', 'no_copy': 0, - 'oldfieldname': 'maintenance_status', - 'oldfieldtype': 'Select', - 'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC', + 'oldfieldname': u'maintenance_status', + 'oldfieldtype': u'Select', + 'options': u'\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC', 'permlevel': 0, + 'print_hide': 0, + 'reqd': 0, 'search_index': 1, - 'width': '150px' + 'width': u'150px' }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'warranty_period', - 'fieldtype': 'Int', - 'label': 'Warranty Period (Days)', - 'oldfieldname': 'warranty_period', - 'oldfieldtype': 'Int', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'warranty_period', + 'fieldtype': u'Int', + 'hidden': 0, + 'label': u'Warranty Period (Days)', + 'oldfieldname': u'warranty_period', + 'oldfieldtype': u'Int', 'permlevel': 0, - 'trigger': 'Client', - 'width': '150px' + 'print_hide': 0, + 'reqd': 0, + 'trigger': u'Client', + 'width': u'150px' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'warranty_expiry_date', - 'fieldtype': 'Date', + 'doctype': u'DocField', + 'fieldname': u'warranty_expiry_date', + 'fieldtype': u'Date', + 'hidden': 0, 'in_filter': 1, - 'label': 'Warranty Expiry Date', - 'oldfieldname': 'warranty_expiry_date', - 'oldfieldtype': 'Date', + 'label': u'Warranty Expiry Date', + 'oldfieldname': u'warranty_expiry_date', + 'oldfieldtype': u'Date', 'permlevel': 0, - 'width': '150px' + 'print_hide': 0, + 'reqd': 0, + 'width': u'150px' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'amc_expiry_date', - 'fieldtype': 'Date', + 'doctype': u'DocField', + 'fieldname': u'amc_expiry_date', + 'fieldtype': u'Date', + 'hidden': 0, 'in_filter': 1, - 'label': 'AMC Expiry Date', - 'oldfieldname': 'amc_expiry_date', - 'oldfieldtype': 'Date', + 'label': u'AMC Expiry Date', + 'oldfieldname': u'amc_expiry_date', + 'oldfieldtype': u'Date', 'permlevel': 0, + 'print_hide': 0, + 'reqd': 0, 'search_index': 0, - 'width': '150px' + 'width': u'150px' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'More Info', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'More Info', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'serial_no_details', - 'fieldtype': 'Text Editor', - 'label': 'Serial No Details', + 'doctype': u'DocField', + 'fieldname': u'serial_no_details', + 'fieldtype': u'Text Editor', + 'label': u'Serial No Details', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'company', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Select', 'in_filter': 1, - 'label': 'Company', - 'options': 'link:Company', + 'label': u'Company', + 'options': u'link:Company', 'permlevel': 0, 'reqd': 1, 'search_index': 1 @@ -667,12 +713,12 @@ # DocField { - 'doctype': 'DocField', - 'fieldname': 'fiscal_year', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'fiscal_year', + 'fieldtype': u'Select', 'in_filter': 1, - 'label': 'Fiscal Year', - 'options': 'link:Fiscal Year', + 'label': u'Fiscal Year', + 'options': u'link:Fiscal Year', 'permlevel': 0, 'reqd': 1, 'search_index': 1 @@ -680,12 +726,28 @@ # DocField { - 'doctype': 'DocField', - 'fieldname': 'trash_reason', - 'fieldtype': 'Small Text', - 'label': 'Trash Reason', - 'oldfieldname': 'trash_reason', - 'oldfieldtype': 'Small Text', - 'permlevel': 1 + 'doctype': u'DocField', + 'fieldname': u'trash_reason', + 'fieldtype': u'Small Text', + 'hidden': 0, + 'label': u'Trash Reason', + 'oldfieldname': u'trash_reason', + 'oldfieldtype': u'Small Text', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'sle_exists', + 'fieldtype': u'Check', + 'hidden': 1, + 'label': u'sle_exists', + 'no_copy': 1, + 'permlevel': 1, + 'print_hide': 1, + 'report_hide': 1 } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py index 35b4f8882e..1d3aabe57f 100644 --- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py +++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py @@ -128,6 +128,7 @@ class DocType: s.modified = nowdate() s.modified_by = session['user'] s.serial_no = serial_no + s.sle_exists = 1 s.fiscal_year = obj.doc.fiscal_year s.company = obj.doc.company s.save(new_rec) From 5a6e641565961627275892e1e05ad22dd128cc5e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 26 Apr 2012 11:11:34 +0530 Subject: [PATCH 17/24] fixed batch issue --- erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index dbc9d6c435..0417f6bae9 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -41,6 +41,8 @@ class DocType: msgprint("""Not enough quantity (requested: %(actual_qty)s, current: %(batch_bal)s in Batch %(batch_no)s for Item %(item_code)s at Warehouse%(warehouse)s as on %(posting_date)s %(posting_time)s""" % self.doc.fields, raise_exception = 1) + + self.doc.fields.pop('batch_bal') # mandatory From 92ec4dcb6fcf204f11b8fceaace7e5d2e9f0010b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 26 Apr 2012 13:13:10 +0530 Subject: [PATCH 18/24] minor fixes --- erpnext/patches/april_2012/after_sync_cleanup.py | 2 +- erpnext/patches/april_2012/change_cacheitem_schema.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/april_2012/after_sync_cleanup.py b/erpnext/patches/april_2012/after_sync_cleanup.py index ab9e70e2ff..33840a00e8 100644 --- a/erpnext/patches/april_2012/after_sync_cleanup.py +++ b/erpnext/patches/april_2012/after_sync_cleanup.py @@ -1,5 +1,5 @@ def execute(): import webnotes from webnotes.model import delete_doc - + webnotes.conn.sql("update `tabDocType` set module = 'Utilities' where name in ('Question', 'Answer')") delete_doc('Module Def', 'Knowledge Base') diff --git a/erpnext/patches/april_2012/change_cacheitem_schema.py b/erpnext/patches/april_2012/change_cacheitem_schema.py index ab127e3396..dc3c253689 100644 --- a/erpnext/patches/april_2012/change_cacheitem_schema.py +++ b/erpnext/patches/april_2012/change_cacheitem_schema.py @@ -1,3 +1,5 @@ def execute(): import webnotes + webnotes.conn.commit() webnotes.conn.sql("alter table __CacheItem modify `value` longtext") + webnotes.conn.begin() From 702473d65edda32c09e5be70ff225a2831e77580 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 26 Apr 2012 19:01:35 +0530 Subject: [PATCH 19/24] website updates --- css/all-app.css | 17 +- css/all-web.css | 425 +++++++++++++++++- erpnext/startup/startup.css | 1 - erpnext/startup/startup.js | 2 +- erpnext/website/css/website.css | 27 +- erpnext/website/doctype/blog/blog.py | 10 +- erpnext/website/doctype/blog/blog.txt | 45 +- erpnext/website/doctype/blog/blog_page.js | 26 +- erpnext/website/doctype/blog/template.html | 8 +- .../style_settings/custom_template.css | 2 +- .../website/doctype/web_page/template.html | 3 - erpnext/website/doctype/web_page/web_page.js | 4 +- erpnext/website/js/topbar.js | 3 +- erpnext/website/page/blog/blog.html | 1 + erpnext/website/page/blog/blog.js | 18 +- js/all-app.js | 11 +- js/all-web.js | 7 +- 17 files changed, 515 insertions(+), 95 deletions(-) diff --git a/css/all-app.css b/css/all-app.css index 21cf8fb041..66229fd393 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -1728,7 +1728,6 @@ body { padding: 0px; font-size: 14px; color: #000; - background-color: #e2e2e2; } /* font settings */ @@ -1848,12 +1847,12 @@ div.comment { color: #444; } div#body_div { display: none; padding-right: 7px; - width: 900px; - margin: auto; - margin-top: 56px; + padding-top: 70px; + padding-bottom: 50px; } .content { + margin: auto; width: 900px; } @@ -1864,23 +1863,19 @@ div#body_div { transition: background 1s ease-in; } -footer { - width: 900px; - margin: auto; -} header .container { width: 900px; margin: auto; } @media (max-width: 1200px) { - div#body_div, header .container, .content, #opened-page-selector, footer { + header .container, .content { width: 900px; } } @media (min-width: 1200px) { - div#body_div, header .container, .content, #opened-page-selector, footer { + header .container, .content { width: 1100px; } } @@ -1931,7 +1926,6 @@ div.std-footer-item { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; - margin-bottom: 30px; overflow: hidden; } @@ -3581,7 +3575,6 @@ span, div, td, input, textarea, button, select { } body { - background: url(../images/redbeech.jpg) repeat; color: #616161; } diff --git a/css/all-web.css b/css/all-web.css index 8ac14cb716..c7ab6f89e8 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -1195,6 +1195,387 @@ button.btn.small, input[type="submit"].btn.small { margin-bottom: 0; } +/* + * lib/css/bootstrap/icons.css + */ +[class^="icon-"], [class*=" icon-"] { + display: inline-block; + width: 14px; + height: 14px; + line-height: 14px; + vertical-align: text-top; + background-image: url("../lib/images/icons/glyphicons-halflings.png"); + background-position: 14px 14px; + background-repeat: no-repeat; + *margin-right: .3em; +} +[class^="icon-"]:last-child, [class*=" icon-"]:last-child { + *margin-left: 0; +} +.icon-white { + background-image: url("../lib/images/icons/glyphicons-halflings-white.png"); +} +.icon-glass { + background-position: 0 0; +} +.icon-music { + background-position: -24px 0; +} +.icon-search { + background-position: -48px 0; +} +.icon-envelope { + background-position: -72px 0; +} +.icon-heart { + background-position: -96px 0; +} +.icon-star { + background-position: -120px 0; +} +.icon-star-empty { + background-position: -144px 0; +} +.icon-user { + background-position: -168px 0; +} +.icon-film { + background-position: -192px 0; +} +.icon-th-large { + background-position: -216px 0; +} +.icon-th { + background-position: -240px 0; +} +.icon-th-list { + background-position: -264px 0; +} +.icon-ok { + background-position: -288px 0; +} +.icon-remove { + background-position: -312px 0; +} +.icon-zoom-in { + background-position: -336px 0; +} +.icon-zoom-out { + background-position: -360px 0; +} +.icon-off { + background-position: -384px 0; +} +.icon-signal { + background-position: -408px 0; +} +.icon-cog { + background-position: -432px 0; +} +.icon-trash { + background-position: -456px 0; +} +.icon-home { + background-position: 0 -24px; +} +.icon-file { + background-position: -24px -24px; +} +.icon-time { + background-position: -48px -24px; +} +.icon-road { + background-position: -72px -24px; +} +.icon-download-alt { + background-position: -96px -24px; +} +.icon-download { + background-position: -120px -24px; +} +.icon-upload { + background-position: -144px -24px; +} +.icon-inbox { + background-position: -168px -24px; +} +.icon-play-circle { + background-position: -192px -24px; +} +.icon-repeat { + background-position: -216px -24px; +} +.icon-refresh { + background-position: -240px -24px; +} +.icon-list-alt { + background-position: -264px -24px; +} +.icon-lock { + background-position: -287px -24px; +} +.icon-flag { + background-position: -312px -24px; +} +.icon-headphones { + background-position: -336px -24px; +} +.icon-volume-off { + background-position: -360px -24px; +} +.icon-volume-down { + background-position: -384px -24px; +} +.icon-volume-up { + background-position: -408px -24px; +} +.icon-qrcode { + background-position: -432px -24px; +} +.icon-barcode { + background-position: -456px -24px; +} +.icon-tag { + background-position: 0 -48px; +} +.icon-tags { + background-position: -25px -48px; +} +.icon-book { + background-position: -48px -48px; +} +.icon-bookmark { + background-position: -72px -48px; +} +.icon-print { + background-position: -96px -48px; +} +.icon-camera { + background-position: -120px -48px; +} +.icon-font { + background-position: -144px -48px; +} +.icon-bold { + background-position: -167px -48px; +} +.icon-italic { + background-position: -192px -48px; +} +.icon-text-height { + background-position: -216px -48px; +} +.icon-text-width { + background-position: -240px -48px; +} +.icon-align-left { + background-position: -264px -48px; +} +.icon-align-center { + background-position: -288px -48px; +} +.icon-align-right { + background-position: -312px -48px; +} +.icon-align-justify { + background-position: -336px -48px; +} +.icon-list { + background-position: -360px -48px; +} +.icon-indent-left { + background-position: -384px -48px; +} +.icon-indent-right { + background-position: -408px -48px; +} +.icon-facetime-video { + background-position: -432px -48px; +} +.icon-picture { + background-position: -456px -48px; +} +.icon-pencil { + background-position: 0 -72px; +} +.icon-map-marker { + background-position: -24px -72px; +} +.icon-adjust { + background-position: -48px -72px; +} +.icon-tint { + background-position: -72px -72px; +} +.icon-edit { + background-position: -96px -72px; +} +.icon-share { + background-position: -120px -72px; +} +.icon-check { + background-position: -144px -72px; +} +.icon-move { + background-position: -168px -72px; +} +.icon-step-backward { + background-position: -192px -72px; +} +.icon-fast-backward { + background-position: -216px -72px; +} +.icon-backward { + background-position: -240px -72px; +} +.icon-play { + background-position: -264px -72px; +} +.icon-pause { + background-position: -288px -72px; +} +.icon-stop { + background-position: -312px -72px; +} +.icon-forward { + background-position: -336px -72px; +} +.icon-fast-forward { + background-position: -360px -72px; +} +.icon-step-forward { + background-position: -384px -72px; +} +.icon-eject { + background-position: -408px -72px; +} +.icon-chevron-left { + background-position: -432px -72px; +} +.icon-chevron-right { + background-position: -456px -72px; +} +.icon-plus-sign { + background-position: 0 -96px; +} +.icon-minus-sign { + background-position: -24px -96px; +} +.icon-remove-sign { + background-position: -48px -96px; +} +.icon-ok-sign { + background-position: -72px -96px; +} +.icon-question-sign { + background-position: -96px -96px; +} +.icon-info-sign { + background-position: -120px -96px; +} +.icon-screenshot { + background-position: -144px -96px; +} +.icon-remove-circle { + background-position: -168px -96px; +} +.icon-ok-circle { + background-position: -192px -96px; +} +.icon-ban-circle { + background-position: -216px -96px; +} +.icon-arrow-left { + background-position: -240px -96px; +} +.icon-arrow-right { + background-position: -264px -96px; +} +.icon-arrow-up { + background-position: -289px -96px; +} +.icon-arrow-down { + background-position: -312px -96px; +} +.icon-share-alt { + background-position: -336px -96px; +} +.icon-resize-full { + background-position: -360px -96px; +} +.icon-resize-small { + background-position: -384px -96px; +} +.icon-plus { + background-position: -408px -96px; +} +.icon-minus { + background-position: -433px -96px; +} +.icon-asterisk { + background-position: -456px -96px; +} +.icon-exclamation-sign { + background-position: 0 -120px; +} +.icon-gift { + background-position: -24px -120px; +} +.icon-leaf { + background-position: -48px -120px; +} +.icon-fire { + background-position: -72px -120px; +} +.icon-eye-open { + background-position: -96px -120px; +} +.icon-eye-close { + background-position: -120px -120px; +} +.icon-warning-sign { + background-position: -144px -120px; +} +.icon-plane { + background-position: -168px -120px; +} +.icon-calendar { + background-position: -192px -120px; +} +.icon-random { + background-position: -216px -120px; +} +.icon-comment { + background-position: -240px -120px; +} +.icon-magnet { + background-position: -264px -120px; +} +.icon-chevron-up { + background-position: -288px -120px; +} +.icon-chevron-down { + background-position: -313px -119px; +} +.icon-retweet { + background-position: -336px -120px; +} +.icon-shopping-cart { + background-position: -360px -120px; +} +.icon-folder-close { + background-position: -384px -120px; +} +.icon-folder-open { + background-position: -408px -120px; +} +.icon-resize-vertical { + background-position: -432px -119px; +} +.icon-resize-horizontal { + background-position: -456px -118px; +} + /* * lib/css/legacy/body.css */ @@ -1208,7 +1589,6 @@ body { padding: 0px; font-size: 14px; color: #000; - background-color: #e2e2e2; } /* font settings */ @@ -1328,12 +1708,12 @@ div.comment { color: #444; } div#body_div { display: none; padding-right: 7px; - width: 900px; - margin: auto; - margin-top: 56px; + padding-top: 70px; + padding-bottom: 50px; } .content { + margin: auto; width: 900px; } @@ -1344,23 +1724,19 @@ div#body_div { transition: background 1s ease-in; } -footer { - width: 900px; - margin: auto; -} header .container { width: 900px; margin: auto; } @media (max-width: 1200px) { - div#body_div, header .container, .content, #opened-page-selector, footer { + header .container, .content { width: 900px; } } @media (min-width: 1200px) { - div#body_div, header .container, .content, #opened-page-selector, footer { + header .container, .content { width: 1100px; } } @@ -1411,7 +1787,6 @@ div.std-footer-item { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; - margin-bottom: 30px; overflow: hidden; } @@ -1898,7 +2273,6 @@ span, div, td, input, textarea, button, select { } body { - background: url(../images/redbeech.jpg) repeat; color: #616161; } @@ -1943,12 +2317,13 @@ body { /* * erpnext/website/css/website.css */ -div#body_div, header .container, .content, #opened-page-selector, footer { +header .container, .content { width: 900px; } div#body_div { - margin-top: 90px; + padding-top: 90px; + min-height: 400px; } p, li { @@ -2007,19 +2382,23 @@ pre { background-color: #444; } + footer { - color: #777; + background-color: #eee; + box-shadow: inset 0 10px 10px rgba(0,0,0,0.3), inset 0 3px 3px rgba(0,0,0,0.3); + border-top: 1px solid #555; + padding-top: 10px; + text-align: center; } .web-footer { color: inherit; - text-align: center; - margin: 10px; + padding: 10px; line-height: 1.7; } .web-footer div, .web-footer a { - font-size: 14px; + font-size: 12px; } .web-footer-menu { @@ -2038,10 +2417,20 @@ footer { border-right: 1px solid #999; } +.web-footer-menu ul li:first-child { + padding-left: 0px; +} + .web-footer-menu ul li:last-child { border-right: 0px solid #777 !important; } +.web-footer-powered { + color: #888; + float: right; + margin-top: -12px; +} + /* slide view */ .next-slide { diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css index bd21144ec6..5ba72f30f8 100644 --- a/erpnext/startup/startup.css +++ b/erpnext/startup/startup.css @@ -13,7 +13,6 @@ span, div, td, input, textarea, button, select { } body { - background: url(../images/redbeech.jpg) repeat; color: #616161; } diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 442e7be090..9c14d2efb8 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -170,7 +170,7 @@ erpnext.startup.set_periodic_updates = function() { } erpnext.set_user_background = function(src) { - set_style(repl('body { background: url("files/%(src)s") repeat;}', {src:src})) + set_style(repl('#body_div { background: url("files/%(src)s") repeat;}', {src:src})) } // start diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index ad8702ab47..fa27d4a9f8 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -1,9 +1,10 @@ -div#body_div, header .container, .content, #opened-page-selector, footer { +header .container, .content { width: 900px; } div#body_div { - margin-top: 90px; + padding-top: 90px; + min-height: 400px; } p, li { @@ -62,19 +63,23 @@ pre { background-color: #444; } + footer { - color: #777; + background-color: #eee; + box-shadow: inset 0 10px 10px rgba(0,0,0,0.3), inset 0 3px 3px rgba(0,0,0,0.3); + border-top: 1px solid #555; + padding-top: 10px; + text-align: center; } .web-footer { color: inherit; - text-align: center; - margin: 10px; + padding: 10px; line-height: 1.7; } .web-footer div, .web-footer a { - font-size: 14px; + font-size: 12px; } .web-footer-menu { @@ -93,10 +98,20 @@ footer { border-right: 1px solid #999; } +.web-footer-menu ul li:first-child { + padding-left: 0px; +} + .web-footer-menu ul li:last-child { border-right: 0px solid #777 !important; } +.web-footer-powered { + color: #888; + float: right; + margin-top: -12px; +} + /* slide view */ .next-slide { diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index 1f1b98b410..c78a9cc3b9 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -32,9 +32,11 @@ class DocType(): self.doc.name = website.utils.page_name(self.doc.title) def validate(self): - """write/update 'Page' with the blog""" + """write/update 'Page' with the blog""" + if self.doc.page_name: + webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name) + p = website.utils.add_page(self.doc.title) - self.doc.name = p.name from jinja2 import Template import markdown2 @@ -54,11 +56,11 @@ class DocType(): p.save() website.utils.add_guest_access_to_page(p.name) + self.doc.page_name = p.name # cleanup for f in ['content_html', 'full_name', 'updated']: if f in self.doc.fields: - del self.doc.fields[f] - + del self.doc.fields[f] \ No newline at end of file diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt index f9ff6fd47f..ad44d13d96 100644 --- a/erpnext/website/doctype/blog/blog.txt +++ b/erpnext/website/doctype/blog/blog.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:47', + 'creation': '2012-04-02 16:02:43', 'docstatus': 0, - 'modified': '2012-03-27 14:36:47', + 'modified': '2012-04-26 16:58:27', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -21,7 +21,7 @@ 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 3 + 'version': 5 }, # These values are common for all DocField @@ -35,15 +35,12 @@ # These values are common for all DocPerm { - 'create': 1, 'doctype': u'DocPerm', 'name': '__common__', 'parent': u'Blog', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'write': 1 + 'read': 1 }, # DocType, Blog @@ -54,14 +51,27 @@ # DocPerm { + 'create': 1, 'doctype': u'DocPerm', - 'role': u'Website Manager' + 'permlevel': 0, + 'role': u'Website Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Blogger', + 'write': 1 }, # DocPerm { 'doctype': u'DocPerm', - 'role': u'Blogger' + 'permlevel': 1, + 'role': u'All' }, # DocField @@ -70,7 +80,8 @@ 'fieldname': u'title', 'fieldtype': u'Data', 'label': u'Title', - 'permlevel': 0 + 'permlevel': 0, + 'reqd': 1 }, # DocField @@ -88,7 +99,8 @@ 'fieldname': u'content', 'fieldtype': u'Code', 'label': u'Content', - 'permlevel': 0 + 'permlevel': 0, + 'reqd': 0 }, # DocField @@ -96,10 +108,19 @@ 'doctype': u'DocField', 'fieldname': u'content_html', 'fieldtype': u'Text', - 'label': u'Preview', + 'label': u'Content HTML', 'permlevel': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'page_name', + 'fieldtype': u'Data', + 'label': u'Page Name', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js index aa3f4c57b1..dddc6e04f8 100644 --- a/erpnext/website/doctype/blog/blog_page.js +++ b/erpnext/website/doctype/blog/blog_page.js @@ -18,32 +18,28 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) { // sidebar - var side = $(wrapper).find('.web-side-section') - .append('

Recent Posts

').get(0); - wrapper.recent_list = new wn.ui.Listing({ - parent: side, + parent: $(wrapper).find('.recent-posts'), + no_toolbar: true, query: 'select name, title, left(content, 100) as content from tabBlog\ - where ifnull(published,1)=1', + where ifnull(published,0)=1 and name!="{{ doc.name }}" order by modified desc', hide_refresh: true, render_row: function(parent, data) { - if(data.content.length==100) data.content += '...'; + console.log(data); + if(data.content && data.content.length==100) data.content += '...'; parent.innerHTML = repl('%(title)s\
%(content)s

', data); }, - page_length: 5 + page_length: 5, }); wrapper.recent_list.run(); - - - // comments - $(wrapper).find('.web-main-section').append('

Comments

'); - + wrapper.comment_list = new wn.ui.Listing({ - parent: $(wrapper).find('.web-main-section').get(0), + parent: $(wrapper).find('.blog-comments').get(0), + no_toolbar: true, query: 'select comment, comment_by_fullname, modified\ from `tabComment` where comment_doctype="Page"\ - and comment_docname="{{ doc.name }}"', + and comment_docname="{{ doc.name }}" order by modified desc', no_result_message: 'Be the first one to comment', render_row: function(parent, data) { data.comment_date = prettyDate(data.modified); @@ -57,7 +53,7 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) { wrapper.comment_list.run(); // add comment - $(wrapper).find('.web-main-section').append('
'); $(wrapper).find('button.add-comment').click(function(){ d = new wn.widgets.Dialog({ diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html index 467f30169f..688ffac310 100644 --- a/erpnext/website/doctype/blog/template.html +++ b/erpnext/website/doctype/blog/template.html @@ -1,14 +1,18 @@
-

Blog

-

{{ doc.title }}

+

{{ doc.title }}

By {{ doc.full_name }} on {{ doc.updated }}

{{ doc.content_html }} +

Comments

+
+

All Blogs

+

Recent Posts

+

Subscribe

diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css index 8c987f87a5..4866ac7be5 100644 --- a/erpnext/website/doctype/style_settings/custom_template.css +++ b/erpnext/website/doctype/style_settings/custom_template.css @@ -1,4 +1,4 @@ -body { +#body_div { {% if doc.background_image %} background: url("files/{{ doc.background_image }}") repeat; {% elif doc.background_color %} diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html index 471c95c94a..b66aded5f3 100644 --- a/erpnext/website/doctype/web_page/template.html +++ b/erpnext/website/doctype/web_page/template.html @@ -28,6 +28,3 @@

-
- Last Modified: {{ doc.updated }} Feedback -
diff --git a/erpnext/website/doctype/web_page/web_page.js b/erpnext/website/doctype/web_page/web_page.js index 0b7b78da59..17e7f15a48 100644 --- a/erpnext/website/doctype/web_page/web_page.js +++ b/erpnext/website/doctype/web_page/web_page.js @@ -24,10 +24,10 @@ $.extend(cur_frm.cscript, { refresh: function(doc) { cur_frm.cscript.layout(doc); }, - insert_style: function() { + insert_style: function(doc) { cur_frm.cscript.layout(doc); }, - insert_code: function() { + insert_code: function(doc) { cur_frm.cscript.layout(doc); } }) \ No newline at end of file diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index aec0f02aa8..8caf8dcf1c 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -91,8 +91,7 @@ erpnext.Footer = Class.extend({ init: function() { $('footer').html(repl('', wn.boot.website_settings)); diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html index ffb81280a4..8d7cd00345 100644 --- a/erpnext/website/page/blog/blog.html +++ b/erpnext/website/page/blog/blog.html @@ -3,6 +3,7 @@

Blog


+