From 15e7c186390a3097617dc6af7a08bb6c396e71d6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 28 Feb 2013 18:10:19 +0530 Subject: [PATCH 1/8] fixes in price list currency --- buying/doctype/purchase_common/purchase_common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index b8346d3893..7775426eaa 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -54,9 +54,6 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({ }, price_list_name: function(callback_fn) { - this.frm.toggle_reqd(["price_list_currency", "plc_conversion_rate"], - !!(this.frm.doc.price_list_name)); - var me = this; if(this.frm.doc.price_list_name) { @@ -137,6 +134,9 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({ }, price_list_currency: function() { + this.frm.toggle_reqd("plc_conversion_rate", + !!(this.frm.doc.price_list_name && this.frm.doc.price_list_currency)); + this.set_dynamic_labels(); if(this.frm.doc.price_list_currency === this.get_company_currency()) From 380f555a8c4419293a848a7df1cbcf6228338251 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 28 Feb 2013 18:41:49 +0530 Subject: [PATCH 2/8] fixes in price list currency --- setup/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/utils.py b/setup/utils.py index 1b61ea9201..1a86921692 100644 --- a/setup/utils.py +++ b/setup/utils.py @@ -40,7 +40,7 @@ def get_price_list_currency(args): if isinstance(args, basestring): args = json.loads(args) - result = webnotes.conn.sql("""select ref_currency from `tabItem Price` + result = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price` where price_list_name=%s and `%s`=1""" % ("%s", args.get("use_for")), (args.get("price_list_name"),)) if result and len(result)==1: From b05185ba965cd1b3432054de01ba0784bdd7d5b0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 28 Feb 2013 18:49:17 +0530 Subject: [PATCH 3/8] hide website fields function removed --- stock/doctype/item/item.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index 6c2c882645..5b32a34c80 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -22,13 +22,11 @@ cur_frm.cscript.refresh = function(doc) { if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) { var callback = function(r, rt) { - var enabled = (r.message == 'exists') ? false : true; + var enabled = (r.message == 'exists') ? false : true; cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], enabled); } $c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback); } - - cur_frm.cscript.hide_website_fields(doc); } cur_frm.cscript.item_code = function(doc) { From 1bfec3a6c8a2da17423a382abfda32e41b62ebba Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 28 Feb 2013 19:17:46 +0530 Subject: [PATCH 4/8] buying - update valuation rate when item row has item_code and quantity, else set valuation rate as 0 --- buying/utils.py | 2 +- controllers/buying_controller.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/buying/utils.py b/buying/utils.py index 9d125de24a..0431e642cb 100644 --- a/buying/utils.py +++ b/buying/utils.py @@ -53,7 +53,7 @@ def get_item_details(args): "qty": 0, "stock_uom": item.stock_uom, "uom": item.stock_uom, - "conversion_factor": 1, + "conversion_factor": 1.0, "warehouse": args.warehouse or item.default_warehouse, "item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in item_wrapper.doclist.get({"parentfield": "item_tax"})))), diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index c49bf2a929..e5b8b07108 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -331,7 +331,9 @@ class BuyingController(AccountsController): # update valuation rate def update_valuation_rate(self, parentfield): for d in self.doclist.get({"parentfield": parentfield}): - if d.qty: + if d.item_code and d.qty: + # if no item code, which is sometimes the case in purchase invoice, + # then it is not possible to track valuation against it d.valuation_rate = (flt(d.purchase_rate or d.rate) + (flt(d.item_tax_amount) + flt(d.rm_supp_cost)) / flt(d.qty) ) / flt(d.conversion_factor) From a9afc254bc03d4cc0a3287733009e2b0449713a7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 Mar 2013 10:41:41 +0530 Subject: [PATCH 5/8] fixes for conversion factor in old invoices --- controllers/buying_controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index e5b8b07108..8b247ccd98 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -331,6 +331,9 @@ class BuyingController(AccountsController): # update valuation rate def update_valuation_rate(self, parentfield): for d in self.doclist.get({"parentfield": parentfield}): + d.conversion_factor = d.conversion_factor or webnotes.conn.get_value( + "UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom}, + "conversion_factor") or 1 if d.item_code and d.qty: # if no item code, which is sometimes the case in purchase invoice, # then it is not possible to track valuation against it From 5657cd775fc896d872a21daf213ba94ba7375d88 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 Mar 2013 11:05:57 +0530 Subject: [PATCH 6/8] fixes for material request --- patches/march_2013/__init__.py | 0 patches/march_2013/update_po_prevdoc_doctype.py | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 patches/march_2013/__init__.py create mode 100644 patches/march_2013/update_po_prevdoc_doctype.py diff --git a/patches/march_2013/__init__.py b/patches/march_2013/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/march_2013/update_po_prevdoc_doctype.py b/patches/march_2013/update_po_prevdoc_doctype.py new file mode 100644 index 0000000000..35e7a257b4 --- /dev/null +++ b/patches/march_2013/update_po_prevdoc_doctype.py @@ -0,0 +1,6 @@ +import webnotes +def execute(): + webnotes.conn.sql("""update `tabPurchase Order Item` set prevdoc_doctype = 'Material Request' + where prevdoc_doctype = 'Purchase Request'""") + webnotes.conn.sql("""update `tabSupplier Quotation Item` + set prevdoc_doctype = 'Material Request' where prevdoc_doctype = 'Purchase Request'""") \ No newline at end of file From 95a72a7a4acad845ad8039c437b9f5ae94a09269 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 Mar 2013 11:07:07 +0530 Subject: [PATCH 7/8] fixes for material request --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index 9e5d6f69af..50eb0cdd81 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -201,4 +201,5 @@ patch_list = [ 'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Spartan") # 2013-02-26', "execute:(not webnotes.conn.exists('Role', 'Projects Manager')) and webnotes.doc({'doctype':'Role', 'role_name':'Projects Manager'}).insert()", "patches.february_2013.p09_remove_cancelled_warehouses", + "patches.march_2013.update_po_prevdoc_doctype", ] \ No newline at end of file From 322bd08f26e108e88135064bef251b5049840666 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 1 Mar 2013 12:52:34 +0530 Subject: [PATCH 8/8] allow attachment in batch --- stock/doctype/batch/batch.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/stock/doctype/batch/batch.txt b/stock/doctype/batch/batch.txt index cad4a0db2c..6a6de8b247 100644 --- a/stock/doctype/batch/batch.txt +++ b/stock/doctype/batch/batch.txt @@ -1,15 +1,17 @@ [ { - "creation": "2013-01-10 16:34:25", + "creation": "2013-03-01 08:21:54", "docstatus": 0, - "modified": "2013-01-29 13:40:32", + "modified": "2013-03-01 08:22:16", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, { + "allow_attach": 1, "autoname": "field:batch_id", "doctype": "DocType", "document_type": "Master", + "max_attachments": 5, "module": "Stock", "name": "__common__" }, @@ -105,6 +107,15 @@ "oldfieldtype": "Small Text", "read_only": 1 }, + { + "doctype": "DocField", + "fieldname": "file_list", + "fieldtype": "Text", + "hidden": 1, + "label": "File List", + "no_copy": 1, + "print_hide": 1 + }, { "doctype": "DocPerm" }