diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py index a99a8cff06..f9a3b2fcf0 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 cb4a0875ae..9a1af7f923 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 cb3bb7bc5e..e58042d75c 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 d447482956..688d6c4ec0 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')