Added patch, fixed codacy issue
This commit is contained in:
parent
6163a397df
commit
7e752c4ebf
@ -2,7 +2,7 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('POS Settings', {
|
frappe.ui.form.on('POS Settings', {
|
||||||
refresh: function(frm) {
|
refresh: function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "0",
|
"default": "1",
|
||||||
"fieldname": "is_online",
|
"fieldname": "is_online",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -55,7 +55,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-08-29 14:34:36.166049",
|
"modified": "2017-08-30 18:34:58.960276",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "POS Settings",
|
"name": "POS Settings",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class POSSettings(Document):
|
class POSSettings(Document):
|
||||||
|
@ -435,4 +435,4 @@ erpnext.patches.v8_5.remove_project_type_property_setter
|
|||||||
erpnext.patches.v8_7.add_more_gst_fields
|
erpnext.patches.v8_7.add_more_gst_fields
|
||||||
erpnext.patches.v8_7.fix_purchase_receipt_status
|
erpnext.patches.v8_7.fix_purchase_receipt_status
|
||||||
erpnext.patches.v8_6.rename_bom_update_tool
|
erpnext.patches.v8_6.rename_bom_update_tool
|
||||||
|
erpnext.patches.v8_7.set_offline_in_pos_settings
|
||||||
|
12
erpnext/patches/v8_7/set_offline_in_pos_settings.py
Normal file
12
erpnext/patches/v8_7/set_offline_in_pos_settings.py
Normal file
@ -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()
|
@ -146,7 +146,7 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
this.map_row_values(this.item, this.values, 'serial_no', 'qty');
|
this.map_row_values(this.item, this.values, 'serial_no', 'qty');
|
||||||
}
|
}
|
||||||
refresh_field("items");
|
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) {
|
map_row_values: function(row, values, number, qty_field, warehouse) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* global Clusterize */
|
/* global Clusterize */
|
||||||
|
|
||||||
frappe.pages['point-of-sale'].on_page_load = function(wrapper) {
|
frappe.pages['point-of-sale'].on_page_load = function(wrapper) {
|
||||||
var page = frappe.ui.make_app_page({
|
frappe.ui.make_app_page({
|
||||||
parent: wrapper,
|
parent: wrapper,
|
||||||
title: 'Point of Sale',
|
title: 'Point of Sale',
|
||||||
single_column: true
|
single_column: true
|
||||||
@ -156,7 +156,7 @@ class PointOfSale {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
// update cart
|
// update cart
|
||||||
this.update_cart_data(item);
|
this.update_cart_data(item);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -172,12 +172,12 @@ class PointOfSale {
|
|||||||
.trigger('item_code', item.doctype, item.name)
|
.trigger('item_code', item.doctype, item.name)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// update cart
|
// update cart
|
||||||
this.update_cart_data(item)
|
this.update_cart_data(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
select_batch_and_serial_no(item) {
|
select_batch_and_serial_no(item) {
|
||||||
let dialog = new erpnext.SerialNoBatchSelector({
|
new erpnext.SerialNoBatchSelector({
|
||||||
frm: this.frm,
|
frm: this.frm,
|
||||||
item: item,
|
item: item,
|
||||||
warehouse_details: {
|
warehouse_details: {
|
||||||
@ -189,9 +189,9 @@ class PointOfSale {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
// update cart
|
// update cart
|
||||||
this.update_cart_data(item);
|
this.update_cart_data(item);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}, true)
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_cart_data(item) {
|
update_cart_data(item) {
|
||||||
@ -202,7 +202,7 @@ class PointOfSale {
|
|||||||
|
|
||||||
update_item_in_frm(item, field, value) {
|
update_item_in_frm(item, field, value) {
|
||||||
if (field) {
|
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
|
return this.frm.script_manager
|
||||||
@ -219,7 +219,7 @@ class PointOfSale {
|
|||||||
frm: this.frm,
|
frm: this.frm,
|
||||||
events: {
|
events: {
|
||||||
submit_form: () => {
|
submit_form: () => {
|
||||||
this.submit_sales_invoice()
|
this.submit_sales_invoice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -323,7 +323,7 @@ class PointOfSale {
|
|||||||
// }).addClass('visible-xs');
|
// }).addClass('visible-xs');
|
||||||
|
|
||||||
this.page.add_menu_item(__("Form View"), function () {
|
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);
|
frappe.set_route("Form", me.frm.doc.doctype, me.frm.doc.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ class POSCart {
|
|||||||
<div class="cart-wrapper">
|
<div class="cart-wrapper">
|
||||||
<div class="list-item-table">
|
<div class="list-item-table">
|
||||||
<div class="list-item list-item--head">
|
<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">${__('Quantity')}</div>
|
||||||
<div class="list-item__content text-muted text-right">${__('Discount')}</div>
|
<div class="list-item__content text-muted text-right">${__('Discount')}</div>
|
||||||
<div class="list-item__content text-muted text-right">${__('Rate')}</div>
|
<div class="list-item__content text-muted text-right">${__('Rate')}</div>
|
||||||
@ -610,8 +610,8 @@ class POSCart {
|
|||||||
get_item_html(item) {
|
get_item_html(item) {
|
||||||
const rate = format_currency(item.rate, this.frm.doc.currency);
|
const rate = format_currency(item.rate, this.frm.doc.currency);
|
||||||
return `
|
return `
|
||||||
<div class="list-item" data-item-code="${item.item_code}">
|
<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-2 ellipsis">
|
<div class="item-name list-item__content list-item__content--flex-1.5 ellipsis">
|
||||||
${item.item_name}
|
${item.item_name}
|
||||||
</div>
|
</div>
|
||||||
<div class="quantity list-item__content text-right">
|
<div class="quantity list-item__content text-right">
|
||||||
@ -824,9 +824,9 @@ class POSItems {
|
|||||||
options: 'Item Group',
|
options: 'Item Group',
|
||||||
default: 'All Item Groups',
|
default: 'All Item Groups',
|
||||||
onchange: () => {
|
onchange: () => {
|
||||||
const item_group = this.item_group_field.get_value()
|
const item_group = this.item_group_field.get_value();
|
||||||
if (item_group) {
|
if (item_group) {
|
||||||
this.filter_items({ item_group: item_group })
|
this.filter_items({ item_group: item_group });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -907,7 +907,7 @@ class POSItems {
|
|||||||
|
|
||||||
bind_events() {
|
bind_events() {
|
||||||
var me = this;
|
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 = $(this);
|
||||||
const item_code = $item.attr('data-item-code');
|
const item_code = $item.attr('data-item-code');
|
||||||
me.events.update_cart(item_code, 'qty', '+1');
|
me.events.update_cart(item_code, 'qty', '+1');
|
||||||
@ -1100,7 +1100,7 @@ class Payment {
|
|||||||
this.set_flag();
|
this.set_flag();
|
||||||
|
|
||||||
let title = __('Total Amount {0}',
|
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({
|
this.dialog = new frappe.ui.Dialog({
|
||||||
title: title,
|
title: title,
|
||||||
@ -1153,7 +1153,7 @@ class Payment {
|
|||||||
options: me.frm.doc.currency,
|
options: me.frm.doc.currency,
|
||||||
fieldname: p.mode_of_payment,
|
fieldname: p.mode_of_payment,
|
||||||
default: p.amount,
|
default: p.amount,
|
||||||
onchange: (e) => {
|
onchange: () => {
|
||||||
const value = this.dialog.get_value(this.fieldname);
|
const value = this.dialog.get_value(this.fieldname);
|
||||||
me.update_payment_value(this.fieldname, value);
|
me.update_payment_value(this.fieldname, value);
|
||||||
}
|
}
|
||||||
@ -1180,7 +1180,7 @@ class Payment {
|
|||||||
onchange: () => {
|
onchange: () => {
|
||||||
me.update_cur_frm_value('write_off_amount', () => {
|
me.update_cur_frm_value('write_off_amount', () => {
|
||||||
frappe.flags.change_amount = false;
|
frappe.flags.change_amount = false;
|
||||||
me.update_change_amount()
|
me.update_change_amount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1237,8 +1237,8 @@ class Payment {
|
|||||||
const value = this.dialog.get_value(fieldname);
|
const value = this.dialog.get_value(fieldname);
|
||||||
this.frm.set_value(fieldname, value)
|
this.frm.set_value(fieldname, value)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
callback()
|
callback();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
frappe.flags[fieldname] = true;
|
frappe.flags[fieldname] = true;
|
||||||
@ -1252,22 +1252,22 @@ class Payment {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
me.update_change_amount();
|
me.update_change_amount();
|
||||||
me.update_write_off_amount();
|
me.update_write_off_amount();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
update_change_amount() {
|
update_change_amount() {
|
||||||
this.dialog.set_value("change_amount", this.frm.doc.change_amount)
|
this.dialog.set_value("change_amount", this.frm.doc.change_amount);
|
||||||
this.show_paid_amount()
|
this.show_paid_amount();
|
||||||
}
|
}
|
||||||
|
|
||||||
update_write_off_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() {
|
show_paid_amount() {
|
||||||
this.dialog.set_value("paid_amount", this.frm.doc.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("outstanding_amount", this.frm.doc.outstanding_amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,9 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, json
|
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()
|
@frappe.whitelist()
|
||||||
def get_items(start, page_length, price_list, item_group, search_value=""):
|
def get_items(start, page_length, price_list, item_group, search_value=""):
|
||||||
condition = ""
|
|
||||||
serial_no = ""
|
serial_no = ""
|
||||||
batch_no = ""
|
batch_no = ""
|
||||||
item_code = search_value
|
item_code = search_value
|
||||||
@ -42,7 +34,7 @@ def get_items(start, page_length, price_list, item_group, search_value=""):
|
|||||||
i.disabled = 0 and i.has_variants = 0
|
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_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
|
||||||
and (i.item_code like %(item_code)s
|
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),
|
limit {start}, {page_length}""".format(start=start, page_length=page_length, lft=lft, rgt=rgt),
|
||||||
{
|
{
|
||||||
'item_code': '%%%s%%'%(frappe.db.escape(item_code)),
|
'item_code': '%%%s%%'%(frappe.db.escape(item_code)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user