mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 22:49:19 +00:00
Merge branch 'version-13-pre-release' into version-13
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '13.10.1'
|
__version__ = '13.10.2'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -1,22 +1,52 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from erpnext.accounts.party import get_party_shipping_address
|
|
||||||
from frappe.test_runner import make_test_objects
|
from frappe.test_runner import make_test_objects
|
||||||
|
|
||||||
|
from erpnext.accounts.party import get_party_shipping_address
|
||||||
|
from erpnext.accounts.utils import get_future_stock_vouchers, get_voucherwise_gl_entries
|
||||||
|
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||||
|
|
||||||
|
|
||||||
class TestUtils(unittest.TestCase):
|
class TestUtils(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestUtils, cls).setUpClass()
|
super(TestUtils, cls).setUpClass()
|
||||||
make_test_objects('Address', ADDRESS_RECORDS)
|
make_test_objects("Address", ADDRESS_RECORDS)
|
||||||
|
|
||||||
def test_get_party_shipping_address(self):
|
def test_get_party_shipping_address(self):
|
||||||
address = get_party_shipping_address('Customer', '_Test Customer 1')
|
address = get_party_shipping_address("Customer", "_Test Customer 1")
|
||||||
self.assertEqual(address, '_Test Billing Address 2 Title-Billing')
|
self.assertEqual(address, "_Test Billing Address 2 Title-Billing")
|
||||||
|
|
||||||
def test_get_party_shipping_address2(self):
|
def test_get_party_shipping_address2(self):
|
||||||
address = get_party_shipping_address('Customer', '_Test Customer 2')
|
address = get_party_shipping_address("Customer", "_Test Customer 2")
|
||||||
self.assertEqual(address, '_Test Shipping Address 2 Title-Shipping')
|
self.assertEqual(address, "_Test Shipping Address 2 Title-Shipping")
|
||||||
|
|
||||||
|
def test_get_voucher_wise_gl_entry(self):
|
||||||
|
|
||||||
|
pr = make_purchase_receipt(
|
||||||
|
item_code="_Test Item",
|
||||||
|
posting_date="2021-02-01",
|
||||||
|
rate=100,
|
||||||
|
qty=1,
|
||||||
|
warehouse="Stores - TCP1",
|
||||||
|
company="_Test Company with perpetual inventory",
|
||||||
|
)
|
||||||
|
|
||||||
|
future_vouchers = get_future_stock_vouchers("2021-01-01", "00:00:00", for_items=["_Test Item"])
|
||||||
|
|
||||||
|
voucher_type_and_no = ("Purchase Receipt", pr.name)
|
||||||
|
self.assertTrue(
|
||||||
|
voucher_type_and_no in future_vouchers,
|
||||||
|
msg="get_future_stock_vouchers not returning correct value",
|
||||||
|
)
|
||||||
|
|
||||||
|
posting_date = "2021-01-01"
|
||||||
|
gl_entries = get_voucherwise_gl_entries(future_vouchers, posting_date)
|
||||||
|
self.assertTrue(
|
||||||
|
voucher_type_and_no in gl_entries, msg="get_voucherwise_gl_entries not returning expected GLes",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
ADDRESS_RECORDS = [
|
ADDRESS_RECORDS = [
|
||||||
@@ -28,12 +58,8 @@ ADDRESS_RECORDS = [
|
|||||||
"city": "Lagos",
|
"city": "Lagos",
|
||||||
"country": "Nigeria",
|
"country": "Nigeria",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"}
|
||||||
"link_doctype": "Customer",
|
],
|
||||||
"link_name": "_Test Customer 2",
|
|
||||||
"doctype": "Dynamic Link"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
@@ -43,12 +69,8 @@ ADDRESS_RECORDS = [
|
|||||||
"city": "Lagos",
|
"city": "Lagos",
|
||||||
"country": "Nigeria",
|
"country": "Nigeria",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"}
|
||||||
"link_doctype": "Customer",
|
],
|
||||||
"link_name": "_Test Customer 2",
|
|
||||||
"doctype": "Dynamic Link"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
@@ -59,12 +81,8 @@ ADDRESS_RECORDS = [
|
|||||||
"country": "Nigeria",
|
"country": "Nigeria",
|
||||||
"is_shipping_address": "1",
|
"is_shipping_address": "1",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{"link_doctype": "Customer", "link_name": "_Test Customer 2", "doctype": "Dynamic Link"}
|
||||||
"link_doctype": "Customer",
|
],
|
||||||
"link_name": "_Test Customer 2",
|
|
||||||
"doctype": "Dynamic Link"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
@@ -75,11 +93,7 @@ ADDRESS_RECORDS = [
|
|||||||
"country": "Nigeria",
|
"country": "Nigeria",
|
||||||
"is_shipping_address": "1",
|
"is_shipping_address": "1",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{"link_doctype": "Customer", "link_name": "_Test Customer 1", "doctype": "Dynamic Link"}
|
||||||
"link_doctype": "Customer",
|
],
|
||||||
"link_name": "_Test Customer 1",
|
},
|
||||||
"doctype": "Dynamic Link"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -960,6 +960,9 @@ def get_voucherwise_gl_entries(future_stock_vouchers, posting_date):
|
|||||||
|
|
||||||
Only fetches GLE fields required for comparing with new GLE.
|
Only fetches GLE fields required for comparing with new GLE.
|
||||||
Check compare_existing_and_expected_gle function below.
|
Check compare_existing_and_expected_gle function below.
|
||||||
|
|
||||||
|
returns:
|
||||||
|
Dict[Tuple[voucher_type, voucher_no], List[GL Entries]]
|
||||||
"""
|
"""
|
||||||
gl_entries = {}
|
gl_entries = {}
|
||||||
if not future_stock_vouchers:
|
if not future_stock_vouchers:
|
||||||
@@ -968,7 +971,7 @@ def get_voucherwise_gl_entries(future_stock_vouchers, posting_date):
|
|||||||
voucher_nos = [d[1] for d in future_stock_vouchers]
|
voucher_nos = [d[1] for d in future_stock_vouchers]
|
||||||
|
|
||||||
gles = frappe.db.sql("""
|
gles = frappe.db.sql("""
|
||||||
select name, account, credit, debit, cost_center, project
|
select name, account, credit, debit, cost_center, project, voucher_type, voucher_no
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where
|
where
|
||||||
posting_date >= %s and voucher_no in (%s)""" %
|
posting_date >= %s and voucher_no in (%s)""" %
|
||||||
|
|||||||
Reference in New Issue
Block a user