[fixes] for tests

This commit is contained in:
Rushabh Mehta 2017-03-14 21:06:15 +05:30
parent 82c258948d
commit 131866a11a
4 changed files with 6 additions and 3 deletions

View File

@ -188,7 +188,7 @@ def make_purchase_invoice(asset, item_code, gross_purchase_amount, company, post
pi = frappe.new_doc("Purchase Invoice") pi = frappe.new_doc("Purchase Invoice")
pi.company = company pi.company = company
pi.currency = frappe.db.get_value("Company", company, "default_currency") 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.posting_date = posting_date
pi.append("items", { pi.append("items", {
"item_code": item_code, "item_code": item_code,

View File

@ -1046,7 +1046,7 @@ class TestSalesInvoice(unittest.TestCase):
def create_sales_invoice(**args): def create_sales_invoice(**args):
si = frappe.new_doc("Sales Invoice") si = frappe.new_doc("Sales Invoice")
args = frappe._dict(args) args = frappe._dict(args)
if si.posting_date: if args.posting_date:
si.set_posting_date = 1 si.set_posting_date = 1
si.posting_date = args.posting_date or nowdate() si.posting_date = args.posting_date or nowdate()

View File

@ -9,6 +9,9 @@ def make_stock_entry(**args):
s = frappe.new_doc("Stock Entry") s = frappe.new_doc("Stock Entry")
args = frappe._dict(args) args = frappe._dict(args)
if args.posting_date or args.posting_time:
s.set_posting_time = 1
if args.posting_date: if args.posting_date:
s.posting_date = args.posting_date s.posting_date = args.posting_date
if args.posting_time: if args.posting_time:

View File

@ -18,7 +18,7 @@ class TransactionBase(StatusUpdater):
frappe.db.get_value("Notification Control", None, dt + "_message")) frappe.db.get_value("Notification Control", None, dt + "_message"))
def validate_posting_time(self): def validate_posting_time(self):
if not getattr(self, 'set_posting_time', False): if not getattr(self, 'set_posting_time', None):
now = now_datetime() now = now_datetime()
self.posting_date = now.strftime('%Y-%m-%d') self.posting_date = now.strftime('%Y-%m-%d')
self.posting_time = now.strftime('%H:%M:%S') self.posting_time = now.strftime('%H:%M:%S')