From 033ed00c56b760a3abf12a69de441fc95649ef64 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 11 Aug 2016 16:37:29 +0530 Subject: [PATCH 1/2] [POS] fixed issue of negative stock --- erpnext/accounts/doctype/sales_invoice/pos.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 53144cbf2b..8f9db21901 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -222,6 +222,7 @@ def submit_invoice(si_doc, name): def save_invoice(e, si_doc, name): if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}): + si_doc.docstatus = 0 si_doc.flags.ignore_mandatory = True si_doc.insert() make_scheduler_log(e, si_doc.name) From 9cd356c7f0aadc5f2e0ee89b442b42a8b47abff2 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 11 Aug 2016 16:54:30 +0530 Subject: [PATCH 2/2] [POS] Fixed print qty decimal issue --- erpnext/accounts/doctype/sales_invoice/pos.py | 2 ++ erpnext/accounts/page/pos/pos.js | 2 ++ .../accounts/print_format/point_of_sale/point_of_sale.json | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 8f9db21901..33032bf1e9 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -181,6 +181,8 @@ def make_invoice(doc_list): si_doc.update(doc) submit_invoice(si_doc, name) name_list.append(name) + else: + name_list.append(name) return name_list diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 64168b2f4b..0d3e0193d5 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -804,6 +804,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.update_invoice() }else{ this.name = $.now(); + this.frm.doc.posting_date = frappe.datetime.get_today(); + this.frm.doc.posting_time = frappe.datetime.now_time(); invoice_data[this.name] = this.frm.doc this.si_docs.push(invoice_data) this.update_localstorage(); diff --git a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json index 645fce6fe6..605c0326b3 100644 --- a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json +++ b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json @@ -6,9 +6,9 @@ "docstatus": 0, "doctype": "Print Format", "font": "Default", - "html": "\n\n

\n\t{{ company }}
\n\t{{ __(\"Invoice\") }}
\n

\n

\n\t{{ __(\"Date\") }}: {{ dateutil.global_date_format(posting_date) }}
\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{% for item in items %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% endfor %}\n\t\n
{{ __(\"Item\") }}{{ __(\"Qty\") }}{{ __(\"Amount\") }}
\n\t\t\t\t{{ item.item_name }}\n\t\t\t{{ item.qty }}
@ {{ format_currency(item.rate, currency) }}
{{ format_currency(item.amount, currency) }}
\n\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% endif %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t
\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t
\n\t\t\t\t{{ __(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t
\n\n\n
\n

{{ __(\"Thank you, please visit again.\") }}

", + "html": "\n\n

\n\t{{ company }}
\n\t{{ __(\"Invoice\") }}
\n

\n

\n\t{{ __(\"Date\") }}: {{ dateutil.global_date_format(posting_date) }}
\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{% for item in items %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% endfor %}\n\t\n
{{ __(\"Item\") }}{{ __(\"Qty\") }}{{ __(\"Amount\") }}
\n\t\t\t\t{{ item.item_name }}\n\t\t\t{{ format_number(item.qty, precision(\"difference\")) }}
@ {{ format_currency(item.rate, currency) }}
{{ format_currency(item.amount, currency) }}
\n\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{% endif %}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t
\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t
\n\t\t\t\t{{ __(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t
\n\n\n
\n

{{ __(\"Thank you, please visit again.\") }}

", "idx": 0, - "modified": "2016-05-21 00:25:20.359074", + "modified": "2016-08-11 07:23:04.530676", "modified_by": "Administrator", "name": "Point of Sale", "owner": "Administrator",