[minor] reset barcode if item is changed, fixes #5314

This commit is contained in:
Rushabh Mehta 2016-06-02 16:34:00 +05:30
parent af7d929386
commit 675f9c6e6e
2 changed files with 33 additions and 28 deletions

View File

@ -216,12 +216,17 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
// barcode cleared, remove item
d.item_code = "";
}
this.item_code(doc, cdt, cdn);
this.item_code(doc, cdt, cdn, true);
},
item_code: function(doc, cdt, cdn) {
item_code: function(doc, cdt, cdn, from_barcode) {
var me = this;
var item = frappe.get_doc(cdt, cdn);
// clear barcode if setting item (else barcode will take priority)
if(!from_barcode) {
item.barcode = null;
}
if(item.item_code || item.barcode || item.serial_no) {
if(!this.validate_company_and_party()) {
cur_frm.fields_dict["items"].grid.grid_rows[item.idx - 1].remove();

View File

@ -144,6 +144,30 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Barcode",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -406,30 +430,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Barcode",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -2228,8 +2228,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2016-05-12 15:33:02.407671",
"modified_by": "umair@erpnext.com",
"modified": "2016-06-02 14:48:46.128121",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
"owner": "Administrator",