Merge pull request #6139 from PawanMeh/fixes_6089
[fix] #6089
diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py
index 1be2cac..97dc894 100644
--- a/erpnext/demo/setup_data.py
+++ b/erpnext/demo/setup_data.py
@@ -290,9 +290,13 @@
def setup_salary_structure():
f = frappe.get_doc('Fiscal Year', frappe.defaults.get_global_default('fiscal_year'))
+ ss = frappe.new_doc('Salary Structure')
+ ss.name = "Sample Salary Structure - " + str(f.year_start_date)
for e in frappe.get_all('Employee', fields=['name', 'date_of_joining']):
- ss = frappe.new_doc('Salary Structure')
- ss.employee = e.name
+ ss.append('employees', {
+ 'employee': e.name,
+ 'base': random.random() * 10000
+ })
if not e.date_of_joining:
continue
@@ -300,16 +304,24 @@
ss.from_date = e.date_of_joining if (e.date_of_joining
and e.date_of_joining > f.year_start_date) else f.year_start_date
ss.to_date = f.year_end_date
- ss.append('earnings', {
- 'salary_component': 'Basic',
- 'amount': random.random() * 10000
- })
- ss.append('deductions', {
- 'salary_component': 'Income Tax',
- 'amount': random.random() * 1000
- })
- ss.insert()
+ ss.append('earnings', {
+ 'salary_component': 'Basic',
+ "abbr":'B',
+ 'condition': 'base > 5000',
+ 'formula': 'base*.2',
+ 'amount_based_on_formula': 1,
+ "idx": 1
+ })
+ ss.append('deductions', {
+ 'salary_component': 'Income Tax',
+ "abbr":'IT',
+ 'condition': 'base > 5000',
+ 'amount': random.random() * 1000,
+ "idx": 1
+ })
+
+ ss.insert()
def setup_salary_structure_for_timesheet():
for e in frappe.get_all('Salary Structure', fields=['name'], filters={'is_active': 'Yes'}, limit=2):
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index 3d5ac83..73f330d 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -92,13 +92,20 @@
expense.sanctioned_amount = sanctioned_amount
def get_timesheet_based_salary_slip_employee():
- return frappe.get_all('Salary Structure', fields = ["distinct employee as name"],
- filters = {'salary_slip_based_on_timesheet': 1})
+ sal_struct = frappe.db.sql("""
+ select name from `tabSalary Structure`
+ where salary_slip_based_on_timesheet = 1
+ and docstatus != 2""")
+ if sal_struct:
+ employees = frappe.db.sql("""
+ select employee from `tabSalary Structure Employee`
+ where parent IN %(sal_struct)s""", {"sal_struct": sal_struct}, as_dict=True)
+ return employees
def make_timesheet_records():
employees = get_timesheet_based_salary_slip_employee()
- for employee in employees:
- ts = make_timesheet(employee.name, simulate = True, billable = 1, activity_type=get_random("Activity Type"))
+ for e in employees:
+ ts = make_timesheet(e.employee, simulate = True, billable = 1, activity_type=get_random("Activity Type"))
rand = random.random()
if rand >= 0.3:
diff --git a/erpnext/docs/user/manual/en/setting-up/email/email-alerts.md b/erpnext/docs/user/manual/en/setting-up/email/email-alerts.md
index 4caffbc..3fbb4e4 100644
--- a/erpnext/docs/user/manual/en/setting-up/email/email-alerts.md
+++ b/erpnext/docs/user/manual/en/setting-up/email/email-alerts.md
@@ -30,7 +30,7 @@
### Setting a Subject
-You can retrieve the data for a particular field by using `doc.[field_name]`. To use it in your subject / message, you have to surround it with `{{ }}`. These are called [Jinja](http://jinja.pocoo.org/) tags. So, for example to get the name of a document, you use `{{ doc.name }}`. The below example sends an email on saving a Task with the Subject, "TASK##### has been created"
+You can retrieve the data for a particular field by using `doc.[field_name]`. To use it in your subject / message, you have to surround it with `{% raw %}{{ }}{% endraw %}`. These are called [Jinja](http://jinja.pocoo.org/) tags. So, for example to get the name of a document, you use `{% raw %}{{ doc.name }}{% endraw %}`. The below example sends an email on saving a Task with the Subject, "TASK##### has been created"
<img class="screenshot" alt="Setting Subject" src="{{docs_base_url}}/assets/img/setup/email/email-alert-subject.png">
@@ -44,7 +44,7 @@
### Setting a Message
-You can use both Jinja Tags (`{{ doc.[field_name] }}`) and HTML tags in the message textbox.
+You can use both Jinja Tags (`{% raw %}{{ doc.[field_name] }}{% endraw %}`) and HTML tags in the message textbox.
{% raw %}<h3>Order Overdue</h3>
diff --git a/erpnext/docs/user/manual/index.md b/erpnext/docs/user/manual/index.md
index a2db1ba..d6cf4f1 100644
--- a/erpnext/docs/user/manual/index.md
+++ b/erpnext/docs/user/manual/index.md
@@ -5,6 +5,6 @@
Select your language
-1. [English](en)
-1. [Deutsch](de)
-1. [Español](es)
\ No newline at end of file
+1. [English]({{docs_base_url}}/user/manual/en)
+1. [Deutsch]({{docs_base_url}}/user/manual/de)
+1. [Español]({{docs_base_url}}/user/manual/es)
\ No newline at end of file
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.py b/erpnext/hr/doctype/process_payroll/process_payroll.py
index c80c660..c7162b8 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.py
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.py
@@ -10,6 +10,7 @@
class ProcessPayroll(Document):
+
def get_emp_list(self):
"""
Returns list of active employees based on selected criteria
@@ -18,15 +19,23 @@
cond = self.get_filter_condition()
cond += self.get_joining_releiving_condition()
+ sal_struct = frappe.db.sql("""
+ select name from `tabSalary Structure`
+ where docstatus != 2 and
+ ifnull(salary_slip_based_on_timesheet,0) = 0""")
+
+ if sal_struct:
+ cond += "and t2.parent IN %(sal_struct)s "
+
emp_list = frappe.db.sql("""
select t1.name
- from `tabEmployee` t1, `tabSalary Structure` t2
- where t1.docstatus!=2 and t2.docstatus != 2 and
- ifnull(t2.salary_slip_based_on_timesheet,0) = 0 and t1.name = t2.employee
- %s """% cond)
+ from `tabEmployee` t1, `tabSalary Structure Employee` t2
+ where t1.docstatus!=2 and t1.name = t2.employee
+ %s """% cond, {"sal_struct": sal_struct})
return emp_list
+
def get_filter_condition(self):
self.check_mandatory()
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index 340ebdb..ac1c7c3 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -26,7 +26,8 @@
"public/js/payment/pos_payment.html",
"public/js/payment/payment_details.html",
"public/js/templates/item_selector.html",
- "public/js/utils/item_selector.js"
+ "public/js/utils/item_selector.js",
+ "public/js/help_links.js"
],
"js/item-dashboard.min.js": [
"stock/dashboard/item_dashboard.html",
diff --git a/erpnext/public/js/help_links.js b/erpnext/public/js/help_links.js
new file mode 100644
index 0000000..3595d77
--- /dev/null
+++ b/erpnext/public/js/help_links.js
@@ -0,0 +1,162 @@
+frappe.provide('frappe.help.help_links');
+
+frappe.help.help_links['Form/Rename Tool'] = [
+ { label: 'Bulk Rename', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/data/bulk-rename.html' },
+]
+
+frappe.help.help_links['List/Customer'] = [
+ { label: 'Customer', url: 'https://frappe.github.io/erpnext/user/manual/en/CRM/customer.html' },
+]
+
+frappe.help.help_links['Form/Naming Series'] = [
+ { label: 'Naming Series', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/settings/naming-series' },
+ { label: 'Setting the Current Value for Naming Series', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/naming-series-current-value' },
+]
+
+frappe.help.help_links['Form/Global Defaults'] = [
+ { label: 'Global Settings', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/settings/global-defaults' },
+]
+
+frappe.help.help_links['Form/Email Digest'] = [
+ { label: 'Email Digest', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/email/email-digest' },
+]
+
+frappe.help.help_links['List/Print Heading'] = [
+ { label: 'Print Heading', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/print/print-headings' },
+]
+
+frappe.help.help_links['List/Letter Head'] = [
+ { label: 'Letter Head', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/print/letter-head' },
+]
+
+frappe.help.help_links['List/Address Template'] = [
+ { label: 'Address Template', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/print/address-template' },
+]
+
+frappe.help.help_links['List/Terms and Conditions'] = [
+ { label: 'Terms and Conditions', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/print/terms-and-conditions' },
+]
+
+frappe.help.help_links['List/Cheque Print Template'] = [
+ { label: 'Cheque Print Template', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/print/cheque-print-template' },
+]
+
+frappe.help.help_links['List/Sales Taxes and Charges Template'] = [
+ { label: 'Setting Up Taxes', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/setting-up-taxes' },
+]
+
+frappe.help.help_links['List/Purchase Taxes and Charges Template'] = [
+ { label: 'Setting Up Taxes', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/setting-up-taxes' },
+]
+
+frappe.help.help_links['List/POS Profile'] = [
+ { label: 'POS Profile', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/pos-setting' },
+]
+
+frappe.help.help_links['List/Price List'] = [
+ { label: 'Price List', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/price-lists' },
+]
+
+frappe.help.help_links['List/Authorization Rule'] = [
+ { label: 'Authorization Rule', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/authorization-rule' },
+]
+
+frappe.help.help_links['Form/SMS Settings'] = [
+ { label: 'SMS Settings', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/sms-setting' },
+]
+
+frappe.help.help_links['List/Stock Reconciliation'] = [
+ { label: 'Stock Reconciliation', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/stock-reconciliation-for-non-serialized-item' },
+]
+
+frappe.help.help_links['Tree/Territory'] = [
+ { label: 'Territory', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/territory' },
+]
+
+frappe.help.help_links['Form/Dropbox Backup'] = [
+ { label: 'Dropbox Backup', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/third-party-backups' },
+ { label: 'Setting Up Dropbox Backup', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/setting-up-dropbox-backups' },
+]
+
+frappe.help.help_links['List/Workflow'] = [
+ { label: 'Workflow', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/workflows' },
+]
+
+frappe.help.help_links['List/Company'] = [
+ { label: 'Company', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/company-setup' },
+ { label: 'Managing Multiple Companies', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/managing-multiple-companies' },
+ { label: 'Delete All Related Transactions for a Company', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/delete-a-company-and-all-related-transactions' },
+]
+
+frappe.help.help_links['permission-manager'] = [
+ { label: 'Role Permissions Manager', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/users-and-permissions/role-based-permissions' },
+ { label: 'Managing Perm Level in Permissions Manager', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/managing-perm-level' },
+]
+
+frappe.help.help_links['data-import-tool'] = [
+ { label: 'Importing and Exporting Data', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/data/data-import-tool.html' },
+ { label: 'Overwriting Data from Data Import Tool', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/overwriting-data-from-data-import-tool' },
+]
+
+//Accounts
+
+frappe.help.help_links['modules/Accounts'] = [
+ { label: 'Introduction to Accounts', url: 'http://frappe.github.io/erpnext/user/manual/en/accounts/' },
+ { label: 'Chart of Accounts', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/chart-of-accounts.html' },
+ { label: 'Multi Currency Accounting', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/multi-currency-accounting' },
+]
+
+frappe.help.help_links['Tree/Account'] = [
+ { label: 'Chart of Accounts', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/chart-of-accounts' },
+]
+
+frappe.help.help_links['List/Sales Invoice'] = [
+ { label: 'Sales Invoice', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/sales-invoice' },
+]
+
+frappe.help.help_links['pos'] = [
+ { label: 'Point of Sale Invoice', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/point-of-sale-pos-invoice' },
+]
+
+frappe.help.help_links['List/Purchase Invoice'] = [
+ { label: 'Purchase Invoice', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/purchase-invoice' },
+]
+
+frappe.help.help_links['List/Journal Entry'] = [
+ { label: 'Journal Entry', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/journal-entry' },
+ { label: 'Advance Payment Entry', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/advance-payment-entry' },
+]
+
+frappe.help.help_links['List/Payment Entry'] = [
+ { label: 'Payment Entry', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/payment-entry' },
+]
+
+frappe.help.help_links['List/Payment Request'] = [
+ { label: 'Payment Request', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/payment-request' },
+]
+
+frappe.help.help_links['List/Asset'] = [
+ { label: 'Managing Fixed Assets', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/managing-fixed-assets' },
+]
+
+frappe.help.help_links['Tree/Cost Center'] = [
+ { label: 'Budgeting', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/budgeting' },
+]
+
+frappe.help.help_links['List/Item'] = [
+ { label: 'Barcode', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/bar-code' },
+ { label: 'Item Wise Taxation', url: 'https://frappe.github.io/erpnext/user/manual/en/accounts/item-wise-taxation' },
+]
+
+frappe.help.help_links['List/Purchase Receipt'] = [
+ { label: 'Barcode', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/bar-code' },
+]
+
+frappe.help.help_links['List/Delivery Note'] = [
+ { label: 'Barcode', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/bar-code' },
+]
+
+frappe.help.help_links['Tree'] = [
+ { label: 'Managing Tree Structure Masters', url: 'https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/managing-tree-structure-masters' },
+]
+