Merge branch 'develop' into new_invoice_fix

This commit is contained in:
Deepesh Garg 2019-12-07 19:54:21 +05:30 committed by GitHub
commit 3139fa2866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 188 additions and 61 deletions

View File

@ -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",

View File

@ -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"
}

View File

@ -606,6 +606,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
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,

View File

@ -188,7 +188,8 @@ class Timesheet(Document):
}, 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -55,14 +55,25 @@ frappe.query_reports["GSTR-1"] = {
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',
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);
}
}
});
});
}
}

View File

@ -532,16 +532,9 @@ class Gstr1Report(object):
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 @@ def get_json():
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 @@ def get_company_gstin_number(company):
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'

View File

@ -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"
}

View File

@ -283,7 +283,7 @@ class EmailDigest(Document):
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)

View File

@ -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"
}

View File

@ -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"
}

View File

@ -106,7 +106,8 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=No
# 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")

View File

@ -249,6 +249,8 @@ frappe.ui.form.on('Stock Entry', {
}, __("Get items from"));
}
frm.events.show_bom_custom_button(frm);
if (frm.doc.company) {
frm.trigger("toggle_display_account_head");
}
@ -262,6 +264,11 @@ frappe.ui.form.on('Stock Entry', {
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 @@ frappe.ui.form.on('Stock Entry', {
}
},
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));

View File

@ -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"
}