Merge pull request #3354 from rmehta/discount-field-relabel
[cleanup] rename discount and reserver warehouse #3325
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 49b5c25..cb36d05 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -55,7 +55,7 @@
.change(function() {
var ctype = frappe.get_route()[1] || 'Account';
erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(),
- chart_area.get(0));
+ chart_area.get(0), wrapper.page);
})
// load up companies
@@ -75,19 +75,23 @@
// set route
var ctype = frappe.get_route()[1] || 'Account';
+
+
if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
wrapper.$company_select.change();
}
}
erpnext.AccountsChart = Class.extend({
- init: function(ctype, company, wrapper) {
+ init: function(ctype, company, wrapper, page) {
$(wrapper).empty();
var me = this;
me.ctype = ctype;
me.can_create = frappe.model.can_create(this.ctype);
me.can_delete = frappe.model.can_delete(this.ctype);
me.can_write = frappe.model.can_write(this.ctype);
+ me.page = page;
+ me.set_title();
// __("Accounts"), __("Cost Centers")
@@ -169,9 +173,9 @@
set_title: function(val) {
var chart_str = this.ctype=="Account" ? __("Chart of Accounts") : __("Chart of Cost Centers");
if(val) {
- wrapper.page.set_title(chart_str + " - " + cstr(val));
+ this.page.set_title(chart_str + " - " + cstr(val));
} else {
- wrapper.page.set_title(chart_str);
+ this.page.set_title(chart_str);
}
},
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html
index 5c6b0f1..0d3170a 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.html
+++ b/erpnext/accounts/report/general_ledger/general_ledger.html
@@ -2,7 +2,7 @@
{%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %}
</div>
<h2 class="text-center">{%= __("Statement of Account") %}</h2>
-<h4 class="text-center">{%= filters.account && (filters.account + ", ") || "" %} {%= filters.company %}</h4>
+<h4 class="text-center">{%= (filters.party || filters.account) && ((filters.party || filters.account) + ", ") || "" %} {%= filters.company %}</h4>
<h5 class="text-center">
{%= dateutil.str_to_user(filters.from_date) %}
{%= __("to") %}
@@ -26,15 +26,20 @@
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
<td>{%= data[i][__("Voucher Type")] %}
<br>{%= data[i][__("Voucher No")] %}</td>
- <td>{%= data[i][__("Account")] %}
- <br>{%= __("Against") %}: {%= data[i][__("Against Account")] %}
+ <td>
+ {% if(!(filters.party || filters.account)) { %}
+ {%= data[i][__("Party")] || data[i][__("Account")] %}
+ <br>
+ {% } %}
+
+ {{ __("Against") }}: {%= data[i][__("Against Account")] %}
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Debit")]) %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Credit")]) %}</td>
{% } else { %}
<td></td>
<td></td>
- <td><b>{%= data[i][__("Account")] || " " %}</b></td>
+ <td><b>{%= frappe.format(data[i][__("Account")], {fieldtype: "Link"}) || " " %}</b></td>
<td style="text-align: right">
{%= data[i][__("Account")] && format_currency(data[i][__("Debit")]) %}</td>
<td style="text-align: right">
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 8e34cdb..fcce345 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -9,7 +9,7 @@
def execute(filters=None):
account_details = {}
for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1):
- account_details.setdefault(acc.name, acc)
+ account_details.setdefault(acc.name, acc)
validate_filters(filters, account_details)
validate_party(filters)
@@ -82,8 +82,6 @@
lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"])
conditions.append("""account in (select name from tabAccount
where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))
- else:
- conditions.append("posting_date between %(from_date)s and %(to_date)s")
if filters.get("voucher_no"):
conditions.append("voucher_no=%(voucher_no)s")
@@ -107,7 +105,7 @@
opening, total_debit, total_credit, gle_map = get_accountwise_gle(filters, gl_entries, gle_map)
# Opening for filtered account
- if filters.get("account"):
+ if filters.get("account") or filters.get("party"):
data += [get_balance_row(_("Opening"), opening), {}]
for acc, acc_dict in gle_map.items():
@@ -130,7 +128,7 @@
data.append({"account": "'" + _("Totals") + "'", "debit": total_debit, "credit": total_credit})
# Closing for filtered account
- if filters.get("account"):
+ if filters.get("account") or filters.get("party"):
data.append(get_balance_row(_("Closing (Opening + Totals)"),
(opening + total_debit - total_credit)))
@@ -153,9 +151,10 @@
for gle in gl_entries:
amount = flt(gle.debit, 3) - flt(gle.credit, 3)
- if filters.get("account") and gle.posting_date < getdate(filters.from_date):
+ if gle.posting_date < getdate(filters.from_date):
gle_map[gle.account].opening += amount
- opening += amount
+ if filters.get("account") or filters.get("party"):
+ opening += amount
elif gle.posting_date <= getdate(filters.to_date):
gle_map[gle.account].entries.append(gle)
gle_map[gle.account].total_debit += flt(gle.debit, 3)
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index a5a4024..64508b8 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -329,4 +329,25 @@
},
]
},
+ {
+ "label": _("Help"),
+ "icon": "icon-facetime-video",
+ "items": [
+ {
+ "type": "help",
+ "label": _("Chart of Accounts"),
+ "youtube_id": "DyR-DST-PyA"
+ },
+ {
+ "type": "help",
+ "label": _("Opening Accounting Balance"),
+ "youtube_id": "kdgM20Q-q68"
+ },
+ {
+ "type": "help",
+ "label": _("Setting up Taxes"),
+ "youtube_id": "nQ1zZdPgdaQ"
+ }
+ ]
+ }
]
diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py
index 17418c3..7729872 100644
--- a/erpnext/config/buying.py
+++ b/erpnext/config/buying.py
@@ -156,4 +156,14 @@
}
]
},
+ {
+ "label": _("Help"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Customer and Supplier"),
+ "youtube_id": "anoGi_RpQ20"
+ },
+ ]
+ },
]
diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py
index 48b8b2f..3a7ab18 100644
--- a/erpnext/config/crm.py
+++ b/erpnext/config/crm.py
@@ -128,4 +128,14 @@
},
]
},
+ {
+ "label": _("Help"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Lead to Quotation"),
+ "youtube_id": "TxYX4r4JAKA"
+ },
+ ]
+ },
]
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index a08fb50..b0c7345 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -62,5 +62,12 @@
"icon": "icon-phone",
"icon": "octicon octicon-issue-opened",
"type": "module"
+ },
+ "Learn": {
+ "color": "#7272FF",
+ "force_show": True,
+ "icon": "icon-facetime-video",
+ "type": "module",
+ "is_help": True
}
}
diff --git a/erpnext/config/learn.py b/erpnext/config/learn.py
new file mode 100644
index 0000000..146bb21
--- /dev/null
+++ b/erpnext/config/learn.py
@@ -0,0 +1,138 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return [
+ {
+ "label": _("General"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Navigating"),
+ "youtube_id": "YDoI2DF4Lmc"
+ },
+ {
+ "type": "help",
+ "label": _("Setup Wizard"),
+ "youtube_id": "oIOf_zCFWKQ"
+ }
+
+ ]
+
+ },
+ {
+ "label": _("Setup"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Data Import and Export"),
+ "youtube_id": "6wiriRKPhmg"
+ },
+ {
+ "type": "help",
+ "label": _("Opening Stock Balance"),
+ "youtube_id": "yPgrtfeCTs"
+ },
+ {
+ "type": "help",
+ "label": _("Setting up Email"),
+ "youtube_id": "YFYe0DrB95o"
+ },
+ {
+ "type": "help",
+ "label": _("Printing and Branding"),
+ "youtube_id": "cKZHcx1znMc"
+ },
+ {
+ "type": "help",
+ "label": _("Users and Permissions"),
+ "youtube_id": "fnBoRhBrwR4"
+ },
+ {
+ "type": "help",
+ "label": _("Workflow"),
+ "youtube_id": "yObJUg9FxFs"
+ },
+ ]
+ },
+ {
+ "label": _("Accounts"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Chart of Accounts"),
+ "youtube_id": "DyR-DST-PyA"
+ },
+ {
+ "type": "help",
+ "label": _("Setting up Taxes"),
+ "youtube_id": "nQ1zZdPgdaQ"
+ },
+ {
+ "type": "help",
+ "label": _("Opening Accounting Balance"),
+ "youtube_id": "kdgM20Q-q68"
+ }
+ ]
+ },
+ {
+ "label": _("CRM"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Lead to Quotation"),
+ "youtube_id": "TxYX4r4JAKA"
+ },
+ ]
+ },
+ {
+ "label": _("Selling"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Customer and Supplier"),
+ "youtube_id": "anoGi_RpQ20"
+ },
+ ]
+ },
+ {
+ "label": _("Stock"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Items and Pricing"),
+ "youtube_id": "qXaEwld4_Ps"
+ },
+ {
+ "type": "help",
+ "label": _("Opening Stock Balance"),
+ "youtube_id": "yPgrtfeCTs"
+ },
+ {
+ "type": "help",
+ "label": _("Item Variants"),
+ "youtube_id": "OGBETlCzU5o"
+ },
+ ]
+ },
+ {
+ "label": _("Buying"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Customer and Supplier"),
+ "youtube_id": "anoGi_RpQ20"
+ },
+ ]
+ },
+ {
+ "label": _("Manufacturing"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Bill of Materials"),
+ "youtube_id": "hDV0c1OeWLo"
+ },
+ ]
+ }
+ ]
diff --git a/erpnext/config/manufacturing.py b/erpnext/config/manufacturing.py
index 4fa8451..c2dacad 100644
--- a/erpnext/config/manufacturing.py
+++ b/erpnext/config/manufacturing.py
@@ -105,4 +105,15 @@
},
]
},
+ {
+ "label": _("Help"),
+ "icon": "icon-facetime-video",
+ "items": [
+ {
+ "type": "help",
+ "label": _("Bill of Materials"),
+ "youtube_id": "hDV0c1OeWLo"
+ },
+ ]
+ }
]
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 91c44d0..7f8d517 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -275,4 +275,14 @@
},
]
},
+ {
+ "label": _("Help"),
+ "items": [
+ {
+ "type": "help",
+ "label": _("Customer and Supplier"),
+ "youtube_id": "anoGi_RpQ20"
+ },
+ ]
+ },
]
diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py
index a33fd539..961e4f7 100644
--- a/erpnext/config/setup.py
+++ b/erpnext/config/setup.py
@@ -44,6 +44,36 @@
]
},
{
+ "label": _("Help"),
+ "items": [
+ {
+ "type": "help",
+ "name": _("Data Import and Export"),
+ "youtube_id": "6wiriRKPhmg"
+ },
+ {
+ "type": "help",
+ "label": _("Setting up Email"),
+ "youtube_id": "YFYe0DrB95o"
+ },
+ {
+ "type": "help",
+ "label": _("Printing and Branding"),
+ "youtube_id": "cKZHcx1znMc"
+ },
+ {
+ "type": "help",
+ "label": _("Users and Permissions"),
+ "youtube_id": "fnBoRhBrwR4"
+ },
+ {
+ "type": "help",
+ "label": _("Workflow"),
+ "youtube_id": "yObJUg9FxFs"
+ },
+ ]
+ },
+ {
"label": _("Customize"),
"icon": "icon-glass",
"items": [
diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py
index d3481b5..86ec458 100644
--- a/erpnext/config/stock.py
+++ b/erpnext/config/stock.py
@@ -254,4 +254,25 @@
},
]
},
+ {
+ "label": _("Help"),
+ "icon": "icon-facetime-video",
+ "items": [
+ {
+ "type": "help",
+ "label": _("Items and Pricing"),
+ "youtube_id": "qXaEwld4_Ps"
+ },
+ {
+ "type": "help",
+ "label": _("Opening Stock Balance"),
+ "youtube_id": "yPgrtfeCTs"
+ },
+ {
+ "type": "help",
+ "label": _("Item Variants"),
+ "youtube_id": "OGBETlCzU5o"
+ },
+ ]
+ }
]
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 2dde685..9a2da96 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -85,9 +85,9 @@
existing_shipping_charge = self.get("taxes", filters=shipping_charge)
if existing_shipping_charge:
# take the last record found
- existing_shipping_charge[-1].rate = shipping_amount
+ existing_shipping_charge[-1].tax_amount = shipping_amount
else:
- shipping_charge["rate"] = shipping_amount
+ shipping_charge["tax_amount"] = shipping_amount
shipping_charge["description"] = shipping_rule.label
self.append("taxes", shipping_charge)
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 54e2d03..c471007 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -34,13 +34,13 @@
website_route_rules = [
{"from_route": "/orders", "to_route": "Sales Order"},
- {"from_route": "/orders/<name>", "to_route": "print", "defaults": {"doctype": "Sales Order"}},
+ {"from_route": "/orders/<path:name>", "to_route": "print", "defaults": {"doctype": "Sales Order"}},
{"from_route": "/invoices", "to_route": "Sales Invoice"},
- {"from_route": "/invoices/<name>", "to_route": "print", "defaults": {"doctype": "Sales Invoice"}},
+ {"from_route": "/invoices/<path:name>", "to_route": "print", "defaults": {"doctype": "Sales Invoice"}},
{"from_route": "/shipments", "to_route": "Delivery Note"},
- {"from_route": "/shipments/<name>", "to_route": "print", "defaults": {"doctype": "Delivery Note"}},
+ {"from_route": "/shipments/<path:name>", "to_route": "print", "defaults": {"doctype": "Delivery Note"}},
{"from_route": "/issues", "to_route": "Issue"},
- {"from_route": "/issues/<name>", "to_route": "print", "defaults": {"doctype": "Issue"}},
+ {"from_route": "/issues/<path:name>", "to_route": "print", "defaults": {"doctype": "Issue"}},
{"from_route": "/addresses", "to_route": "Address"},
]
diff --git a/erpnext/manufacturing/doctype/bom/bom_list.js b/erpnext/manufacturing/doctype/bom/bom_list.js
index c73ed0d..2b06ed7 100644
--- a/erpnext/manufacturing/doctype/bom/bom_list.js
+++ b/erpnext/manufacturing/doctype/bom/bom_list.js
@@ -10,3 +10,5 @@
}
}
};
+
+frappe.help.youtube_id["BOM"] = "hDV0c1OeWLo";
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 6cd2ad2..529c2a4 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -176,18 +176,18 @@
self.set('operations', [])
operations = frappe.db.sql("""select operation, description, workstation, idx,
- hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
+ hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
where parent = %s order by idx""", self.bom_no, as_dict=1)
self.set('operations', operations)
self.calculate_time()
-
+
def calculate_time(self):
bom_qty = frappe.db.get_value("BOM", self.bom_no, "quantity")
-
+
for d in self.get("operations"):
d.time_in_mins = flt(d.time_in_mins) / flt(bom_qty) * flt(self.qty)
-
+
self.calculate_operating_cost()
def get_holidays(self, workstation):
@@ -220,7 +220,9 @@
time_log = make_time_log(self.name, d.operation, d.planned_start_time, d.planned_end_time,
flt(self.qty) - flt(d.completed_qty), self.project_name, d.workstation, operation_id=d.name)
- self.check_operation_fits_in_working_hours(d)
+ if d.workstation:
+ # validate operating hours if workstation [not mandatory] is specified
+ self.check_operation_fits_in_working_hours(d)
original_start_time = time_log.from_time
while True:
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 1298790..e11863a 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -359,10 +359,7 @@
def insert_purchase_request(self):
items_to_be_requested = self.get_requested_items()
-
- from erpnext.accounts.utils import get_fiscal_year
- fiscal_year = get_fiscal_year(nowdate())[0]
-
+
purchase_request_list = []
if items_to_be_requested:
for item in items_to_be_requested:
@@ -372,7 +369,6 @@
"transaction_date": nowdate(),
"status": "Draft",
"company": self.company,
- "fiscal_year": fiscal_year,
"requested_by": frappe.session.user,
"material_request_type": "Purchase"
})
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index bc9b190..dae01df 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
-from frappe.utils import flt, cint, getdate, formatdate, comma_and, time_diff_in_seconds, get_datetime
+from frappe.utils import flt, cint, getdate, formatdate, comma_and, time_diff_in_seconds, to_timedelta
from frappe.model.document import Document
from dateutil.parser import parse
@@ -60,7 +60,7 @@
workstation = frappe.get_doc("Workstation", workstation)
for working_hour in workstation.working_hours:
- slot_length = (get_datetime(working_hour.end_time) - get_datetime(working_hour.start_time)).total_seconds()
+ slot_length = (to_timedelta(working_hour.end_time or "") - to_timedelta(working_hour.start_time or "")).total_seconds()
if slot_length >= operation_length:
return
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index fcf0ea7..5db55c6 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -158,3 +158,4 @@
erpnext.patches.v5_0.rename_pos_setting
erpnext.patches.v5_0.update_operation_description
erpnext.patches.v5_0.set_footer_address
+execute:frappe.db.set_value("Backup Manager", None, "send_backups_to_dropbox", 1 if frappe.db.get_value("Backup Manager", None, "upload_backups_to_dropbox") in ("Daily", "Weekly") else 0)
diff --git a/erpnext/patches/v4_2/party_model.py b/erpnext/patches/v4_2/party_model.py
index 03eec16..b1bd895 100644
--- a/erpnext/patches/v4_2/party_model.py
+++ b/erpnext/patches/v4_2/party_model.py
@@ -19,7 +19,7 @@
receivable_payable_accounts = frappe._dict()
def _create_account(args):
- if args["parent_account"]:
+ if args["parent_account"] and frappe.db.exists("Account", args["parent_account"]):
account_id = frappe.db.get_value("Account",
{"account_name": args["account_name"], "company": args["company"]})
if not account_id:
diff --git a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py
index 31747b8..5ab150d 100644
--- a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py
+++ b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py
@@ -46,9 +46,9 @@
)
for fields in rename_map.values():
- if fields[0] != "entries":
- renamed_fields += tuple(fields)
-
+ valid_fields = [d for d in fields if d[0] != "entries"]
+ renamed_fields += tuple(valid_fields)
+
return renamed_fields
def update_script(dt, name, script_field, script, renamed_fields):
@@ -62,4 +62,4 @@
elif dt in ("Sales Invoice", "Purchase Invoice"):
script = re.sub(r"\bentries\b", "items", script)
- frappe.db.set_value(dt, name, script_field, script)
+ frappe.db.set_value(dt, name, script_field, script)
\ No newline at end of file
diff --git a/erpnext/patches/v5_0/set_footer_address.py b/erpnext/patches/v5_0/set_footer_address.py
index 2779e48..a3324a0 100644
--- a/erpnext/patches/v5_0/set_footer_address.py
+++ b/erpnext/patches/v5_0/set_footer_address.py
@@ -4,4 +4,5 @@
frappe.reload_doctype("System Settings")
ss = frappe.get_doc("System Settings", "System Settings")
ss.email_footer_address = frappe.db.get_default("company")
+ ss.flags.ignore_mandatory = True
ss.save()
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 7d02940..9b4df40 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -48,3 +48,9 @@
.product-text {
padding: 15px 0px;
}
+@media (max-width: 767px) {
+ .product-search {
+ width: 100%;
+ margin-bottom: 13px;
+ }
+}
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 5476d14..3dfd7e1 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -14,19 +14,21 @@
},
get_fiscal_year: function(company, date, fn) {
- frappe.call({
- type:"GET",
- method: "erpnext.accounts.utils.get_fiscal_year",
- args: {
- "company": company,
- "date": date,
- "verbose": 0
- },
- callback: function(r) {
- if (r.message) cur_frm.set_value("fiscal_year", r.message[0]);
- if (fn) fn();
- }
- });
+ if(frappe.meta.get_docfield(cur_frm.doctype, "fiscal_year")) {
+ frappe.call({
+ type:"GET",
+ method: "erpnext.accounts.utils.get_fiscal_year",
+ args: {
+ "company": company,
+ "date": date,
+ "verbose": 0
+ },
+ callback: function(r) {
+ if (r.message) cur_frm.set_value("fiscal_year", r.message[0]);
+ if (fn) fn();
+ }
+ });
+ }
},
toggle_naming_series: function() {
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index c42cb4c..c0667cc 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -51,3 +51,10 @@
.product-text {
padding: 15px 0px;
}
+
+@media (max-width: 767px) {
+ .product-search {
+ width: 100%;
+ margin-bottom: 13px;
+ }
+}
diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
index 5bac1c5..f7aa70f 100644
--- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
@@ -72,7 +72,7 @@
target_details = {}
for d in frappe.db.sql("""select md.name, mdp.month, mdp.percentage_allocation
- from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` mdp
+ from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
where mdp.parent=md.name and md.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
diff --git a/erpnext/setup/doctype/backup_manager/backup_dropbox.py b/erpnext/setup/doctype/backup_manager/backup_dropbox.py
index c6862d2..9e38833 100644
--- a/erpnext/setup/doctype/backup_manager/backup_dropbox.py
+++ b/erpnext/setup/doctype/backup_manager/backup_dropbox.py
@@ -48,6 +48,7 @@
frappe.db.set_value("Backup Manager", "Backup Manager", "dropbox_access_key", access_token.key)
frappe.db.set_value("Backup Manager", "Backup Manager", "dropbox_access_secret", access_token.secret)
frappe.db.set_value("Backup Manager", "Backup Manager", "dropbox_access_allowed", allowed)
+ frappe.db.set_value("Backup Manager", "Backup Manager", "send_backups_to_dropbox", 1)
dropbox_client = client.DropboxClient(sess)
try:
dropbox_client.file_create_folder("files")
diff --git a/erpnext/setup/doctype/backup_manager/backup_files_list.html b/erpnext/setup/doctype/backup_manager/backup_files_list.html
new file mode 100644
index 0000000..5ee52ef
--- /dev/null
+++ b/erpnext/setup/doctype/backup_manager/backup_files_list.html
@@ -0,0 +1,30 @@
+<table class="table table-striped" style="max-width: 600px;">
+ <thead>
+ <tr>
+ <th style="width: 30%;">
+ {{ __("Date") }}
+ </th>
+ <th style="width: 50%;">
+ {{ __("File") }}
+ </th>
+ <th>
+ {{ __("Size") }}
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for (var i=0; i < files.length; i++) { %}
+ <tr>
+ <td>
+ {{ files[i][1] }}
+ </td>
+ <td>
+ <a href="{{ files[i][0] }}" target="_blank">{{ files[i][0] }}</a>
+ </td>
+ <td>
+ {{ files[i][2] }}
+ </td>
+ </tr>
+ {% } %}
+ </tbody>
+</table>
diff --git a/erpnext/setup/doctype/backup_manager/backup_manager.js b/erpnext/setup/doctype/backup_manager/backup_manager.js
index 6f4ec6b..cb4104a 100644
--- a/erpnext/setup/doctype/backup_manager/backup_manager.js
+++ b/erpnext/setup/doctype/backup_manager/backup_manager.js
@@ -2,35 +2,16 @@
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
+ onload_post_render: function() {
+ cur_frm.fields_dict.allow_dropbox_access.$input.addClass("btn-primary");
+
+ if(cur_frm.doc.__onload && cur_frm.doc.__onload.files) {
+ $(frappe.render_template("backup_files_list", {files:cur_frm.doc.__onload.files}))
+ .appendTo(cur_frm.fields_dict.current_backups.$wrapper.empty());
+ }
+ },
refresh: function() {
cur_frm.disable_save();
-
- if(!(cint(cur_frm.doc.dropbox_access_allowed) ||
- cint(cur_frm.doc.gdrive_access_allowed))) {
- cur_frm.set_intro(__("You can start by selecting backup frequency and granting access for sync"));
- } else {
- var services = {
- "dropbox": __("Dropbox")
- // "gdrive": __("Google Drive")
- }
- var active_services = [];
-
- $.each(services, function(service, label) {
- var access_allowed = cint(cur_frm.doc[service + "_access_allowed"]);
- var frequency = cur_frm.doc["upload_backups_to_" + service];
- if(access_allowed && frequency && frequency !== "Never") {
- active_services.push(label + " [" + frequency + "]");
- }
- });
-
- if(active_services.length > 0) {
- cur_frm.set_intro(__("Backups will be uploaded to") + ": " +
- frappe.utils.comma_and(active_services));
- } else {
- cur_frm.set_intro("");
- }
- }
-
},
validate_send_notifications_to: function() {
diff --git a/erpnext/setup/doctype/backup_manager/backup_manager.json b/erpnext/setup/doctype/backup_manager/backup_manager.json
index e8840d5..7aa038e 100644
--- a/erpnext/setup/doctype/backup_manager/backup_manager.json
+++ b/erpnext/setup/doctype/backup_manager/backup_manager.json
@@ -8,16 +8,22 @@
{
"fieldname": "setup",
"fieldtype": "Section Break",
- "label": "Setup",
+ "label": "Download Backups",
"permlevel": 0
},
{
- "description": "Email ids separated by commas.",
- "fieldname": "send_notifications_to",
- "fieldtype": "Data",
- "label": "Send Notifications To",
+ "fieldname": "current_backups",
+ "fieldtype": "HTML",
+ "label": "Current Backups",
"permlevel": 0,
- "reqd": 1
+ "precision": ""
+ },
+ {
+ "description": "",
+ "fieldname": "sync_with_dropbox",
+ "fieldtype": "Section Break",
+ "label": "Sync with Dropbox",
+ "permlevel": 0
},
{
"fieldname": "backup_right_now",
@@ -28,13 +34,15 @@
"read_only": 1
},
{
- "description": "Note: Backups and files are not deleted from Dropbox, you will have to delete them manually.",
- "fieldname": "sync_with_dropbox",
- "fieldtype": "Section Break",
- "label": "Sync with Dropbox",
- "permlevel": 0
+ "fieldname": "send_backups_to_dropbox",
+ "fieldtype": "Check",
+ "label": "Send Backups to Dropbox",
+ "permlevel": 0,
+ "precision": ""
},
{
+ "depends_on": "send_backups_to_dropbox",
+ "description": "Note: Backups and files are not deleted from Dropbox, you will have to delete them manually.",
"fieldname": "upload_backups_to_dropbox",
"fieldtype": "Select",
"label": "Upload Backups to Dropbox",
@@ -42,6 +50,15 @@
"permlevel": 0
},
{
+ "depends_on": "send_backups_to_dropbox",
+ "description": "Email ids separated by commas.",
+ "fieldname": "send_notifications_to",
+ "fieldtype": "Data",
+ "label": "Send Notifications To",
+ "permlevel": 0,
+ "reqd": 0
+ },
+ {
"fieldname": "dropbox_access_key",
"fieldtype": "Data",
"hidden": 1,
@@ -66,6 +83,7 @@
"read_only": 1
},
{
+ "depends_on": "send_backups_to_dropbox",
"fieldname": "allow_dropbox_access",
"fieldtype": "Button",
"label": "Allow Dropbox Access",
@@ -140,7 +158,7 @@
"icon": "icon-cloud-upload",
"idx": 1,
"issingle": 1,
- "modified": "2015-02-05 05:11:34.700674",
+ "modified": "2015-05-26 04:54:10.193573",
"modified_by": "Administrator",
"module": "Setup",
"name": "Backup Manager",
diff --git a/erpnext/setup/doctype/backup_manager/backup_manager.py b/erpnext/setup/doctype/backup_manager/backup_manager.py
index 4a38a6a..8d9d48f 100644
--- a/erpnext/setup/doctype/backup_manager/backup_manager.py
+++ b/erpnext/setup/doctype/backup_manager/backup_manager.py
@@ -4,13 +4,36 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+from frappe.utils import get_site_path
+from frappe.utils.data import convert_utc_to_user_timezone
+import os
+import datetime
import frappe
-from frappe import _
from frappe.model.document import Document
class BackupManager(Document):
- pass
+ def onload(self):
+ self.set_onload("files", get_files())
+
+def get_files():
+ def get_time(path):
+ dt = os.path.getmtime(path)
+ return convert_utc_to_user_timezone(datetime.datetime.utcfromtimestamp(dt)).strftime('%Y-%m-%d %H:%M')
+
+ def get_size(path):
+ size = os.path.getsize(path)
+ if size > 1048576:
+ return "{0:.1f}M".format(float(size) / 1048576)
+ else:
+ return "{0:.1f}K".format(float(size) / 1024)
+
+ path = get_site_path('private', 'backups')
+ files = [x for x in os.listdir(path) if os.path.isfile(os.path.join(path, x))]
+ files = [('/backups/' + _file,
+ get_time(os.path.join(path, _file)),
+ get_size(os.path.join(path, _file))) for _file in files]
+ return files
def take_backups_daily():
take_backups_if("Daily")
@@ -19,11 +42,12 @@
take_backups_if("Weekly")
def take_backups_if(freq):
- if frappe.db.get_value("Backup Manager", None, "upload_backups_to_dropbox")==freq:
- take_backups_dropbox()
+ if frappe.db.get_value("Backup Manager", None, "send_backups_to_dropbox"):
+ if frappe.db.get_value("Backup Manager", None, "upload_backups_to_dropbox")==freq:
+ take_backups_dropbox()
- # if frappe.db.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
- # take_backups_gdrive()
+ # if frappe.db.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
+ # take_backups_gdrive()
@frappe.whitelist()
def take_backups_dropbox():
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
index 1ad344a..5fba1ff 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
@@ -130,6 +130,9 @@
def get_price_list(self, billing_territory):
price_list = self.get_name_from_territory(billing_territory, "price_lists", "selling_price_list")
+ if not (price_list and price_list[0]):
+ price_list = self.get_name_from_territory(self.default_territory, "price_lists", "selling_price_list")
+
return price_list and price_list[0] or None
def get_tax_master(self, billing_territory):
diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js
index c6beeff..6eaa492 100644
--- a/erpnext/stock/doctype/item/item_list.js
+++ b/erpnext/stock/doctype/item/item_list.js
@@ -14,3 +14,5 @@
}
}
};
+
+frappe.help.youtube_id["Item"] = "qXaEwld4_Ps";
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 9734512..894b9e1 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -132,21 +132,6 @@
"width": "100px"
},
{
- "fieldname": "fiscal_year",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Fiscal Year",
- "oldfieldname": "fiscal_year",
- "oldfieldtype": "Select",
- "options": "Fiscal Year",
- "permlevel": 0,
- "print_hide": 1,
- "print_width": "150px",
- "reqd": 1,
- "search_index": 1,
- "width": "150px"
- },
- {
"fieldname": "column_break2",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
@@ -236,7 +221,7 @@
"icon": "icon-ticket",
"idx": 1,
"is_submittable": 1,
- "modified": "2015-02-20 05:07:33.215371",
+ "modified": "2015-05-27 15:36:06.818491",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request",
diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py
index 30fe755..f5b612c 100644
--- a/erpnext/stock/reorder_item.py
+++ b/erpnext/stock/reorder_item.py
@@ -3,12 +3,11 @@
import frappe
from frappe.utils import flt, cstr, nowdate, add_days, cint
-from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
def reorder_item():
""" Reorder item if stock reaches reorder level"""
# if initial setup not completed, return
- if not frappe.db.sql("select name from `tabFiscal Year` limit 1"):
+ if not (frappe.db.a_row_exists("Company") and frappe.db.a_row_exists("Fiscal Year")):
return
if cint(frappe.db.get_value('Stock Settings', None, 'auto_indent')):
@@ -83,7 +82,6 @@
def create_material_request(material_requests):
""" Create indent on reaching reorder level """
mr_list = []
- defaults = frappe.defaults.get_defaults()
exceptions_list = []
def _log_exception():
@@ -93,14 +91,6 @@
else:
exceptions_list.append(frappe.get_traceback())
- try:
- current_fiscal_year = get_fiscal_year(nowdate())[0] or defaults.fiscal_year
-
- except FiscalYearError:
- _log_exception()
- notify_errors(exceptions_list)
- return
-
for request_type in material_requests:
for company in material_requests[request_type]:
try:
@@ -111,7 +101,6 @@
mr = frappe.new_doc("Material Request")
mr.update({
"company": company,
- "fiscal_year": current_fiscal_year,
"transaction_date": nowdate(),
"material_request_type": request_type
})
@@ -170,7 +159,7 @@
msg += "<tr><td>" + item.item_code + "</td><td>" + item.warehouse + "</td><td>" + \
cstr(item.qty) + "</td><td>" + cstr(item.uom) + "</td></tr>"
msg += "</table>"
- frappe.sendmail(recipients=email_list,
+ frappe.sendmail(recipients=email_list,
subject='Auto Material Request Generation Notification', message = msg)
def notify_errors(exceptions_list):
diff --git a/erpnext/templates/includes/product_search_box.html b/erpnext/templates/includes/product_search_box.html
index d4f6e7b..a5592c1 100644
--- a/erpnext/templates/includes/product_search_box.html
+++ b/erpnext/templates/includes/product_search_box.html
@@ -2,7 +2,7 @@
frappe.ready(function() {
$(".product-search").remove();
- $('<div class="product-search">\
+ $('<div class="product-search pull-right">\
<form class="form-inline form-search">\
<div class="input-group">\
<input class="form-control" type="text" id="product-search" placeholder="Product Search...">\
@@ -12,13 +12,13 @@
</span>\
</div>\
</form>\
- </div>').appendTo(".page-header-right");
+ </div>').prependTo(".page-header-block");
$('.dropdown-toggle').dropdown();
$("#btn-product-search").click(function() {
var txt = $("#product-search").val();
if(txt) {
- window.location.href="product_search?q=" + txt;
+ window.location.href="/product_search?q=" + txt;
}
return false;
});