[fixes] pos, chart of accounts
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 7227f74..6047378 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -23,13 +23,14 @@
return item_code
# search barcode
- item_code = frappe.db.sql("""select name, item_code from `tabItem` where barcode=%s""",
+ item_code = frappe.db.sql("""select name, item_code from `tabItem`
+ where barcode=%s""",
(item), as_dict=1)
if item_code:
item_code[0]["barcode"] = item
return item_code
- condition += " and CONCAT(i.name, i.item_name) like %(name)s"
+ condition += " and (CONCAT(i.name, i.item_name) like %(name)s or (i.variant_of like %(name)s))"
args["name"] = "%%%s%%" % item
return frappe.db.sql("""select i.name, i.item_name, i.image,
@@ -38,6 +39,7 @@
(select item_code, price_list_rate, currency from
`tabItem Price` where price_list=%s) item_det
ON
- item_det.item_code=i.name
+ (item_det.item_code=i.name or item_det.item_code=i.variant_of)
where
+ ifnull(i.has_variants, 0) = 0 and
%s""" % ('%(price_list)s', condition), args, as_dict=1)
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index aaa59c0..1b3482d 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -203,7 +203,8 @@
'Equity', 'Cost of Goods Sold', 'Fixed Asset', 'Expense Account',
'Income Account', 'Tax', 'Chargeable'].join('\n'),
description: __("Optional. This setting will be used to filter in various transactions.") },
- {fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate')}
+ {fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate')},
+ {fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse"}
]
})
@@ -214,21 +215,16 @@
if($(this).val()=='Group') {
$(fd.account_type.wrapper).toggle(false);
$(fd.tax_rate.wrapper).toggle(false);
+ $(fd.warehouse.wrapper).toggle(false);
} else {
- $(fd.account_type.wrapper).toggle(true);
- if(fd.account_type.get_value()=='Tax') {
- $(fd.tax_rate.wrapper).toggle(true);
- }
+ fd.account_type.$input.trigger("change");
}
});
// tax rate if tax
$(fd.account_type.input).change(function() {
- if($(this).val()=='Tax') {
- $(fd.tax_rate.wrapper).toggle(true);
- } else {
- $(fd.tax_rate.wrapper).toggle(false);
- }
+ $(fd.tax_rate.wrapper).toggle(fd.account_type.get_value()==='Tax');
+ $(fd.warehouse.wrapper).toggle(fd.account_type.get_value()==='Warehouse');
})
// create
@@ -237,6 +233,11 @@
var v = d.get_values();
if(!v) return;
+ if(v.account_type==="Warehouse" && !v.warehouse) {
+ msgprint(__("Warehouse is required"));
+ return;
+ }
+
var node = me.tree.get_selected_node();
v.parent_account = node.label;
v.company = me.company;