Merge remote-tracking branch 'upstream/develop' into club-mr-column

Merge remote-tracking branch 'upstream/develop' into club-mr-column
This commit is contained in:
Afshan 2020-07-13 11:43:19 +05:30
commit e40605d711
13 changed files with 84 additions and 90 deletions

View File

@ -2,6 +2,7 @@
{ {
"doctype": "Item Tax Template", "doctype": "Item Tax Template",
"title": "_Test Account Excise Duty @ 10", "title": "_Test Account Excise Duty @ 10",
"company": "_Test Company",
"taxes": [ "taxes": [
{ {
"doctype": "Item Tax Template Detail", "doctype": "Item Tax Template Detail",
@ -14,6 +15,7 @@
{ {
"doctype": "Item Tax Template", "doctype": "Item Tax Template",
"title": "_Test Account Excise Duty @ 12", "title": "_Test Account Excise Duty @ 12",
"company": "_Test Company",
"taxes": [ "taxes": [
{ {
"doctype": "Item Tax Template Detail", "doctype": "Item Tax Template Detail",
@ -26,6 +28,7 @@
{ {
"doctype": "Item Tax Template", "doctype": "Item Tax Template",
"title": "_Test Account Excise Duty @ 15", "title": "_Test Account Excise Duty @ 15",
"company": "_Test Company",
"taxes": [ "taxes": [
{ {
"doctype": "Item Tax Template Detail", "doctype": "Item Tax Template Detail",
@ -38,6 +41,7 @@
{ {
"doctype": "Item Tax Template", "doctype": "Item Tax Template",
"title": "_Test Account Excise Duty @ 20", "title": "_Test Account Excise Duty @ 20",
"company": "_Test Company",
"taxes": [ "taxes": [
{ {
"doctype": "Item Tax Template Detail", "doctype": "Item Tax Template Detail",
@ -50,6 +54,7 @@
{ {
"doctype": "Item Tax Template", "doctype": "Item Tax Template",
"title": "_Test Item Tax Template 1", "title": "_Test Item Tax Template 1",
"company": "_Test Company",
"taxes": [ "taxes": [
{ {
"doctype": "Item Tax Template Detail", "doctype": "Item Tax Template Detail",

View File

@ -319,7 +319,9 @@ 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) # filter function always returns a filter object even if empty
# list conversion is necessary to check for an empty result
filtered_rules = list(filter(lambda x: x.get(field)==args.get(field), pricing_rules))
if filtered_rules: break if filtered_rules: break
return filtered_rules or pricing_rules return filtered_rules or pricing_rules

View File

@ -1,4 +1,5 @@
{ {
"actions": "",
"allow_import": 1, "allow_import": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2016-02-25 01:24:07.224790", "creation": "2016-02-25 01:24:07.224790",
@ -28,7 +29,6 @@
"letter_head", "letter_head",
"more_info", "more_info",
"status", "status",
"fiscal_year",
"column_break3", "column_break3",
"amended_from" "amended_from"
], ],
@ -218,17 +218,6 @@
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{
"fieldname": "fiscal_year",
"fieldtype": "Link",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"print_hide": 1,
"reqd": 1,
"search_index": 1
},
{ {
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break" "fieldtype": "Column Break"
@ -245,7 +234,8 @@
], ],
"icon": "fa fa-shopping-cart", "icon": "fa fa-shopping-cart",
"is_submittable": 1, "is_submittable": 1,
"modified": "2019-09-24 15:08:32.750661", "links": [],
"modified": "2020-06-25 14:37:21.140194",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Request for Quotation", "name": "Request for Quotation",

View File

@ -13,14 +13,12 @@ class TestMapper(unittest.TestCase):
'''Test mapping of multiple source docs on a single target doc''' '''Test mapping of multiple source docs on a single target doc'''
make_test_records("Item") make_test_records("Item")
items = frappe.get_all("Item", fields = ["name", "item_code"], filters = {'is_sales_item': 1, 'has_variants': 0, 'disabled': 0}) items = ['_Test Item', '_Test Item 2', '_Test FG Item']
customers = frappe.get_all("Customer")
if items and customers: # Make source docs (quotations) and a target doc (sales order)
# Make source docs (quotations) and a target doc (sales order) qtn1, item_list_1 = self.make_quotation(items, '_Test Customer')
customer = random.choice(customers).name qtn2, item_list_2 = self.make_quotation(items, '_Test Customer')
qtn1, item_list_1 = self.make_quotation(items, customer) so, item_list_3 = self.make_sales_order()
qtn2, item_list_2 = self.make_quotation(items, customer)
so, item_list_3 = self.make_sales_order()
# Map source docs to target with corresponding mapper method # Map source docs to target with corresponding mapper method
method = "erpnext.selling.doctype.quotation.quotation.make_sales_order" method = "erpnext.selling.doctype.quotation.quotation.make_sales_order"
@ -28,18 +26,12 @@ class TestMapper(unittest.TestCase):
# Assert that all inserted items are present in updated sales order # Assert that all inserted items are present in updated sales order
src_items = item_list_1 + item_list_2 + item_list_3 src_items = item_list_1 + item_list_2 + item_list_3
self.assertEqual(set([d.item_code for d in src_items]), self.assertEqual(set([d for d in src_items]),
set([d.item_code for d in updated_so.items])) set([d.item_code for d in updated_so.items]))
def get_random_items(self, items, limit):
'''Get a number of random items from a list of given items'''
random_items = []
for i in range(0, limit):
random_items.append(random.choice(items))
return random_items
def make_quotation(self, items, customer): def make_quotation(self, item_list, customer):
item_list = self.get_random_items(items, 3)
qtn = frappe.get_doc({ qtn = frappe.get_doc({
"doctype": "Quotation", "doctype": "Quotation",
"quotation_to": "Customer", "quotation_to": "Customer",
@ -49,7 +41,7 @@ class TestMapper(unittest.TestCase):
"valid_till" : add_months(nowdate(), 1) "valid_till" : add_months(nowdate(), 1)
}) })
for item in item_list: for item in item_list:
qtn.append("items", {"qty": "2", "item_code": item.item_code}) qtn.append("items", {"qty": "2", "item_code": item})
qtn.submit() qtn.submit()
return qtn, item_list return qtn, item_list
@ -60,7 +52,7 @@ class TestMapper(unittest.TestCase):
"base_rate": 100.0, "base_rate": 100.0,
"description": "CPU", "description": "CPU",
"doctype": "Sales Order Item", "doctype": "Sales Order Item",
"item_code": "_Test Item Home Desktop 100", "item_code": "_Test Item",
"item_name": "CPU", "item_name": "CPU",
"parentfield": "items", "parentfield": "items",
"qty": 10.0, "qty": 10.0,
@ -72,4 +64,4 @@ class TestMapper(unittest.TestCase):
}) })
so = frappe.get_doc(frappe.get_test_records('Sales Order')[0]) so = frappe.get_doc(frappe.get_test_records('Sales Order')[0])
so.insert(ignore_permissions=True) so.insert(ignore_permissions=True)
return so, [item] return so, [item.item_code]

View File

@ -30,6 +30,7 @@ class TestTaxes(unittest.TestCase):
self.item_tax_template = frappe.get_doc({ self.item_tax_template = frappe.get_doc({
'doctype': 'Item Tax Template', 'doctype': 'Item Tax Template',
'title': uuid4(), 'title': uuid4(),
'company': self.company.name,
'taxes': [ 'taxes': [
{ {
'tax_type': self.account.name, 'tax_type': self.account.name,

View File

@ -29,10 +29,16 @@ frappe.ui.form.on("Task", {
filters: filters filters: filters
}; };
}) })
},
refresh: function (frm) { frm.set_query("parent_task", function () {
frm.set_query("parent_task", { "is_group": 1 }); let filters = {
"is_group": 1
};
if (frm.doc.project) filters["project"] = frm.doc.project;
return {
filters: filters
}
});
}, },
is_group: function (frm) { is_group: function (frm) {

View File

@ -458,19 +458,23 @@ def generate_ewb_json(dt, dn):
@frappe.whitelist() @frappe.whitelist()
def download_ewb_json(): def download_ewb_json():
data = frappe._dict(frappe.local.form_dict) data = json.loads(frappe.local.form_dict.data)
frappe.local.response.filecontent = json.dumps(data, indent=4, sort_keys=True)
frappe.local.response.filecontent = json.dumps(data['data'], indent=4, sort_keys=True)
frappe.local.response.type = 'download' frappe.local.response.type = 'download'
billList = json.loads(data['data'])['billLists'] filename_prefix = 'Bulk'
docname = frappe.local.form_dict.docname
if docname:
if docname.startswith('['):
docname = json.loads(docname)
if len(docname) == 1:
docname = docname[0]
if len(billList) > 1: if not isinstance(docname, list):
doc_name = 'Bulk' # removes characters not allowed in a filename (https://stackoverflow.com/a/38766141/4767738)
else: filename_prefix = re.sub('[^\w_.)( -]', '', docname)
doc_name = data['docname']
frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(doc_name, frappe.utils.random_string(5)) frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(filename_prefix, frappe.utils.random_string(5))
@frappe.whitelist() @frappe.whitelist()
def get_gstins_for_company(company): def get_gstins_for_company(company):

View File

@ -30,7 +30,7 @@ frappe.query_reports["DATEV"] = {
} }
], ],
onload: function(query_report) { onload: function(query_report) {
query_report.page.add_inner_button("Download DATEV Export", () => { query_report.page.add_menu_item(__("Download DATEV File"), () => {
const filters = JSON.stringify(query_report.get_values()); const filters = JSON.stringify(query_report.get_values());
window.open(`/api/method/erpnext.regional.report.datev.datev.download_datev_csv?filters=${filters}`); window.open(`/api/method/erpnext.regional.report.datev.datev.download_datev_csv?filters=${filters}`);
}); });

View File

@ -20,8 +20,8 @@
"base_rate": 100.0, "base_rate": 100.0,
"description": "CPU", "description": "CPU",
"doctype": "Sales Order Item", "doctype": "Sales Order Item",
"item_code": "_Test Item Home Desktop 100", "item_code": "_Test Item",
"item_name": "CPU", "item_name": "_Test Item 1",
"delivery_date": "2013-02-23", "delivery_date": "2013-02-23",
"parentfield": "items", "parentfield": "items",
"qty": 10.0, "qty": 10.0,

View File

@ -29,12 +29,10 @@ def after_install():
def check_setup_wizard_not_completed(): def check_setup_wizard_not_completed():
if frappe.db.get_default('desktop:home_page') == 'desktop': if frappe.db.get_default('desktop:home_page') != 'setup-wizard':
print() message = """ERPNext can only be installed on a fresh site where the setup wizard is not completed.
print("ERPNext can only be installed on a fresh site where the setup wizard is not completed") You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall"""
print("You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall") frappe.throw(message)
print()
return False
def set_single_defaults(): def set_single_defaults():
@ -105,4 +103,3 @@ def add_company_to_session_defaults():
"ref_doctype": "Company" "ref_doctype": "Company"
}) })
settings.save() settings.save()

View File

@ -92,8 +92,7 @@
{ {
"doctype": "Item Tax", "doctype": "Item Tax",
"parentfield": "taxes", "parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 10", "item_tax_template": "_Test Account Excise Duty @ 10"
"tax_category": ""
} }
], ],
"stock_uom": "_Test UOM 1" "stock_uom": "_Test UOM 1"
@ -371,8 +370,7 @@
{ {
"doctype": "Item Tax", "doctype": "Item Tax",
"parentfield": "taxes", "parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 10", "item_tax_template": "_Test Account Excise Duty @ 10"
"tax_category": ""
}, },
{ {
"doctype": "Item Tax", "doctype": "Item Tax",
@ -451,14 +449,13 @@
{ {
"doctype": "Item Tax", "doctype": "Item Tax",
"parentfield": "taxes", "parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 20", "item_tax_template": "_Test Account Excise Duty @ 20"
"tax_category": ""
}, },
{ {
"doctype": "Item Tax", "doctype": "Item Tax",
"parentfield": "taxes", "parentfield": "taxes",
"item_tax_template": "_Test Item Tax Template 1", "tax_category": "_Test Tax Category 1",
"tax_category": "_Test Tax Category 1" "item_tax_template": "_Test Item Tax Template 1"
} }
] ]
} }

View File

@ -2,7 +2,7 @@ braintree==3.57.1
frappe frappe
gocardless-pro==1.11.0 gocardless-pro==1.11.0
googlemaps==3.1.1 googlemaps==3.1.1
pandas==0.24.2 pandas==1.0.5
plaid-python==3.4.0 plaid-python==3.4.0
pycountry==19.8.18 pycountry==19.8.18
PyGithub==1.44.1 PyGithub==1.44.1