Merge pull request #16022 from ESS-LLP/fix-patch
fix: healthcare patch
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 92efe8e..c00d90e 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
-__version__ = '10.1.72'
+__version__ = '10.1.73'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index dfcf64c..4930207 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -194,7 +194,7 @@
{% if(!filters.show_pdc_in_print) { %}
<td style="text-align: right">
{%= format_currency(data[i]["paid_amount"], data[i]["currency"]) %}</td>
- <td style="text-align: right">{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} </td>
+ <td style="text-align: right">{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["debit_note"], data[i]["currency"]) %} </td>
{% } %}
<td style="text-align: right">
{%= format_currency(data[i]["outstanding_amount"], data[i]["currency"]) %}</td>
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index 7b0072c..7bf9972 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
@@ -22,7 +22,7 @@
columns += [ args.get("party_type") + " Name::140"]
credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt"
-
+
columns += [{
"label": _("Total Invoiced Amt"),
"fieldname": "total_invoiced_amt",
@@ -107,7 +107,7 @@
"options": "Supplier Group",
"width": 80
}]
-
+
columns.append({
"fieldname": "currency",
"label": _("Currency"),
@@ -138,7 +138,7 @@
row += [self.get_territory(party), self.get_customer_group(party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_group(party)]
-
+
row.append(party_dict.currency)
data.append(row)
@@ -162,7 +162,7 @@
for k in list(party_total[d.party]):
if k != "currency":
party_total[d.party][k] += flt(d.get(k, 0))
-
+
party_total[d.party].currency = d.currency
return party_total
diff --git a/erpnext/buying/page/purchase_analytics/README.md b/erpnext/buying/page/purchase_analytics/README.md
deleted file mode 100644
index 332e4c2..0000000
--- a/erpnext/buying/page/purchase_analytics/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Trends of purchases across Items, Item Groups, Suppliers.
\ No newline at end of file
diff --git a/erpnext/buying/page/purchase_analytics/__init__.py b/erpnext/buying/page/purchase_analytics/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/buying/page/purchase_analytics/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
deleted file mode 100644
index 06764a3..0000000
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-frappe.pages['purchase-analytics'].on_page_load = function(wrapper) {
- frappe.ui.make_app_page({
- parent: wrapper,
- title: __('Purchase Analytics'),
- single_column: true
- });
-
- new erpnext.PurchaseAnalytics(wrapper);
-
- frappe.breadcrumbs.add("Buying");
-}
-
-erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
- init: function(wrapper) {
- this._super({
- title: __("Purchase Analytics"),
- parent: $(wrapper).find('.layout-main'),
- page: wrapper.page,
- doctypes: ["Item", "Item Group", "Supplier", "Supplier Group", "Company", "Fiscal Year",
- "Purchase Invoice", "Purchase Invoice Item",
- "Purchase Order", "Purchase Order Item[Purchase Analytics]",
- "Purchase Receipt", "Purchase Receipt Item[Purchase Analytics]"],
- tree_grid: { show: true }
- });
-
- this.tree_grids = {
- "Supplier Group": {
- label: __("Supplier Group / Supplier"),
- show: true,
- item_key: "supplier",
- parent_field: "parent_supplier_group",
- formatter: function(item) {
- return item.supplier_name ? item.supplier_name + " (" + item.name + ")" : item.name;
- }
- },
- "Supplier": {
- label: __("Supplier"),
- show: false,
- item_key: "supplier",
- formatter: function(item) {
- return item.supplier_name ? item.supplier_name + " (" + item.name + ")" : item.name;
- }
- },
- "Item Group": {
- label: "Item",
- show: true,
- parent_field: "parent_item_group",
- item_key: "item_code",
- formatter: function(item) {
- return item.name;
- }
- },
- "Item": {
- label: "Item",
- show: false,
- item_key: "item_code",
- formatter: function(item) {
- return item.name;
- }
- },
- }
- },
- setup_columns: function() {
- this.tree_grid = this.tree_grids[this.tree_type];
-
- var std_columns = [
- {id: "name", name: this.tree_grid.label, field: "name", width: 300},
- {id: "total", name: "Total", field: "total", plot: false,
- formatter: this.currency_formatter}
- ];
-
- this.make_date_range_columns();
- this.columns = std_columns.concat(this.columns);
- },
- filters: [
- {fieldtype:"Select", label: __("Tree Type"), fieldname: "tree_type",
- options:["Supplier Group", "Supplier", "Item Group", "Item"],
- filter: function(val, item, opts, me) {
- return me.apply_zero_filter(val, item, opts, me);
- }},
- {fieldtype:"Select", label: __("Based On"), fieldname: "based_on",
- options:["Purchase Invoice", "Purchase Order", "Purchase Receipt"]},
- {fieldtype:"Select", label: __("Value or Qty"), fieldname: "value_or_qty",
- options:["Value", "Quantity"]},
- {fieldtype:"Select", label: __("Company"), link:"Company", fieldname: "company",
- default_value: __("Select Company...")},
- {fieldtype:"Date", label: __("From Date"), fieldname: "from_date"},
- {fieldtype:"Date", label: __("To Date"), fieldname: "to_date"},
- {fieldtype:"Select", label: __("Range"), fieldname: "range",
- options:[{label: __("Daily"), value: "Daily"}, {label: __("Weekly"), value: "Weekly"},
- {label: __("Monthly"), value: "Monthly"}, {label: __("Quarterly"), value: "Quarterly"},
- {label: __("Yearly"), value: "Yearly"}]}
- ],
- setup_filters: function() {
- var me = this;
- this._super();
-
- this.trigger_refresh_on_change(["value_or_qty", "tree_type", "based_on", "company"]);
-
- this.show_zero_check();
- },
- init_filter_values: function() {
- this._super();
- this.filter_inputs.range.val('Monthly');
- },
- prepare_data: function() {
- var me = this;
- if (!this.tl) {
- // add 'Not Set' Supplier & Item
- // (Supplier / Item are not mandatory!!)
- frappe.report_dump.data["Supplier"].push({
- name: __("Not Set"),
- parent_supplier_group: __("All Supplier Groups"),
- id: "Not Set",
- });
-
- frappe.report_dump.data["Item"].push({
- name: __("Not Set"),
- parent_item_group: "All Item Groups",
- id: "Not Set",
- });
- }
-
- if (!this.tl || !this.tl[this.based_on]) {
- this.make_transaction_list(this.based_on, this.based_on + " Item");
- }
-
-
- if(!this.data || me.item_type != me.tree_type) {
- var items;
- if(me.tree_type=='Supplier') {
- items = frappe.report_dump.data["Supplier"];
- } else if(me.tree_type=='Supplier Group') {
- items = this.prepare_tree("Supplier", "Supplier Group");
- } else if(me.tree_type=="Item Group") {
- items = this.prepare_tree("Item", "Item Group");
- } else if(me.tree_type=="Item") {
- items = frappe.report_dump.data["Item"];
- }
-
- me.item_type = me.tree_type
- me.parent_map = {};
- me.item_by_name = {};
- me.data = [];
-
- $.each(items, function(i, v) {
- var d = copy_dict(v);
-
- me.data.push(d);
- me.item_by_name[d.name] = d;
- if(d[me.tree_grid.parent_field]) {
- me.parent_map[d.name] = d[me.tree_grid.parent_field];
- }
- me.reset_item_values(d);
- });
-
- this.set_indent();
-
- } else {
- // otherwise, only reset values
- $.each(this.data, function(i, d) {
- me.reset_item_values(d);
- });
- }
-
- this.prepare_balances();
- if(me.tree_grid.show) {
- this.set_totals(false);
- this.update_groups();
- } else {
- this.set_totals(true);
- }
- },
- prepare_balances: function() {
- var me = this;
- var from_date = frappe.datetime.str_to_obj(this.from_date);
- var to_date = frappe.datetime.str_to_obj(this.to_date);
- var is_val = this.value_or_qty == 'Value';
-
- $.each(this.tl[this.based_on], function(i, tl) {
- if (me.is_default('company') ? true : tl.company === me.company) {
- var posting_date = frappe.datetime.str_to_obj(tl.posting_date);
- if (posting_date >= from_date && posting_date <= to_date) {
- var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
- me.item_by_name['Not Set'];
- item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
- }
- }
- });
- },
- update_groups: function() {
- var me = this;
-
- $.each(this.data, function(i, item) {
- var parent = me.parent_map[item.name];
- while(parent) {
- var parent_group = me.item_by_name[parent];
-
- $.each(me.columns, function(c, col) {
- if (col.formatter == me.currency_formatter) {
- parent_group[col.field] =
- flt(parent_group[col.field])
- + flt(item[col.field]);
- }
- });
- parent = me.parent_map[parent];
- }
- });
- },
- set_totals: function(sort) {
- var me = this;
- var checked = false;
- $.each(this.data, function(i, d) {
- d.total = 0.0;
- $.each(me.columns, function(i, col) {
- if(col.formatter==me.currency_formatter && !col.hidden && col.field!="total")
- d.total += d[col.field];
- if(d.checked) checked = true;
- })
- });
-
- if(sort)this.data = this.data.sort(function(a, b) { return b.total - a.total; });
-
- if(!this.checked) {
- this.data[0].checked = true;
- }
- }
-});
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.json b/erpnext/buying/page/purchase_analytics/purchase_analytics.json
deleted file mode 100644
index ad13c7d..0000000
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "creation": "2012-09-21 20:15:16.000000",
- "docstatus": 0,
- "doctype": "Page",
- "icon": "fa fa-bar-chart",
- "idx": 1,
- "modified": "2013-07-11 14:43:52.000000",
- "modified_by": "Administrator",
- "module": "Buying",
- "name": "purchase-analytics",
- "owner": "Administrator",
- "page_name": "purchase-analytics",
- "roles": [
- {
- "role": "Analytics"
- },
- {
- "role": "Purchase Manager"
- }
- ],
- "standard": "Yes",
- "title": "Purchase Analytics"
-}
\ No newline at end of file
diff --git a/erpnext/buying/report/purchase_analytics/purchase_analytics.js b/erpnext/buying/report/purchase_analytics/purchase_analytics.js
index 297ec51..b55046e 100644
--- a/erpnext/buying/report/purchase_analytics/purchase_analytics.js
+++ b/erpnext/buying/report/purchase_analytics/purchase_analytics.js
@@ -68,11 +68,8 @@
}
],
- "formatter": function(value, row, column, data) {
- if(!value){
- value = 0
- }
- return value;
+ after_datatable_render: function(datatable_obj) {
+ $(datatable_obj.wrapper).find(".dt-row-0").find('input[type=checkbox]').click();
},
get_datatable_options(options) {
return Object.assign(options, {
@@ -110,19 +107,19 @@
labels: raw_data.labels,
datasets: new_datasets
}
-
+
setTimeout(() => {
frappe.query_report.chart.update(new_data)
- },200)
-
-
+ },500)
+
+
setTimeout(() => {
frappe.query_report.chart.draw(true);
- }, 800)
+ }, 1000)
frappe.query_report.raw_chart_data = new_data;
},
}
- })
- },
+ });
+ }
}
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index dbde304..ee6dc2a 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -12,6 +12,7 @@
from erpnext.stock.stock_ledger import get_valuation_rate
from erpnext.stock.doctype.stock_entry.stock_entry import get_used_alternative_items
from erpnext.stock.doctype.serial_no.serial_no import get_auto_serial_nos, auto_make_serial_nos, get_serial_nos
+from frappe.contacts.doctype.address.address import get_address_display
from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget
from erpnext.controllers.stock_controller import StockController
@@ -42,6 +43,7 @@
self.set_qty_as_per_stock_uom()
self.validate_stock_or_nonstock_items()
self.validate_warehouse()
+ self.set_supplier_address()
if self.doctype=="Purchase Invoice":
self.validate_purchase_receipt_if_update_stock()
@@ -113,6 +115,16 @@
if not d.cost_center and lc_voucher_data and lc_voucher_data[0][1]:
d.db_set('cost_center', lc_voucher_data[0][1])
+ def set_supplier_address(self):
+ address_dict = {
+ 'supplier_address': 'address_display',
+ 'shipping_address': 'shipping_address_display'
+ }
+
+ for address_field, address_display_field in address_dict.items():
+ if self.get(address_field):
+ self.set(address_display_field, get_address_display(self.get(address_field)))
+
def set_total_in_words(self):
from frappe.utils import money_in_words
if self.meta.get_field("base_in_words"):
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 7739592..684a2cd 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -9,6 +9,7 @@
from erpnext.stock.utils import get_incoming_rate
from erpnext.stock.get_item_details import get_conversion_factor
from erpnext.stock.doctype.item.item import get_item_defaults, set_item_default
+from frappe.contacts.doctype.address.address import get_address_display
from erpnext.controllers.stock_controller import StockController
@@ -16,7 +17,7 @@
def __setup__(self):
if hasattr(self, "taxes"):
self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
- "print_taxes_with_zero_amount"))
+ "print_taxes_with_zero_amount"))
self.flags.show_inclusive_tax_in_print = self.is_inclusive_tax()
self.print_templates = {
@@ -43,6 +44,7 @@
self.set_po_nos()
self.set_gross_profit()
set_default_income_account_for_item(self)
+ self.set_customer_address()
def set_missing_values(self, for_validate=False):
@@ -355,6 +357,17 @@
item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))
+ def set_customer_address(self):
+ address_dict = {
+ 'customer_address': 'address_display',
+ 'shipping_address_name': 'shipping_address',
+ 'company_address': 'company_address_display'
+ }
+
+ for address_field, address_display_field in address_dict.items():
+ if self.get(address_field):
+ self.set(address_display_field, get_address_display(self.get(address_field)))
+
def validate_items(self):
# validate items to see if they have is_sales_item enabled
from erpnext.controllers.buying_controller import validate_item_type
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 43afa2a..cbd3939 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -12,7 +12,7 @@
source_link = "https://github.com/frappe/erpnext"
develop_version = '12.x.x-develop'
-staging_version = '11.0.3-beta.24'
+staging_version = '11.0.3-beta.25'
error_report_email = "support@erpnext.com"
diff --git a/erpnext/manufacturing/page/production_analytics/__init__.py b/erpnext/manufacturing/page/production_analytics/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/manufacturing/page/production_analytics/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/manufacturing/page/production_analytics/production_analytics.js b/erpnext/manufacturing/page/production_analytics/production_analytics.js
deleted file mode 100644
index 1647313..0000000
--- a/erpnext/manufacturing/page/production_analytics/production_analytics.js
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-frappe.pages['production-analytics'].on_page_load = function(wrapper) {
- frappe.ui.make_app_page({
- parent: wrapper,
- title: __('Production Analytics'),
- single_column: true
- });
-
- new erpnext.ProductionAnalytics(wrapper);
-
- frappe.breadcrumbs.add("Manufacturing");
-}
-
-erpnext.ProductionAnalytics = frappe.views.GridReportWithPlot.extend({
- init: function(wrapper) {
- this._super({
- title: __("Production Analytics"),
- parent: $(wrapper).find('.layout-main'),
- page: wrapper.page,
- doctypes: ["Item", "Company", "Fiscal Year", "Work Order"]
- });
-
- },
- setup_columns: function() {
-
- var std_columns = [
- {id: "name", name: __("Status"), field: "name", width: 100}
- ];
-
- this.make_date_range_columns();
- this.columns = std_columns.concat(this.columns);
- },
- filters: [
- {fieldtype:"Select", label: __("Company"), link:"Company", fieldname: "company",
- default_value: __("Select Company...")},
- {fieldtype:"Date", label: __("From Date"), fieldname: "from_date"},
- {fieldtype:"Date", label: __("To Date"), fieldname: "to_date"},
- {fieldtype:"Select", label: __("Range"), fieldname: "range",
- options:[{label: __("Daily"), value: "Daily"}, {label: __("Weekly"), value: "Weekly"},
- {label: __("Monthly"), value: "Monthly"}, {label: __("Quarterly"), value: "Quarterly"},
- {label: __("Yearly"), value: "Yearly"}]}
- ],
- setup_filters: function() {
- var me = this;
- this._super();
-
- this.trigger_refresh_on_change(["company"]);
- this.trigger_refresh_on_change(["range"]);
-
- this.show_zero_check();
-
- },
- init_filter_values: function() {
- this._super();
- this.filter_inputs.range.val('Monthly');
- },
- setup_chart: function() {
- var me = this;
-
- var chart_data = this.get_chart_data ? this.get_chart_data() : null;
-
- const parent = this.wrapper.find('.chart')[0];
- this.chart = new Chart(parent, {
- height: 200,
- data: chart_data,
- type: 'line'
- });
- },
- set_default_values: function() {
- var values = {
- from_date: frappe.datetime.str_to_user(frappe.datetime.add_months(frappe.datetime.now_datetime(),-12) ),
- to_date: frappe.datetime.str_to_user(frappe.datetime.add_months(frappe.datetime.now_datetime(),1))
- }
-
- var me = this;
- $.each(values, function(i, v) {
- if(me.filter_inputs[i] && !me.filter_inputs[i].val())
- me.filter_inputs[i].val(v);
- })
- },
-
- prepare_data: function() {
- // add Opening, Closing, Totals rows
- // if filtered by account and / or voucher
- var me = this;
- var all_open_orders = {name:"All Work Orders", "id": "all-open-pos",
- checked:true};
- var not_started = {name:"Not Started", "id":"not-started-pos",
- checked:true};
- var overdue = {name:"Overdue (Not Started)", "id":"overdue-pos",
- checked:true};
- var pending = {name:"Pending", "id":"pending-pos",
- checked:true};
- var completed = {name:"Completed", "id":"completed-pos",
- checked:true};
-
- $.each(frappe.report_dump.data["Work Order"], function(i, d) {
- var dateobj = frappe.datetime.str_to_obj(d.creation);
- var date = frappe.datetime.str_to_user(d.creation.split(" ")[0]);
-
- $.each(me.columns, function(i,col) {
- if (i > 1){
- var start_period = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(col.id));
- var end_period = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(col.name));
- var astart_date = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.actual_start_date));
- var planned_start_date = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.planned_start_date));
- var aend_date = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.actual_end_date));
- var modified = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.modified));
-
- if (dateobj <= start_period || dateobj <= end_period) {
- all_open_orders[col.field] = flt(all_open_orders[col.field]) + 1;
-
- if(d.status=="Completed") {
- if(aend_date < start_period || modified < start_period) {
- completed[col.field] = flt(completed[col.field]) + 1;
- }
- else if (astart_date < start_period) {
- pending[col.field] = flt(pending[col.field]) + 1;
- }
- else if (planned_start_date < start_period) {
- overdue[col.field] = flt(overdue[col.field]) + 1;
- } else {
- not_started[col.field] = flt(not_started[col.field]) + 1;
- }
- }else if(d.status == "In Process")
- {
- if (astart_date < start_period || modified < start_period){
- pending[col.field] = flt(pending[col.field]) + 1;
- }else if (planned_start_date < start_period) {
- overdue[col.field] = flt(overdue[col.field]) + 1;
- }else{
- not_started[col.field] = flt(not_started[col.field]) + 1;
- }
- }else if(d.status == "Not Started") {
- if (planned_start_date < start_period){
- overdue[col.field] = flt(overdue[col.field]) + 1;
- }else{
- not_started[col.field] = flt(not_started[col.field]) + 1;
- }
- }
- }
- }
- });
- });
- if(me.columns.length < 30){
- this.chart_area.toggle(true);
- }else {
- this.chart_area.toggle(false);
- }
- this.data = [all_open_orders, not_started, overdue, pending, completed];
-
- }
-});
diff --git a/erpnext/manufacturing/page/production_analytics/production_analytics.json b/erpnext/manufacturing/page/production_analytics/production_analytics.json
deleted file mode 100644
index cd73bc8..0000000
--- a/erpnext/manufacturing/page/production_analytics/production_analytics.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "content": null,
- "creation": "2012-09-21 20:15:16",
- "docstatus": 0,
- "doctype": "Page",
- "icon": "fa fa-bar-chart",
- "idx": 1,
- "modified": "2017-02-20 17:33:05.913097",
- "modified_by": "Administrator",
- "module": "Manufacturing",
- "name": "production-analytics",
- "owner": "Administrator",
- "page_name": "production-analytics",
- "roles": [
- {
- "role": "Analytics"
- },
- {
- "role": "Manufacturing Manager"
- }
- ],
- "script": null,
- "standard": "Yes",
- "style": null,
- "title": "Production Analytics"
-}
\ No newline at end of file
diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.js b/erpnext/manufacturing/report/production_analytics/production_analytics.js
index b7b8f05..99f9b12 100644
--- a/erpnext/manufacturing/report/production_analytics/production_analytics.js
+++ b/erpnext/manufacturing/report/production_analytics/production_analytics.js
@@ -39,8 +39,5 @@
default: "Monthly",
reqd: 1
}
- ],
- "formatter": function(value, row, column, data) {
- return value;
- }
+ ]
}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index dc4c94c..4a67eb4 100755
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -568,10 +568,10 @@
erpnext.patches.v11_0.add_default_dispatch_notification_template
erpnext.patches.v11_0.add_market_segments
erpnext.patches.v11_0.add_sales_stages
-execute:frappe.delete_doc("Page", "sales-analytics")
-execute:frappe.delete_doc("Page", "purchase-analytics")
-execute:frappe.delete_doc("Page", "stock-analytics")
-execute:frappe.delete_doc("Page", "production-analytics")
+execute:frappe.delete_doc_if_exists("Page", "sales-analytics")
+execute:frappe.delete_doc_if_exists("Page", "purchase-analytics")
+execute:frappe.delete_doc_if_exists("Page", "stock-analytics")
+execute:frappe.delete_doc_if_exists("Page", "production-analytics")
erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13
erpnext.patches.v11_0.drop_column_max_days_allowed
erpnext.patches.v11_0.change_healthcare_desktop_icons
diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js
index b8f324a..c1a9c44 100644
--- a/erpnext/projects/doctype/task/task.js
+++ b/erpnext/projects/doctype/task/task.js
@@ -80,15 +80,15 @@
}
},
- is_group: function(frm) {
+ is_group: function (frm) {
frappe.call({
- method:"erpnext.projects.doctype.task.task.check_if_child_exists",
+ method: "erpnext.projects.doctype.task.task.check_if_child_exists",
args: {
name: frm.doc.name
},
- callback: function(r){
- if(r.message){
- frappe.msgprint(__('Cannot convert it to non-group. Child Tasks exist.'));
+ callback: function (r) {
+ if (r.message.length > 0) {
+ frappe.msgprint(__(`Cannot convert it to non-group. The following child Tasks exist: ${r.message.join(", ")}.`));
frm.reload_doc();
}
}
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index 3dc52d4..649d73a 100755
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils import getdate, date_diff, add_days, cstr
+import json
+
+import frappe
from frappe import _, throw
+from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate
from frappe.utils.nestedset import NestedSet
+
class CircularReferenceError(frappe.ValidationError): pass
class Task(NestedSet):
@@ -157,8 +160,10 @@
@frappe.whitelist()
def check_if_child_exists(name):
- return frappe.db.sql("""select name from `tabTask`
- where parent_task = %s""", name)
+ child_tasks = frappe.get_all("Task", filters={"parent_task": name})
+ child_tasks = [get_link_to_form("Task", task.name) for task in child_tasks]
+ return child_tasks
+
def get_project(doctype, txt, searchfield, start, page_len, filters):
from erpnext.controllers.queries import get_match_cond
@@ -237,4 +242,4 @@
new_task.insert()
def on_doctype_update():
- frappe.db.add_index("Task", ["lft", "rgt"])
\ No newline at end of file
+ frappe.db.add_index("Task", ["lft", "rgt"])
diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css
index 460efbf..c55e422 100644
--- a/erpnext/public/css/erpnext.css
+++ b/erpnext/public/css/erpnext.css
@@ -346,6 +346,11 @@
body[data-route="pos"] .collapse-btn {
cursor: pointer;
}
+@media (max-width: 767px) {
+ body[data-route="pos"] .page-actions {
+ max-width: 110px;
+ }
+}
.price-info {
position: absolute;
left: 0;
diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js
index 8b1d1b1..26be997 100644
--- a/erpnext/public/js/projects/timer.js
+++ b/erpnext/public/js/projects/timer.js
@@ -44,8 +44,8 @@
};
erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) {
- var $btn_start = $(".playpause .btn-start");
- var $btn_complete = $(".playpause .btn-complete");
+ var $btn_start = dialog.$wrapper.find(".playpause .btn-start");
+ var $btn_complete = dialog.$wrapper.find(".playpause .btn-complete");
var interval = null;
var currentIncrement = timestamp;
var initialised = row ? true : false;
diff --git a/erpnext/selling/page/sales_analytics/README.md b/erpnext/selling/page/sales_analytics/README.md
deleted file mode 100644
index 11994c2..0000000
--- a/erpnext/selling/page/sales_analytics/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Trends of sales by Item, Item Group, Customer etc.
\ No newline at end of file
diff --git a/erpnext/selling/page/sales_analytics/__init__.py b/erpnext/selling/page/sales_analytics/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/selling/page/sales_analytics/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js
deleted file mode 100644
index f5caf1d..0000000
--- a/erpnext/selling/page/sales_analytics/sales_analytics.js
+++ /dev/null
@@ -1,246 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-frappe.pages['sales-analytics'].on_page_load = function(wrapper) {
- frappe.ui.make_app_page({
- parent: wrapper,
- title: __('Sales Analytics'),
- single_column: true
- });
- new erpnext.SalesAnalytics(wrapper);
-
-
- frappe.breadcrumbs.add("Selling")
-
-};
-
-erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({
- init: function(wrapper) {
- this._super({
- title: __("Sales Analytics"),
- parent: $(wrapper).find('.layout-main'),
- page: wrapper.page,
- doctypes: ["Item", "Item Group", "Customer", "Customer Group", "Company", "Territory",
- "Fiscal Year", "Sales Invoice", "Sales Invoice Item",
- "Sales Order", "Sales Order Item[Sales Analytics]",
- "Delivery Note", "Delivery Note Item[Sales Analytics]"],
- tree_grid: { show: true }
- });
-
- this.tree_grids = {
- "Customer Group": {
- label: __("Customer Group / Customer"),
- show: true,
- item_key: "customer",
- parent_field: "parent_customer_group",
- formatter: function(item) {
- return item.customer_name? item.customer_name + " (" + item.name + ")" : item.name;
- }
- },
- "Customer": {
- label: __("Customer"),
- show: false,
- item_key: "customer",
- formatter: function(item) {
- return item.customer_name? item.customer_name + " (" + item.name + ")" : item.name;
- }
- },
- "Item Group": {
- label: __("Item"),
- show: true,
- parent_field: "parent_item_group",
- item_key: "item_code",
- formatter: function(item) {
- return item.name;
- }
- },
- "Item": {
- label: __("Item"),
- show: false,
- item_key: "item_code",
- formatter: function(item) {
- return item.name;
- }
- },
- "Territory": {
- label: __("Territory / Customer"),
- show: true,
- item_key: "customer",
- parent_field: "parent_territory",
- formatter: function(item) {
- return item.customer_name? item.customer_name + " (" + item.name + ")" : item.name;
- }
- }
- }
- },
- setup_columns: function() {
- this.tree_grid = this.tree_grids[this.tree_type];
-
- var std_columns = [
- {id: "name", name: this.tree_grid.label, field: "name", width: 300},
- {id: "total", name: "Total", field: "total", plot: false,
- formatter: this.currency_formatter}
- ];
-
- this.make_date_range_columns();
- this.columns = std_columns.concat(this.columns);
- },
- filters: [
- {fieldtype:"Select", fieldname: "tree_type", label: __("Tree Type"), options:["Customer Group", "Customer",
- "Item Group", "Item", "Territory"],
- filter: function(val, item, opts, me) {
- return me.apply_zero_filter(val, item, opts, me);
- }},
- {fieldtype:"Select", fieldname: "based_on", label: __("Based On"), options:["Sales Invoice",
- "Sales Order", "Delivery Note"]},
- {fieldtype:"Select", fieldname: "value_or_qty", label: __("Value or Qty"),
- options:[{label: __("Value"), value: "Value"}, {label: __("Quantity"), value: "Quantity"}]},
- {fieldtype:"Date", fieldname: "from_date", label: __("From Date")},
- {fieldtype:"Label", fieldname: "to", label: __("To")},
- {fieldtype:"Date", fieldname: "to_date", label: __("To Date")},
- {fieldtype:"Select", fieldname: "company", label: __("Company"), link:"Company",
- default_value: __("Select Company...")},
- {fieldtype:"Select", label: __("Range"), fieldname: "range",
- options:[{label: __("Daily"), value: "Daily"}, {label: __("Weekly"), value: "Weekly"},
- {label: __("Monthly"), value: "Monthly"}, {label: __("Quarterly"), value: "Quarterly"},
- {label: __("Yearly"), value: "Yearly"}]}
- ],
- setup_filters: function() {
- var me = this;
- this._super();
-
- this.trigger_refresh_on_change(["value_or_qty", "tree_type", "based_on", "company"]);
-
- this.show_zero_check();
- },
- init_filter_values: function() {
- this._super();
- this.filter_inputs.range.val('Monthly');
- },
- prepare_data: function() {
- var me = this;
- if (!this.tl) {
- // add 'Not Set' Customer & Item
- // (Customer / Item are not mandatory!!)
- frappe.report_dump.data["Customer"].push({
- name: "Not Set",
- parent_customer_group: "All Customer Groups",
- parent_territory: "All Territories",
- id: "Not Set",
- });
-
- frappe.report_dump.data["Item"].push({
- name: "Not Set",
- parent_item_group: "All Item Groups",
- id: "Not Set",
- });
- }
-
- if (!this.tl || !this.tl[this.based_on]) {
- this.make_transaction_list(this.based_on, this.based_on + " Item");
- }
-
- if(!this.data || me.item_type != me.tree_type) {
- if(me.tree_type=='Customer') {
- var items = frappe.report_dump.data["Customer"];
- } if(me.tree_type=='Customer Group') {
- var items = this.prepare_tree("Customer", "Customer Group");
- } else if(me.tree_type=="Item Group") {
- var items = this.prepare_tree("Item", "Item Group");
- } else if(me.tree_type=="Item") {
- var items = frappe.report_dump.data["Item"];
- } else if(me.tree_type=="Territory") {
- var items = this.prepare_tree("Customer", "Territory");
- }
-
- me.item_type = me.tree_type
- me.parent_map = {};
- me.item_by_name = {};
- me.data = [];
-
- $.each(items, function(i, v) {
- var d = copy_dict(v);
-
- me.data.push(d);
- me.item_by_name[d.name] = d;
- if(d[me.tree_grid.parent_field]) {
- me.parent_map[d.name] = d[me.tree_grid.parent_field];
- }
- me.reset_item_values(d);
- });
-
- this.set_indent();
-
- } else {
- // otherwise, only reset values
- $.each(this.data, function(i, d) {
- me.reset_item_values(d);
- });
- }
-
- this.prepare_balances();
- if(me.tree_grid.show) {
- this.set_totals(false);
- this.update_groups();
- } else {
- this.set_totals(true);
- }
-
- },
- prepare_balances: function() {
- var me = this;
- var from_date = frappe.datetime.str_to_obj(this.from_date);
- var to_date = frappe.datetime.str_to_obj(this.to_date);
- var is_val = this.value_or_qty == 'Value';
-
- $.each(this.tl[this.based_on], function(i, tl) {
- if (me.is_default('company') ? true : tl.company === me.company) {
- var posting_date = frappe.datetime.str_to_obj(tl.posting_date);
- if (posting_date >= from_date && posting_date <= to_date) {
- var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
- me.item_by_name['Not Set'];
- if(item){
- item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
- }
- }
- }
- });
- },
- update_groups: function() {
- var me = this;
-
- $.each(this.data, function(i, item) {
- var parent = me.parent_map[item.name];
- while(parent) {
- var parent_group = me.item_by_name[parent];
-
- $.each(me.columns, function(c, col) {
- if (col.formatter == me.currency_formatter) {
- parent_group[col.field] =
- flt(parent_group[col.field])
- + flt(item[col.field]);
- }
- });
- parent = me.parent_map[parent];
- }
- });
- },
- set_totals: function(sort) {
- var me = this;
- var checked = false;
- $.each(this.data, function(i, d) {
- d.total = 0.0;
- $.each(me.columns, function(i, col) {
- if(col.formatter==me.currency_formatter && !col.hidden && col.field!="total")
- d.total += d[col.field];
- if(d.checked) checked = true;
- })
- });
-
- if(sort)this.data = this.data.sort(function(a, b) { return a.total < b.total; });
-
- if(!this.checked) {
- this.data[0].checked = true;
- }
- }
-});
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.json b/erpnext/selling/page/sales_analytics/sales_analytics.json
deleted file mode 100644
index 4a7761e..0000000
--- a/erpnext/selling/page/sales_analytics/sales_analytics.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "creation": "2012-09-21 20:15:12.000000",
- "docstatus": 0,
- "doctype": "Page",
- "icon": "fa fa-bar-chart",
- "idx": 1,
- "modified": "2013-07-11 14:43:59.000000",
- "modified_by": "Administrator",
- "module": "Selling",
- "name": "sales-analytics",
- "owner": "Administrator",
- "page_name": "sales-analytics",
- "roles": [
- {
- "role": "Analytics"
- },
- {
- "role": "Sales Manager"
- },
- {
- "role": "Maintenance Manager"
- }
- ],
- "standard": "Yes",
- "title": "Sales Analytics"
-}
\ No newline at end of file
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.js b/erpnext/selling/report/sales_analytics/sales_analytics.js
index 7dc7c75..0df425d 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.js
@@ -67,6 +67,9 @@
reqd: 1
}
],
+ after_datatable_render: function(datatable_obj) {
+ $(datatable_obj.wrapper).find(".dt-row-0").find('input[type=checkbox]').click();
+ },
get_datatable_options(options) {
return Object.assign(options, {
checkboxColumn: true,
@@ -106,12 +109,12 @@
setTimeout(() => {
frappe.query_report.chart.update(new_data)
- },200)
+ }, 500)
setTimeout(() => {
frappe.query_report.chart.draw(true);
- }, 800)
+ }, 1000)
frappe.query_report.raw_chart_data = new_data;
},
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py
index 8d99a9b..9cc6c40 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.py
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.py
@@ -212,11 +212,11 @@
def get_period(self, posting_date):
if self.filters.range == 'Weekly':
- period = "Week " + str(posting_date.isocalendar()[1])
+ period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
elif self.filters.range == 'Monthly':
- period = self.months[posting_date.month - 1]
+ period = str(self.months[posting_date.month - 1]) + " " + str(posting_date.year)
elif self.filters.range == 'Quarterly':
- period = "Quarter " + str(((posting_date.month-1)//3)+1)
+ period = "Quarter " + str(((posting_date.month-1)//3)+1) +" " + str(posting_date.year)
else:
year = get_fiscal_year(posting_date, company=self.filters.company)
period = str(year[2])
@@ -280,8 +280,7 @@
self.chart = {
"data": {
'labels': labels,
- 'datasets':[
- ]
+ 'datasets':[]
},
"type": "line"
}
\ No newline at end of file
diff --git a/erpnext/selling/report/sales_analytics/test_analytics.py b/erpnext/selling/report/sales_analytics/test_analytics.py
index f59fff4..5d68b06 100644
--- a/erpnext/selling/report/sales_analytics/test_analytics.py
+++ b/erpnext/selling/report/sales_analytics/test_analytics.py
@@ -35,52 +35,52 @@
{
"entity": "_Test Customer 1",
"entity_name": "_Test Customer 1",
- "apr": 0.0,
- "may": 0.0,
- "jun": 0.0,
- "jul": 0.0,
- "aug": 0.0,
- "sep": 0.0,
- "oct": 0.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 2000.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 0.0,
+ "jul_2017": 0.0,
+ "aug_2017": 0.0,
+ "oct_2017": 0.0,
+ "sep_2017": 0.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 2000.0,
+ "mar_2018": 0.0,
"total":2000.0
},
{
"entity": "_Test Customer 2",
"entity_name": "_Test Customer 2",
- "apr": 0.0,
- "may": 0.0,
- "jun": 0.0,
- "jul": 0.0,
- "aug": 0.0,
- "sep": 1500.0,
- "oct": 1000.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 0.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 0.0,
+ "jul_2017": 0.0,
+ "aug_2017": 0.0,
+ "sep_2017": 1500.0,
+ "oct_2017": 1000.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 0.0,
+ "mar_2018": 0.0,
"total":2500.0
},
{
"entity": "_Test Customer 3",
"entity_name": "_Test Customer 3",
- "apr": 0.0,
- "may": 0.0,
- "jun": 2000.0,
- "jul": 1000.0,
- "aug": 0.0,
- "sep": 0.0,
- "oct": 0.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 0.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 2000.0,
+ "jul_2017": 1000.0,
+ "aug_2017": 0.0,
+ "sep_2017": 0.0,
+ "oct_2017": 0.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 0.0,
+ "mar_2018": 0.0,
"total": 3000.0
}
]
@@ -103,18 +103,18 @@
expected_first_row = {
"entity": "All Customer Groups",
"indent": 0,
- "apr": 0.0,
- "may": 0.0,
- "jun": 2000.0,
- "jul": 1000.0,
- "aug": 0.0,
- "sep": 1500.0,
- "oct": 1000.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 2000.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 2000.0,
+ "jul_2017": 1000.0,
+ "aug_2017": 0.0,
+ "sep_2017": 1500.0,
+ "oct_2017": 1000.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 2000.0,
+ "mar_2018": 0.0,
"total":7500.0
}
self.assertEqual(expected_first_row, report[1][0])
@@ -136,52 +136,52 @@
{
"entity": "_Test Customer 1",
"entity_name": "_Test Customer 1",
- "apr": 0.0,
- "may": 0.0,
- "jun": 0.0,
- "jul": 0.0,
- "aug": 0.0,
- "sep": 0.0,
- "oct": 0.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 20.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 0.0,
+ "jul_2017": 0.0,
+ "aug_2017": 0.0,
+ "sep_2017": 0.0,
+ "oct_2017": 0.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 20.0,
+ "mar_2018": 0.0,
"total":20.0
},
{
"entity": "_Test Customer 2",
"entity_name": "_Test Customer 2",
- "apr": 0.0,
- "may": 0.0,
- "jun": 0.0,
- "jul": 0.0,
- "aug": 0.0,
- "sep": 15.0,
- "oct": 10.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 0.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 0.0,
+ "jul_2017": 0.0,
+ "aug_2017": 0.0,
+ "sep_2017": 15.0,
+ "oct_2017": 10.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 0.0,
+ "mar_2018": 0.0,
"total":25.0
},
{
"entity": "_Test Customer 3",
"entity_name": "_Test Customer 3",
- "apr": 0.0,
- "may": 0.0,
- "jun": 20.0,
- "jul": 10.0,
- "aug": 0.0,
- "sep": 0.0,
- "oct": 0.0,
- "nov": 0.0,
- "dec": 0.0,
- "jan": 0.0,
- "feb": 0.0,
- "mar": 0.0,
+ "apr_2017": 0.0,
+ "may_2017": 0.0,
+ "jun_2017": 20.0,
+ "jul_2017": 10.0,
+ "aug_2017": 0.0,
+ "sep_2017": 0.0,
+ "oct_2017": 0.0,
+ "nov_2017": 0.0,
+ "dec_2017": 0.0,
+ "jan_2018": 0.0,
+ "feb_2018": 0.0,
+ "mar_2018": 0.0,
"total": 30.0
}
]
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index fc53794..cf72527 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -53,8 +53,9 @@
pi.qty = flt(qty)
pi.description = description
if not pi.warehouse:
- pi.warehouse = (main_item_row.warehouse
- if (doc.get('is_pos') or not item.default_warehouse) else item.default_warehouse)
+ pi.warehouse = (main_item_row.warehouse if ((doc.get('is_pos')
+ or not item.default_warehouse) and main_item_row.warehouse) else item.default_warehouse)
+
if not pi.batch_no:
pi.batch_no = cstr(main_item_row.get("batch_no"))
if not pi.target_warehouse:
diff --git a/erpnext/stock/page/stock_analytics/README.md b/erpnext/stock/page/stock_analytics/README.md
deleted file mode 100644
index 86c3644..0000000
--- a/erpnext/stock/page/stock_analytics/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Trends of Items quantities and values.
\ No newline at end of file
diff --git a/erpnext/stock/page/stock_analytics/__init__.py b/erpnext/stock/page/stock_analytics/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/stock/page/stock_analytics/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/stock/page/stock_analytics/stock_analytics.js b/erpnext/stock/page/stock_analytics/stock_analytics.js
deleted file mode 100644
index 6deeb7a..0000000
--- a/erpnext/stock/page/stock_analytics/stock_analytics.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-frappe.pages['stock-analytics'].on_page_load = function(wrapper) {
- frappe.ui.make_app_page({
- parent: wrapper,
- title: __('Stock Analytics'),
- single_column: true
- });
-
- frappe.require(["assets/erpnext/js/stock_grid_report.js",
- "assets/erpnext/js/stock_analytics.js"], function() {
- new erpnext.StockAnalytics(wrapper);
- frappe.breadcrumbs.add("Stock")
- });
-};
diff --git a/erpnext/stock/page/stock_analytics/stock_analytics.json b/erpnext/stock/page/stock_analytics/stock_analytics.json
deleted file mode 100644
index 90e9f2e..0000000
--- a/erpnext/stock/page/stock_analytics/stock_analytics.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "creation": "2012-09-21 20:15:14.000000",
- "docstatus": 0,
- "doctype": "Page",
- "icon": "fa fa-bar-chart",
- "idx": 1,
- "modified": "2013-07-11 14:44:10.000000",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "stock-analytics",
- "owner": "Administrator",
- "page_name": "stock-analytics",
- "roles": [
- {
- "role": "Analytics"
- },
- {
- "role": "Material Manager"
- }
- ],
- "standard": "Yes",
- "title": "Stock Analytics"
-}
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.js b/erpnext/stock/report/stock_analytics/stock_analytics.js
index bebc84e..6b384e2 100644
--- a/erpnext/stock/report/stock_analytics/stock_analytics.js
+++ b/erpnext/stock/report/stock_analytics/stock_analytics.js
@@ -71,16 +71,8 @@
reqd: 1
}
],
- "formatter": function(value, row, column, data) {
- if(!value && (column.fieldname == 'brand' || column.fieldname == 'uom')){
- value = ""
- }
-
- if(Number(value)){
- value = value.toFixed(2)
- }
-
- return value;
+ after_datatable_render: function(datatable_obj) {
+ $(datatable_obj.wrapper).find(".dt-row-0").find('input[type=checkbox]').click();
},
get_datatable_options(options) {
return Object.assign(options, {
@@ -120,16 +112,16 @@
setTimeout(() => {
frappe.query_report.chart.update(new_data)
- },200)
+ },500)
setTimeout(() => {
frappe.query_report.chart.draw(true);
- }, 800)
+ }, 1000)
frappe.query_report.raw_chart_data = new_data;
},
}
- })
- },
+ });
+ }
}
diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.py b/erpnext/stock/report/stock_analytics/stock_analytics.py
index dad8be1..54eefdf 100644
--- a/erpnext/stock/report/stock_analytics/stock_analytics.py
+++ b/erpnext/stock/report/stock_analytics/stock_analytics.py
@@ -99,11 +99,11 @@
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
if filters.range == 'Weekly':
- period = "Week " + str(posting_date.isocalendar()[1])
+ period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
elif filters.range == 'Monthly':
- period = months[posting_date.month - 1]
+ period = str(months[posting_date.month - 1]) + " " + str(posting_date.year)
elif filters.range == 'Quarterly':
- period = "Quarter " + str(((posting_date.month-1)//3)+1)
+ period = "Quarter " + str(((posting_date.month-1)//3)+1) +" " + str(posting_date.year)
else:
year = get_fiscal_year(posting_date, company=filters.company)
period = str(year[2])
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 928dd88..0c83529 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -178,7 +178,11 @@
# rounding as per precision
self.stock_value = flt(self.stock_value, self.precision)
- stock_value_difference = self.stock_value - self.prev_stock_value
+ if self.prev_stock_value < 0 and self.stock_value >= 0:
+ stock_value_difference = sle.actual_qty * self.valuation_rate
+ else:
+ stock_value_difference = self.stock_value - self.prev_stock_value
+
self.prev_stock_value = self.stock_value
# update current sle