[enhancement] POS print after save #385:wq:wq

This commit is contained in:
Rushabh Mehta
2015-08-18 15:29:42 +05:30
parent d726ce5e9e
commit ad9156a6ae
7 changed files with 562 additions and 168 deletions

View File

@@ -50,7 +50,7 @@ def get_item_details(args):
get_price_list_rate(args, item_doc, out)
if args.transaction_type == "selling" and cint(args.is_pos):
out.update(get_pos_profiles_item_details(args.company, args))
out.update(get_pos_profile_item_details(args.company, args))
# update args with out, if key or value not exists
for key, value in out.iteritems():
@@ -284,16 +284,16 @@ def get_party_item_code(args, item_doc, out):
item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier})
out.supplier_part_no = item_supplier[0].supplier_part_no if item_supplier else None
def get_pos_profiles_item_details(company, args, pos_profiles=None):
def get_pos_profile_item_details(company, args, pos_profile=None):
res = frappe._dict()
if not pos_profiles:
pos_profiles = get_pos_profiles(company)
if not pos_profile:
pos_profile = get_pos_profile(company)
if pos_profiles:
if pos_profile:
for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
if not args.get(fieldname) and pos_profiles.get(fieldname):
res[fieldname] = pos_profiles.get(fieldname)
if not args.get(fieldname) and pos_profile.get(fieldname):
res[fieldname] = pos_profile.get(fieldname)
if res.get("warehouse"):
res.actual_qty = get_available_qty(args.item_code,
@@ -301,15 +301,16 @@ def get_pos_profiles_item_details(company, args, pos_profiles=None):
return res
def get_pos_profiles(company):
pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` where user = %s
@frappe.whitelist()
def get_pos_profile(company):
pos_profile = frappe.db.sql("""select * from `tabPOS Profile` where user = %s
and company = %s""", (frappe.session['user'], company), as_dict=1)
if not pos_profiles:
pos_profiles = frappe.db.sql("""select * from `tabPOS Profile`
if not pos_profile:
pos_profile = frappe.db.sql("""select * from `tabPOS Profile`
where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
return pos_profiles and pos_profiles[0] or None
return pos_profile and pos_profile[0] or None
def get_serial_nos_by_fifo(args, item_doc):