From 131866a11acd5c87295bea289b08970dea33cced Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 14 Mar 2017 21:06:15 +0530 Subject: [PATCH] [fixes] for tests --- erpnext/accounts/doctype/asset/asset.py | 2 +- erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py | 2 +- erpnext/stock/doctype/stock_entry/stock_entry_utils.py | 3 +++ erpnext/utilities/transaction_base.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py index a99a8cff063..f9a3b2fcf09 100644 --- a/erpnext/accounts/doctype/asset/asset.py +++ b/erpnext/accounts/doctype/asset/asset.py @@ -188,7 +188,7 @@ def make_purchase_invoice(asset, item_code, gross_purchase_amount, company, post pi = frappe.new_doc("Purchase Invoice") pi.company = company pi.currency = frappe.db.get_value("Company", company, "default_currency") - pi.set_posting_date = 1 + pi.set_posting_time = 1 pi.posting_date = posting_date pi.append("items", { "item_code": item_code, diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index cb4a0875aeb..9a1af7f9232 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -1046,7 +1046,7 @@ class TestSalesInvoice(unittest.TestCase): def create_sales_invoice(**args): si = frappe.new_doc("Sales Invoice") args = frappe._dict(args) - if si.posting_date: + if args.posting_date: si.set_posting_date = 1 si.posting_date = args.posting_date or nowdate() diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py index cb3bb7bc5e6..e58042d75ce 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py @@ -9,6 +9,9 @@ def make_stock_entry(**args): s = frappe.new_doc("Stock Entry") args = frappe._dict(args) + if args.posting_date or args.posting_time: + s.set_posting_time = 1 + if args.posting_date: s.posting_date = args.posting_date if args.posting_time: diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index d447482956e..688d6c4ec0e 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -18,7 +18,7 @@ class TransactionBase(StatusUpdater): frappe.db.get_value("Notification Control", None, dt + "_message")) def validate_posting_time(self): - if not getattr(self, 'set_posting_time', False): + if not getattr(self, 'set_posting_time', None): now = now_datetime() self.posting_date = now.strftime('%Y-%m-%d') self.posting_time = now.strftime('%H:%M:%S')