mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
style: format code with black
This commit is contained in:
@@ -27,7 +27,7 @@ def retry_failing_transaction(log_date=None):
|
||||
.where(btp.date == log_date)
|
||||
).run(as_dict=True)
|
||||
|
||||
if data :
|
||||
if data:
|
||||
if len(data) > 10:
|
||||
frappe.enqueue(job, queue="long", job_name="bulk_retry", data=data, log_date=log_date)
|
||||
else:
|
||||
@@ -35,6 +35,7 @@ def retry_failing_transaction(log_date=None):
|
||||
else:
|
||||
return "No Failed Records"
|
||||
|
||||
|
||||
def job(data, log_date):
|
||||
for d in data:
|
||||
failed = []
|
||||
@@ -51,7 +52,7 @@ def job(data, log_date):
|
||||
d.to_doctype,
|
||||
status="Failed",
|
||||
log_date=log_date,
|
||||
restarted=1
|
||||
restarted=1,
|
||||
)
|
||||
|
||||
if not failed:
|
||||
|
||||
@@ -10,7 +10,6 @@ from erpnext.utilities.bulk_transaction import transaction_processing
|
||||
|
||||
|
||||
class TestBulkTransactionLog(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
create_company()
|
||||
create_customer()
|
||||
@@ -19,7 +18,11 @@ class TestBulkTransactionLog(unittest.TestCase):
|
||||
def test_for_single_record(self):
|
||||
so_name = create_so()
|
||||
transaction_processing([{"name": so_name}], "Sales Order", "Sales Invoice")
|
||||
data = frappe.db.get_list("Sales Invoice", filters = {"posting_date": date.today(), "customer": "Bulk Customer"}, fields=["*"])
|
||||
data = frappe.db.get_list(
|
||||
"Sales Invoice",
|
||||
filters={"posting_date": date.today(), "customer": "Bulk Customer"},
|
||||
fields=["*"],
|
||||
)
|
||||
if not data:
|
||||
self.fail("No Sales Invoice Created !")
|
||||
|
||||
@@ -36,32 +39,35 @@ class TestBulkTransactionLog(unittest.TestCase):
|
||||
self.assertEqual(d.retried, 0)
|
||||
|
||||
|
||||
|
||||
def create_company():
|
||||
if not frappe.db.exists('Company', '_Test Company'):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Company',
|
||||
'company_name': '_Test Company',
|
||||
'country': 'India',
|
||||
'default_currency': 'INR'
|
||||
}).insert()
|
||||
if not frappe.db.exists("Company", "_Test Company"):
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "Company",
|
||||
"company_name": "_Test Company",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
def create_customer():
|
||||
if not frappe.db.exists('Customer', 'Bulk Customer'):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Customer',
|
||||
'customer_name': 'Bulk Customer'
|
||||
}).insert()
|
||||
if not frappe.db.exists("Customer", "Bulk Customer"):
|
||||
frappe.get_doc({"doctype": "Customer", "customer_name": "Bulk Customer"}).insert()
|
||||
|
||||
|
||||
def create_item():
|
||||
if not frappe.db.exists("Item", "MK"):
|
||||
frappe.get_doc({
|
||||
"doctype": "Item",
|
||||
"item_code": "MK",
|
||||
"item_name": "Milk",
|
||||
"description": "Milk",
|
||||
"item_group": "Products"
|
||||
}).insert()
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "Item",
|
||||
"item_code": "MK",
|
||||
"item_name": "Milk",
|
||||
"description": "Milk",
|
||||
"item_group": "Products",
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
def create_so(intent=None):
|
||||
so = frappe.new_doc("Sales Order")
|
||||
@@ -70,12 +76,15 @@ def create_so(intent=None):
|
||||
so.transaction_date = date.today()
|
||||
|
||||
so.set_warehouse = "Finished Goods - _TC"
|
||||
so.append("items", {
|
||||
"item_code": "MK",
|
||||
"delivery_date": date.today(),
|
||||
"qty": 10,
|
||||
"rate": 80,
|
||||
})
|
||||
so.append(
|
||||
"items",
|
||||
{
|
||||
"item_code": "MK",
|
||||
"delivery_date": date.today(),
|
||||
"qty": 10,
|
||||
"rate": 80,
|
||||
},
|
||||
)
|
||||
so.insert()
|
||||
so.submit()
|
||||
return so.name
|
||||
return so.name
|
||||
|
||||
Reference in New Issue
Block a user