Merge pull request #17135 from hrwX/validate_stock_transaction_v12
fix(Item): check transactions for batch, serial check
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index e64ad28..4f17e9f 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -155,7 +155,6 @@
def set_default_profile(pos_profile, company):
modified = now()
user = frappe.session.user
- company = frappe.db.escape(company)
if pos_profile and company:
frappe.db.sql(""" update `tabPOS Profile User` pfu, `tabPOS Profile` pf
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 2fac232..608e8b2 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -152,7 +152,6 @@
{"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role":"Customer"},
{"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"},
{"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
- {"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
{"title": _("Lab Test"), "route": "/lab-test", "reference_doctype": "Lab Test", "role":"Patient"},
{"title": _("Prescription"), "route": "/prescription", "reference_doctype": "Patient Encounter", "role":"Patient"},
{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
@@ -332,4 +331,4 @@
'match_field': 'contact_email',
'personal_fields': ['contact_mobile', 'contact_display', 'customer_name'],
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/public/.gitignore b/erpnext/public/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/erpnext/public/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/erpnext/public/node_modules b/erpnext/public/node_modules
deleted file mode 120000
index 903b09c..0000000
--- a/erpnext/public/node_modules
+++ /dev/null
@@ -1 +0,0 @@
-/Users/netchampfaris/frappe-bench/apps/erpnext/node_modules
\ No newline at end of file
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 388605d..4c0f42d 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -488,16 +488,15 @@
}
setup_company() {
- this.company = frappe.sys_defaults.company;
return new Promise(resolve => {
- if(!this.company) {
+ if(!frappe.sys_defaults.company) {
frappe.prompt({fieldname:"company", options: "Company", fieldtype:"Link",
label: __("Select Company"), reqd: 1}, (data) => {
this.company = data.company;
resolve(this.company);
}, __("Select Company"));
} else {
- resolve(this.company);
+ resolve();
}
})
}
@@ -551,7 +550,9 @@
}
set_pos_profile_data() {
- this.frm.doc.company = this.company;
+ if (this.company) {
+ this.frm.doc.company = this.company;
+ }
return new Promise(resolve => {
return this.frm.call({
@@ -1247,7 +1248,10 @@
clearTimeout(this.last_search);
this.last_search = setTimeout(() => {
const search_term = e.target.value;
- this.filter_items({ search_term });
+ const item_group = this.item_group_field ?
+ this.item_group_field.get_value() : '';
+
+ this.filter_items({ search_term:search_term, item_group: item_group});
}, 300);
});
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 6d75314..4d8022c 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -667,28 +667,39 @@
@frappe.whitelist()
def get_pos_profile(company, pos_profile=None, user=None):
- if pos_profile:
- return frappe.get_cached_doc('POS Profile', pos_profile)
+ if pos_profile: return frappe.get_cached_doc('POS Profile', pos_profile)
if not user:
user = frappe.session['user']
+ condition = "pfu.user = %(user)s AND pfu.default=1"
+ if user and company:
+ condition = "pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1"
+
pos_profile = frappe.db.sql("""SELECT pf.*
FROM
`tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
ON
pf.name = pfu.parent
WHERE
- (
- (pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1)
- OR (pfu.user = %(user)s AND pfu.default=1)
- OR (ifnull(pfu.user, '') = '' AND pf.company = %(company)s)
- ) AND pf.disabled = 0
- """, {
+ {cond} AND pf.disabled = 0
+ """.format(cond = condition), {
'user': user,
'company': company
}, as_dict=1)
+ if not pos_profile and company:
+ pos_profile = frappe.db.sql("""SELECT pf.*
+ FROM
+ `tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
+ ON
+ pf.name = pfu.parent
+ WHERE
+ pf.company = %(company)s AND pf.disabled = 0
+ """, {
+ 'company': company
+ }, as_dict=1)
+
return pos_profile and pos_profile[0] or None
def get_serial_nos_by_fifo(args, sales_order=None):