From 95a822c70113ad3d7a627ab01338452c0bf85b3a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 9 Jul 2012 11:09:07 +0530 Subject: [PATCH 1/4] Fetch Customer's Item Code in Sales Transaction --- .../sales_invoice_item/sales_invoice_item.txt | 15 ++- .../doctype/opportunity/opportunity.js | 107 +----------------- .../doctype/quotation_item/quotation_item.txt | 15 ++- .../doctype/sales_common/sales_common.py | 9 ++ .../sales_order_item/sales_order_item.txt | 15 ++- .../delivery_note_item/delivery_note_item.txt | 15 ++- 6 files changed, 62 insertions(+), 114 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt index 88af72b279..0dddb8a924 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:18', + 'creation': '2012-06-08 16:07:55', 'docstatus': 0, - 'modified': '2012-06-07 19:05:06', + 'modified': '2012-07-09 11:00:18', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -67,6 +67,17 @@ 'trigger': u'Client' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'customer_item_code', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u"Customer's Item Code", + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/selling/doctype/opportunity/opportunity.js b/erpnext/selling/doctype/opportunity/opportunity.js index c672aa11f3..4487c8909a 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.js +++ b/erpnext/selling/doctype/opportunity/opportunity.js @@ -140,79 +140,8 @@ cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = f else return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50'; } - - //Fetch Item Details -//==================================================================================================================== -cur_frm.cscript.item_code = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if (d.item_code) { - get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1); - } -} -/* - //Fetch Customer Details -//====================================================================================================================== -cur_frm.cscript.customer = function(doc, cdt, cdn){ - if (doc.customer) { - get_server_fields('get_cust_address',doc.customer,'',doc,cdt,cdn,1); - } -} -*/ - -/* -//======================================================================================================================= -cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50'; -} -*/ - -/* -//======================================================================================================================= -cur_frm.cscript.contact_person = function(doc, cdt, cdn){ - if (doc.contact_person) { - arg = {}; - arg.contact_person = doc.contact_person; - arg.customer = doc.customer; - get_server_fields('get_contact_details',docstring(arg),'',doc,cdt,cdn,1); - } -} -*/ - -/* -// hide - unhide fields based on lead or customer.. -//======================================================================================================================= -cur_frm.cscript.clear_values = function(doc,cdt,cdn) { - if(doc.enquiry_from == 'Lead') { - doc.customer = doc.customer_name = doc.contact_person = doc.customer_group = ""; - } - else if(doc.enquiry_from == 'Customer') { - doc.lead = doc.lead_name = ""; - } - refresh_many(['lead','lead_name','customer','customer_name','contact_person','customer_group']); -} -*/ - -/* -//================ hide - unhide fields on basis of enquiry from either lead or customer =============================== -cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){ - cur_frm.cscript.clear_values(doc,cdt,cdn); - doc.address = doc.territory = doc.contact_no = doc.email_id = ""; - refresh_many(['territory','address','contact_no','email_id']); -} -*/ - -/* -//================ create new contact ============================================================================ -cur_frm.cscript.new_contact = function(){ - tn = createLocal('Contact'); - locals['Contact'][tn].is_customer = 1; - if(doc.customer) locals['Contact'][tn].customer = doc.customer; - loaddoc('Contact', tn); -} -*/ - // Create New Quotation -// ======================================================================================================================= +// Create New Quotation cur_frm.cscript['Create Quotation'] = function(){ n = createLocal("Quotation"); $c('dt_map', args={ @@ -284,39 +213,5 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){ } //get query select Territory -//======================================================================================================================= cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';} - -/* -//===================== Opportunity From validation - either customer or lead is mandatory ===================================== -cur_frm.cscript.enq_frm_validate = function(doc,cdt,cdn){ - - if(doc.enquiry_from == 'Lead'){ - if(!doc.lead){ - alert("Lead is mandatory."); - validated = false; - } - } - else if(doc.enquiry_from == 'Customer'){ - if(!doc.customer){ - alert("Customer is mandatory."); - validated = false; - } - else if(!doc.contact_person){ - alert("Contact Person is mandatory."); - validated = false; - } - else if(!doc.customer_group){ - alert("Customer Group is mandatory."); - validated = false; - } - } -} -*/ - -//===================validation function ============================================================================== - -cur_frm.cscript.validate = function(doc,cdt,cdn){ - //cur_frm.cscript.enq_frm_validate(doc,cdt,cdn); -} diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.txt b/erpnext/selling/doctype/quotation_item/quotation_item.txt index d5ece1f602..6ae657cbf1 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.txt +++ b/erpnext/selling/doctype/quotation_item/quotation_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-06-04 15:40:56', + 'creation': '2012-06-08 16:07:57', 'docstatus': 0, - 'modified': '2012-06-07 17:58:39', + 'modified': '2012-07-09 11:04:47', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -60,6 +60,17 @@ 'width': u'150px' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'customer_item_code', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u"Customer's Item Code", + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index f57e7194a1..0a776a84e6 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -163,6 +163,15 @@ class DocType(TransactionBase): if ret['warehouse'] or ret['reserved_warehouse']: av_qty = self.get_available_qty({'item_code': args['item_code'], 'warehouse': ret['warehouse'] or ret['reserved_warehouse']}) ret.update(av_qty) + + # get customer code for given item from Item Customer Detail + customer_item_code_row = webnotes.conn.sql("""\ + select ref_code from `tabItem Customer Detail` + where parent = %s and customer_name = %s""", + (args['item_code'], obj.doc.customer)) + if customer_item_code_row and customer_item_code_row[0][0]: + ret['customer_item_code'] = customer_item_code_row[0][0] + return ret diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt index 1d2f358bac..1c806982c6 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:28', + 'creation': '2012-06-08 16:07:58', 'docstatus': 0, - 'modified': '2012-06-07 18:04:52', + 'modified': '2012-07-09 11:05:16', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -57,6 +57,17 @@ 'width': u'150px' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'customer_item_code', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u"Customer's Item Code", + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt index 5abb70d3d6..8d0d387699 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:35', + 'creation': '2012-06-08 16:08:01', 'docstatus': 0, - 'modified': '2012-06-07 17:57:14', + 'modified': '2012-07-09 11:06:26', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -68,6 +68,17 @@ 'width': u'150px' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'customer_item_code', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u"Customer's Item Code", + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'colour': u'White:FFF', From c6fce634cffcd66f3546fa2506e11341cb385795 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 9 Jul 2012 12:34:02 +0530 Subject: [PATCH 2/4] added app frame to todo list --- erpnext/stock/doctype/item/item.py | 3 +-- erpnext/utilities/page/questions/questions.js | 3 +-- erpnext/utilities/page/todo/todo.css | 5 +++++ erpnext/utilities/page/todo/todo.html | 11 +++-------- erpnext/utilities/page/todo/todo.js | 15 +++++++++------ 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index f0fb5e7ecc..0f6cc4c8b1 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -59,8 +59,7 @@ class DocType: if cstr(d.uom) in check_list: msgprint("UOM %s has been entered more than once in Conversion Factor Details." % cstr(d.uom)) raise Exception - - if not cstr(d.uom) in check_list: + else: check_list.append(cstr(d.uom)) if cstr(d.uom) == cstr(self.doc.stock_uom): diff --git a/erpnext/utilities/page/questions/questions.js b/erpnext/utilities/page/questions/questions.js index 33e0853422..048ed54bb6 100644 --- a/erpnext/utilities/page/questions/questions.js +++ b/erpnext/utilities/page/questions/questions.js @@ -14,8 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pscript.onload_questions = function(wrapper) { - console.log(1); +pscript.onload_questions = function(wrapper) { body = $(wrapper).find('.layout-main-section').get(0); wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe')); diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css index ee9b4f1f37..7c7dcaf23d 100644 --- a/erpnext/utilities/page/todo/todo.css +++ b/erpnext/utilities/page/todo/todo.css @@ -47,4 +47,9 @@ .todo-content { padding-right: 15px; +} + +.layout-main { + background-color: #FFFDC9; + min-height: 300px; } \ No newline at end of file diff --git a/erpnext/utilities/page/todo/todo.html b/erpnext/utilities/page/todo/todo.html index d49fc23011..88dcbf3759 100644 --- a/erpnext/utilities/page/todo/todo.html +++ b/erpnext/utilities/page/todo/todo.html @@ -1,9 +1,6 @@ -
+
-
- × -

To Do

-
+

My List


@@ -14,8 +11,6 @@
-
- -
+
\ No newline at end of file diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index 206becf36d..786e757e29 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -48,11 +48,6 @@ erpnext.todo.refresh = function() { } } }); - - $('#add-todo').click(function() { - erpnext.todo.make_dialog({ - date:get_today(), priority:'Medium', checked:0, description:''}); - }) } erpnext.todo.ToDoItem = Class.extend({ @@ -196,7 +191,15 @@ erpnext.todo.save = function(btn) { }); } -wn.pages.todo.onload = function() { +wn.pages.todo.onload = function(wrapper) { + // create app frame + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'), 'To Do'); + wrapper.appframe.add_button('Refresh', erpnext.todo.refresh, 'icon-refresh'); + wrapper.appframe.add_button('Add', function() { + erpnext.todo.make_dialog({ + date:get_today(), priority:'Medium', checked:0, description:''}); + }, 'icon-plus'); + // load todos erpnext.todo.refresh(); } \ No newline at end of file From 0f5e220d6cf8d83ceb7aae1f45999c168bb51564 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 9 Jul 2012 12:48:32 +0530 Subject: [PATCH 3/4] Email Digest: New Transactions --> consider feed_type is null records only --- erpnext/setup/doctype/email_digest/email_digest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index b0f0e9f231..aff79f608a 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -255,7 +255,10 @@ class DocType: args['sum_if_reqd'] = "IFNULL(SUM(IFNULL(%(sum_col)s, 0)), 0) AS '%(sum_col)s'," % args if args['type'] == 'new_transactions': - args['company_condition'] = '' + # tabFeed doesn't have company column + # using this arg to set condition of feed_type as null + # so that comments, logins and assignments are not counted + args['company_condition'] = "feed_type IS NULL AND" else: args['company_condition'] = "company = '%(company)s' AND" % args From 368cb53cf64f2fa92ab48bea07b89e3de6a3b187 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 9 Jul 2012 13:32:06 +0530 Subject: [PATCH 4/4] css fix for sidebar statuses in list view --- public/css/all-app.css | 6 ++++++ public/css/all-web.css | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/public/css/all-app.css b/public/css/all-app.css index 93dfe47ebf..ecdbe652f9 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -3219,6 +3219,8 @@ div.stat-item { height: 18px; border: 1px solid #aaa; border-radius: 9px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; overflow: hidden; } @@ -3227,6 +3229,10 @@ div.stat-bar { left: 0px; height: 100%; z-index: 0; + /* So that this div is also curved like the enclosing one */ + border-radius: 9px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; background: #e0ff84; /* Old browsers */ background: -moz-linear-gradient(top, #e0ff84 0%, #a4e567 100%); /* FF3.6+ */ diff --git a/public/css/all-web.css b/public/css/all-web.css index a2de6b612e..332471b01b 100644 --- a/public/css/all-web.css +++ b/public/css/all-web.css @@ -2470,6 +2470,8 @@ div.stat-item { height: 18px; border: 1px solid #aaa; border-radius: 9px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; overflow: hidden; } @@ -2478,6 +2480,10 @@ div.stat-bar { left: 0px; height: 100%; z-index: 0; + /* So that this div is also curved like the enclosing one */ + border-radius: 9px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; background: #e0ff84; /* Old browsers */ background: -moz-linear-gradient(top, #e0ff84 0%, #a4e567 100%); /* FF3.6+ */