[fixed] frappe.require is now async 💥
This commit is contained in:
parent
127de729b2
commit
be2ee18de4
@ -3,12 +3,12 @@
|
||||
|
||||
//c-form js file
|
||||
// -----------------------------
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
cur_frm.fields_dict.invoices.grid.get_field("invoice_no").get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
"docstatus": 1,
|
||||
"docstatus": 1,
|
||||
"customer": doc.customer,
|
||||
"company": doc.company,
|
||||
"c_form_applicable": 'Yes',
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
frappe.provide("erpnext.accounts");
|
||||
frappe.provide("erpnext.journal_entry");
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
frappe.ui.form.on("Journal Entry", {
|
||||
refresh: function(frm) {
|
||||
|
@ -13,9 +13,10 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "invoice_type",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Invoice Type",
|
||||
@ -24,6 +25,7 @@
|
||||
"options": "Sales Invoice\nPurchase Invoice\nJournal Entry",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -36,17 +38,19 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "invoice_number",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Invoice Number",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"options": "invoice_type",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -62,6 +66,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Invoice Date",
|
||||
@ -69,6 +74,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -84,6 +90,7 @@
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "",
|
||||
@ -91,6 +98,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -106,6 +114,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
@ -113,6 +122,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -128,6 +138,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Outstanding Amount",
|
||||
@ -135,6 +146,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -145,21 +157,24 @@
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-11-16 06:29:51.516537",
|
||||
"modified": "2016-04-29 05:47:14.124370",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Reconciliation Invoice",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
@ -12,7 +12,7 @@ frappe.pages['financial-analytics'].on_page_load = function(wrapper) {
|
||||
|
||||
};
|
||||
|
||||
frappe.require("assets/erpnext/js/account_tree_grid.js");
|
||||
{% include "erpnext/public/js/account_tree_grid.js" %}
|
||||
|
||||
erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
||||
filters: [
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/financial_statements.js");
|
||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
frappe.query_reports["Balance Sheet"] = erpnext.financial_statements;
|
||||
});
|
||||
|
||||
|
||||
frappe.query_reports["Balance Sheet"] = erpnext.financial_statements;
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/financial_statements.js");
|
||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
frappe.query_reports["Cash Flow"] = erpnext.financial_statements;
|
||||
|
||||
frappe.query_reports["Cash Flow"] = erpnext.financial_statements;
|
||||
|
||||
frappe.query_reports["Cash Flow"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
})
|
||||
frappe.query_reports["Cash Flow"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
});
|
||||
});
|
@ -1,15 +1,12 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/financial_statements.js");
|
||||
|
||||
frappe.query_reports["Profit and Loss Statement"] = $.extend({}, erpnext.financial_statements);
|
||||
|
||||
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
});
|
||||
|
||||
console.log(frappe.query_reports["Profit and Loss Statement"]);
|
||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
frappe.query_reports["Profit and Loss Statement"] = $.extend({}, erpnext.financial_statements);
|
||||
|
||||
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
});
|
||||
});
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js");
|
||||
|
||||
frappe.query_reports["Purchase Invoice Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
||||
frappe.query_reports["Purchase Invoice Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js");
|
||||
|
||||
frappe.query_reports["Sales Invoice Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
|
||||
frappe.query_reports["Sales Invoice Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
@ -1,65 +1,66 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/financial_statements.js");
|
||||
|
||||
frappe.query_reports["Trial Balance"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname": "company",
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "fiscal_year",
|
||||
"label": __("Fiscal Year"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Fiscal Year",
|
||||
"default": frappe.defaults.get_user_default("fiscal_year"),
|
||||
"reqd": 1,
|
||||
"on_change": function(query_report) {
|
||||
var fiscal_year = query_report.get_values().fiscal_year;
|
||||
if (!fiscal_year) {
|
||||
return;
|
||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
frappe.query_reports["Trial Balance"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname": "company",
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "fiscal_year",
|
||||
"label": __("Fiscal Year"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Fiscal Year",
|
||||
"default": frappe.defaults.get_user_default("fiscal_year"),
|
||||
"reqd": 1,
|
||||
"on_change": function(query_report) {
|
||||
var fiscal_year = query_report.get_values().fiscal_year;
|
||||
if (!fiscal_year) {
|
||||
return;
|
||||
}
|
||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
||||
query_report.filters_by_name.from_date.set_input(fy.year_start_date);
|
||||
query_report.filters_by_name.to_date.set_input(fy.year_end_date);
|
||||
query_report.trigger_refresh();
|
||||
});
|
||||
}
|
||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
||||
query_report.filters_by_name.from_date.set_input(fy.year_start_date);
|
||||
query_report.filters_by_name.to_date.set_input(fy.year_end_date);
|
||||
query_report.trigger_refresh();
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
},
|
||||
{
|
||||
"fieldname": "with_period_closing_entry",
|
||||
"label": __("Period Closing Entry"),
|
||||
"fieldtype": "Check",
|
||||
"default": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "show_zero_values",
|
||||
"label": __("Show zero values"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
],
|
||||
"formatter": erpnext.financial_statements.formatter,
|
||||
"tree": true,
|
||||
"name_field": "account",
|
||||
"parent_field": "parent_account",
|
||||
"initial_depth": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
},
|
||||
{
|
||||
"fieldname": "with_period_closing_entry",
|
||||
"label": __("Period Closing Entry"),
|
||||
"fieldtype": "Check",
|
||||
"default": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "show_zero_values",
|
||||
"label": __("Show zero values"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
],
|
||||
"formatter": erpnext.financial_statements.formatter,
|
||||
"tree": true,
|
||||
"name_field": "account",
|
||||
"parent_field": "parent_account",
|
||||
"initial_depth": 3
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4,9 +4,8 @@
|
||||
frappe.provide("erpnext.buying");
|
||||
|
||||
cur_frm.cscript.tax_table = "Purchase Taxes and Charges";
|
||||
{% include 'erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js' %}
|
||||
|
||||
frappe.require("assets/erpnext/js/controllers/transaction.js");
|
||||
{% include 'erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js' %}
|
||||
|
||||
cur_frm.email_field = "contact_email";
|
||||
|
||||
@ -129,12 +128,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this._super(doc, cdt, cdn);
|
||||
this.conversion_factor(doc, cdt, cdn);
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
received_qty: function(doc, cdt, cdn) {
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
||||
@ -142,7 +141,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
|
||||
this.qty(doc, cdt, cdn);
|
||||
},
|
||||
|
||||
|
||||
rejected_qty: function(doc, cdt, cdn) {
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
|
||||
@ -152,7 +151,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
__(frappe.meta.get_label(item.doctype, "received_qty", item.name))]));
|
||||
item.qty = item.rejected_qty = 0.0;
|
||||
} else {
|
||||
|
||||
|
||||
item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
|
||||
}
|
||||
|
||||
@ -236,7 +235,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
erpnext.utils.get_address_display(this.frm, "shipping_address",
|
||||
"shipping_address_display", is_your_company_address=true)
|
||||
},
|
||||
|
||||
|
||||
tc_name: function() {
|
||||
this.get_terms();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{% include 'erpnext/buying/doctype/purchase_common/purchase_common.js' %};
|
||||
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
frappe.ui.form.on("Request for Quotation",{
|
||||
setup: function(frm){
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js");
|
||||
|
||||
frappe.query_reports["Purchase Order Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
||||
frappe.query_reports["Purchase Order Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
@ -2,7 +2,7 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext.crm");
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
cur_frm.email_field = "contact_email";
|
||||
frappe.ui.form.on("Opportunity", {
|
||||
customer: function(frm) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
frappe.provide("erpnext.hr");
|
||||
|
||||
erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
cur_frm.cscript.onload = function(doc) {
|
||||
cur_frm.set_value("company", frappe.defaults.get_user_default("Company"))
|
||||
|
@ -43,20 +43,9 @@ frappe.ui.form.on("Project", {
|
||||
});
|
||||
}
|
||||
|
||||
frm.dashboard.show_heatmap = true;
|
||||
frm.dashboard.heatmap_message = __('This is based on the Time Logs created against this project');
|
||||
frm.dashboard.show_dashboard();
|
||||
// frm.dashboard.add_section(frappe.render_template('project_dashboard', {project: frm.doc}));
|
||||
|
||||
// var bars = [];
|
||||
// bars.push({
|
||||
// 'title': __('Percent Complete'),
|
||||
// 'width': (frm.doc.percent_complete || 1) + '%',
|
||||
// 'progress_class': 'progress-bar-success'
|
||||
// })
|
||||
//
|
||||
// var message = __("{0}% complete", [frm.doc.percent_complete]);
|
||||
//
|
||||
// frm.dashboard.add_progress(__('Status'), bars, message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -154,8 +154,17 @@ def get_dashboard_data(name):
|
||||
from frappe.desk.notifications import get_open_count
|
||||
return {
|
||||
'count': get_open_count('Project', name),
|
||||
'timeline_data': get_timeline_data(name)
|
||||
}
|
||||
|
||||
def get_timeline_data(name):
|
||||
'''Return timeline for attendance'''
|
||||
return dict(frappe.db.sql('''select unix_timestamp(from_time), count(*)
|
||||
from `tabTime Log` where project=%s
|
||||
and from_time > date_sub(curdate(), interval 1 year)
|
||||
and docstatus < 2
|
||||
group by date(from_time)''', name))
|
||||
|
||||
def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20):
|
||||
return frappe.db.sql('''select distinct project.*
|
||||
from tabProject project, `tabProject User` project_user
|
||||
|
@ -461,7 +461,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval:doc.for_manufacturing",
|
||||
"depends_on": "for_manufacturing",
|
||||
"fieldname": "section_break_11",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -645,7 +645,8 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "",
|
||||
"collapsible_depends_on": "",
|
||||
"depends_on": "costing_rate",
|
||||
"fieldname": "section_break_24",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -653,6 +654,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Cost",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@ -748,6 +750,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "0",
|
||||
"depends_on": "billable",
|
||||
"description": "",
|
||||
"fieldname": "billing_rate",
|
||||
"fieldtype": "Currency",
|
||||
@ -801,6 +804,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "0",
|
||||
"depends_on": "billable",
|
||||
"description": "Will be updated only if Time Log is 'Billable'",
|
||||
"fieldname": "billing_amount",
|
||||
"fieldtype": "Currency",
|
||||
@ -935,7 +939,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-04-29 03:45:50.096299",
|
||||
"modified": "2016-04-29 05:19:18.247260",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Time Log",
|
||||
|
@ -11,15 +11,20 @@
|
||||
"public/js/feature_setup.js",
|
||||
"public/js/utils.js",
|
||||
"public/js/queries.js",
|
||||
"public/js/sms_manager.js",
|
||||
"public/js/utils/party.js",
|
||||
"public/js/templates/address_list.html",
|
||||
"public/js/templates/contact_list.html",
|
||||
"public/js/controllers/stock_controller.js",
|
||||
"public/js/controllers/taxes_and_totals.js",
|
||||
"public/js/controllers/transaction.js",
|
||||
"public/js/pos/pos.html",
|
||||
"public/js/pos/pos_bill_item.html",
|
||||
"public/js/pos/pos_item.html",
|
||||
"public/js/pos/pos_tax_row.html",
|
||||
"public/js/pos/pos.js",
|
||||
"public/js/templates/item_selector.html"
|
||||
"public/js/templates/item_selector.html",
|
||||
"public/js/utils/item_selector.js"
|
||||
],
|
||||
"js/item-dashboard.min.js": [
|
||||
"stock/dashboard/item_dashboard.html",
|
||||
|
@ -1,9 +1,6 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext");
|
||||
frappe.require("assets/erpnext/js/controllers/stock_controller.js");
|
||||
|
||||
erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
calculate_taxes_and_totals: function(update_paid_amount) {
|
||||
this.discount_amount_applied = false;
|
||||
@ -59,7 +56,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
"to_currency": company_currency
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -256,7 +253,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
me.round_off_totals(tax);
|
||||
|
||||
// adjust Discount Amount loss in last tax iteration
|
||||
if ((i == me.frm.doc["taxes"].length - 1) && me.discount_amount_applied
|
||||
if ((i == me.frm.doc["taxes"].length - 1) && me.discount_amount_applied
|
||||
&& me.frm.doc.apply_discount_on == "Grand Total" && me.frm.doc.discount_amount)
|
||||
me.adjust_discount_amount_loss(tax);
|
||||
}
|
||||
@ -321,10 +318,10 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
|
||||
discount_amount_loss, precision("tax_amount", tax));
|
||||
tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
|
||||
|
||||
|
||||
this.set_in_company_currency(tax, ["total", "tax_amount_after_discount_amount"]);
|
||||
},
|
||||
|
||||
|
||||
manipulate_grand_total_for_inclusive_tax: function() {
|
||||
var me = this;
|
||||
// if fully inclusive taxes and diff
|
||||
@ -342,8 +339,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
last_tax.tax_amount += diff;
|
||||
last_tax.tax_amount_after_discount += diff;
|
||||
last_tax.total += diff;
|
||||
|
||||
this.set_in_company_currency(last_tax,
|
||||
|
||||
this.set_in_company_currency(last_tax,
|
||||
["total", "tax_amount", "tax_amount_after_discount_amount"]);
|
||||
}
|
||||
}
|
||||
@ -392,14 +389,14 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
|
||||
// rounded totals
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total = round_based_on_smallest_currency_fraction(this.frm.doc.grand_total,
|
||||
this.frm.doc.rounded_total = round_based_on_smallest_currency_fraction(this.frm.doc.grand_total,
|
||||
this.frm.doc.currency, precision("rounded_total"));
|
||||
}
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
|
||||
var company_currency = this.get_company_currency();
|
||||
|
||||
this.frm.doc.base_rounded_total =
|
||||
round_based_on_smallest_currency_fraction(this.frm.doc.base_grand_total,
|
||||
|
||||
this.frm.doc.base_rounded_total =
|
||||
round_based_on_smallest_currency_fraction(this.frm.doc.base_grand_total,
|
||||
company_currency, precision("base_rounded_total"));
|
||||
}
|
||||
},
|
||||
@ -497,28 +494,28 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
|
||||
this.calculate_outstanding_amount(update_paid_amount);
|
||||
},
|
||||
|
||||
|
||||
calculate_outstanding_amount: function(update_paid_amount) {
|
||||
// NOTE:
|
||||
// paid_amount and write_off_amount is only for POS Invoice
|
||||
// total_advance is only for non POS Invoice
|
||||
if(this.frm.doc.is_return || this.frm.doc.docstatus > 0) return;
|
||||
|
||||
|
||||
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]);
|
||||
if(this.frm.doc.party_account_currency == this.frm.doc.currency) {
|
||||
var total_amount_to_pay = flt((this.frm.doc.grand_total - this.frm.doc.total_advance
|
||||
if(this.frm.doc.party_account_currency == this.frm.doc.currency) {
|
||||
var total_amount_to_pay = flt((this.frm.doc.grand_total - this.frm.doc.total_advance
|
||||
- this.frm.doc.write_off_amount), precision("grand_total"));
|
||||
} else {
|
||||
var total_amount_to_pay = flt(
|
||||
(flt(this.frm.doc.grand_total*this.frm.doc.conversion_rate, precision("grand_total"))
|
||||
- this.frm.doc.total_advance - this.frm.doc.base_write_off_amount),
|
||||
(flt(this.frm.doc.grand_total*this.frm.doc.conversion_rate, precision("grand_total"))
|
||||
- this.frm.doc.total_advance - this.frm.doc.base_write_off_amount),
|
||||
precision("base_grand_total")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if(this.frm.doc.doctype == "Sales Invoice" || this.frm.doc.doctype == "Purchase Invoice") {
|
||||
frappe.model.round_floats_in(this.frm.doc, ["paid_amount"]);
|
||||
|
||||
|
||||
if(this.frm.doc.is_pos || this.frm.doc.is_paid) {
|
||||
if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) {
|
||||
this.frm.doc.paid_amount = flt(total_amount_to_pay);
|
||||
@ -529,16 +526,16 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
this.set_in_company_currency(this.frm.doc, ["paid_amount"]);
|
||||
this.frm.refresh_field("paid_amount");
|
||||
this.frm.refresh_field("base_paid_amount");
|
||||
|
||||
var paid_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
|
||||
|
||||
var paid_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
|
||||
this.frm.doc.paid_amount : this.frm.doc.base_paid_amount;
|
||||
|
||||
var outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
|
||||
|
||||
var outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
|
||||
precision("outstanding_amount"));
|
||||
|
||||
|
||||
} else if(this.frm.doc.doctype == "Purchase Invoice") {
|
||||
var outstanding_amount = flt(total_amount_to_pay, precision("outstanding_amount"));
|
||||
}
|
||||
}
|
||||
this.frm.set_value("outstanding_amount", outstanding_amount);
|
||||
}
|
||||
})
|
||||
|
@ -1,13 +1,85 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext");
|
||||
frappe.require([
|
||||
"assets/erpnext/js/controllers/taxes_and_totals.js",
|
||||
"assets/erpnext/js/utils.js",
|
||||
"assets/erpnext/js/utils/item_selector.js"]);
|
||||
|
||||
erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
setup: function() {
|
||||
frappe.ui.form.on(this.frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
frappe.model.round_floats_in(item, ["rate", "price_list_rate"]);
|
||||
|
||||
if(item.price_list_rate) {
|
||||
item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0, precision("discount_percentage", item));
|
||||
} else {
|
||||
item.discount_percentage = 0.0;
|
||||
}
|
||||
|
||||
cur_frm.cscript.set_gross_profit(item);
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(this.frm.cscript.tax_table, "rate", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(this.frm.cscript.tax_table, "tax_amount", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(this.frm.cscript.tax_table, "row_id", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(this.frm.cscript.tax_table, "included_in_print_rate", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.set_dynamic_labels();
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(this.frm.doctype, "apply_discount_on", function(frm) {
|
||||
if(frm.doc.additional_discount_percentage) {
|
||||
frm.trigger("additional_discount_percentage");
|
||||
} else {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
}
|
||||
})
|
||||
|
||||
frappe.ui.form.on(this.frm.doctype, "additional_discount_percentage", function(frm) {
|
||||
if (frm.via_discount_amount) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!frm.doc.apply_discount_on) {
|
||||
frappe.msgprint(__("Please set 'Apply Additional Discount On'"));
|
||||
return
|
||||
}
|
||||
|
||||
frm.via_discount_percentage = true;
|
||||
|
||||
if(frm.doc.additional_discount_percentage && frm.doc.discount_amount) {
|
||||
// Reset discount amount and net / grand total
|
||||
frm.set_value("discount_amount", 0);
|
||||
}
|
||||
|
||||
var total = flt(frm.doc[frappe.model.scrub(frm.doc.apply_discount_on)]);
|
||||
var discount_amount = flt(total*flt(frm.doc.additional_discount_percentage) / 100,
|
||||
precision("discount_amount"));
|
||||
|
||||
frm.set_value("discount_amount", discount_amount);
|
||||
delete frm.via_discount_percentage;
|
||||
});
|
||||
|
||||
frappe.ui.form.on(this.frm.doctype, "discount_amount", function(frm) {
|
||||
frm.cscript.set_dynamic_labels();
|
||||
|
||||
if (!frm.via_discount_percentage) {
|
||||
frm.via_discount_amount = true;
|
||||
frm.set_value("additional_discount_percentage", 0);
|
||||
delete frm.via_discount_amount;
|
||||
}
|
||||
|
||||
frm.cscript.calculate_taxes_and_totals();
|
||||
});
|
||||
|
||||
},
|
||||
onload: function() {
|
||||
var me = this;
|
||||
//this.frm.show_print_first = true;
|
||||
@ -128,7 +200,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
},
|
||||
|
||||
send_sms: function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(this.frm.doc);
|
||||
},
|
||||
|
||||
@ -911,80 +982,4 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
frappe.ui.form.on(cur_frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
frappe.model.round_floats_in(item, ["rate", "price_list_rate"]);
|
||||
|
||||
if(item.price_list_rate) {
|
||||
item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0, precision("discount_percentage", item));
|
||||
} else {
|
||||
item.discount_percentage = 0.0;
|
||||
}
|
||||
|
||||
cur_frm.cscript.set_gross_profit(item);
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(cur_frm.cscript.tax_table, "rate", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(cur_frm.cscript.tax_table, "tax_amount", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(cur_frm.cscript.tax_table, "row_id", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(cur_frm.cscript.tax_table, "included_in_print_rate", function(frm, cdt, cdn) {
|
||||
cur_frm.cscript.set_dynamic_labels();
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
})
|
||||
|
||||
frappe.ui.form.on(cur_frm.doctype, "apply_discount_on", function(frm) {
|
||||
if(frm.doc.additional_discount_percentage) {
|
||||
frm.trigger("additional_discount_percentage");
|
||||
} else {
|
||||
cur_frm.cscript.calculate_taxes_and_totals();
|
||||
}
|
||||
})
|
||||
|
||||
frappe.ui.form.on(cur_frm.doctype, "additional_discount_percentage", function(frm) {
|
||||
if (frm.via_discount_amount) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!frm.doc.apply_discount_on) {
|
||||
frappe.msgprint(__("Please set 'Apply Additional Discount On'"));
|
||||
return
|
||||
}
|
||||
|
||||
frm.via_discount_percentage = true;
|
||||
|
||||
if(frm.doc.additional_discount_percentage && frm.doc.discount_amount) {
|
||||
// Reset discount amount and net / grand total
|
||||
frm.set_value("discount_amount", 0);
|
||||
}
|
||||
|
||||
var total = flt(frm.doc[frappe.model.scrub(frm.doc.apply_discount_on)]);
|
||||
var discount_amount = flt(total*flt(frm.doc.additional_discount_percentage) / 100,
|
||||
precision("discount_amount"));
|
||||
|
||||
frm.set_value("discount_amount", discount_amount);
|
||||
delete frm.via_discount_percentage;
|
||||
});
|
||||
|
||||
frappe.ui.form.on(cur_frm.doctype, "discount_amount", function(frm) {
|
||||
frm.cscript.set_dynamic_labels();
|
||||
|
||||
if (!frm.via_discount_percentage) {
|
||||
frm.via_discount_amount = true;
|
||||
frm.set_value("additional_discount_percentage", 0);
|
||||
delete frm.via_discount_amount;
|
||||
}
|
||||
|
||||
frm.cscript.calculate_taxes_and_totals();
|
||||
});
|
||||
});
|
@ -1,213 +1,214 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/stock_grid_report.js");
|
||||
frappe.require("assets/erpnext/js/stock_grid_report.js", function() {
|
||||
erpnext.StockAnalytics = erpnext.StockGridReport.extend({
|
||||
init: function(wrapper, opts) {
|
||||
var args = {
|
||||
title: __("Stock Analytics"),
|
||||
page: wrapper,
|
||||
parent: $(wrapper).find('.layout-main'),
|
||||
page: wrapper.page,
|
||||
doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand",
|
||||
"Fiscal Year", "Serial No"],
|
||||
tree_grid: {
|
||||
show: true,
|
||||
parent_field: "parent_item_group",
|
||||
formatter: function(item) {
|
||||
if(!item.is_group) {
|
||||
return repl("<a \
|
||||
onclick='frappe.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
|
||||
%(value)s</a>", {
|
||||
value: item.name,
|
||||
});
|
||||
} else {
|
||||
return item.name;
|
||||
}
|
||||
|
||||
erpnext.StockAnalytics = erpnext.StockGridReport.extend({
|
||||
init: function(wrapper, opts) {
|
||||
var args = {
|
||||
title: __("Stock Analytics"),
|
||||
page: wrapper,
|
||||
parent: $(wrapper).find('.layout-main'),
|
||||
page: wrapper.page,
|
||||
doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand",
|
||||
"Fiscal Year", "Serial No"],
|
||||
tree_grid: {
|
||||
show: true,
|
||||
parent_field: "parent_item_group",
|
||||
formatter: function(item) {
|
||||
if(!item.is_group) {
|
||||
return repl("<a \
|
||||
onclick='frappe.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
|
||||
%(value)s</a>", {
|
||||
value: item.name,
|
||||
});
|
||||
} else {
|
||||
return item.name;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
if(opts) $.extend(args, opts);
|
||||
|
||||
this._super(args);
|
||||
},
|
||||
setup_columns: function() {
|
||||
var std_columns = [
|
||||
{id: "_check", name: __("Plot"), field: "_check", width: 30,
|
||||
formatter: this.check_formatter},
|
||||
{id: "name", name: __("Item"), field: "name", width: 300,
|
||||
formatter: this.tree_formatter},
|
||||
{id: "brand", name: __("Brand"), field: "brand", width: 100},
|
||||
{id: "stock_uom", name: __("UOM"), field: "stock_uom", width: 100},
|
||||
{id: "opening", name: __("Opening"), field: "opening", hidden: true,
|
||||
formatter: this.currency_formatter}
|
||||
];
|
||||
|
||||
this.make_date_range_columns();
|
||||
this.columns = std_columns.concat(this.columns);
|
||||
},
|
||||
filters: [
|
||||
{fieldtype:"Select", label: __("Value or Qty"), fieldname: "value_or_qty",
|
||||
options:[{label:__("Value"), value:"Value"}, {label:__("Quantity"), value:"Quantity"}],
|
||||
filter: function(val, item, opts, me) {
|
||||
return me.apply_zero_filter(val, item, opts, me);
|
||||
}},
|
||||
{fieldtype:"Select", label: __("Brand"), link:"Brand", fieldname: "brand",
|
||||
default_value: __("Select Brand..."), filter: function(val, item, opts) {
|
||||
return val == opts.default_value || item.brand == val || item._show;
|
||||
}, link_formatter: {filter_input: "brand"}},
|
||||
{fieldtype:"Select", label: __("Warehouse"), link:"Warehouse", fieldname: "warehouse",
|
||||
default_value: __("Select Warehouse...")},
|
||||
{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", "brand", "warehouse", "range"]);
|
||||
|
||||
this.show_zero_check();
|
||||
this.setup_plot_check();
|
||||
},
|
||||
init_filter_values: function() {
|
||||
this._super();
|
||||
this.filter_inputs.range && this.filter_inputs.range.val('Monthly');
|
||||
},
|
||||
prepare_data: function() {
|
||||
var me = this;
|
||||
|
||||
if(!this.data) {
|
||||
var items = this.prepare_tree("Item", "Item Group");
|
||||
|
||||
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.parent_item_group) {
|
||||
me.parent_map[d.name] = d.parent_item_group;
|
||||
}
|
||||
me.reset_item_values(d);
|
||||
});
|
||||
this.set_indent();
|
||||
this.data[0].checked = true;
|
||||
} else {
|
||||
// otherwise, only reset values
|
||||
$.each(this.data, function(i, d) {
|
||||
me.reset_item_values(d);
|
||||
d["closing_qty_value"] = 0;
|
||||
});
|
||||
}
|
||||
|
||||
this.prepare_balances();
|
||||
this.update_groups();
|
||||
|
||||
},
|
||||
prepare_balances: function() {
|
||||
var me = this;
|
||||
var from_date = dateutil.str_to_obj(this.from_date);
|
||||
var to_date = dateutil.str_to_obj(this.to_date);
|
||||
var data = frappe.report_dump.data["Stock Ledger Entry"];
|
||||
|
||||
this.item_warehouse = {};
|
||||
this.serialized_buying_rates = this.get_serialized_buying_rates();
|
||||
|
||||
for(var i=0, j=data.length; i<j; i++) {
|
||||
var sl = data[i];
|
||||
sl.posting_datetime = sl.posting_date + " " + sl.posting_time;
|
||||
var posting_datetime = dateutil.str_to_obj(sl.posting_datetime);
|
||||
|
||||
if(me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) {
|
||||
var item = me.item_by_name[sl.item_code];
|
||||
if(item.closing_qty_value==undefined) item.closing_qty_value = 0;
|
||||
|
||||
if(me.value_or_qty!="Quantity") {
|
||||
var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
|
||||
var valuation_method = item.valuation_method ?
|
||||
item.valuation_method : sys_defaults.valuation_method;
|
||||
var is_fifo = valuation_method == "FIFO";
|
||||
|
||||
if(sl.voucher_type=="Stock Reconciliation") {
|
||||
var diff = (sl.qty_after_transaction * sl.valuation_rate) - item.closing_qty_value;
|
||||
wh.fifo_stack = [[sl.qty_after_transaction, sl.valuation_rate, sl.posting_date]];
|
||||
wh.balance_qty = sl.qty_after_transaction;
|
||||
wh.balance_value = sl.valuation_rate * sl.qty_after_transaction;
|
||||
} else {
|
||||
var diff = me.get_value_diff(wh, sl, is_fifo);
|
||||
}
|
||||
} else {
|
||||
if(sl.voucher_type=="Stock Reconciliation") {
|
||||
var diff = sl.qty_after_transaction - item.closing_qty_value;
|
||||
} else {
|
||||
var diff = sl.qty;
|
||||
}
|
||||
}
|
||||
|
||||
if(posting_datetime < from_date) {
|
||||
item.opening += diff;
|
||||
} else if(posting_datetime <= to_date) {
|
||||
item[me.column_map[sl.posting_date].field] += diff;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
item.closing_qty_value += diff;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
update_groups: function() {
|
||||
var me = this;
|
||||
$.each(this.data, function(i, item) {
|
||||
// update groups
|
||||
if(!item.is_group && me.apply_filter(item, "brand")) {
|
||||
var balance = item.opening;
|
||||
$.each(me.columns, function(i, col) {
|
||||
if(col.formatter==me.currency_formatter && !col.hidden) {
|
||||
item[col.field] = balance + item[col.field];
|
||||
balance = item[col.field];
|
||||
}
|
||||
});
|
||||
|
||||
var parent = me.parent_map[item.name];
|
||||
while(parent) {
|
||||
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]);
|
||||
if(opts) $.extend(args, opts);
|
||||
|
||||
this._super(args);
|
||||
},
|
||||
setup_columns: function() {
|
||||
var std_columns = [
|
||||
{id: "_check", name: __("Plot"), field: "_check", width: 30,
|
||||
formatter: this.check_formatter},
|
||||
{id: "name", name: __("Item"), field: "name", width: 300,
|
||||
formatter: this.tree_formatter},
|
||||
{id: "brand", name: __("Brand"), field: "brand", width: 100},
|
||||
{id: "stock_uom", name: __("UOM"), field: "stock_uom", width: 100},
|
||||
{id: "opening", name: __("Opening"), field: "opening", hidden: true,
|
||||
formatter: this.currency_formatter}
|
||||
];
|
||||
|
||||
this.make_date_range_columns();
|
||||
this.columns = std_columns.concat(this.columns);
|
||||
},
|
||||
filters: [
|
||||
{fieldtype:"Select", label: __("Value or Qty"), fieldname: "value_or_qty",
|
||||
options:[{label:__("Value"), value:"Value"}, {label:__("Quantity"), value:"Quantity"}],
|
||||
filter: function(val, item, opts, me) {
|
||||
return me.apply_zero_filter(val, item, opts, me);
|
||||
}},
|
||||
{fieldtype:"Select", label: __("Brand"), link:"Brand", fieldname: "brand",
|
||||
default_value: __("Select Brand..."), filter: function(val, item, opts) {
|
||||
return val == opts.default_value || item.brand == val || item._show;
|
||||
}, link_formatter: {filter_input: "brand"}},
|
||||
{fieldtype:"Select", label: __("Warehouse"), link:"Warehouse", fieldname: "warehouse",
|
||||
default_value: __("Select Warehouse...")},
|
||||
{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", "brand", "warehouse", "range"]);
|
||||
|
||||
this.show_zero_check();
|
||||
this.setup_plot_check();
|
||||
},
|
||||
init_filter_values: function() {
|
||||
this._super();
|
||||
this.filter_inputs.range && this.filter_inputs.range.val('Monthly');
|
||||
},
|
||||
prepare_data: function() {
|
||||
var me = this;
|
||||
|
||||
if(!this.data) {
|
||||
var items = this.prepare_tree("Item", "Item Group");
|
||||
|
||||
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.parent_item_group) {
|
||||
me.parent_map[d.name] = d.parent_item_group;
|
||||
}
|
||||
me.reset_item_values(d);
|
||||
});
|
||||
this.set_indent();
|
||||
this.data[0].checked = true;
|
||||
} else {
|
||||
// otherwise, only reset values
|
||||
$.each(this.data, function(i, d) {
|
||||
me.reset_item_values(d);
|
||||
d["closing_qty_value"] = 0;
|
||||
});
|
||||
}
|
||||
|
||||
this.prepare_balances();
|
||||
this.update_groups();
|
||||
|
||||
},
|
||||
prepare_balances: function() {
|
||||
var me = this;
|
||||
var from_date = dateutil.str_to_obj(this.from_date);
|
||||
var to_date = dateutil.str_to_obj(this.to_date);
|
||||
var data = frappe.report_dump.data["Stock Ledger Entry"];
|
||||
|
||||
this.item_warehouse = {};
|
||||
this.serialized_buying_rates = this.get_serialized_buying_rates();
|
||||
|
||||
for(var i=0, j=data.length; i<j; i++) {
|
||||
var sl = data[i];
|
||||
sl.posting_datetime = sl.posting_date + " " + sl.posting_time;
|
||||
var posting_datetime = dateutil.str_to_obj(sl.posting_datetime);
|
||||
|
||||
if(me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) {
|
||||
var item = me.item_by_name[sl.item_code];
|
||||
if(item.closing_qty_value==undefined) item.closing_qty_value = 0;
|
||||
|
||||
if(me.value_or_qty!="Quantity") {
|
||||
var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
|
||||
var valuation_method = item.valuation_method ?
|
||||
item.valuation_method : sys_defaults.valuation_method;
|
||||
var is_fifo = valuation_method == "FIFO";
|
||||
|
||||
if(sl.voucher_type=="Stock Reconciliation") {
|
||||
var diff = (sl.qty_after_transaction * sl.valuation_rate) - item.closing_qty_value;
|
||||
wh.fifo_stack = [[sl.qty_after_transaction, sl.valuation_rate, sl.posting_date]];
|
||||
wh.balance_qty = sl.qty_after_transaction;
|
||||
wh.balance_value = sl.valuation_rate * sl.qty_after_transaction;
|
||||
} else {
|
||||
var diff = me.get_value_diff(wh, sl, is_fifo);
|
||||
}
|
||||
} else {
|
||||
if(sl.voucher_type=="Stock Reconciliation") {
|
||||
var diff = sl.qty_after_transaction - item.closing_qty_value;
|
||||
} else {
|
||||
var diff = sl.qty;
|
||||
}
|
||||
}
|
||||
|
||||
if(posting_datetime < from_date) {
|
||||
item.opening += diff;
|
||||
} else if(posting_datetime <= to_date) {
|
||||
item[me.column_map[sl.posting_date].field] += diff;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
item.closing_qty_value += diff;
|
||||
}
|
||||
}
|
||||
},
|
||||
update_groups: function() {
|
||||
var me = this;
|
||||
$.each(this.data, function(i, item) {
|
||||
// update groups
|
||||
if(!item.is_group && me.apply_filter(item, "brand")) {
|
||||
var balance = item.opening;
|
||||
$.each(me.columns, function(i, col) {
|
||||
if(col.formatter==me.currency_formatter && !col.hidden) {
|
||||
item[col.field] = balance + item[col.field];
|
||||
balance = item[col.field];
|
||||
}
|
||||
});
|
||||
parent = me.parent_map[parent];
|
||||
|
||||
var parent = me.parent_map[item.name];
|
||||
while(parent) {
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
get_plot_points: function(item, col, idx) {
|
||||
return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
|
||||
},
|
||||
show_stock_ledger: function(item_code) {
|
||||
frappe.route_options = {
|
||||
item_code: item_code,
|
||||
from_date: this.from_date,
|
||||
to_date: this.to_date
|
||||
};
|
||||
frappe.set_route("query-report", "Stock Ledger");
|
||||
}
|
||||
});
|
||||
},
|
||||
get_plot_points: function(item, col, idx) {
|
||||
return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
|
||||
},
|
||||
show_stock_ledger: function(item_code) {
|
||||
frappe.route_options = {
|
||||
item_code: item_code,
|
||||
from_date: this.from_date,
|
||||
to_date: this.to_date
|
||||
};
|
||||
frappe.set_route("query-report", "Stock Ledger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
frappe.ui.form.on_change("Installation Note", "customer",
|
||||
function(frm) { erpnext.utils.get_party_details(frm); });
|
||||
|
@ -1,8 +1,9 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js");
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
|
||||
frappe.query_reports["Quotation Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
||||
|
||||
frappe.query_reports["Quotation Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js");
|
||||
|
||||
frappe.query_reports["Sales Order Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
|
||||
frappe.query_reports["Sales Order Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
@ -5,11 +5,10 @@
|
||||
cur_frm.cscript.tax_table = "Sales Taxes and Charges";
|
||||
{% include 'erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.js' %}
|
||||
|
||||
frappe.provide("erpnext.selling");
|
||||
frappe.require("assets/erpnext/js/controllers/transaction.js");
|
||||
|
||||
cur_frm.email_field = "contact_email";
|
||||
|
||||
frappe.provide("erpnext.selling");
|
||||
erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
onload: function() {
|
||||
this._super();
|
||||
@ -182,7 +181,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
warehouse: function(doc, cdt, cdn) {
|
||||
var me = this;
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
|
||||
|
||||
if(item.item_code && item.warehouse) {
|
||||
return this.frm.call({
|
||||
method: "erpnext.stock.get_item_details.get_bin_details",
|
||||
|
@ -2,7 +2,6 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext.item");
|
||||
frappe.require('assets/js/item-dashboard.min.js');
|
||||
|
||||
frappe.ui.form.on("Item", {
|
||||
onload: function(frm) {
|
||||
@ -77,17 +76,6 @@ frappe.ui.form.on("Item", {
|
||||
|
||||
erpnext.item.toggle_attributes(frm);
|
||||
|
||||
frm.dashboard.show_heatmap = frm.doc.is_stock_item;
|
||||
frm.dashboard.heatmap_message = __('This is based on stock movement. See {0} for details',
|
||||
['<a href="#query-report/Stock Ledger">' + __('Stock Ledger') + '</a>']);
|
||||
frm.dashboard.show_dashboard();
|
||||
|
||||
var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;">Stock Levels</h5>');
|
||||
erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
|
||||
parent: section,
|
||||
item_code: frm.doc.name
|
||||
});
|
||||
erpnext.item.item_dashboard.refresh();
|
||||
|
||||
},
|
||||
|
||||
@ -184,6 +172,20 @@ $.extend(erpnext.item, {
|
||||
frm.dashboard.reset();
|
||||
if(frm.doc.__islocal)
|
||||
return;
|
||||
|
||||
frm.dashboard.show_heatmap = frm.doc.is_stock_item;
|
||||
frm.dashboard.heatmap_message = __('This is based on stock movement. See {0} for details',
|
||||
['<a href="#query-report/Stock Ledger">' + __('Stock Ledger') + '</a>']);
|
||||
frm.dashboard.show_dashboard();
|
||||
|
||||
frappe.require('assets/js/item-dashboard.min.js', function() {
|
||||
var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;">Stock Levels</h5>');
|
||||
erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
|
||||
parent: section,
|
||||
item_code: frm.doc.name
|
||||
});
|
||||
erpnext.item.item_dashboard.refresh();
|
||||
});
|
||||
},
|
||||
|
||||
edit_prices_button: function(frm) {
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
|
||||
frappe.provide("erpnext.stock");
|
||||
frappe.require("assets/erpnext/js/controllers/stock_controller.js");
|
||||
|
||||
erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({
|
||||
setup: function() {
|
||||
@ -11,16 +10,16 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({
|
||||
this.frm.fields_dict.purchase_receipts.grid.get_field('receipt_document').get_query =
|
||||
function(doc, cdt ,cdn) {
|
||||
var d = locals[cdt][cdn]
|
||||
|
||||
|
||||
var filters = [
|
||||
[d.receipt_document_type, 'docstatus', '=', '1'],
|
||||
[d.receipt_document_type, 'company', '=', me.frm.doc.company],
|
||||
]
|
||||
|
||||
|
||||
if(d.receipt_document_type == "Purchase Invoice") {
|
||||
filters.push(["Purchase Invoice", "update_stock", "=", "1"])
|
||||
}
|
||||
|
||||
|
||||
if(!me.frm.doc.company) msgprint(__("Please enter company first"));
|
||||
return {
|
||||
filters:filters
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
{% include 'erpnext/buying/doctype/purchase_common/purchase_common.js' %};
|
||||
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
frappe.ui.form.on("Material Request Item", {
|
||||
"qty": function(frm, doctype, name) {
|
||||
|
@ -1,10 +1,5 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require([
|
||||
"assets/erpnext/js/controllers/stock_controller.js",
|
||||
"assets/erpnext/js/utils.js",
|
||||
"assets/erpnext/js/utils/item_selector.js"]);
|
||||
|
||||
frappe.provide("erpnext.stock");
|
||||
|
||||
erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/controllers/stock_controller.js");
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
frappe.provide("erpnext.stock");
|
||||
|
||||
frappe.ui.form.on("Stock Reconciliation", {
|
||||
|
@ -1,19 +1,16 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/stock_analytics.js", function() {
|
||||
frappe.pages['stock-analytics'].on_page_load = function(wrapper) {
|
||||
frappe.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
title: __('Stock Analytics'),
|
||||
single_column: true
|
||||
});
|
||||
|
||||
frappe.pages['stock-analytics'].on_page_load = function(wrapper) {
|
||||
frappe.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
title: __('Stock Analytics'),
|
||||
single_column: true
|
||||
});
|
||||
new erpnext.StockAnalytics(wrapper);
|
||||
|
||||
new erpnext.StockAnalytics(wrapper);
|
||||
|
||||
|
||||
frappe.breadcrumbs.add("Stock")
|
||||
|
||||
};
|
||||
|
||||
frappe.require("assets/erpnext/js/stock_analytics.js");
|
||||
frappe.breadcrumbs.add("Stock")
|
||||
};
|
||||
});
|
||||
|
@ -1,5 +1,3 @@
|
||||
frappe.require('assets/js/item-dashboard.min.js');
|
||||
|
||||
frappe.pages['stock-balance'].on_page_load = function(wrapper) {
|
||||
var page = frappe.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
@ -52,32 +50,35 @@ frappe.pages['stock-balance'].on_page_load = function(wrapper) {
|
||||
|
||||
page.sort_selector.wrapper.css({'margin-right': '15px', 'margin-top': '4px'});
|
||||
|
||||
page.item_dashboard = new erpnext.stock.ItemDashboard({
|
||||
parent: page.main,
|
||||
})
|
||||
frappe.require('assets/js/item-dashboard.min.js', function() {
|
||||
page.item_dashboard = new erpnext.stock.ItemDashboard({
|
||||
parent: page.main,
|
||||
})
|
||||
|
||||
page.item_dashboard.before_refresh = function() {
|
||||
this.item_code = page.item_field.get_value();
|
||||
this.warehouse = page.warehouse_field.get_value();
|
||||
}
|
||||
page.item_dashboard.before_refresh = function() {
|
||||
this.item_code = page.item_field.get_value();
|
||||
this.warehouse = page.warehouse_field.get_value();
|
||||
}
|
||||
|
||||
page.item_dashboard.refresh();
|
||||
page.item_dashboard.refresh();
|
||||
|
||||
// item click
|
||||
var setup_click = function(doctype) {
|
||||
page.main.on('click', 'a[data-type="'+ doctype.toLowerCase() +'"]', function() {
|
||||
var name = $(this).attr('data-name');
|
||||
var field = page[doctype.toLowerCase() + '_field'];
|
||||
if(field.get_value()===name) {
|
||||
frappe.set_route('Form', doctype, name)
|
||||
} else {
|
||||
field.set_input(name);
|
||||
page.item_dashboard.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
// item click
|
||||
var setup_click = function(doctype) {
|
||||
page.main.on('click', 'a[data-type="'+ doctype.toLowerCase() +'"]', function() {
|
||||
var name = $(this).attr('data-name');
|
||||
var field = page[doctype.toLowerCase() + '_field'];
|
||||
if(field.get_value()===name) {
|
||||
frappe.set_route('Form', doctype, name)
|
||||
} else {
|
||||
field.set_input(name);
|
||||
page.item_dashboard.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setup_click('Item');
|
||||
setup_click('Warehouse');
|
||||
});
|
||||
|
||||
setup_click('Item');
|
||||
setup_click('Warehouse');
|
||||
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js");
|
||||
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
|
||||
frappe.query_reports["Delivery Note Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
||||
|
||||
frappe.query_reports["Delivery Note Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js");
|
||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
||||
frappe.query_reports["Purchase Receipt Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
||||
});
|
||||
|
||||
frappe.query_reports["Purchase Receipt Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext.support");
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
|
@ -2,7 +2,8 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext.support");
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
{% include "erpnext/public/js/utils.js" %}
|
||||
|
||||
frappe.ui.form.on("Warranty Claim", {
|
||||
customer: function(frm) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-xs-8">
|
||||
{% if(doc.warehouse) {
|
||||
var label_class = "label-default",
|
||||
var color = "grey",
|
||||
title = "Warehouse",
|
||||
actual_qty = (frm.doc.doctype==="Sales Order"
|
||||
? doc.projected_qty : doc.actual_qty);
|
||||
@ -21,16 +21,16 @@
|
||||
&& in_list(["Sales Order Item", "Delivery Note Item"], doc.doctype)) {
|
||||
if(actual_qty != undefined) {
|
||||
if(actual_qty >= doc.qty) {
|
||||
var label_class = "label-success";
|
||||
var color = "green";
|
||||
var title = "In Stock"
|
||||
} else {
|
||||
var label_class = "label-danger";
|
||||
var color = "red";
|
||||
var title = "Not In Stock"
|
||||
}
|
||||
}
|
||||
} %}
|
||||
<span class="pull-right" title="{%= title %}">
|
||||
<span class="label {%= label_class %}">
|
||||
<span class="pull-right" title="{%= title %}" style="margin-left: 10px;">
|
||||
<span class="indicator {{ color }}">
|
||||
{%= doc.warehouse %}
|
||||
</span>
|
||||
</span>
|
||||
|
@ -16,21 +16,27 @@
|
||||
{% if(doc.item_name != doc.item_code) { %}
|
||||
<br>{%= doc.item_name %}{% } %}
|
||||
{% include "templates/form_grid/includes/visible_cols.html" %}
|
||||
{% if(frm.doc.docstatus==0 && doc.s_warehouse && doc.actual_qty < doc.qty) { %}
|
||||
<span class="text-danger small" style="margin-left: 15px;">
|
||||
Not in Stock
|
||||
</span>
|
||||
{% } %}
|
||||
</div>
|
||||
|
||||
<!-- warehouse -->
|
||||
<div class="col-sm-3 col-xs-4">
|
||||
{% if(doc.s_warehouse) { %}
|
||||
<span class="label label-default grid-label" title="{% __("Source" )%}">
|
||||
{%= doc.s_warehouse || "" %}</span>
|
||||
{% } %}
|
||||
{% if(doc.t_warehouse) { %}<span class="label label-primary grid-label" title="{% __("Target" )%}">
|
||||
{%= doc.t_warehouse || "" %}</span>{% } %}
|
||||
{% if(doc.s_warehouse) {
|
||||
if(frm.doc.docstatus==0) {
|
||||
var color = (doc.s_warehouse && doc.actual_qty < doc.qty) ? "red" : "green";
|
||||
var title = color === "red" ? __("Not in Stock") : __("In Stock");
|
||||
} else {
|
||||
var color = "grey";
|
||||
var title = __("Source");
|
||||
}
|
||||
%}
|
||||
<span class="indicator {{ color }}" title="{{ title }}">
|
||||
{%= doc.s_warehouse %}</span>
|
||||
{% }; %}
|
||||
{% if(doc.t_warehouse) { %}
|
||||
<div><span class="indicator {{ doc.docstatus==1 ? "blue" : "grey" }}" title="{{ __("Target" ) }}">
|
||||
{%= doc.t_warehouse %}</span>
|
||||
</div>
|
||||
{% }; %}
|
||||
</div>
|
||||
|
||||
<!-- qty -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user