Merge branch 'develop' into new_invoice_fix
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index 15bc97c..6768dfa 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -1,4 +1,5 @@
{
+ "actions": [],
"autoname": "hash",
"creation": "2013-05-24 19:29:06",
"doctype": "DocType",
@@ -43,6 +44,7 @@
"base_amount",
"pricing_rules",
"is_free_item",
+ "is_fixed_asset",
"section_break_29",
"net_rate",
"net_amount",
@@ -708,11 +710,20 @@
"fieldname": "against_blanket_order",
"fieldtype": "Check",
"label": "Against Blanket Order"
+ },
+ {
+ "default": "0",
+ "fetch_from": "item_code.is_fixed_asset",
+ "fieldname": "is_fixed_asset",
+ "fieldtype": "Check",
+ "label": "Is Fixed Asset",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
- "modified": "2019-11-19 14:10:52.865006",
+ "links": [],
+ "modified": "2019-12-06 13:17:12.142799",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
diff --git a/erpnext/buying/setup_wizard_slide/add_a_few_suppliers/add_a_few_suppliers.json b/erpnext/buying/onboarding_slide/add_a_few_suppliers/add_a_few_suppliers.json
similarity index 78%
rename from erpnext/buying/setup_wizard_slide/add_a_few_suppliers/add_a_few_suppliers.json
rename to erpnext/buying/onboarding_slide/add_a_few_suppliers/add_a_few_suppliers.json
index 006d139..d3adcb7 100644
--- a/erpnext/buying/setup_wizard_slide/add_a_few_suppliers/add_a_few_suppliers.json
+++ b/erpnext/buying/onboarding_slide/add_a_few_suppliers/add_a_few_suppliers.json
@@ -3,18 +3,18 @@
"app": "ERPNext",
"creation": "2019-11-15 14:45:32.626641",
"docstatus": 0,
- "doctype": "Setup Wizard Slide",
+ "doctype": "Onboarding Slide",
"domains": [],
"help_links": [
{
- "label": "Supplier",
+ "label": "Learn More",
"video_id": "zsrrVDk6VBs"
}
],
"idx": 0,
- "image_src": "/assets/erpnext/images/illustrations/supplier.png",
+ "image_src": "/assets/erpnext/images/illustrations/supplier-onboard.png",
"max_count": 3,
- "modified": "2019-11-26 18:26:25.498325",
+ "modified": "2019-12-03 22:53:50.552445",
"modified_by": "Administrator",
"name": "Add A Few Suppliers",
"owner": "Administrator",
@@ -44,6 +44,5 @@
],
"slide_order": 50,
"slide_title": "Add A Few Suppliers",
- "slide_type": "Create",
- "submit_method": ""
+ "slide_type": "Create"
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 5579954..e3ece56 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -606,6 +606,7 @@
item.image,
bom.project,
item.stock_uom,
+ item.item_group,
item.allow_alternative_item,
item_default.default_warehouse,
item_default.expense_account as expense_account,
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index c4481c9..e908216 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -188,7 +188,8 @@
}, as_dict=True)
# check internal overlap
for time_log in self.time_logs:
- if not (time_log.from_time or time_log.to_time): continue
+ if not (time_log.from_time and time_log.to_time
+ and args.from_time and args.to_time): continue
if (fieldname != 'workstation' or args.get(fieldname) == time_log.get(fieldname)) and \
args.idx != time_log.idx and ((args.from_time > time_log.from_time and args.from_time < time_log.to_time) or
diff --git a/erpnext/public/images/illustrations/collaboration.png b/erpnext/public/images/illustrations/collaboration.png
deleted file mode 100644
index 12c67e3..0000000
--- a/erpnext/public/images/illustrations/collaboration.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/public/images/illustrations/customer.png b/erpnext/public/images/illustrations/customer.png
deleted file mode 100644
index b2ddbf3..0000000
--- a/erpnext/public/images/illustrations/customer.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/public/images/illustrations/customers-onboard.png b/erpnext/public/images/illustrations/customers-onboard.png
new file mode 100644
index 0000000..4a517bd
--- /dev/null
+++ b/erpnext/public/images/illustrations/customers-onboard.png
Binary files differ
diff --git a/erpnext/public/images/illustrations/desk-onboard.png b/erpnext/public/images/illustrations/desk-onboard.png
new file mode 100644
index 0000000..74b632d
--- /dev/null
+++ b/erpnext/public/images/illustrations/desk-onboard.png
Binary files differ
diff --git a/erpnext/public/images/illustrations/letterhead-onboard.png b/erpnext/public/images/illustrations/letterhead-onboard.png
new file mode 100644
index 0000000..fdfd16a
--- /dev/null
+++ b/erpnext/public/images/illustrations/letterhead-onboard.png
Binary files differ
diff --git a/erpnext/public/images/illustrations/letterhead.png b/erpnext/public/images/illustrations/letterhead.png
deleted file mode 100644
index 37df6d7..0000000
--- a/erpnext/public/images/illustrations/letterhead.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/public/images/illustrations/onboard.png b/erpnext/public/images/illustrations/onboard.png
deleted file mode 100644
index 094aa3f..0000000
--- a/erpnext/public/images/illustrations/onboard.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/public/images/illustrations/product.png b/erpnext/public/images/illustrations/product.png
deleted file mode 100644
index f864b7a..0000000
--- a/erpnext/public/images/illustrations/product.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/public/images/illustrations/products-onboard.png b/erpnext/public/images/illustrations/products-onboard.png
new file mode 100644
index 0000000..2dee203
--- /dev/null
+++ b/erpnext/public/images/illustrations/products-onboard.png
Binary files differ
diff --git a/erpnext/public/images/illustrations/supplier-onboard.png b/erpnext/public/images/illustrations/supplier-onboard.png
new file mode 100644
index 0000000..30335f2
--- /dev/null
+++ b/erpnext/public/images/illustrations/supplier-onboard.png
Binary files differ
diff --git a/erpnext/public/images/illustrations/supplier.png b/erpnext/public/images/illustrations/supplier.png
deleted file mode 100644
index 87f7789..0000000
--- a/erpnext/public/images/illustrations/supplier.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/public/images/illustrations/user.png b/erpnext/public/images/illustrations/user.png
deleted file mode 100644
index 7dd7db2..0000000
--- a/erpnext/public/images/illustrations/user.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/regional/report/gstr_1/gstr_1.js b/erpnext/regional/report/gstr_1/gstr_1.js
index ce55921..1a7ff2b 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.js
+++ b/erpnext/regional/report/gstr_1/gstr_1.js
@@ -55,14 +55,25 @@
report.page.add_inner_button(__("Download as JSON"), function () {
var filters = report.get_values();
- const args = {
- cmd: 'erpnext.regional.report.gstr_1.gstr_1.get_json',
- data: report.data,
- report_name: report.report_name,
- filters: filters
- };
-
- open_url_post(frappe.request.url, args);
+ frappe.call({
+ method: 'erpnext.regional.report.gstr_1.gstr_1.get_json',
+ args: {
+ data: report.data,
+ report_name: report.report_name,
+ filters: filters
+ },
+ callback: function(r) {
+ if (r.message) {
+ const args = {
+ cmd: 'erpnext.regional.report.gstr_1.gstr_1.download_json_file',
+ data: r.message.data,
+ report_name: r.message.report_name,
+ report_type: r.message.report_type
+ };
+ open_url_post(frappe.request.url, args);
+ }
+ }
+ });
});
}
}
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index 090616b..4f9cc7f 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -532,16 +532,9 @@
self.columns = self.invoice_columns + self.tax_columns + self.other_columns
@frappe.whitelist()
-def get_json():
- data = frappe._dict(frappe.local.form_dict)
-
- del data["cmd"]
- if "csrf_token" in data:
- del data["csrf_token"]
-
- filters = json.loads(data["filters"])
- report_data = json.loads(data["data"])
- report_name = data["report_name"]
+def get_json(filters, report_name, data):
+ filters = json.loads(filters)
+ report_data = json.loads(data)
gstin = get_company_gstin_number(filters["company"])
fp = "%02d%s" % (getdate(filters["to_date"]).month, getdate(filters["to_date"]).year)
@@ -575,7 +568,11 @@
out = get_export_json(res)
gst_json["exp"] = out
- download_json_file(report_name, filters["type_of_business"], gst_json)
+ return {
+ 'report_name': report_name,
+ 'report_type': filters['type_of_business'],
+ 'data': gst_json
+ }
def get_b2b_json(res, gstin):
inv_type, out = {"Registered Regular": "R", "Deemed Export": "DE", "URD": "URD", "SEZ": "SEZ"}, []
@@ -722,11 +719,15 @@
if gstin:
return gstin[0]["gstin"]
else:
- frappe.throw(_("Please set valid GSTIN No. in Company Address"))
+ frappe.throw(_("Please set valid GSTIN No. in Company Address for company {0}".format(
+ frappe.bold(company)
+ )))
-def download_json_file(filename, report_type, data):
+@frappe.whitelist()
+def download_json_file():
''' download json content in a file '''
- frappe.response['filename'] = frappe.scrub("{0} {1}".format(filename, report_type)) + '.json'
- frappe.response['filecontent'] = json.dumps(data)
+ data = frappe._dict(frappe.local.form_dict)
+ frappe.response['filename'] = frappe.scrub("{0} {1}".format(data['report_name'], data['report_type'])) + '.json'
+ frappe.response['filecontent'] = data['data']
frappe.response['content_type'] = 'application/json'
frappe.response['type'] = 'download'
diff --git a/erpnext/selling/setup_wizard_slide/add_a_few_customers/add_a_few_customers.json b/erpnext/selling/onboarding_slide/add_a_few_customers/add_a_few_customers.json
similarity index 77%
rename from erpnext/selling/setup_wizard_slide/add_a_few_customers/add_a_few_customers.json
rename to erpnext/selling/onboarding_slide/add_a_few_customers/add_a_few_customers.json
index a0bb6fe..f39fea4 100644
--- a/erpnext/selling/setup_wizard_slide/add_a_few_customers/add_a_few_customers.json
+++ b/erpnext/selling/onboarding_slide/add_a_few_customers/add_a_few_customers.json
@@ -3,18 +3,18 @@
"app": "ERPNext",
"creation": "2019-11-15 14:44:10.065014",
"docstatus": 0,
- "doctype": "Setup Wizard Slide",
+ "doctype": "Onboarding Slide",
"domains": [],
"help_links": [
{
- "label": "Customers",
+ "label": "Learn More",
"video_id": "zsrrVDk6VBs"
}
],
"idx": 0,
- "image_src": "/assets/erpnext/images/illustrations/customer.png",
+ "image_src": "/assets/erpnext/images/illustrations/customers-onboard.png",
"max_count": 3,
- "modified": "2019-11-26 18:26:15.888794",
+ "modified": "2019-12-03 22:54:28.959549",
"modified_by": "Administrator",
"name": "Add A Few Customers",
"owner": "Administrator",
@@ -44,6 +44,5 @@
],
"slide_order": 40,
"slide_title": "Add A Few Customers",
- "slide_type": "Create",
- "submit_method": ""
+ "slide_type": "Create"
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 0bcddc2..4d2d540 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -283,7 +283,7 @@
card.value = card.value *-1
card.value = self.fmt_money(card.value,False if key in ("bank_balance", "credit_balance") else True)
- cache.setex(cache_key, card, 24 * 60 * 60)
+ cache.set_value(cache_key, card, expires_in_sec=24 * 60 * 60)
context.cards.append(card)
diff --git "a/erpnext/setup/onboarding_slide/welcome_back_to_erpnext\041/welcome_back_to_erpnext\041.json" "b/erpnext/setup/onboarding_slide/welcome_back_to_erpnext\041/welcome_back_to_erpnext\041.json"
new file mode 100644
index 0000000..bf330d0
--- /dev/null
+++ "b/erpnext/setup/onboarding_slide/welcome_back_to_erpnext\041/welcome_back_to_erpnext\041.json"
@@ -0,0 +1,23 @@
+{
+ "add_more_button": 0,
+ "app": "ERPNext",
+ "creation": "2019-12-04 19:21:39.995776",
+ "docstatus": 0,
+ "doctype": "Onboarding Slide",
+ "domains": [],
+ "help_links": [],
+ "idx": 0,
+ "image_src": "/assets/erpnext/images/illustrations/desk-onboard.png",
+ "is_completed": 0,
+ "max_count": 3,
+ "modified": "2019-12-04 19:21:39.995776",
+ "modified_by": "Administrator",
+ "name": "Welcome back to ERPNext!",
+ "owner": "Administrator",
+ "slide_desc": "<p>Let's continue where you left from!</p>",
+ "slide_fields": [],
+ "slide_module": "Setup",
+ "slide_order": 0,
+ "slide_title": "Welcome back to ERPNext!",
+ "slide_type": "Continue"
+}
\ No newline at end of file
diff --git "a/erpnext/setup/setup_wizard_slide/welcome_to_erpnext\041/welcome_to_erpnext\041.json" "b/erpnext/setup/onboarding_slide/welcome_to_erpnext\041/welcome_to_erpnext\041.json"
similarity index 60%
rename from "erpnext/setup/setup_wizard_slide/welcome_to_erpnext\041/welcome_to_erpnext\041.json"
rename to "erpnext/setup/onboarding_slide/welcome_to_erpnext\041/welcome_to_erpnext\041.json"
index 1da9dd4..4ea6985 100644
--- "a/erpnext/setup/setup_wizard_slide/welcome_to_erpnext\041/welcome_to_erpnext\041.json"
+++ "b/erpnext/setup/onboarding_slide/welcome_to_erpnext\041/welcome_to_erpnext\041.json"
@@ -3,20 +3,20 @@
"app": "ERPNext",
"creation": "2019-11-26 17:01:26.671859",
"docstatus": 0,
- "doctype": "Setup Wizard Slide",
+ "doctype": "Onboarding Slide",
"domains": [],
"help_links": [],
"idx": 0,
- "image_src": "/assets/erpnext/images/illustrations/onboard.png",
+ "image_src": "/assets/erpnext/images/illustrations/desk-onboard.png",
"max_count": 0,
- "modified": "2019-11-26 17:17:29.813299",
+ "modified": "2019-12-03 22:49:12.871260",
"modified_by": "Administrator",
"name": "Welcome to ERPNext!",
"owner": "Administrator",
- "slide_desc": "Setting up an ERP can be overwhelming. But don't worry, we have got your back!<br>\nLet's setup your company.\nThis wizard will help you onboard to ERPNext in a short time!",
+ "slide_desc": "Setting up an ERP can be overwhelming. But don't worry, we have got your back!\nLet's setup your company.\nThis wizard will help you onboard to ERPNext in a short time!",
"slide_fields": [],
"slide_module": "Setup",
- "slide_order": 10,
+ "slide_order": 1,
"slide_title": "Welcome to ERPNext!",
"slide_type": "Information"
}
\ No newline at end of file
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index d1c206d..1a86b79 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -106,7 +106,8 @@
# expire in 6 hours
response.raise_for_status()
value = response.json()["rates"][to_currency]
- cache.setex(key, value, 6 * 60 * 60)
+
+ cache.set_value(key, value, expires_in_sec=6 * 60 * 60)
return flt(value)
except:
frappe.log_error(title="Get Exchange Rate")
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index d9c94fc..4770471 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -249,6 +249,8 @@
}, __("Get items from"));
}
+ frm.events.show_bom_custom_button(frm);
+
if (frm.doc.company) {
frm.trigger("toggle_display_account_head");
}
@@ -262,6 +264,11 @@
frm.trigger("setup_quality_inspection");
},
+ stock_entry_type: function(frm){
+ frm.remove_custom_button('Bill of Materials', "Get items from");
+ frm.events.show_bom_custom_button(frm);
+ },
+
purpose: function(frm) {
frm.trigger('validate_purpose_consumption');
frm.fields_dict.items.grid.refresh();
@@ -398,6 +405,85 @@
}
},
+ show_bom_custom_button: function(frm){
+ if (frm.doc.docstatus === 0 &&
+ ['Material Issue', 'Material Receipt', 'Material Transfer', 'Send to Subcontractor'].includes(frm.doc.purpose)) {
+ frm.add_custom_button(__('Bill of Materials'), function() {
+ frm.events.get_items_from_bom(frm);
+ }, __("Get items from"));
+ }
+ },
+
+ get_items_from_bom: function(frm) {
+ let filters = function(){
+ return {filters: { docstatus:1 }};
+ }
+
+ let fields = [
+ {"fieldname":"bom", "fieldtype":"Link", "label":__("BOM"),
+ options:"BOM", reqd: 1, get_query: filters()},
+ {"fieldname":"source_warehouse", "fieldtype":"Link", "label":__("Source Warehouse"),
+ options:"Warehouse"},
+ {"fieldname":"target_warehouse", "fieldtype":"Link", "label":__("Target Warehouse"),
+ options:"Warehouse"},
+ {"fieldname":"qty", "fieldtype":"Float", "label":__("Quantity"),
+ reqd: 1, "default": 1},
+ {"fieldname":"fetch_exploded", "fieldtype":"Check",
+ "label":__("Fetch exploded BOM (including sub-assemblies)"), "default":1},
+ {"fieldname":"fetch", "label":__("Get Items from BOM"), "fieldtype":"Button"}
+ ]
+
+ // Exclude field 'Target Warehouse' in case of Material Issue
+ if (frm.doc.purpose == 'Material Issue'){
+ fields.splice(2,1);
+ }
+ // Exclude field 'Source Warehouse' in case of Material Receipt
+ else if(frm.doc.purpose == 'Material Receipt'){
+ fields.splice(1,1);
+ }
+
+ let d = new frappe.ui.Dialog({
+ title: __("Get Items from BOM"),
+ fields: fields
+ });
+ d.get_input("fetch").on("click", function() {
+ let values = d.get_values();
+ if(!values) return;
+ values["company"] = frm.doc.company;
+ if(!frm.doc.company) frappe.throw(__("Company field is required"));
+ frappe.call({
+ method: "erpnext.manufacturing.doctype.bom.bom.get_bom_items",
+ args: values,
+ callback: function(r) {
+ if (!r.message) {
+ frappe.throw(__("BOM does not contain any stock item"));
+ } else {
+ erpnext.utils.remove_empty_first_row(frm, "items");
+ $.each(r.message, function(i, item) {
+ let d = frappe.model.add_child(cur_frm.doc, "Stock Entry Detail", "items");
+ d.item_code = item.item_code;
+ d.item_name = item.item_name;
+ d.item_group = item.item_group;
+ d.s_warehouse = values.source_warehouse;
+ d.t_warehouse = values.target_warehouse;
+ d.uom = item.stock_uom;
+ d.stock_uom = item.stock_uom;
+ d.conversion_factor = item.conversion_factor ? item.conversion_factor : 1;
+ d.qty = item.qty;
+ d.expense_account = item.expense_account;
+ d.project = item.project;
+ frm.events.set_basic_rate(frm, d.doctype, d.name);
+ });
+ }
+ d.hide();
+ refresh_field("items");
+ }
+ });
+
+ });
+ d.show();
+ },
+
calculate_basic_amount: function(frm, item) {
item.basic_amount = flt(flt(item.transfer_qty) * flt(item.basic_rate),
precision("basic_amount", item));
diff --git a/erpnext/stock/setup_wizard_slide/add_a_few_products_you_buy_or_sell/add_a_few_products_you_buy_or_sell.json b/erpnext/stock/onboarding_slide/add_a_few_products_you_buy_or_sell/add_a_few_products_you_buy_or_sell.json
similarity index 76%
rename from erpnext/stock/setup_wizard_slide/add_a_few_products_you_buy_or_sell/add_a_few_products_you_buy_or_sell.json
rename to erpnext/stock/onboarding_slide/add_a_few_products_you_buy_or_sell/add_a_few_products_you_buy_or_sell.json
index c536f7b..27a3062 100644
--- a/erpnext/stock/setup_wizard_slide/add_a_few_products_you_buy_or_sell/add_a_few_products_you_buy_or_sell.json
+++ b/erpnext/stock/onboarding_slide/add_a_few_products_you_buy_or_sell/add_a_few_products_you_buy_or_sell.json
@@ -3,13 +3,13 @@
"app": "ERPNext",
"creation": "2019-11-15 14:41:12.007359",
"docstatus": 0,
- "doctype": "Setup Wizard Slide",
+ "doctype": "Onboarding Slide",
"domains": [],
"help_links": [],
"idx": 0,
- "image_src": "/assets/erpnext/images/illustrations/product.png",
+ "image_src": "/assets/erpnext/images/illustrations/products-onboard.png",
"max_count": 3,
- "modified": "2019-11-26 18:26:35.305755",
+ "modified": "2019-12-03 22:54:07.558632",
"modified_by": "Administrator",
"name": "Add A Few Products You Buy Or Sell",
"owner": "Administrator",
@@ -26,15 +26,9 @@
},
{
"align": "",
- "fieldtype": "Column Break",
- "reqd": 1
- },
- {
- "align": "",
- "fieldname": "uom",
- "fieldtype": "Link",
- "label": "UOM",
- "options": "UOM",
+ "fieldname": "item_price",
+ "fieldtype": "Currency",
+ "label": "Item Price",
"reqd": 1
},
{
@@ -44,14 +38,14 @@
},
{
"align": "",
- "fieldname": "item_price",
- "fieldtype": "Currency",
- "label": "Item Price",
+ "fieldname": "uom",
+ "fieldtype": "Link",
+ "label": "UOM",
+ "options": "UOM",
"reqd": 1
}
],
"slide_order": 30,
"slide_title": "Add A Few Products You Buy Or Sell",
- "slide_type": "Create",
- "submit_method": ""
+ "slide_type": "Create"
}
\ No newline at end of file