From ca627fb806599e52819c451ba554a238910991e6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 5 Sep 2016 16:16:53 +0530 Subject: [PATCH 1/4] [fix] Fetch advance journal entry in invoice if it is tagged against linked order --- erpnext/controllers/accounts_controller.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 432d09a987..8927da7f78 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -662,7 +662,7 @@ def get_advance_journal_entries(party_type, party, party_account, amount_field, .format(order_doctype, order_condition)) reference_condition = " and (" + " or ".join(conditions) + ")" if conditions else "" - + journal_entries = frappe.db.sql(""" select "Journal Entry" as reference_type, t1.name as reference_name, @@ -674,8 +674,7 @@ def get_advance_journal_entries(party_type, party, party_account, amount_field, t1.name = t2.parent and t2.account = %s and t2.party_type = %s and t2.party = %s and t2.is_advance = 'Yes' and t1.docstatus = 1 - and {1} > 0 - and (ifnull(t2.reference_name, '')='' {2}) + and {1} > 0 {2} order by t1.posting_date""".format(amount_field, dr_or_cr, reference_condition), [party_account, party_type, party] + order_list, as_dict=1) From 377c7acd53eafd17b7d262f4b6b977abb3921dd9 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 5 Sep 2016 17:56:44 +0530 Subject: [PATCH 2/4] [POS] Added offline_pos_name in print format --- erpnext/accounts/page/pos/pos.js | 1 + .../accounts/print_format/point_of_sale/point_of_sale.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 5947bde878..234f9623f7 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -775,6 +775,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.update_invoice() }else{ this.name = $.now(); + this.frm.doc.offline_pos_name = this.name; 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 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 605c0326b3..773f7fc8e3 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{{ 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.\") }}

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

\n\t{{ company }}
\n\t{{ __(\"POS No : \") }}{{offline_pos_name}}
\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-08-11 07:23:04.530676", + "modified": "2016-09-05 08:28:42.308782", "modified_by": "Administrator", "name": "Point of Sale", "owner": "Administrator", From f79d7188de63bd6dbe10c83bd3d119b71963db02 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 6 Sep 2016 17:47:05 +0530 Subject: [PATCH 3/4] Patch fixed --- .../v7_0/migrate_mode_of_payments_v6_to_v7.py | 13 +++++++++++-- ...ccount_table_for_expense_claim_type_if_exists.py | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py index e2d2c89437..03f0afba18 100644 --- a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py +++ b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py @@ -5,8 +5,17 @@ def execute(): frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet') frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment') - for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount from - `tabSales Invoice` where is_pos = 1 and docstatus < 2 and cash_bank_account is not null""", as_dict=1): + for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount, company + from `tabSales Invoice` + where is_pos = 1 and docstatus < 2 + and cash_bank_account is not null and cash_bank_account != ''""", as_dict=1): + + if not data.mode_of_payment and not frappe.db.exists("Mode of Payment", "Cash"): + mop = frappe.new_doc("Mode of Payment") + mop.mode_of_payment = "Cash" + mop.type = "Cash" + mop.save() + si_doc = frappe.get_doc('Sales Invoice', data.name) si_doc.append('payments', { 'mode_of_payment': data.mode_of_payment or 'Cash', diff --git a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py index a067e71ed0..96224909ae 100644 --- a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py +++ b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py @@ -9,7 +9,8 @@ def execute(): return for expense_claim_type in frappe.get_all("Expense Claim Type", fields=["name", "default_account"]): - if expense_claim_type.default_account: + if expense_claim_type.default_account \ + and frappe.db.exists("Account", expense_claim_type.default_account): doc = frappe.get_doc("Expense Claim Type", expense_claim_type.name) doc.append("accounts", { "company": frappe.db.get_value("Account", expense_claim_type.default_account, "company"), From 9b54b78794cb05494d9075902df6733967acd3b2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 6 Sep 2016 18:25:55 +0600 Subject: [PATCH 4/4] bumped to version 7.0.40 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 6018a4ca1f..7e94a34634 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.39' +__version__ = '7.0.40' def get_default_company(user=None): '''Get default company for user'''