[item price] item price made as an individual master and removed from price list

This commit is contained in:
Akhilesh Darjee
2013-10-18 14:24:21 +05:30
parent 04638a5f77
commit fcd70d04f3
22 changed files with 312 additions and 364 deletions

View File

@@ -160,7 +160,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
item_code: function(doc, cdt, cdn) {
var me = this;
var item = wn.model.get_doc(cdt, cdn);
if(item.item_code || item.barcode) {
if(item.item_code || item.barcode || item.serial_no) {
if(!this.validate_company_and_party("customer")) {
cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
} else {
@@ -171,6 +171,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
args: {
item_code: item.item_code,
barcode: item.barcode,
serial_no: item.serial_no,
warehouse: item.warehouse,
doctype: me.frm.doc.doctype,
parentfield: item.parentfield,

View File

@@ -83,9 +83,14 @@ wn.module_page["Selling"] = [
},
{
label: wn._("Price List"),
description: wn._("Mupltiple Item prices."),
description: wn._("Multiple Price list."),
doctype:"Price List"
},
{
label: wn._("Item Price"),
description: wn._("Multiple Item prices."),
doctype:"Item Price"
},
{
label: wn._("Sales BOM"),
description: wn._("Bundle items at time of sale."),

View File

@@ -40,7 +40,9 @@ def get_item_details(args):
args = webnotes._dict(args)
if args.barcode:
args.item_code = _get_item_code(args.barcode)
args.item_code = _get_item_code(barcode=args.barcode)
elif not args.item_code and args.serial_no:
args.item_code = _get_item_code(serial_no=args.serial_no)
item_bean = webnotes.bean("Item", args.item_code)
@@ -88,15 +90,17 @@ def _get_serial_nos_by_fifo(args, item_bean):
"qty": cint(args.qty)
}))
def _get_item_code(barcode):
item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)
def _get_item_code(barcode=None, serial_no=None):
if barcode:
input_type = "Barcode"
item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)
elif serial_no:
input_type = "Serial No"
item_code = webnotes.conn.sql_list("""select item_code from `tabSerial No`
where name=%s""", serial_no)
if not item_code:
msgprint(_("No Item found with Barcode") + ": %s" % barcode, raise_exception=True)
elif len(item_code) > 1:
msgprint(_("Items") + " %s " % comma_and(item_code) +
_("have the same Barcode") + " %s" % barcode, raise_exception=True)
msgprint(_("No Item found with ") + input_type + ": %s" % (barcode or serial_no), raise_exception=True)
return item_code[0]
@@ -142,9 +146,8 @@ def _get_basic_details(args, item_bean, warehouse_fieldname):
return out
def _get_price_list_rate(args, item_bean, meta):
ref_rate = webnotes.conn.sql("""select ip.ref_rate from `tabItem Price` ip,
`tabPrice List` pl where ip.parent = pl.name and ip.parent=%s and
ip.item_code=%s and pl.buying_or_selling='Selling'""",
ref_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price`
where price_list=%s and item_code=%s and buying_or_selling='Selling'""",
(args.selling_price_list, args.item_code), as_dict=1)
if not ref_rate:

View File

@@ -27,9 +27,8 @@ def get_product_info(item_code):
else:
in_stock = -1
price = price_list and webnotes.conn.sql("""select ip.ref_rate, pl.currency from
`tabItem Price` ip, `tabPrice List` pl where ip.parent = pl.name and
ip.item_code=%s and ip.parent=%s""",
price = price_list and webnotes.conn.sql("""select ref_rate, currency from
`tabItem Price` where item_code=%s and price_list=%s""",
(item_code, price_list), as_dict=1) or []
price = price and price[0] or None