diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index b8346d38934..7775426eaa4 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()) diff --git a/buying/utils.py b/buying/utils.py index 9d125de24ab..0431e642cb7 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 c49bf2a929f..8b247ccd988 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -331,7 +331,12 @@ class BuyingController(AccountsController): # update valuation rate def update_valuation_rate(self, parentfield): for d in self.doclist.get({"parentfield": parentfield}): - if d.qty: + 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 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) diff --git a/patches/march_2013/__init__.py b/patches/march_2013/__init__.py new file mode 100644 index 00000000000..e69de29bb2d 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 00000000000..35e7a257b4e --- /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 diff --git a/patches/patch_list.py b/patches/patch_list.py index 9e5d6f69af0..50eb0cdd819 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 diff --git a/setup/utils.py b/setup/utils.py index 1b61ea9201e..1a86921692e 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: diff --git a/stock/doctype/batch/batch.txt b/stock/doctype/batch/batch.txt index cad4a0db2c1..6a6de8b2476 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" } diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index 6c2c8826458..5b32a34c80c 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) {