mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
[fixes] for recurring and tests
This commit is contained in:
@@ -188,6 +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.posting_date = posting_date
|
pi.posting_date = posting_date
|
||||||
pi.append("items", {
|
pi.append("items", {
|
||||||
"item_code": item_code,
|
"item_code": item_code,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "naming_series:",
|
"autoname": "naming_series:",
|
||||||
@@ -254,7 +255,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "",
|
"default": "",
|
||||||
"depends_on": "eval:in_list([\"Receive\", \"Pay\"], doc.payment_type)",
|
"depends_on": "eval:in_list([\"Receive\", \"Pay\"], doc.payment_type) && doc.docstatus==0",
|
||||||
"fieldname": "party_type",
|
"fieldname": "party_type",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -1664,17 +1665,17 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"has_web_view": 0,
|
||||||
"hide_heading": 0,
|
"hide_heading": 0,
|
||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"image_view": 0,
|
"image_view": 0,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"in_dialog": 0,
|
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-02-17 16:15:52.917533",
|
"modified": "2017-03-14 17:12:48.816644",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Entry",
|
"name": "Payment Entry",
|
||||||
|
|||||||
@@ -1046,6 +1046,8 @@ 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:
|
||||||
|
si.set_posting_date = 1
|
||||||
si.posting_date = args.posting_date or nowdate()
|
si.posting_date = args.posting_date or nowdate()
|
||||||
|
|
||||||
si.company = args.company or "_Test Company"
|
si.company = args.company or "_Test Company"
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ def make_new_document(reference_doc, date_field, posting_date):
|
|||||||
"next_date": get_next_date(reference_doc.next_date, mcount,cint(reference_doc.repeat_on_day_of_month))
|
"next_date": get_next_date(reference_doc.next_date, mcount,cint(reference_doc.repeat_on_day_of_month))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if new_document.meta.get_field('set_posting_time'):
|
||||||
|
new_document.set('set_posting_time', 1)
|
||||||
|
|
||||||
# copy document fields
|
# copy document fields
|
||||||
for fieldname in ("owner", "recurring_type", "repeat_on_day_of_month",
|
for fieldname in ("owner", "recurring_type", "repeat_on_day_of_month",
|
||||||
"recurring_id", "notification_email_address", "is_recurring", "end_date",
|
"recurring_id", "notification_email_address", "is_recurring", "end_date",
|
||||||
|
|||||||
@@ -437,6 +437,7 @@ class TestDeliveryNote(unittest.TestCase):
|
|||||||
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
|
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
|
||||||
|
|
||||||
dn1 = make_delivery_note(so.name)
|
dn1 = make_delivery_note(so.name)
|
||||||
|
dn1.set_posting_time = 1
|
||||||
dn1.posting_time = "10:00"
|
dn1.posting_time = "10:00"
|
||||||
dn1.get("items")[0].qty = 2
|
dn1.get("items")[0].qty = 2
|
||||||
dn1.submit()
|
dn1.submit()
|
||||||
@@ -468,6 +469,7 @@ class TestDeliveryNote(unittest.TestCase):
|
|||||||
so = make_sales_order()
|
so = make_sales_order()
|
||||||
|
|
||||||
dn1 = make_delivery_note(so.name)
|
dn1 = make_delivery_note(so.name)
|
||||||
|
dn1.set_posting_time = 1
|
||||||
dn1.posting_time = "10:00"
|
dn1.posting_time = "10:00"
|
||||||
dn1.get("items")[0].qty = 2
|
dn1.get("items")[0].qty = 2
|
||||||
dn1.submit()
|
dn1.submit()
|
||||||
|
|||||||
@@ -512,6 +512,7 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
# test freeze_stocks_upto_days
|
# test freeze_stocks_upto_days
|
||||||
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 7)
|
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 7)
|
||||||
se = frappe.copy_doc(test_records[0])
|
se = frappe.copy_doc(test_records[0])
|
||||||
|
se.set_posting_time = 1
|
||||||
se.posting_date = add_days(nowdate(), -15)
|
se.posting_date = add_days(nowdate(), -15)
|
||||||
se.insert()
|
se.insert()
|
||||||
self.assertRaises(StockFreezeError, se.submit)
|
self.assertRaises(StockFreezeError, se.submit)
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ def create_stock_reconciliation(**args):
|
|||||||
sr = frappe.new_doc("Stock Reconciliation")
|
sr = frappe.new_doc("Stock Reconciliation")
|
||||||
sr.posting_date = args.posting_date or nowdate()
|
sr.posting_date = args.posting_date or nowdate()
|
||||||
sr.posting_time = args.posting_time or nowtime()
|
sr.posting_time = args.posting_time or nowtime()
|
||||||
|
sr.set_posting_time = 1
|
||||||
sr.company = args.company or "_Test Company"
|
sr.company = args.company or "_Test Company"
|
||||||
sr.expense_account = args.expense_account or \
|
sr.expense_account = args.expense_account or \
|
||||||
("Stock Adjustment - _TC" if frappe.get_all("Stock Ledger Entry") else "Temporary Opening - _TC")
|
("Stock Adjustment - _TC" if frappe.get_all("Stock Ledger Entry") else "Temporary Opening - _TC")
|
||||||
|
|||||||
Reference in New Issue
Block a user