Fetch warehouse from pos settings
This commit is contained in:
parent
4a1c897b2d
commit
cf2632fe59
@ -383,20 +383,20 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
|
|
||||||
def get_warehouse(self):
|
def get_warehouse(self):
|
||||||
w = frappe.db.sql("""select warehouse from `tabPOS Setting`
|
user_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
|
||||||
where ifnull(user,'') = %s and company = %s""",
|
where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company))
|
||||||
(frappe.session['user'], self.company))
|
warehouse = user_pos_setting[0][1] if user_pos_setting else None
|
||||||
w = w and w[0][0] or ''
|
|
||||||
if not w:
|
if not warehouse:
|
||||||
ps = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
|
global_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
|
||||||
where ifnull(user,'') = '' and company = %s""", self.company)
|
where ifnull(user,'') = '' and company = %s""", self.company)
|
||||||
if not ps:
|
|
||||||
|
if global_pos_setting:
|
||||||
|
warehouse = global_pos_setting[0][1] if global_pos_setting else None
|
||||||
|
elif not user_pos_setting:
|
||||||
msgprint(_("POS Setting required to make POS Entry"), raise_exception=True)
|
msgprint(_("POS Setting required to make POS Entry"), raise_exception=True)
|
||||||
elif not ps[0][1]:
|
|
||||||
msgprint(_("Warehouse required in POS Setting"))
|
return warehouse
|
||||||
else:
|
|
||||||
w = ps[0][1]
|
|
||||||
return w
|
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
if cint(self.update_stock) == 1:
|
if cint(self.update_stock) == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user