mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
Merge branch 'hotfix' into fix_bom_include_exploded_item
This commit is contained in:
25
.travis.yml
25
.travis.yml
@@ -3,6 +3,11 @@ dist: trusty
|
|||||||
|
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
- "2.7"
|
||||||
|
- "3.6"
|
||||||
|
|
||||||
|
env:
|
||||||
|
- TEST_TYPE="Server Side Test"
|
||||||
|
- TEST_TYPE="Patch Test"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- mysql
|
- mysql
|
||||||
@@ -39,18 +44,8 @@ before_script:
|
|||||||
- bench start &
|
- bench start &
|
||||||
- sleep 10
|
- sleep 10
|
||||||
|
|
||||||
jobs:
|
script:
|
||||||
include:
|
- bash $TRAVIS_BUILD_DIR/travis/run-tests.sh
|
||||||
- stage: test
|
|
||||||
script:
|
after_script:
|
||||||
- set -e
|
- coveralls -b apps/erpnext -d ../../sites/.coverage
|
||||||
- bench run-tests --app erpnext --coverage
|
|
||||||
after_script:
|
|
||||||
- coveralls -b apps/erpnext -d ../../sites/.coverage
|
|
||||||
env: Server Side Test
|
|
||||||
- # stage
|
|
||||||
script:
|
|
||||||
- wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz
|
|
||||||
- bench --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz --mariadb-root-password travis
|
|
||||||
- bench migrate
|
|
||||||
env: Patch Testing
|
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ def filter_pricing_rules(args, pricing_rules):
|
|||||||
if len(pricing_rules) > 1:
|
if len(pricing_rules) > 1:
|
||||||
rate_or_discount = list(set([d.rate_or_discount for d in pricing_rules]))
|
rate_or_discount = list(set([d.rate_or_discount for d in pricing_rules]))
|
||||||
if len(rate_or_discount) == 1 and rate_or_discount[0] == "Discount Percentage":
|
if len(rate_or_discount) == 1 and rate_or_discount[0] == "Discount Percentage":
|
||||||
pricing_rules = filter(lambda x: x.for_price_list==args.price_list, pricing_rules) \
|
pricing_rules = list(filter(lambda x: x.for_price_list==args.price_list, pricing_rules)) \
|
||||||
or pricing_rules
|
or pricing_rules
|
||||||
|
|
||||||
if len(pricing_rules) > 1 and not args.for_shopping_cart:
|
if len(pricing_rules) > 1 and not args.for_shopping_cart:
|
||||||
@@ -373,7 +373,7 @@ def apply_internal_priority(pricing_rules, field_set, args):
|
|||||||
filtered_rules = []
|
filtered_rules = []
|
||||||
for field in field_set:
|
for field in field_set:
|
||||||
if args.get(field):
|
if args.get(field):
|
||||||
filtered_rules = filter(lambda x: x[field]==args[field], pricing_rules)
|
filtered_rules = list(filter(lambda x: x[field]==args[field], pricing_rules))
|
||||||
if filtered_rules: break
|
if filtered_rules: break
|
||||||
|
|
||||||
return filtered_rules or pricing_rules
|
return filtered_rules or pricing_rules
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TestTaxWithholdingCategory(unittest.TestCase):
|
|||||||
invoices = []
|
invoices = []
|
||||||
|
|
||||||
# create invoices for lower than single threshold tax rate
|
# create invoices for lower than single threshold tax rate
|
||||||
for _ in xrange(2):
|
for _ in range(2):
|
||||||
pi = create_purchase_invoice(supplier = "Test TDS Supplier")
|
pi = create_purchase_invoice(supplier = "Test TDS Supplier")
|
||||||
pi.submit()
|
pi.submit()
|
||||||
invoices.append(pi)
|
invoices.append(pi)
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
|||||||
pe.submit()
|
pe.submit()
|
||||||
|
|
||||||
mop = get_mode_of_payments(filters)
|
mop = get_mode_of_payments(filters)
|
||||||
self.assertTrue('Credit Card' in mop.values()[0])
|
self.assertTrue('Credit Card' in list(mop.values())[0])
|
||||||
self.assertTrue('Cash' in mop.values()[0])
|
self.assertTrue('Cash' in list(mop.values())[0])
|
||||||
|
|
||||||
# Cancel all Cash payment entry and check if this mode of payment is still fetched.
|
# Cancel all Cash payment entry and check if this mode of payment is still fetched.
|
||||||
payment_entries = frappe.get_all("Payment Entry", filters={"mode_of_payment": "Cash", "docstatus": 1}, fields=["name", "docstatus"])
|
payment_entries = frappe.get_all("Payment Entry", filters={"mode_of_payment": "Cash", "docstatus": 1}, fields=["name", "docstatus"])
|
||||||
@@ -57,8 +57,8 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
|||||||
pe.cancel()
|
pe.cancel()
|
||||||
|
|
||||||
mop = get_mode_of_payments(filters)
|
mop = get_mode_of_payments(filters)
|
||||||
self.assertTrue('Credit Card' in mop.values()[0])
|
self.assertTrue('Credit Card' in list(mop.values())[0])
|
||||||
self.assertTrue('Cash' not in mop.values()[0])
|
self.assertTrue('Cash' not in list(mop.values())[0])
|
||||||
|
|
||||||
def test_get_mode_of_payments_details(self):
|
def test_get_mode_of_payments_details(self):
|
||||||
filters = get_filters()
|
filters = get_filters()
|
||||||
@@ -84,7 +84,7 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
|||||||
|
|
||||||
mopd = get_mode_of_payment_details(filters)
|
mopd = get_mode_of_payment_details(filters)
|
||||||
|
|
||||||
mopd_values = mopd.values()[0]
|
mopd_values = list(mopd.values())[0]
|
||||||
for mopd_value in mopd_values:
|
for mopd_value in mopd_values:
|
||||||
if mopd_value[0] == "Credit Card":
|
if mopd_value[0] == "Credit Card":
|
||||||
cc_init_amount = mopd_value[1]
|
cc_init_amount = mopd_value[1]
|
||||||
@@ -96,7 +96,7 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
|||||||
pe.cancel()
|
pe.cancel()
|
||||||
|
|
||||||
mopd = get_mode_of_payment_details(filters)
|
mopd = get_mode_of_payment_details(filters)
|
||||||
mopd_values = mopd.values()[0]
|
mopd_values = list(mopd.values())[0]
|
||||||
for mopd_value in mopd_values:
|
for mopd_value in mopd_values:
|
||||||
if mopd_value[0] == "Credit Card":
|
if mopd_value[0] == "Credit Card":
|
||||||
cc_final_amount = mopd_value[1]
|
cc_final_amount = mopd_value[1]
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ class AssetValueAdjustment(Document):
|
|||||||
rate_per_day = flt(d.value_after_depreciation) / flt(total_days)
|
rate_per_day = flt(d.value_after_depreciation) / flt(total_days)
|
||||||
from_date = self.date
|
from_date = self.date
|
||||||
else:
|
else:
|
||||||
no_of_depreciations = len([e.name for e in asset.schedules
|
no_of_depreciations = len([s.name for s in asset.schedules
|
||||||
if (cint(s.finance_book_id) == d.idx and not e.journal_entry)])
|
if (cint(s.finance_book_id) == d.idx and not s.journal_entry)])
|
||||||
|
|
||||||
value_after_depreciation = d.value_after_depreciation
|
value_after_depreciation = d.value_after_depreciation
|
||||||
for data in asset.schedules:
|
for data in asset.schedules:
|
||||||
|
|||||||
@@ -25,9 +25,12 @@ class TestLocation(unittest.TestCase):
|
|||||||
temp['features'][0]['properties']['feature_of'] = location
|
temp['features'][0]['properties']['feature_of'] = location
|
||||||
formatted_locations.extend(temp['features'])
|
formatted_locations.extend(temp['features'])
|
||||||
|
|
||||||
formatted_location_string = str(formatted_locations)
|
|
||||||
test_location = frappe.get_doc('Location', 'Test Location Area')
|
test_location = frappe.get_doc('Location', 'Test Location Area')
|
||||||
test_location.save()
|
test_location.save()
|
||||||
|
|
||||||
self.assertEqual(formatted_location_string, str(json.loads(test_location.get('location'))['features']))
|
test_location_features = json.loads(test_location.get('location'))['features']
|
||||||
|
ordered_test_location_features = sorted(test_location_features, key=lambda x: x['properties']['feature_of'])
|
||||||
|
ordered_formatted_locations = sorted(formatted_locations, key=lambda x: x['properties']['feature_of'])
|
||||||
|
|
||||||
|
self.assertEqual(ordered_formatted_locations, ordered_test_location_features)
|
||||||
self.assertEqual(area, test_location.get('area'))
|
self.assertEqual(area, test_location.get('area'))
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ def call_mws_method(mws_method, *args, **kwargs):
|
|||||||
mws_settings = frappe.get_doc("Amazon MWS Settings")
|
mws_settings = frappe.get_doc("Amazon MWS Settings")
|
||||||
max_retries = mws_settings.max_retry_limit
|
max_retries = mws_settings.max_retry_limit
|
||||||
|
|
||||||
for x in xrange(0, max_retries):
|
for x in range(0, max_retries):
|
||||||
try:
|
try:
|
||||||
response = mws_method(*args, **kwargs)
|
response = mws_method(*args, **kwargs)
|
||||||
return response
|
return response
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
|
|||||||
from frappe.utils.csvutils import getlink
|
from frappe.utils.csvutils import getlink
|
||||||
from erpnext.stock.utils import get_bin, validate_warehouse_company, get_latest_stock_qty
|
from erpnext.stock.utils import get_bin, validate_warehouse_company, get_latest_stock_qty
|
||||||
from erpnext.utilities.transaction_base import validate_uom_is_integer
|
from erpnext.utilities.transaction_base import validate_uom_is_integer
|
||||||
|
from six import text_type
|
||||||
|
|
||||||
class OverProductionError(frappe.ValidationError): pass
|
class OverProductionError(frappe.ValidationError): pass
|
||||||
class StockOverProductionError(frappe.ValidationError): pass
|
class StockOverProductionError(frappe.ValidationError): pass
|
||||||
@@ -591,10 +592,10 @@ def make_timesheet(production_order, company):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def add_timesheet_detail(timesheet, args):
|
def add_timesheet_detail(timesheet, args):
|
||||||
if isinstance(timesheet, unicode):
|
if isinstance(timesheet, text_type):
|
||||||
timesheet = frappe.get_doc('Timesheet', timesheet)
|
timesheet = frappe.get_doc('Timesheet', timesheet)
|
||||||
|
|
||||||
if isinstance(args, unicode):
|
if isinstance(args, text_type):
|
||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
|
|
||||||
timesheet.append('time_logs', args)
|
timesheet.append('time_logs', args)
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ erpnext.patches.v11_0.create_department_records_for_each_company
|
|||||||
erpnext.patches.v11_0.make_location_from_warehouse
|
erpnext.patches.v11_0.make_location_from_warehouse
|
||||||
erpnext.patches.v11_0.make_asset_finance_book_against_old_entries
|
erpnext.patches.v11_0.make_asset_finance_book_against_old_entries
|
||||||
erpnext.patches.v11_0.check_buying_selling_in_currency_exchange
|
erpnext.patches.v11_0.check_buying_selling_in_currency_exchange
|
||||||
erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-2018
|
erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-2018 #19-06-2019
|
||||||
erpnext.patches.v11_0.refactor_erpnext_shopify #2018-09-07
|
erpnext.patches.v11_0.refactor_erpnext_shopify #2018-09-07
|
||||||
erpnext.patches.v11_0.rename_overproduction_percent_field
|
erpnext.patches.v11_0.rename_overproduction_percent_field
|
||||||
erpnext.patches.v11_0.update_backflush_subcontract_rm_based_on_bom
|
erpnext.patches.v11_0.update_backflush_subcontract_rm_based_on_bom
|
||||||
|
|||||||
@@ -17,10 +17,8 @@ def execute():
|
|||||||
frappe.reload_doc('stock', 'doctype', 'item_default')
|
frappe.reload_doc('stock', 'doctype', 'item_default')
|
||||||
frappe.reload_doc('stock', 'doctype', 'item')
|
frappe.reload_doc('stock', 'doctype', 'item')
|
||||||
|
|
||||||
if frappe.db.a_row_exists('Item Default'): return
|
|
||||||
|
|
||||||
companies = frappe.get_all("Company")
|
companies = frappe.get_all("Company")
|
||||||
if len(companies) == 1:
|
if len(companies) == 1 and not frappe.get_all("Item Default", limit=1):
|
||||||
try:
|
try:
|
||||||
frappe.db.sql('''
|
frappe.db.sql('''
|
||||||
INSERT INTO `tabItem Default`
|
INSERT INTO `tabItem Default`
|
||||||
@@ -35,32 +33,64 @@ def execute():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
item_details = frappe.get_all("Item", fields=["name", "default_warehouse", "buying_cost_center",
|
item_details = frappe.db.sql(""" SELECT name, default_warehouse,
|
||||||
"expense_account", "selling_cost_center", "income_account"], limit=100)
|
buying_cost_center, expense_account, selling_cost_center, income_account
|
||||||
|
FROM tabItem
|
||||||
|
WHERE
|
||||||
|
name not in (select distinct parent from `tabItem Default`) and ifnull(disabled, 0) = 0"""
|
||||||
|
, as_dict=1)
|
||||||
|
|
||||||
for item in item_details:
|
items_default_data = {}
|
||||||
item_defaults = []
|
for item_data in item_details:
|
||||||
|
for d in [["default_warehouse", "Warehouse"], ["expense_account", "Account"],
|
||||||
|
["income_account", "Account"], ["buying_cost_center", "Cost Center"],
|
||||||
|
["selling_cost_center", "Cost Center"]]:
|
||||||
|
if item_data.get(d[0]):
|
||||||
|
company = frappe.get_value(d[1], item_data.get(d[0]), "company", cache=True)
|
||||||
|
|
||||||
def insert_into_item_defaults(doc_field_name, doc_field_value, company):
|
if item_data.name not in items_default_data:
|
||||||
for d in item_defaults:
|
items_default_data[item_data.name] = {}
|
||||||
if d.get("company") == company:
|
|
||||||
d[doc_field_name] = doc_field_value
|
|
||||||
return
|
|
||||||
item_defaults.append({
|
|
||||||
"company": company,
|
|
||||||
doc_field_name: doc_field_value
|
|
||||||
})
|
|
||||||
|
|
||||||
for d in [
|
company_wise_data = items_default_data[item_data.name]
|
||||||
["default_warehouse", "Warehouse"], ["expense_account", "Account"], ["income_account", "Account"],
|
|
||||||
["buying_cost_center", "Cost Center"], ["selling_cost_center", "Cost Center"]
|
|
||||||
]:
|
|
||||||
if item.get(d[0]):
|
|
||||||
company = frappe.get_value(d[1], item.get(d[0]), "company", cache=True)
|
|
||||||
insert_into_item_defaults(d[0], item.get(d[0]), company)
|
|
||||||
|
|
||||||
doc = frappe.get_doc("Item", item.name)
|
if company not in company_wise_data:
|
||||||
doc.extend("item_defaults", item_defaults)
|
company_wise_data[company] = {}
|
||||||
|
|
||||||
for child_doc in doc.item_defaults:
|
default_data = company_wise_data[company]
|
||||||
child_doc.db_insert()
|
default_data[d[0]] = item_data.get(d[0])
|
||||||
|
|
||||||
|
to_insert_data = []
|
||||||
|
|
||||||
|
# items_default_data data structure will be as follow
|
||||||
|
# {
|
||||||
|
# 'item_code 1': {'company 1': {'default_warehouse': 'Test Warehouse 1'}},
|
||||||
|
# 'item_code 2': {
|
||||||
|
# 'company 1': {'default_warehouse': 'Test Warehouse 1'},
|
||||||
|
# 'company 2': {'default_warehouse': 'Test Warehouse 1'}
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
for item_code, companywise_item_data in items_default_data.items():
|
||||||
|
for company, item_default_data in companywise_item_data.items():
|
||||||
|
to_insert_data.append((
|
||||||
|
frappe.generate_hash("", 10),
|
||||||
|
item_code,
|
||||||
|
'Item',
|
||||||
|
'item_defaults',
|
||||||
|
company,
|
||||||
|
item_default_data.get('default_warehouse'),
|
||||||
|
item_default_data.get('expense_account'),
|
||||||
|
item_default_data.get('income_account'),
|
||||||
|
item_default_data.get('buying_cost_center'),
|
||||||
|
item_default_data.get('selling_cost_center'),
|
||||||
|
))
|
||||||
|
|
||||||
|
if to_insert_data:
|
||||||
|
frappe.db.sql('''
|
||||||
|
INSERT INTO `tabItem Default`
|
||||||
|
(
|
||||||
|
`name`, `parent`, `parenttype`, `parentfield`, `company`, `default_warehouse`,
|
||||||
|
`expense_account`, `income_account`, `buying_cost_center`, `selling_cost_center`
|
||||||
|
)
|
||||||
|
VALUES {}
|
||||||
|
'''.format(', '.join(['%s'] * len(to_insert_data))), tuple(to_insert_data))
|
||||||
@@ -103,8 +103,8 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
{
|
{
|
||||||
"billable": 1,
|
"billable": 1,
|
||||||
"activity_type": "_Test Activity Type",
|
"activity_type": "_Test Activity Type",
|
||||||
"from_type": now_datetime(),
|
"from_time": now_datetime(),
|
||||||
"hours": 3,
|
"to_time": now_datetime() + datetime.timedelta(hours=3),
|
||||||
"company": "_Test Company"
|
"company": "_Test Company"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -113,8 +113,8 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
{
|
{
|
||||||
"billable": 1,
|
"billable": 1,
|
||||||
"activity_type": "_Test Activity Type",
|
"activity_type": "_Test Activity Type",
|
||||||
"from_type": now_datetime(),
|
"from_time": now_datetime(),
|
||||||
"hours": 3,
|
"to_time": now_datetime() + datetime.timedelta(hours=3),
|
||||||
"company": "_Test Company"
|
"company": "_Test Company"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ def get_result_as_list(data, filters):
|
|||||||
if account_number[0] is not None:
|
if account_number[0] is not None:
|
||||||
CompteNum = account_number[0]
|
CompteNum = account_number[0]
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Account number for account {0} is not available.<br> Please setup your Chart of Accounts correctly.").format(account.name))
|
frappe.throw(_("Account number for account {0} is not available.<br> Please setup your Chart of Accounts correctly.").format(d.get("account")))
|
||||||
|
|
||||||
if d.get("party_type") == "Customer":
|
if d.get("party_type") == "Customer":
|
||||||
CompAuxNum = d.get("cusName")
|
CompAuxNum = d.get("cusName")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt, add_days, nowdate, add_months
|
from frappe.utils import flt, add_days, nowdate, add_months, getdate
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
test_dependencies = ["Product Bundle"]
|
test_dependencies = ["Product Bundle"]
|
||||||
@@ -18,7 +18,7 @@ class TestQuotation(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(quotation.payment_schedule)
|
self.assertTrue(quotation.payment_schedule)
|
||||||
|
|
||||||
def test_make_sales_order_terms_not_copied(self):
|
def test_make_sales_order_terms_copied(self):
|
||||||
from erpnext.selling.doctype.quotation.quotation import make_sales_order
|
from erpnext.selling.doctype.quotation.quotation import make_sales_order
|
||||||
|
|
||||||
quotation = frappe.copy_doc(test_records[0])
|
quotation = frappe.copy_doc(test_records[0])
|
||||||
@@ -29,7 +29,7 @@ class TestQuotation(unittest.TestCase):
|
|||||||
|
|
||||||
sales_order = make_sales_order(quotation.name)
|
sales_order = make_sales_order(quotation.name)
|
||||||
|
|
||||||
self.assertFalse(sales_order.get('payment_schedule'))
|
self.assertTrue(sales_order.get('payment_schedule'))
|
||||||
|
|
||||||
def test_make_sales_order_with_different_currency(self):
|
def test_make_sales_order_with_different_currency(self):
|
||||||
from erpnext.selling.doctype.quotation.quotation import make_sales_order
|
from erpnext.selling.doctype.quotation.quotation import make_sales_order
|
||||||
@@ -109,10 +109,10 @@ class TestQuotation(unittest.TestCase):
|
|||||||
sales_order.insert()
|
sales_order.insert()
|
||||||
|
|
||||||
self.assertEqual(sales_order.payment_schedule[0].payment_amount, 8906.00)
|
self.assertEqual(sales_order.payment_schedule[0].payment_amount, 8906.00)
|
||||||
self.assertEqual(sales_order.payment_schedule[0].due_date, quotation.transaction_date)
|
self.assertEqual(sales_order.payment_schedule[0].due_date, getdate(quotation.transaction_date))
|
||||||
self.assertEqual(sales_order.payment_schedule[1].payment_amount, 8906.00)
|
self.assertEqual(sales_order.payment_schedule[1].payment_amount, 8906.00)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sales_order.payment_schedule[1].due_date, add_days(quotation.transaction_date, 30)
|
sales_order.payment_schedule[1].due_date, getdate(add_days(quotation.transaction_date, 30))
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_valid_till(self):
|
def test_valid_till(self):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from frappe.utils import flt, cint, nowdate
|
|||||||
|
|
||||||
from frappe import throw, _
|
from frappe import throw, _
|
||||||
import frappe.defaults
|
import frappe.defaults
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate, cint
|
||||||
from erpnext.controllers.buying_controller import BuyingController
|
from erpnext.controllers.buying_controller import BuyingController
|
||||||
from erpnext.accounts.utils import get_account_currency
|
from erpnext.accounts.utils import get_account_currency
|
||||||
from frappe.desk.notifications import clear_doctype_notifications
|
from frappe.desk.notifications import clear_doctype_notifications
|
||||||
@@ -128,7 +128,7 @@ class PurchaseReceipt(BuyingController):
|
|||||||
self.company, self.base_grand_total)
|
self.company, self.base_grand_total)
|
||||||
|
|
||||||
self.update_prevdoc_status()
|
self.update_prevdoc_status()
|
||||||
if self.per_billed < 100:
|
if cint(self.per_billed) < 100:
|
||||||
self.update_billing_status()
|
self.update_billing_status()
|
||||||
else:
|
else:
|
||||||
self.status = "Completed"
|
self.status = "Completed"
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
for d in stock_entry.get("items"):
|
for d in stock_entry.get("items"):
|
||||||
if d.item_code != "_Test FG Item 2":
|
if d.item_code != "_Test FG Item 2":
|
||||||
rm_cost += flt(d.amount)
|
rm_cost += flt(d.amount)
|
||||||
fg_cost = filter(lambda x: x.item_code=="_Test FG Item 2", stock_entry.get("items"))[0].amount
|
fg_cost = list(filter(lambda x: x.item_code=="_Test FG Item 2", stock_entry.get("items")))[0].amount
|
||||||
self.assertEqual(fg_cost,
|
self.assertEqual(fg_cost,
|
||||||
flt(rm_cost + bom_operation_cost + work_order.additional_operating_cost, 2))
|
flt(rm_cost + bom_operation_cost + work_order.additional_operating_cost, 2))
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from jinja2 import utils
|
|||||||
from html2text import html2text
|
from html2text import html2text
|
||||||
from frappe.utils import sanitize_html
|
from frappe.utils import sanitize_html
|
||||||
from frappe.utils.global_search import search
|
from frappe.utils.global_search import search
|
||||||
|
from six import text_type
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
@@ -73,7 +74,7 @@ def prepare_api_results(api, topics_data):
|
|||||||
for topic in topics_data:
|
for topic in topics_data:
|
||||||
route = api.base_url + '/' + (api.post_route + '/' if api.post_route else "")
|
route = api.base_url + '/' + (api.post_route + '/' if api.post_route else "")
|
||||||
for key in api.post_route_key_list.split(','):
|
for key in api.post_route_key_list.split(','):
|
||||||
route += unicode(topic[key])
|
route += text_type(topic[key])
|
||||||
|
|
||||||
results.append(frappe._dict({
|
results.append(frappe._dict({
|
||||||
'title': topic[api.post_title_key],
|
'title': topic[api.post_title_key],
|
||||||
|
|||||||
12
travis/run-tests.sh
Executable file
12
travis/run-tests.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ $TEST_TYPE == 'Server Side Test' ]]; then
|
||||||
|
bench run-tests --app erpnext --coverage
|
||||||
|
|
||||||
|
elif [[ $TEST_TYPE == 'Patch Test' ]]; then
|
||||||
|
wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz
|
||||||
|
bench --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz --mariadb-root-password travis
|
||||||
|
bench migrate
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user