[fixes] pos, chart of accounts

This commit is contained in:
Rushabh Mehta 2015-03-05 16:38:43 +05:30
parent c4dce99f4b
commit 06a6bcce17
2 changed files with 16 additions and 13 deletions

View File

@ -23,13 +23,14 @@ def get_items(price_list, sales_or_purchase, item=None):
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 @@ def get_items(price_list, sales_or_purchase, item=None):
(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)

View File

@ -203,7 +203,8 @@ erpnext.AccountsChart = Class.extend({
'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 @@ erpnext.AccountsChart = Class.extend({
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 @@ erpnext.AccountsChart = Class.extend({
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;