Merge branch 'master' into edge
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index b8346d3..7775426 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -54,9 +54,6 @@
},
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 @@
},
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 9d125de..0431e64 100644
--- a/buying/utils.py
+++ b/buying/utils.py
@@ -53,7 +53,7 @@
"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 c49bf2a..8b247cc 100644
--- a/controllers/buying_controller.py
+++ b/controllers/buying_controller.py
@@ -331,7 +331,12 @@
# 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 0000000..e69de29
--- /dev/null
+++ b/patches/march_2013/__init__.py
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 0000000..35e7a25
--- /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 9e5d6f6..50eb0cd 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -201,4 +201,5 @@
'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 1b61ea9..1a86921 100644
--- a/setup/utils.py
+++ b/setup/utils.py
@@ -40,7 +40,7 @@
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 cad4a0d..6a6de8b 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__"
},
@@ -106,6 +108,15 @@
"read_only": 1
},
{
+ "doctype": "DocField",
+ "fieldname": "file_list",
+ "fieldtype": "Text",
+ "hidden": 1,
+ "label": "File List",
+ "no_copy": 1,
+ "print_hide": 1
+ },
+ {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index 6c2c882..5b32a34 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -22,13 +22,11 @@
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) {