Added patch, fixed codacy issue
diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.js b/erpnext/accounts/doctype/pos_settings/pos_settings.js
index fab766b..1a14618 100644
--- a/erpnext/accounts/doctype/pos_settings/pos_settings.js
+++ b/erpnext/accounts/doctype/pos_settings/pos_settings.js
@@ -2,7 +2,7 @@
// For license information, please see license.txt
frappe.ui.form.on('POS Settings', {
- refresh: function(frm) {
+ refresh: function() {
}
});
diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.json b/erpnext/accounts/doctype/pos_settings/pos_settings.json
index cdd1865..a04558d 100644
--- a/erpnext/accounts/doctype/pos_settings/pos_settings.json
+++ b/erpnext/accounts/doctype/pos_settings/pos_settings.json
@@ -18,7 +18,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "default": "0",
+ "default": "1",
"fieldname": "is_online",
"fieldtype": "Check",
"hidden": 0,
@@ -55,7 +55,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-08-29 14:34:36.166049",
+ "modified": "2017-08-30 18:34:58.960276",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Settings",
diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.py b/erpnext/accounts/doctype/pos_settings/pos_settings.py
index c978a4e..736d36e 100644
--- a/erpnext/accounts/doctype/pos_settings/pos_settings.py
+++ b/erpnext/accounts/doctype/pos_settings/pos_settings.py
@@ -3,7 +3,6 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
class POSSettings(Document):
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 35958e3..4e25a94 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -435,4 +435,4 @@
erpnext.patches.v8_7.add_more_gst_fields
erpnext.patches.v8_7.fix_purchase_receipt_status
erpnext.patches.v8_6.rename_bom_update_tool
-
+erpnext.patches.v8_7.set_offline_in_pos_settings
diff --git a/erpnext/patches/v8_7/set_offline_in_pos_settings.py b/erpnext/patches/v8_7/set_offline_in_pos_settings.py
new file mode 100644
index 0000000..64a3a7c
--- /dev/null
+++ b/erpnext/patches/v8_7/set_offline_in_pos_settings.py
@@ -0,0 +1,12 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.reload_doc('accounts', 'doctype', 'pos_settings')
+
+ doc = frappe.get_doc('POS Settings')
+ doc.is_online = 0
+ doc.save()
\ No newline at end of file
diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js
index ed5a0f6..3e2414e 100644
--- a/erpnext/public/js/utils/serial_no_batch_selector.js
+++ b/erpnext/public/js/utils/serial_no_batch_selector.js
@@ -146,7 +146,7 @@
this.map_row_values(this.item, this.values, 'serial_no', 'qty');
}
refresh_field("items");
- this.callback && this.callback(this.item)
+ this.callback && this.callback(this.item);
},
map_row_values: function(row, values, number, qty_field, warehouse) {
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index 4ce1ca1..6bbb267 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -1,7 +1,7 @@
/* global Clusterize */
frappe.pages['point-of-sale'].on_page_load = function(wrapper) {
- var page = frappe.ui.make_app_page({
+ frappe.ui.make_app_page({
parent: wrapper,
title: 'Point of Sale',
single_column: true
@@ -156,7 +156,7 @@
.then(() => {
// update cart
this.update_cart_data(item);
- })
+ });
}
return;
}
@@ -172,12 +172,12 @@
.trigger('item_code', item.doctype, item.name)
.then(() => {
// update cart
- this.update_cart_data(item)
+ this.update_cart_data(item);
});
}
select_batch_and_serial_no(item) {
- let dialog = new erpnext.SerialNoBatchSelector({
+ new erpnext.SerialNoBatchSelector({
frm: this.frm,
item: item,
warehouse_details: {
@@ -189,9 +189,9 @@
.then(() => {
// update cart
this.update_cart_data(item);
- })
+ });
}
- }, true)
+ }, true);
}
update_cart_data(item) {
@@ -202,7 +202,7 @@
update_item_in_frm(item, field, value) {
if (field) {
- frappe.model.set_value(item.doctype, item.name, field, value)
+ frappe.model.set_value(item.doctype, item.name, field, value);
}
return this.frm.script_manager
@@ -219,7 +219,7 @@
frm: this.frm,
events: {
submit_form: () => {
- this.submit_sales_invoice()
+ this.submit_sales_invoice();
}
}
});
@@ -323,7 +323,7 @@
// }).addClass('visible-xs');
this.page.add_menu_item(__("Form View"), function () {
- var doc = frappe.model.sync(me.frm.doc);
+ frappe.model.sync(me.frm.doc);
frappe.set_route("Form", me.frm.doc.doctype, me.frm.doc.name);
});
@@ -376,7 +376,7 @@
<div class="cart-wrapper">
<div class="list-item-table">
<div class="list-item list-item--head">
- <div class="list-item__content list-item__content--flex-2 text-muted">${__('Item Name')}</div>
+ <div class="list-item__content list-item__content--flex-1.5 text-muted">${__('Item Name')}</div>
<div class="list-item__content text-muted text-right">${__('Quantity')}</div>
<div class="list-item__content text-muted text-right">${__('Discount')}</div>
<div class="list-item__content text-muted text-right">${__('Rate')}</div>
@@ -610,8 +610,8 @@
get_item_html(item) {
const rate = format_currency(item.rate, this.frm.doc.currency);
return `
- <div class="list-item" data-item-code="${item.item_code}">
- <div class="item-name list-item__content list-item__content--flex-2 ellipsis">
+ <div class="list-item" data-item-code="${item.item_code}" title="${item.item_name}">
+ <div class="item-name list-item__content list-item__content--flex-1.5 ellipsis">
${item.item_name}
</div>
<div class="quantity list-item__content text-right">
@@ -824,9 +824,9 @@
options: 'Item Group',
default: 'All Item Groups',
onchange: () => {
- const item_group = this.item_group_field.get_value()
+ const item_group = this.item_group_field.get_value();
if (item_group) {
- this.filter_items({ item_group: item_group })
+ this.filter_items({ item_group: item_group });
}
},
},
@@ -907,7 +907,7 @@
bind_events() {
var me = this;
- this.wrapper.on('click', '.pos-item-wrapper', function(e) {
+ this.wrapper.on('click', '.pos-item-wrapper', function() {
const $item = $(this);
const item_code = $item.attr('data-item-code');
me.events.update_cart(item_code, 'qty', '+1');
@@ -1100,7 +1100,7 @@
this.set_flag();
let title = __('Total Amount {0}',
- [format_currency(this.frm.doc.grand_total, this.frm.doc.currency)])
+ [format_currency(this.frm.doc.grand_total, this.frm.doc.currency)]);
this.dialog = new frappe.ui.Dialog({
title: title,
@@ -1153,7 +1153,7 @@
options: me.frm.doc.currency,
fieldname: p.mode_of_payment,
default: p.amount,
- onchange: (e) => {
+ onchange: () => {
const value = this.dialog.get_value(this.fieldname);
me.update_payment_value(this.fieldname, value);
}
@@ -1180,7 +1180,7 @@
onchange: () => {
me.update_cur_frm_value('write_off_amount', () => {
frappe.flags.change_amount = false;
- me.update_change_amount()
+ me.update_change_amount();
});
}
},
@@ -1237,8 +1237,8 @@
const value = this.dialog.get_value(fieldname);
this.frm.set_value(fieldname, value)
.then(() => {
- callback()
- })
+ callback();
+ });
}
frappe.flags[fieldname] = true;
@@ -1252,22 +1252,22 @@
.then(() => {
me.update_change_amount();
me.update_write_off_amount();
- })
+ });
}
});
}
update_change_amount() {
- this.dialog.set_value("change_amount", this.frm.doc.change_amount)
- this.show_paid_amount()
+ this.dialog.set_value("change_amount", this.frm.doc.change_amount);
+ this.show_paid_amount();
}
update_write_off_amount() {
- this.dialog.set_value("write_off_amount", this.frm.doc.write_off_amount)
+ this.dialog.set_value("write_off_amount", this.frm.doc.write_off_amount);
}
show_paid_amount() {
- this.dialog.set_value("paid_amount", this.frm.doc.paid_amount)
- this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount)
+ this.dialog.set_value("paid_amount", this.frm.doc.paid_amount);
+ this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount);
}
}
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index 4e2b1b1..8ed288b 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -3,17 +3,9 @@
from __future__ import unicode_literals
import frappe, json
-from frappe import _
-from frappe.utils import nowdate
-from erpnext.setup.utils import get_exchange_rate
-from frappe.core.doctype.communication.email import make
-from erpnext.stock.get_item_details import get_pos_profile
-from erpnext.accounts.party import get_party_account_currency
-from erpnext.controllers.accounts_controller import get_taxes_and_charges
@frappe.whitelist()
def get_items(start, page_length, price_list, item_group, search_value=""):
- condition = ""
serial_no = ""
batch_no = ""
item_code = search_value
@@ -42,7 +34,7 @@
i.disabled = 0 and i.has_variants = 0
and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
and (i.item_code like %(item_code)s
- or i.item_name like %(item_code)s)
+ or i.item_name like %(item_code)s or i.barcode like %(item_code)s)
limit {start}, {page_length}""".format(start=start, page_length=page_length, lft=lft, rgt=rgt),
{
'item_code': '%%%s%%'%(frappe.db.escape(item_code)),