Skip to content

Commit

Permalink
Merge branch 'staging' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil28297 committed Dec 13, 2021
2 parents d79effd + 7036d34 commit b18e697
Show file tree
Hide file tree
Showing 79 changed files with 953 additions and 774 deletions.
9 changes: 5 additions & 4 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pull_request_rules:
conditions:
- status-success=Sider
- status-success=Semantic Pull Request
- status-success=Codacy Static Code Analysis
- status-success=Travis CI - Pull Request
- status-success=Python Unit Tests
- status-success=Patch Test
- status-success=security/snyk (Bloomstack)
- label!=Don't Merge
- label!=squash
Expand All @@ -15,8 +15,9 @@ pull_request_rules:
- name: Automatic squash on CI success and review
conditions:
- status-success=Sider
- status-success=Codacy Static Code Analysis
- status-success=Travis CI - Pull Request
- status-success=Semantic Pull Request
- status-success=Python Unit Tests
- status-success=Patch Test
- status-success=security/snyk (Bloomstack)
- label!=Don't Merge
- label=squash
Expand Down
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .travis/site_config.json

This file was deleted.

2 changes: 1 addition & 1 deletion erpnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from frappe.utils import getdate

__erpnext_version__ = '12.10.1'
__version__ = '2.7.0'
__version__ = '2.8.0'

def get_default_company(user=None):
'''Get default company for user'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,12 @@
import unittest
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import delete_accounting_dimension

test_dependencies = ['Cost Center', 'Location', 'Warehouse', 'Department']

class TestAccountingDimension(unittest.TestCase):
def setUp(self):
frappe.set_user("Administrator")

if not frappe.db.exists("Accounting Dimension", {"document_type": "Department"}):
dimension = frappe.get_doc({
"doctype": "Accounting Dimension",
"document_type": "Department",
}).insert()
else:
dimension1 = frappe.get_doc("Accounting Dimension", "Department")
dimension1.disabled = 0
dimension1.save()

if not frappe.db.exists("Accounting Dimension", {"document_type": "Location"}):
dimension1 = frappe.get_doc({
"doctype": "Accounting Dimension",
"document_type": "Location",
})

dimension1.append("dimension_defaults", {
"company": "_Test Company",
"reference_document": "Location",
"default_dimension": "Block 1",
"mandatory_for_bs": 1
})

dimension1.insert()
dimension1.save()
else:
dimension1 = frappe.get_doc("Accounting Dimension", "Location")
dimension1.disabled = 0
dimension1.save()
create_dimension()

def test_dimension_against_sales_invoice(self):
si = create_sales_invoice(do_not_save=1)
Expand Down Expand Up @@ -101,6 +72,38 @@ def test_mandatory(self):
def tearDown(self):
disable_dimension()

def create_dimension():
frappe.set_user("Administrator")

if not frappe.db.exists("Accounting Dimension", {"document_type": "Department"}):
frappe.get_doc({
"doctype": "Accounting Dimension",
"document_type": "Department",
}).insert()
else:
dimension = frappe.get_doc("Accounting Dimension", "Department")
dimension.disabled = 0
dimension.save()

if not frappe.db.exists("Accounting Dimension", {"document_type": "Location"}):
dimension1 = frappe.get_doc({
"doctype": "Accounting Dimension",
"document_type": "Location",
})

dimension1.append("dimension_defaults", {
"company": "_Test Company",
"reference_document": "Location",
"default_dimension": "Block 1",
"mandatory_for_bs": 1
})

dimension1.insert()
dimension1.save()
else:
dimension1 = frappe.get_doc("Accounting Dimension", "Location")
dimension1.disabled = 0
dimension1.save()

def disable_dimension():
dimension1 = frappe.get_doc("Accounting Dimension", "Department")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_on_close_before_loan_period(self):

def test_make_payment_before_loan_period(self):
#it has problem
inv = create_sales_invoice(rate=700)
inv = create_sales_invoice(item_code="_Test Item Home Desktop 100",rate=700)
inv_disc = create_invoice_discounting([inv.name],
accounts_receivable_credit=self.ar_credit,
accounts_receivable_discounted=self.ar_discounted,
Expand Down Expand Up @@ -238,7 +238,7 @@ def test_make_payment_before_loan_period(self):

def test_make_payment_before_after_period(self):
#it has problem
inv = create_sales_invoice(rate=700)
inv = create_sales_invoice(item_code="_Test Item Home Desktop 100",rate=700)
inv_disc = create_invoice_discounting([inv.name],
accounts_receivable_credit=self.ar_credit,
accounts_receivable_discounted=self.ar_discounted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def cancel_against_voucher_testcase(self, test_voucher):
elif test_voucher.doctype in ["Sales Order", "Purchase Order"]:
# if test_voucher is a Sales Order/Purchase Order, test error on cancellation of test_voucher
submitted_voucher = frappe.get_doc(test_voucher.doctype, test_voucher.name)
self.assertRaises(frappe.LinkExistsError, submitted_voucher.cancel)
self.assertRaises(frappe.LinkExistsError, submitted_voucher.cancel())

def test_jv_against_stock_account(self):
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
Expand Down
4 changes: 2 additions & 2 deletions erpnext/accounts/doctype/pos_profile/test_pos_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def test_pos_profile(self):
items = get_items_list(doc, doc.company)
customers = get_customers_list(doc)

products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group'""", as_list=1)
customers_count = frappe.db.sql(""" select count(name) from tabCustomer where customer_group = '_Test Customer Group'""")
products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group' and disabled = 0 and has_variants = 0 and is_sales_item = 1""", as_list=1)
customers_count = frappe.db.sql(""" select count(name) from tabCustomer where customer_group = '_Test Customer Group' and disabled = 0""")

self.assertEqual(len(items), products_count[0][0])
self.assertEqual(len(customers), customers_count[0][0])
Expand Down
24 changes: 12 additions & 12 deletions erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_sales_invoice_calculation_export_currency(self):
self.assertEqual(si.grand_total, 32.55)

def test_sales_invoice_with_discount_and_inclusive_tax(self):
si = create_sales_invoice(qty=100, rate=50, do_not_save=True)
si = create_sales_invoice(item_code="_Test Item Home Desktop 100", qty=100, rate=50, do_not_save=True)
si.append("taxes", {
"charge_type": "On Net Total",
"account_head": "_Test Account Service Tax - _TC",
Expand Down Expand Up @@ -1034,14 +1034,14 @@ def test_serial_numbers_against_delivery_note(self):
self.assertEqual(si.get("items")[0].serial_no, dn.get("items")[0].serial_no)

def test_return_sales_invoice(self):
make_stock_entry(item_code="_Test Item", target="Stores - TCP1", qty=50, basic_rate=100)
make_stock_entry(item_code="_Test Item Home Desktop 100", target="Stores - TCP1", qty=50, basic_rate=100)

actual_qty_0 = get_qty_after_transaction(item_code = "_Test Item", warehouse = "Stores - TCP1")
actual_qty_0 = get_qty_after_transaction(item_code = "_Test Item Home Desktop 100", warehouse = "Stores - TCP1")

si = create_sales_invoice(qty = 5, rate=500, update_stock=1, company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1")
si = create_sales_invoice(qty = 5, rate=500, update_stock=1, company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test Item Home Desktop 100", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1")


actual_qty_1 = get_qty_after_transaction(item_code = "_Test Item", warehouse = "Stores - TCP1")
actual_qty_1 = get_qty_after_transaction(item_code = "_Test Item Home Desktop 100", warehouse = "Stores - TCP1")

frappe.db.commit()

Expand All @@ -1052,9 +1052,9 @@ def test_return_sales_invoice(self):
"voucher_no": si.name}, "stock_value_difference") / 5

# return entry
si1 = create_sales_invoice(is_return=1, return_against=si.name, qty=-2, rate=500, update_stock=1, company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1")
si1 = create_sales_invoice(is_return=1, return_against=si.name, qty=-2, rate=500, update_stock=1, company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test Item Home Desktop 100", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1")

actual_qty_2 = get_qty_after_transaction(item_code = "_Test Item", warehouse = "Stores - TCP1")
actual_qty_2 = get_qty_after_transaction(item_code = "_Test Item Home Desktop 100", warehouse = "Stores - TCP1")
self.assertEqual(actual_qty_1 + 2, actual_qty_2)

incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
Expand Down Expand Up @@ -1208,7 +1208,7 @@ def test_invalid_currency(self):
self.assertRaises(InvalidAccountCurrency, si5.submit)

def test_create_so_with_margin(self):
si = create_sales_invoice(item_code="_Test Item", qty=1, do_not_submit=True)
si = create_sales_invoice(item_code="_Test Item Home Desktop 100", qty=1, do_not_submit=True)
price_list_rate = 100
si.items[0].price_list_rate = price_list_rate
si.items[0].margin_type = 'Percentage'
Expand Down Expand Up @@ -1460,10 +1460,10 @@ def test_rounding_adjustment(self):
self.assertEqual(expected_values[gle.account][2], gle.credit)

def test_rounding_adjustment_2(self):
si = create_sales_invoice(rate=400, do_not_save=True)
si = create_sales_invoice(item_code="_Test Item Home Desktop 100", rate=400, do_not_save=True)
for rate in [400, 600, 100]:
si.append("items", {
"item_code": "_Test Item",
"item_code": "_Test Item Home Desktop 100",
"gst_hsn_code": "999800",
"warehouse": "_Test Warehouse - _TC",
"qty": 1,
Expand Down Expand Up @@ -1584,7 +1584,7 @@ def test_sales_invoice_for_enable_allow_cost_center_in_entry_of_bs_account(self)
cost_center = "_Test Cost Center for BS Account - _TC"
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")

si = create_sales_invoice_against_cost_center(cost_center=cost_center, debit_to="Debtors - _TC")
si = create_sales_invoice_against_cost_center(item_code="_Test Item Home Desktop 100", cost_center=cost_center, debit_to="Debtors - _TC")
self.assertEqual(si.cost_center, cost_center)

expected_values = {
Expand Down Expand Up @@ -1614,7 +1614,7 @@ def test_sales_invoice_for_disable_allow_cost_center_in_entry_of_bs_account(self
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
accounts_settings.save()
cost_center = "_Test Cost Center - _TC"
si = create_sales_invoice(debit_to="Debtors - _TC")
si = create_sales_invoice(item_code="_Test Item Home Desktop 100", debit_to="Debtors - _TC")

expected_values = {
"Debtors - _TC": {
Expand Down
16 changes: 3 additions & 13 deletions erpnext/accounts/doctype/tax_rule/test_tax_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,16 @@ def test_conflict(self):

def test_conflict_with_non_overlapping_dates(self):
tax_rule1 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01")
tax_rule1.save()
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01", save=1)

tax_rule2 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, to_date = "2013-01-01")
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, to_date = "2013-01-01", save=1)

tax_rule2.save()
self.assertTrue(tax_rule2.name)

def test_for_parent_customer_group(self):
tax_rule1 = make_tax_rule(customer_group= "All Customer Groups",
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01")
tax_rule1.save()
self.assertEqual(get_tax_template("2015-01-01", {"customer_group" : "Commercial", "use_for_shopping_cart":0}),
"_Test Sales Taxes and Charges Template - _TC")

def test_conflict_with_overlapping_dates(self):
tax_rule1 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01", to_date = "2015-01-05")
tax_rule1.save()
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01", to_date = "2015-01-05", save=1)

tax_rule2 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-03", to_date = "2015-01-09")
Expand Down
13 changes: 7 additions & 6 deletions erpnext/accounts/report/account_balance/test_account_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_account_balance(self):

expected_data = [
{
"account": 'Sales - _TC2',
"account": 'Direct Income - _TC2',
"currency": 'EUR',
"balance": -100.0,
},
Expand All @@ -33,23 +33,24 @@ def test_account_balance(self):
"balance": -100.0,
},
{
"account": 'Service - _TC2',
"account": 'Indirect Income - _TC2',
"currency": 'EUR',
"balance": 0.0,
},
{
"account": 'Direct Income - _TC2',
"account": 'Sales - _TC2',
"currency": 'EUR',
"balance": -100.0,
},
{
"account": 'Indirect Income - _TC2',
"account": 'Service - _TC2',
"currency": 'EUR',
"balance": 0.0,
},
}
]

self.assertEqual(expected_data, report[1])
sorted_list = sorted(report[1], key = lambda i: i['account'])
self.assertEqual(expected_data, sorted_list)

def make_sales_invoice():
frappe.set_user("Administrator")
Expand Down
Loading

0 comments on commit b18e697

Please sign in to comment.