[Fix] Sales Invoice shows default date while no default mentioned
This commit is contained in:
parent
a09285122f
commit
5d97d89a03
@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
||||
import unittest
|
||||
import frappe
|
||||
import frappe.model
|
||||
from frappe.utils import cint, flt
|
||||
from frappe.utils import cint, flt, today
|
||||
import frappe.defaults
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
|
||||
test_records as pr_test_records
|
||||
@ -412,8 +412,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
def make_purchase_invoice(**args):
|
||||
pi = frappe.new_doc("Purchase Invoice")
|
||||
args = frappe._dict(args)
|
||||
if args.posting_date:
|
||||
pi.posting_date = args.posting_date
|
||||
pi.posting_date = args.posting_date or today()
|
||||
if args.posting_time:
|
||||
pi.posting_time = args.posting_time
|
||||
if args.update_stock:
|
||||
|
@ -955,7 +955,6 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
def create_sales_invoice(**args):
|
||||
si = frappe.new_doc("Sales Invoice")
|
||||
args = frappe._dict(args)
|
||||
if args.posting_date:
|
||||
si.posting_date = args.posting_date or nowdate()
|
||||
|
||||
si.company = args.company or "_Test Company"
|
||||
|
@ -81,8 +81,9 @@ class AccountsController(TransactionBase):
|
||||
convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
for fieldname in ["posting_date", "transaction_date"]:
|
||||
if not self.get(fieldname) and self.meta.get_field(fieldname):
|
||||
if frappe.flags.in_test:
|
||||
for fieldname in ["posting_date","transaction_date"]:
|
||||
if self.meta.get_field(fieldname) and not self.get(fieldname):
|
||||
self.set(fieldname, today())
|
||||
break
|
||||
|
||||
|
@ -87,15 +87,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
var today = get_today(),
|
||||
currency = frappe.defaults.get_user_default("currency");
|
||||
|
||||
$.each(["posting_date", "transaction_date"], function(i, fieldname) {
|
||||
if (me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname] && me.frm[fieldname]) {
|
||||
me.frm.set_value(fieldname, me.frm[fieldname]);
|
||||
}
|
||||
});
|
||||
|
||||
$.each({
|
||||
posting_date: today,
|
||||
transaction_date: today,
|
||||
currency: currency,
|
||||
price_list_currency: currency,
|
||||
status: "Draft",
|
||||
|
@ -7,7 +7,7 @@ import unittest
|
||||
import frappe
|
||||
import json
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint, nowdate, nowtime, cstr, add_days, flt
|
||||
from frappe.utils import cint, nowdate, nowtime, cstr, add_days, flt, today
|
||||
from erpnext.stock.stock_ledger import get_previous_sle
|
||||
from erpnext.accounts.utils import get_balance_on
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt \
|
||||
@ -516,8 +516,7 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
def create_delivery_note(**args):
|
||||
dn = frappe.new_doc("Delivery Note")
|
||||
args = frappe._dict(args)
|
||||
if args.posting_date:
|
||||
dn.posting_date = args.posting_date
|
||||
dn.posting_date = args.posting_date or today()
|
||||
if args.posting_time:
|
||||
dn.posting_time = args.posting_time
|
||||
|
||||
|
@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
||||
import unittest
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint, flt, cstr
|
||||
from frappe.utils import cint, flt, cstr, today
|
||||
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
|
||||
|
||||
class TestPurchaseReceipt(unittest.TestCase):
|
||||
@ -193,6 +193,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
po = create_purchase_order()
|
||||
|
||||
pr1 = make_purchase_receipt(po.name)
|
||||
pr1.posting_date = today()
|
||||
pr1.posting_time = "10:00"
|
||||
pr1.get("items")[0].received_qty = 2
|
||||
pr1.get("items")[0].qty = 2
|
||||
@ -209,6 +210,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
pi2.submit()
|
||||
|
||||
pr2 = make_purchase_receipt(po.name)
|
||||
pr2.posting_date = today()
|
||||
pr2.posting_time = "08:00"
|
||||
pr2.get("items")[0].received_qty = 5
|
||||
pr2.get("items")[0].qty = 5
|
||||
@ -236,8 +238,7 @@ def set_perpetual_inventory(enable=1):
|
||||
def make_purchase_receipt(**args):
|
||||
pr = frappe.new_doc("Purchase Receipt")
|
||||
args = frappe._dict(args)
|
||||
if args.posting_date:
|
||||
pr.posting_date = args.posting_date
|
||||
pr.posting_date = args.posting_date or today()
|
||||
if args.posting_time:
|
||||
pr.posting_time = args.posting_time
|
||||
pr.company = args.company or "_Test Company"
|
||||
|
Loading…
Reference in New Issue
Block a user