Compare commits

...

133 Commits

Author SHA1 Message Date
Nabin Hait
c4894a5287 Merge branch 'hotfix' 2017-03-30 13:14:34 +05:30
Nabin Hait
a9bef56a94 bumped to version 7.2.32 2017-03-30 13:44:34 +06:00
mbauskar
07e6bdd4f2 [minor] check employee date of joining before marking the employee attendance 2017-03-30 12:52:29 +05:30
mbauskar
de98ff6bb9 [minor] hide the stock details section if update_stock is unchecked 2017-03-29 17:29:58 +05:30
Nabin Hait
da749f716b Merge pull request #8172 from rohitwaghchaure/credit_note_serial_no_issue
[fix] During making credit note from sales invoice, system fetching new serial no instead of old serial no from the sales invoice
2017-03-28 13:49:32 +05:30
Nabin Hait
2cf5ca28f6 Merge pull request #8173 from nabinhait/hotfix
In gross profit report, if incoming rate not found from last sle, consider average valuation rate
2017-03-28 13:49:09 +05:30
Nabin Hait
95db9f9e09 Merge pull request #8175 from rohitwaghchaure/production_planning_issue
[fix] sales order with status closed fetching on production planning tool
2017-03-28 13:48:42 +05:30
Rohit Waghchaure
d7908f8e3a [fix] sales order with status closed fetching on production planning tool 2017-03-28 12:30:23 +05:30
Nabin Hait
77c970549b In gross profit report, if incoming rate not found from last sle, consider average valuation rate 2017-03-28 12:20:31 +05:30
Rohit Waghchaure
5ecbaa408b [fix] During making credit note from sales invoice, system fetching new serial no instead of old serial no from the sales invoice 2017-03-28 12:09:07 +05:30
Nabin Hait
3e43f275a0 Merge branch 'hotfix' 2017-03-27 12:27:38 +05:30
Nabin Hait
70c3f79d12 bumped to version 7.2.31 2017-03-27 12:57:38 +06:00
Nabin Hait
d25e314ccb Merge pull request #8054 from rohitwaghchaure/purchase_return_issue_invoice
[fix] Quantity is not copying in the Received Qty during making of debit note from the purchase invoice
2017-03-23 17:01:58 +05:30
Nabin Hait
c7dc838306 Merge pull request #8068 from rohitwaghchaure/asset_depreciation_issue
[fix] Precision issue during making of depreciation schedule
2017-03-23 16:59:12 +05:30
Nabin Hait
1775a3db38 Merge pull request #8115 from rohitwaghchaure/setup_wizard_unpickle_issue
[fix] UnpickleError, removed _ method from the argument of the function
2017-03-23 16:14:52 +05:30
Rohit Waghchaure
57f35a25a1 [fix] UnpickleError, removed _ method from the argument of the function 2017-03-23 14:55:52 +05:30
Rohit Waghchaure
b69d311268 [fix] precision issue during making of depreciation schedule 2017-03-20 16:30:34 +05:30
Rohit Waghchaure
414c0ab3bb [fix] Quantity is not copying in the Received Qty during making of debit note 2017-03-17 17:19:17 +05:30
Nabin Hait
f494626ce4 Merge pull request #8034 from mbauskar/hotfix
[minor] make item code mandatory if update_stock is selected
2017-03-15 19:40:20 +05:30
mbauskar
27efc91db0 [minor] make item code mandatory if update_stock is selected 2017-03-15 18:57:18 +05:30
Nabin Hait
c1a5b348b5 Merge branch 'hotfix' 2017-03-15 11:28:06 +05:30
Nabin Hait
1157ee365b bumped to version 7.2.30 2017-03-15 11:58:06 +06:00
Nabin Hait
fd9b2467d6 Merge pull request #7966 from rohitwaghchaure/item_variant_issue_for_nuermic
[Fix] Item variants broken when using naming series for items and vriants of numeric value
2017-03-12 16:34:40 +05:30
Rohit Waghchaure
0169341917 [Fix] Item variants broken when using naming series for items and vriants of numeric value 2017-03-10 19:40:08 +05:30
Nabin Hait
e7e82fe477 Merge pull request #7970 from rmehta/sample-tasks
Descriptions on sample tasks
2017-03-10 14:58:52 +05:30
Rushabh Mehta
83aa5ee3df [messages] cleanup 2017-03-10 12:47:29 +05:30
Rushabh Mehta
868bb26e24 [sample] add help for sample tasks and make them into notifications 2017-03-09 18:11:11 +05:30
Rushabh Mehta
aea1c2a1e3 [minor] allow sales order delivery date before order date 2017-03-09 12:46:51 +05:30
Nabin Hait
89d494fbf5 Merge branch 'hotfix' 2017-03-08 14:30:12 +05:30
Nabin Hait
27c4fdc2df bumped to version 7.2.29 2017-03-08 15:00:12 +06:00
Nabin Hait
804c4fc4a7 Merge pull request #7951 from rohitwaghchaure/purchase_return_issue
[Fix] Purchase return issue
2017-03-08 14:28:55 +05:30
Nabin Hait
842d4fcf53 Merge pull request #7954 from mbauskar/hotfix
removed the test_clear_blank_rows test case from JE
2017-03-08 14:19:04 +05:30
mbauskar
02198ec8b0 removed the test_clear_blank_rows test case from JE 2017-03-08 12:34:36 +05:30
Nabin Hait
40f5d1845f Merge branch 'hotfix' 2017-03-08 11:16:00 +05:30
Nabin Hait
f967206523 bumped to version 7.2.28 2017-03-08 11:46:00 +06:00
Rohit Waghchaure
d05a8737f9 [Fix] Purchase return issue 2017-03-08 10:30:23 +05:30
Nabin Hait
44bc6ab242 Merge pull request #7937 from mbauskar/hotfix
[minor] allowed the credit and debit amount to be 0 in JE
2017-03-07 12:56:02 +05:30
mbauskar
c03f275e7a [minor] allowed the credit and debit amount to be 0 in JE 2017-03-07 11:59:55 +05:30
Nabin Hait
f5a9c8ecf2 Merge pull request #7936 from rohitwaghchaure/financial_statement_issue
Minor fix
2017-03-07 00:27:53 +05:30
Rohit Waghchaure
9f4317e9b8 minor fix 2017-03-06 23:42:45 +05:30
Nabin Hait
9e6e718ee1 Merge pull request #7913 from rohitwaghchaure/minor_fix
Removed fiscal year and month from the print of monthly salary register
2017-03-04 18:30:44 +05:30
Rohit Waghchaure
f8aa6ed46b removed fiscal year and month from the print 2017-03-02 17:51:15 +05:30
Nabin Hait
c99f85d84c Merge branch 'hotfix' 2017-03-02 12:38:14 +05:30
Nabin Hait
1cc7024cb4 bumped to version 7.2.27 2017-03-02 13:08:14 +06:00
Rushabh Mehta
7067ff026a [minor] add progress in desktop help message 2017-03-02 11:14:09 +05:30
Rushabh Mehta
e7900b24a0 [minor] add progress in desktop help message 2017-03-02 11:13:18 +05:30
Nabin Hait
093eba2336 Merge branch 'hotfix' 2017-02-28 18:56:25 +05:30
Nabin Hait
db2aefa3a6 bumped to version 7.2.26 2017-02-28 19:26:25 +06:00
Rushabh Mehta
f8b19e07cf [minor] activation messages only for non activated users 2017-02-28 18:54:07 +05:30
Nabin Hait
d39b012981 Merge branch 'hotfix' 2017-02-27 15:41:43 +05:30
Nabin Hait
b99a38d6ae bumped to version 7.2.25 2017-02-27 16:11:43 +06:00
Nabin Hait
a2afc4e11c Update activation.py 2017-02-27 15:39:29 +05:30
Nabin Hait
e0d661f433 Merge branch 'hotfix' 2017-02-27 14:31:10 +05:30
Nabin Hait
79c5ee0a65 bumped to version 7.2.24 2017-02-27 15:01:10 +06:00
Nabin Hait
afd0d086a7 Merge pull request #7872 from rohitwaghchaure/delivery_note_serail_no_issue
[Fix] Serial nos not pulling on the delivery note, for spanish language add serial no button is not working
2017-02-27 14:11:30 +05:30
Nabin Hait
704b6a3e1f Merge pull request #7756 from mlisb0n/master
[Translation] Revised and updated all translations to meet european portuguese business/accounting terminology
2017-02-27 14:10:51 +05:30
Rohit Waghchaure
2087e574aa [Fix] Serial nos not pulling on the delivery note, for language spanish add serial no button was not working 2017-02-27 13:43:04 +05:30
Nabin Hait
ff5bd680c2 Merge pull request #7840 from rmehta/new-buttons
[enhance] connect new buttons on dashboard to custom make buttons and fix text for payment request
2017-02-24 12:57:13 +05:30
Nabin Hait
d9afd7e4aa Merge pull request #7822 from rmehta/desktop-messages
[enhance] desktop messages
2017-02-24 12:55:34 +05:30
Nabin Hait
9f0d64b679 Merge pull request #7841 from mbauskar/hotfix
[minor] fixed assessment module icon
2017-02-24 12:50:16 +05:30
mbauskar
cea7d32b31 [minor] fixed assessment module icon 2017-02-23 20:28:47 +05:30
Rushabh Mehta
509543752c [enhance] connect new buttons on dashboard to custom make buttons and fix text for payment request 2017-02-23 17:03:46 +05:30
Nabin Hait
4c27ec5618 Merge pull request #7839 from KanchanChauhan/holiday-cal-fix
[Fix] Holiday Calendar Fix
2017-02-23 16:36:35 +05:30
Kanchan Chauhan
52a5cb9ae3 [Fix] Holiday Calendar Fix 2017-02-23 16:15:12 +05:30
nick9822
089c5caea5 Sales analytics error after upgrade
Hi Team,

We were getting errors in sales analytics report after the upgrade. 
https://discuss.erpnext.com/t/sales-analytics-report-hangs-on-erpnext-v7/17951/6

With the efforts of @Tropicalrambler into the report we made it work by putting checkpoint for item.
Please see whether its good or there is better solution for it.

Thanks,
Nick
2017-02-22 17:09:29 +05:30
Rushabh Mehta
05ce7ec7bb [enhance] desktop messages 2017-02-22 16:15:43 +05:30
Nabin Hait
10ec553859 Merge branch 'hotfix' 2017-02-22 15:05:27 +05:30
Nabin Hait
633698affc bumped to version 7.2.23 2017-02-22 15:35:27 +06:00
Nabin Hait
1965949c67 Merge pull request #7816 from mbauskar/hotfix
[minor] minor fixes for journal entry get_exchange_rate trigger
2017-02-22 15:03:32 +05:30
mbauskar
a8fa10d2a9 [minor] minor fixes for journal entry get_exchange_rate trigger 2017-02-22 14:51:09 +05:30
Nabin Hait
1bdb6a57f2 Merge pull request #7809 from rohitwaghchaure/financial_statement_company_issue
[Fix] Company fiscal year issue in financial statement
2017-02-22 11:41:16 +05:30
Nabin Hait
8c9bc8edbb Merge pull request #7807 from nabinhait/hotfix
Company, Currency, Conversion Rate fields are mandatory in BOM
2017-02-21 16:06:20 +05:30
Rohit Waghchaure
49523d7f80 [Fix] Company fiscal year issue in financial statement 2017-02-21 14:20:26 +05:30
Nabin Hait
6e1a2b16a5 Company, Currency, Conversion Rate fields are mandatory in BOM 2017-02-21 13:11:02 +05:30
Nabin Hait
7056ce54d7 Update salary_structure.py 2017-02-20 23:28:47 +05:30
Nabin Hait
6cbe02400a Merge pull request #7672 from KanchanChauhan/remove-joining-datep-validation
From date, to date moved from Salary Structure to Salary Structure Employee
2017-02-20 19:31:49 +05:30
Nabin Hait
6a85752ead Merge branch 'hotfix' into remove-joining-datep-validation 2017-02-20 19:31:38 +05:30
Nabin Hait
e17519accb Update salary_structure.py 2017-02-20 19:30:44 +05:30
Nabin Hait
f8cff128b3 Merge branch 'hotfix' 2017-02-20 14:52:01 +05:30
Nabin Hait
66b373033a bumped to version 7.2.22 2017-02-20 15:22:01 +06:00
Nabin Hait
64e222697c Merge pull request #7769 from nabinhait/setup_fy_dates
Set fiscal year start and end date based on country
2017-02-17 15:18:28 +05:30
Nabin Hait
e285258374 Merge pull request #7762 from mbauskar/hotfix
[minor] timestamp fixes for heatmap
2017-02-17 15:18:01 +05:30
Nabin Hait
a6eb1434b3 Merge pull request #7771 from rmehta/item-name
[minor] item name not mandatory and item price with quick edit
2017-02-17 15:17:24 +05:30
Rushabh Mehta
0c5375d0fa [minor] item name not mandatory and item price with quick edit 2017-02-17 14:57:31 +05:30
Nabin Hait
6af7dd4e1b Set fiscal year start and end date based on country 2017-02-17 14:47:33 +05:30
Nabin Hait
801fa80b39 Merge pull request #7764 from rohitwaghchaure/clean_supplied_items
[Fix] Cleanup supplied items if supply raw material is set as No
2017-02-17 12:36:05 +05:30
Nabin Hait
9e5b3dad29 Minor fix in assesment 2017-02-17 11:03:44 +05:30
Rohit Waghchaure
4b9d2f2733 [Fix] Cleanup supplied items if supply raw material is set as No 2017-02-16 18:53:23 +05:30
mbauskar
e7b87ad071 [minor] timestamp fixes for heatmap 2017-02-16 16:05:46 +05:30
Nabin Hait
1b59b624c3 Merge branch 'hotfix' 2017-02-16 15:59:58 +05:30
Nabin Hait
a7d6b68bc0 bumped to version 7.2.21 2017-02-16 16:29:58 +06:00
Nabin Hait
c70a4d2037 Merge pull request #7760 from rmehta/add-activation-1
[add] site activation level
2017-02-16 15:51:04 +05:30
Rushabh Mehta
6dd461fec4 [add] site activation level 2017-02-16 14:53:21 +05:30
Nabin Hait
d5d0b36973 Merge branch 'hotfix' 2017-02-16 14:37:49 +05:30
Nabin Hait
7677b56f7c bumped to version 7.2.20 2017-02-16 15:07:48 +06:00
Nabin Hait
b280398626 Merge pull request #7739 from rohitwaghchaure/payment_entry_currency_symbol_issue
[Fix] Payment Entry currency symbol issue
2017-02-16 14:21:24 +05:30
Nabin Hait
99c6c79834 Update payment_entry.js 2017-02-16 14:21:04 +05:30
Nabin Hait
3437a9a123 minor fix 2017-02-16 12:14:30 +05:30
mlisb0n
835a615af8 Add files via upload 2017-02-15 15:45:52 +01:00
Nabin Hait
6a2e138021 Merge pull request #7731 from nabinhait/hotfix
Check existing SO, PO and MR for enabling / disabling 'Is Stock Item' checkbox
2017-02-15 17:25:56 +05:30
Rohit Waghchaure
ff41c82c2b [Fix] Payment Entry currency symbol issue 2017-02-15 11:44:15 +05:30
Nabin Hait
99dfa3060a Check existing SO, PO and MR for disabling 'Is Stock Item' checkbox 2017-02-13 16:06:02 +05:30
Nabin Hait
89b6c47b2e Merge pull request #7712 from rohitwaghchaure/minor_fix_item_valuation_method
[Fix] Valuation method changing issue in the item
2017-02-13 15:42:22 +05:30
Nabin Hait
ec07d18222 Merge pull request #7716 from KanchanChauhan/apply-now-job
[Fix] Apply Now button redirect fixed for Job Opening
2017-02-13 15:42:02 +05:30
Kanchan Chauhan
1cd5e583ba [Fix] Apply Now button redirect fixed for Job Opening 2017-02-10 17:58:41 +05:30
Nabin Hait
bdd470a6d1 Update item.py 2017-02-10 17:12:48 +05:30
Rohit Waghchaure
2f09dc0e62 [Fix] Valuation method changing issue in the item 2017-02-10 15:29:45 +05:30
Nabin Hait
eee23eaf5c Merge pull request #7702 from mbauskar/hotfix
[minor] payment entry company trigger
2017-02-09 13:48:09 +05:30
mbauskar
d487bf77e1 [minor] payment entry company trigger 2017-02-09 12:57:25 +05:30
Nabin Hait
efd5eadfea Merge branch 'hotfix' 2017-02-08 11:32:47 +05:30
Nabin Hait
57e97c06e6 bumped to version 7.2.19 2017-02-08 12:02:47 +06:00
Nabin Hait
6f93cd5bd0 Merge pull request #7692 from rohitwaghchaure/minor_fixes_v_7_2
Minor fixes
2017-02-08 11:21:54 +05:30
Nabin Hait
533d22e88b Merge pull request #7606 from rohitwaghchaure/data_import_tool_for_cost_center
[Fix] Allow data import tool for cost center
2017-02-08 11:21:25 +05:30
Rohit Waghchaure
b3489548a9 minor fix 2017-02-08 11:20:04 +05:30
Nabin Hait
ccd2e00331 Merge pull request #7676 from nabinhait/missing_val_rate
Get standard/historical valuation rate where missing, if item is not a sample item
2017-02-08 11:05:06 +05:30
Nabin Hait
0a6aaf4257 Get standard/historical valuation rate where missing: some minor fixes 2017-02-07 12:50:22 +05:30
Nabin Hait
ea8fab52c6 Get standard/historical valuation rate where missing, if item is not a sample item 2017-02-07 01:24:32 +05:30
Nabin Hait
8200485baa Merge pull request #7675 from mbauskar/hotfix
[minor] index out of range fixes for JE
2017-02-06 19:23:33 +05:30
mbauskar
c874a82559 [minor] index out of range fixes for JE 2017-02-06 15:41:34 +05:30
Kanchan Chauhan
5f5457085e Joining date validation removed from Salary Structure 2017-02-06 14:50:39 +05:30
Nabin Hait
101aaed643 Merge pull request #7614 from KanchanChauhan/account-filters-payroll
[Fix] Account filter in Process Payroll and Salary Component
2017-02-06 11:36:48 +05:30
Nabin Hait
20d2d7548a Update salary_component.js 2017-02-06 11:36:38 +05:30
Kanchan Chauhan
3e2ecc3423 [Fix] Account filter in Process Payroll and Salary Component 2017-02-02 14:41:48 +05:30
Nabin Hait
6b9902627d Merge pull request #7638 from rohitwaghchaure/gross_profit_report_issue
[Fix] Buying rate in gross profit report
2017-02-02 13:41:32 +05:30
Rohit Waghchaure
38f808cfae [Fix] Buying rate in gross profit report 2017-02-01 13:34:06 +05:30
Rohit Waghchaure
b327429db7 [Fix] Allow data import tool for cost center 2017-01-30 11:34:29 +05:30
Rohit Waghchaure
bf667a6540 Merge branch 'hotfix' 2017-01-28 14:14:32 +05:30
Rohit Waghchaure
ce4a0b20ab bumped to version 7.2.18 2017-01-28 14:44:32 +06:00
Nabin Hait
68fd31ca0e Merge pull request #7599 from KanchanChauhan/stock-controller-urgent-fix
[URGENT][FIX]Stock Controller fix
2017-01-28 14:11:14 +05:30
Kanchan Chauhan
b77eaf7053 [URGENT][FIX]Stock Controller fix 2017-01-28 13:26:46 +05:30
Rushabh Mehta
245c2e885a Merge branch 'hotfix' 2017-01-27 16:18:26 +05:30
Rushabh Mehta
098bd34f00 bumped to version 7.2.17 2017-01-27 16:48:25 +06:00
Rushabh Mehta
063e86a1bf [fix] remove on_update in Item 2017-01-27 16:16:08 +05:30
93 changed files with 5493 additions and 4793 deletions

View File

@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
__version__ = '7.2.16'
__version__ = '7.2.32'
def get_default_company(user=None):
'''Get default company for user'''

View File

@@ -112,8 +112,8 @@ class Asset(Document):
def set_accumulated_depreciation(self):
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
for d in self.get("schedules"):
accumulated_depreciation += flt(d.depreciation_amount)
d.accumulated_depreciation_amount = accumulated_depreciation
accumulated_depreciation += flt(d.depreciation_amount, d.precision("depreciation_amount"))
d.accumulated_depreciation_amount = flt(accumulated_depreciation, d.precision("accumulated_depreciation_amount"))
def get_depreciation_amount(self, depreciable_value):
if self.depreciation_method in ("Straight Line", "Manual"):

View File

@@ -74,6 +74,9 @@ class BankReconciliation(Document):
clearance_date_updated = False
for d in self.get('payment_entries'):
if d.clearance_date:
if not d.payment_document:
frappe.throw(_("Row #{0}: Payment document is required to complete the trasaction"))
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}")
.format(d.idx, d.clearance_date, d.cheque_date))

View File

@@ -278,14 +278,14 @@
"icon": "fa fa-money",
"idx": 1,
"image_view": 0,
"in_create": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-11-07 05:20:40.282432",
"modified": "2017-01-30 11:27:36.615323",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cost Center",

View File

@@ -38,7 +38,7 @@ frappe.ui.form.on("Journal Entry", {
},
posting_date: function(frm) {
if(!frm.doc.multi_currency) return;
if(!frm.doc.multi_currency || !frm.doc.posting_date) return;
$.each(frm.doc.accounts || [], function(i, row) {
erpnext.journal_entry.set_exchange_rate(frm, row.doctype, row.name);

View File

@@ -37,13 +37,8 @@ class JournalEntry(AccountsController):
self.validate_credit_debit_note()
self.validate_empty_accounts_table()
self.set_account_and_party_balance()
self.clear_zero_debit_credit_row()
if not self.title:
self.title = self.get_title()
def clear_zero_debit_credit_row(self):
self.accounts = [account for account in self.accounts
if not (account.debit_in_account_currency==0.0 and account.credit_in_account_currency==0.0)]
def on_submit(self):
self.check_credit_limit()
@@ -829,7 +824,7 @@ def get_account_balance_and_party_type(account, date, company, debit=None, credi
# Added posting_date as one of the parameters of get_exchange_rate
@frappe.whitelist()
def get_exchange_rate(posting_date, account, account_currency=None, company=None,
def get_exchange_rate(posting_date, account=None, account_currency=None, company=None,
reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None):
from erpnext.setup.utils import get_exchange_rate
account_details = frappe.db.get_value("Account", account,

View File

@@ -171,20 +171,6 @@ class TestJournalEntry(unittest.TestCase):
})
jv.submit()
def test_clear_blank_rows(self):
je = make_journal_entry("_Test Bank - _TC", "_Test Account Stock Expenses - _TC", 100, save=False)
je.append("accounts", {
"account": "_Test Cash - _TC",
"debit_in_account_currency": 0,
"credit_in_account_currency": 0,
"exchange_rate": 1
})
self.assertEqual(len(je.get("accounts")), 3)
je.save()
self.assertEqual(len(je.get("accounts")), 2)
def make_journal_entry(account1, account2, amount, cost_center=None, posting_date=None, exchange_rate=1, save=True, submit=False, project=None):
if not cost_center:

View File

@@ -79,8 +79,13 @@ frappe.ui.form.on('Payment Entry', {
frm.events.show_general_ledger(frm);
},
company: function(frm) {
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
},
hide_unhide_fields: function(frm) {
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: "";
frm.toggle_display("source_exchange_rate",
(frm.doc.paid_amount && frm.doc.paid_from_account_currency != company_currency));
@@ -118,7 +123,7 @@ frappe.ui.form.on('Payment Entry', {
},
set_dynamic_labels: function(frm) {
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: "";
frm.set_currency_labels(["base_paid_amount", "base_received_amount", "base_total_allocated_amount",
"difference_amount"], company_currency);
@@ -131,6 +136,10 @@ frappe.ui.form.on('Payment Entry', {
frm.set_currency_labels(["total_allocated_amount", "unallocated_amount"], party_account_currency);
var currency_field = (frm.doc.payment_type=="Receive") ? "paid_from_account_currency" : "paid_to_account_currency"
frm.set_df_property("total_allocated_amount", "options", currency_field);
frm.set_df_property("unallocated_amount", "options", currency_field);
frm.set_currency_labels(["total_amount", "outstanding_amount", "allocated_amount"],
party_account_currency, "references");
@@ -741,4 +750,4 @@ frappe.ui.form.on('Payment Entry Deduction', {
deductions_remove: function(frm) {
frm.events.set_difference_amount(frm);
}
})
})

View File

@@ -362,7 +362,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "message",
"fieldtype": "Small Text",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -400,7 +400,7 @@
"label": "Message Examples",
"length": 0,
"no_copy": 0,
"options": "<pre><h5>Message Example</h5>\n\n&lt;p&gt; Thank You for being a part of {{ doc.company }}! We hope you are enjoying the service.&lt;/p&gt;\n\n&lt;p&gt; Please find enclosed the E Bill statement. The outstanding amount is {{ doc.grand_total }}.&lt;/p&gt;\n\n&lt;p&gt; We don't want you to be spending time running around in order to pay for your Bill.<br>After all, life is beautiful and the time you have in hand should be spent to enjoy it!<br>So here are our little ways to help you get more time for life! &lt;/p&gt;\n\n&lt;a href=\"{{ payment_url }}\"&gt; click here to pay &lt;/a&gt;\n\n</pre>\n",
"options": "<pre><h5>Message Example</h5>\n\n&lt;p&gt;Dear {{ doc.contact_person }},&lt;/p&gt;\n\n&lt;p&gt;Requesting payment for {{ doc.doctype }}, {{ doc.name }} for {{ doc.grand_total }}.&lt;/p&gt;\n\n&lt;a href=\"{{ payment_url }}\"&gt; click here to pay &lt;/a&gt;\n\n</pre>\n",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -675,13 +675,13 @@
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-12-15 14:46:19.662816",
"modified": "2017-02-23 05:03:37.464863",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",

View File

@@ -26,7 +26,7 @@ class PaymentRequest(Document):
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
if self.payment_account and ref_doc.currency != frappe.db.get_value("Account", self.payment_account, "account_currency"):
frappe.throw(_("Transaction currency must be same as Payment Gateway currency"))
def on_submit(self):
send_mail = True
self.make_communication_entry()
@@ -54,20 +54,20 @@ class PaymentRequest(Document):
def set_payment_request_url(self):
if self.payment_account:
self.payment_url = self.get_payment_url()
if self.payment_url:
self.db_set('payment_url', self.payment_url)
if self.payment_url or not self.payment_gateway_account:
self.db_set('status', 'Initiated')
def get_payment_url(self):
data = frappe.db.get_value(self.reference_doctype, self.reference_name,
["company", "customer_name"], as_dict=1)
controller = get_integration_controller(self.payment_gateway)
controller.validate_transaction_currency(self.currency)
return controller.get_payment_url(**{
"amount": self.grand_total,
"title": data.company,
@@ -83,7 +83,7 @@ class PaymentRequest(Document):
def set_as_paid(self):
if frappe.session.user == "Guest":
frappe.set_user("Administrator")
payment_entry = self.create_payment_entry()
self.make_invoice()
@@ -157,7 +157,7 @@ class PaymentRequest(Document):
def set_as_cancelled(self):
self.db_set("status", "Cancelled")
def check_if_payment_entry_exists(self):
if self.status == "Paid":
payment_entry = frappe.db.sql_list("""select parent from `tabPayment Entry Reference`
@@ -179,11 +179,11 @@ class PaymentRequest(Document):
def get_payment_success_url(self):
return self.payment_success_url
def on_payment_authorized(self, status=None):
if not status:
return
shopping_cart_settings = frappe.get_doc("Shopping Cart Settings")
if status in ["Authorized", "Completed"]:
@@ -203,9 +203,9 @@ class PaymentRequest(Document):
}).get(success_url, "me")
else:
redirect_to = get_url("/orders/{0}".format(self.reference_name))
return redirect_to
@frappe.whitelist(allow_guest=True)
def make_payment_request(**args):
"""Make payment request"""
@@ -234,7 +234,7 @@ def make_payment_request(**args):
"grand_total": grand_total,
"email_to": args.recipient_id or "",
"subject": "Payment Request for %s"%args.dn,
"message": gateway_account.get("message") or get_dummy_message(args.use_dummy_message),
"message": gateway_account.get("message") or get_dummy_message(ref_doc),
"reference_doctype": args.dt,
"reference_name": args.dn
})
@@ -319,19 +319,24 @@ def make_status_as_paid(doc, method):
payment_request_name = frappe.db.get_value("Payment Request",
{"reference_doctype": ref.reference_doctype, "reference_name": ref.reference_name,
"docstatus": 1})
if payment_request_name:
doc = frappe.get_doc("Payment Request", payment_request_name)
if doc.status != "Paid":
doc.db_set('status', 'Paid')
frappe.db.commit()
def get_dummy_message(use_dummy_message=True):
return """
<p> Hope you are enjoying a service. Please consider bank details for payment </p>
<p> Bank Details <p><br>
<p> Bank Name : National Bank </p>
<p> Account Number : 123456789000872 </p>
<p> IFSC code : NB000001 </p>
<p> Account Name : Wind Power LLC </p>
"""
def get_dummy_message(doc):
return frappe.render_template("""{% if doc.contact_person -%}
<p>Dear {{ doc.contact_person }},</p>
{%- else %}<p>Hello,</p>{% endif %}
<p>{{ _("Requesting payment against {0} {1} for amount {2}").format(doc.doctype,
doc.name, doc.get_formatted("grand_total")) }}</p>
<a href="{{ payment_url }}">{{ _("Make Payment") }}</a>
<p>{{ _("If you have any questions, please get back to us.") }}</p>
<p>{{ _("Thank you for your business!") }}</p>
""", dict(doc=doc, payment_url = '{{ payment_url }}'))

View File

@@ -117,7 +117,7 @@ def apply_pricing_rule(args):
args_copy = copy.deepcopy(args)
args_copy.update(item)
out.append(get_pricing_rule_for_item(args_copy))
if set_serial_nos_based_on_fifo:
if set_serial_nos_based_on_fifo and not args.get('is_return'):
out.append(get_serial_no_for_item(args_copy))
return out

View File

@@ -8,7 +8,7 @@ frappe.provide("erpnext.accounts");
erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
onload: function() {
this._super();
if(!this.frm.doc.__islocal) {
// show credit_to in print format
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
@@ -32,7 +32,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(doc.update_stock==1 && doc.docstatus==1) {
this.show_stock_ledger();
}
if(!doc.is_return && doc.docstatus==1) {
if(doc.outstanding_amount != 0) {
this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
@@ -205,6 +205,7 @@ function hide_fields(doc) {
cur_frm.cscript.update_stock = function(doc, dt, dn) {
hide_fields(doc, dt, dn);
this.frm.fields_dict.items.grid.toggle_reqd("item_code", doc.update_stock? true: false)
}
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
@@ -336,6 +337,12 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
}
frappe.ui.form.on("Purchase Invoice", {
setup: function(frm) {
frm.custom_make_buttons = {
'Purchase Invoice': 'Debit Note',
'Payment Entry': 'Payment'
}
},
onload: function(frm) {
$.each(["warehouse", "rejected_warehouse"], function(i, field) {
frm.set_query(field, "items", function() {

View File

@@ -156,6 +156,12 @@ class PurchaseInvoice(BuyingController):
super(PurchaseInvoice, self).validate_warehouse()
def validate_item_code(self):
for d in self.get('items'):
if not d.item_code:
frappe.msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
def set_expense_account(self, for_validate=False):
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
@@ -164,6 +170,7 @@ class PurchaseInvoice(BuyingController):
stock_items = self.get_stock_items()
if self.update_stock:
self.validate_item_code()
self.validate_warehouse()
warehouse_account = get_warehouse_account()

View File

@@ -1315,6 +1315,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1788,7 +1816,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-16 16:04:52.465169",
"modified": "2017-02-07 01:21:03.737800",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@@ -321,6 +321,7 @@ cur_frm.cscript.hide_fields = function(doc) {
cur_frm.cscript.update_stock = function(doc, dt, dn) {
cur_frm.cscript.hide_fields(doc, dt, dn);
this.frm.fields_dict.items.grid.toggle_reqd("item_code", doc.update_stock? true: false)
}
cur_frm.cscript['Make Delivery Note'] = function() {
@@ -469,6 +470,12 @@ cur_frm.set_query("asset", "items", function(doc, cdt, cdn) {
frappe.ui.form.on('Sales Invoice', {
setup: function(frm){
frm.custom_make_buttons = {
'Delivery Note': 'Delivery',
'Sales Invoice': 'Sales Return',
'Payment Request': 'Payment Request',
'Payment': 'Payment Entry'
},
frm.fields_dict["timesheets"].grid.get_field("time_sheet").get_query = function(doc, cdt, cdn){
return{
query: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet",

View File

@@ -1216,6 +1216,7 @@
"collapsible": 1,
"collapsible_depends_on": "eval:doc.serial_no || doc.batch_no",
"columns": 0,
"depends_on": "eval: parent.update_stock",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1381,6 +1382,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1882,7 +1911,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-16 16:04:02.438952",
"modified": "2017-03-29 16:26:36.507924",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@@ -7,7 +7,7 @@ import frappe
import datetime
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years, get_timestamp
from erpnext.utilities.doctype.address.address import get_address_display
from erpnext.utilities.doctype.contact.contact import get_contact_details
from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
@@ -351,8 +351,17 @@ def validate_party_frozen_disabled(party_type, party_name):
def get_timeline_data(doctype, name):
'''returns timeline data for the past one year'''
from frappe.desk.form.load import get_communication_data
out = {}
data = get_communication_data(doctype, name,
fields = 'unix_timestamp(date(creation)), count(name)',
fields = 'date(creation), count(name)',
after = add_years(None, -1).strftime('%Y-%m-%d'),
group_by='group by date(creation)', as_dict=False)
return dict(data)
timeline_items = dict(data)
for date, count in timeline_items.iteritems():
timestamp = get_timestamp(date)
out.update({ timestamp: count })
return out

View File

@@ -8,7 +8,7 @@ from frappe.utils import flt, cint
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False)
liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)

View File

@@ -10,7 +10,7 @@ from erpnext.accounts.utils import get_fiscal_year
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
operation_accounts = {
"section_name": "Operations",

View File

@@ -8,7 +8,7 @@ from frappe import _
from frappe.utils import (flt, getdate, get_first_day, get_last_day, date_diff,
add_months, add_days, formatdate, cint)
def get_period_list(from_fiscal_year, to_fiscal_year, periodicity):
def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, company):
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
Periodicity can be (Yearly, Quarterly, Monthly)"""
@@ -50,7 +50,7 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity):
# if a fiscal year ends before a 12 month period
period.to_date = year_end_date
period.to_date_fiscal_year = get_date_fiscal_year(period.to_date)
period.to_date_fiscal_year = get_date_fiscal_year(period.to_date, company)
period_list.append(period)
@@ -141,16 +141,16 @@ def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accum
if entry.posting_date <= period.to_date:
if (accumulated_values or entry.posting_date >= period.from_date) and \
(entry.fiscal_year == period.to_date_fiscal_year or not ignore_accumulated_values_for_fy):
(not ignore_accumulated_values_for_fy or entry.fiscal_year == period.to_date_fiscal_year):
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
if entry.posting_date < period_list[0].year_start_date:
d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
def get_date_fiscal_year(date):
def get_date_fiscal_year(date, company):
from erpnext.accounts.utils import get_fiscal_year
return get_fiscal_year(date)[0]
return get_fiscal_year(date, company=company)[0]
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
"""accumulate children's values in parent accounts"""

View File

@@ -4,6 +4,8 @@
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from erpnext.stock.utils import get_incoming_rate
from erpnext.stock.stock_ledger import get_valuation_rate
from frappe.utils import flt
@@ -208,21 +210,21 @@ class GrossProfitGenerator(object):
flt(my_sle[i+1].stock_value) or 0.0
return previous_stock_value - flt(sle.stock_value)
else:
return flt(row.qty) * self.get_average_buying_rate(item_code)
return flt(row.qty) * self.get_average_buying_rate(row, item_code)
return 0.0
def get_average_buying_rate(self, item_code):
def get_average_buying_rate(self, row, item_code):
if not item_code in self.average_buying_rate:
if item_code in self.non_stock_items:
self.average_buying_rate[item_code] = flt(frappe.db.sql("""select sum(base_net_amount) / sum(qty * conversion_factor)
from `tabPurchase Invoice Item`
where item_code = %s and docstatus=1""", item_code)[0][0])
else:
self.average_buying_rate[item_code] = flt(frappe.db.sql("""select avg(valuation_rate)
from `tabStock Ledger Entry`
where item_code = %s and qty_after_transaction > 0""", item_code)[0][0])
average_buying_rate = get_incoming_rate(row)
if not average_buying_rate:
average_buying_rate = get_valuation_rate(item_code, row.warehouse, allow_zero_rate=True)
self.average_buying_rate[item_code] = average_buying_rate
return self.average_buying_rate[item_code]

View File

@@ -8,7 +8,7 @@ from frappe.utils import flt
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)

View File

@@ -11,9 +11,11 @@ from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
value_fields = ("income", "expense", "gross_profit_loss")
def execute(filters=None):
if not filters.get('based_on'): filters["based_on"] = 'Cost Center'
based_on = filters.based_on.replace(' ', '_').lower()
validate_filters(filters)
accounts = get_accounts_data(based_on, filters.company)
accounts = get_accounts_data(based_on, filters.get("company"))
data = get_data(accounts, filters, based_on)
columns = get_columns(filters)
return columns, data
@@ -27,14 +29,14 @@ def get_accounts_data(based_on, company):
def get_data(accounts, filters, based_on):
if not accounts:
return None
return []
accounts, accounts_by_name, parent_children_map = filter_accounts(accounts)
gl_entries_by_account = {}
set_gl_entries_by_account(filters.company, filters.from_date,
filters.to_date, based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry))
set_gl_entries_by_account(filters.get("company"), filters.get("from_date"),
filters.get("to_date"), based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.get("with_period_closing_entry")))
total_row = calculate_values(accounts, gl_entries_by_account, filters)
accumulate_values_into_parents(accounts, accounts_by_name)
@@ -90,7 +92,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
data = []
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
for d in accounts:
has_value = False
@@ -99,7 +101,7 @@ def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
"account": d.name,
"parent_account": d.parent_account,
"indent": d.indent,
"fiscal_year": filters.fiscal_year,
"fiscal_year": filters.get("fiscal_year"),
"currency": company_currency,
"based_on": based_on
}
@@ -122,9 +124,9 @@ def get_columns(filters):
return [
{
"fieldname": "account",
"label": _(filters.based_on),
"label": _(filters.get("based_on")),
"fieldtype": "Link",
"options": filters.based_on,
"options": filters.get("based_on"),
"width": 300
},
{

View File

@@ -44,8 +44,8 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
raise FiscalYearError, error_msg
return fy
def validate_fiscal_year(date, fiscal_year, label=_("Date"), doc=None):
years = [f[0] for f in get_fiscal_years(date, label=label)]
def validate_fiscal_year(date, fiscal_year, label="Date", doc=None):
years = [f[0] for f in get_fiscal_years(date, label=_(label))]
if fiscal_year not in years:
if doc:
doc.fiscal_year = years[0]

View File

@@ -139,9 +139,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && doc.update_stock)) {
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
if(!(item.received_qty || item.rejected_qty) && item.qty) {
if(!item.rejected_qty && item.qty) {
item.received_qty = item.qty;
}

View File

@@ -6,6 +6,13 @@ frappe.provide("erpnext.buying");
{% include 'erpnext/buying/doctype/purchase_common/purchase_common.js' %};
frappe.ui.form.on("Purchase Order", {
setup: function(frm) {
frm.custom_make_buttons = {
'Purchase Receipt': 'Receive',
'Purchase Invoice': 'Invoice',
'Stock Entry': 'Material to Supplier'
}
},
onload: function(frm) {
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
@@ -28,10 +35,8 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
var item = cur_frm.doc.items[i];
if(item.delivered_by_supplier !== 1) {
allow_receipt = true;
}
else {
is_drop_ship = true
} else {
is_drop_ship = true;
}
if(is_drop_ship && allow_receipt) {

View File

@@ -8,6 +8,10 @@ cur_frm.add_fetch('contact', 'email_id', 'email_id')
frappe.ui.form.on("Request for Quotation",{
setup: function(frm) {
frm.custom_make_buttons = {
'Supplier Quotation': 'Supplier Quotation'
}
frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn){
var d =locals[cdt][cdn];
return {

View File

@@ -4,6 +4,14 @@
// attach required files
{% include 'erpnext/buying/doctype/purchase_common/purchase_common.js' %};
frappe.ui.form.on('Suppier Quotation', {
setup: function() {
frm.custom_make_buttons = {
'Purchase Order': 'Purchase Order'
}
}
});
erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({
refresh: function() {
this._super();

View File

@@ -231,7 +231,7 @@ def get_data():
{
"module_name": "Assessment",
"color": "#8a70be",
"icon": "fa fa-file-text-alt",
"icon": "fa fa-file-text",
"label": _("Assessment"),
"link": "List/Assessment",
"_doctype": "Assessment",

View File

@@ -44,7 +44,7 @@ def get_data():
},
{
"type": "help",
"label": _("Setting up Email"),
"label": _("Setting up Email Account"),
"youtube_id": "YFYe0DrB95o"
},
{
@@ -62,11 +62,6 @@ def get_data():
"label": _("Workflow"),
"youtube_id": "yObJUg9FxFs"
},
{
"type": "help",
"label": _("Email Account"),
"youtube_id": "YFYe0DrB95o"
},
{
"type": "help",
"label": _("File Manager"),

View File

@@ -178,6 +178,9 @@ class BuyingController(StockController):
for item in self.get("items"):
item.rm_supp_cost = 0.0
if self.is_subcontracted == "No" and self.get("supplied_items"):
self.set('supplied_items', [])
def update_raw_materials_supplied(self, item, raw_material_table):
bom_items = self.get_items_from_bom(item.item_code, item.bom)
raw_materials_cost = 0

View File

@@ -169,7 +169,7 @@ def make_variant_item_code(template_item_code, variant):
item_attribute = frappe.db.sql("""select i.numeric_values, v.abbr
from `tabItem Attribute` i left join `tabItem Attribute Value` v
on (i.name=v.parent)
where i.name=%(attribute)s and v.attribute_value=%(attribute_value)s""", {
where i.name=%(attribute)s and (v.attribute_value=%(attribute_value)s or i.numeric_values = 1)""", {
"attribute": attr.attribute,
"attribute_value": attr.attribute_value
}, as_dict=True)
@@ -180,11 +180,8 @@ def make_variant_item_code(template_item_code, variant):
# frappe.bold(attr.attribute_value)), title=_('Invalid Attribute'),
# exc=InvalidItemAttributeValueError)
if item_attribute[0].numeric_values:
# don't generate item code if one of the attributes is numeric
return
abbreviations.append(item_attribute[0].abbr)
abbr_or_value = cstr(attr.attribute_value) if item_attribute[0].numeric_values else item_attribute[0].abbr
abbreviations.append(abbr_or_value)
if abbreviations:
variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations))

View File

@@ -43,7 +43,7 @@ class StockController(AccountsController):
gl_list = []
warehouse_with_no_account = []
for item_row in voucher_details:
sle_list = sle_map.get(item_row.name)
if sle_list:
@@ -53,9 +53,16 @@ class StockController(AccountsController):
self.check_expense_account(item_row)
if not sle.stock_value_difference:
self.update_stock_ledger_entries(sle)
self.validate_negative_stock(sle)
# If item is not a sample item
# and ( valuation rate not mentioned in an incoming entry
# or incoming entry not found while delivering the item),
# try to pick valuation rate from previous sle or Item master and update in SLE
# Otherwise, throw an exception
if not sle.stock_value_difference and self.doctype != "Stock Reconciliation" \
and not item_row.get("is_sample_item"):
sle = self.update_stock_ledger_entries(sle)
gl_list.append(self.get_gl_dict({
"account": warehouse_account[sle.warehouse]["name"],
@@ -89,17 +96,24 @@ class StockController(AccountsController):
def update_stock_ledger_entries(self, sle):
sle.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no)
self.doctype, self.name)
sle.stock_value = flt(sle.qty_after_transaction) * flt(sle.valuation_rate)
sle.stock_value_difference = sle.stock_value
sle.doctype="Stock Ledger Entry"
frappe.get_doc(sle).db_update()
def validate_negative_stock(self, sle):
if sle.qty_after_transaction < 0 and sle.actual_qty < 0:
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries (for booking expenses). Please create an incoming stock transaction or mention valuation rate in Item record, and then try submiting {1} {2}")
.format(sle.item_code, sle.voucher_type, sle.voucher_no))
sle.stock_value_difference = flt(sle.actual_qty) * flt(sle.valuation_rate)
if sle.name:
frappe.db.sql("""
update
`tabStock Ledger Entry`
set
stock_value = %(stock_value)s,
valuation_rate = %(valuation_rate)s,
stock_value_difference = %(stock_value_difference)s
where
name = %(name)s""", (sle))
return sle
def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
if self.doctype == "Stock Reconciliation":
return [frappe._dict({ "name": voucher_detail_no, "expense_account": default_expense_account,
@@ -147,10 +161,18 @@ class StockController(AccountsController):
def get_stock_ledger_details(self):
stock_ledger = {}
for sle in frappe.db.sql("""select warehouse, stock_value_difference,
voucher_detail_no, item_code, posting_date, posting_time, actual_qty, qty_after_transaction
from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""",
(self.doctype, self.name), as_dict=True):
stock_ledger_entries = frappe.db.sql("""
select
name, warehouse, stock_value_difference, valuation_rate,
voucher_detail_no, item_code, posting_date, posting_time,
actual_qty, qty_after_transaction
from
`tabStock Ledger Entry`
where
voucher_type=%s and voucher_no=%s
""", (self.doctype, self.name), as_dict=True)
for sle in stock_ledger_entries:
stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle)
return stock_ledger

View File

@@ -5,6 +5,12 @@ frappe.provide("erpnext.crm");
cur_frm.email_field = "contact_email";
frappe.ui.form.on("Opportunity", {
setup: function(frm) {
frm.custom_make_buttons = {
'Quotation': 'Quotation',
'Supplier Quotation': 'Supplier Quotation'
}
},
customer: function(frm) {
erpnext.utils.get_party_details(frm);
},
@@ -35,7 +41,7 @@ frappe.ui.form.on("Opportunity", {
cur_frm.cscript.create_quotation, __("Make"));
frm.page.set_inner_btn_group_as_primary(__("Make"));
if(doc.status!=="Quotation") {
frm.add_custom_button(__('Lost'),
cur_frm.cscript['Declare Opportunity Lost']);
@@ -62,7 +68,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
if(!this.frm.doc.status)
set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Open' });
if(!this.frm.doc.company && frappe.defaults.get_user_default("Company"))
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
{ company:frappe.defaults.get_user_default("Company") });
this.setup_queries();

View File

@@ -8,7 +8,6 @@ def get_data():
},
'transactions': [
{
'label': _('Related'),
'items': ['Quotation', 'Supplier Quotation']
},
]

View File

@@ -28,6 +28,7 @@ after_install = "erpnext.setup.install.after_install"
boot_session = "erpnext.startup.boot.boot_session"
notification_config = "erpnext.startup.notifications.get_notification_config"
get_help_messages = "erpnext.utilities.activation.get_help_messages"
on_session_creation = "erpnext.shopping_cart.utils.set_cart_count"
on_logout = "erpnext.shopping_cart.utils.clear_cart_count"

View File

@@ -32,6 +32,8 @@ class Attendance(Document):
def validate_att_date(self):
if getdate(self.att_date) > getdate(nowdate()):
frappe.throw(_("Attendance can not be marked for future dates"))
elif getdate(self.att_date) < frappe.db.get_value("Employee", self.employee, "date_of_joining"):
frappe.throw(_("Attendance date can not be less than employee's joining date"))
def validate_employee(self):
emp = frappe.db.sql("select name from `tabEmployee` where name = %s and status = 'Active'",

View File

@@ -3,8 +3,8 @@
frappe.views.calendar["Holiday List"] = {
field_map: {
"start": "from_date",
"end": "to_date",
"start": "holiday_date",
"end": "holiday_date",
"id": "name",
"title": "description",
"allDay": "allDay"

View File

@@ -10,6 +10,19 @@ frappe.ui.form.on("Process Payroll", {
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},
setup: function(frm) {
frm.set_query("payment_account", function() {
var account_types = ["Bank", "Cash"];
return {
filters: {
"account_type": ["in", account_types],
"is_group": 0,
"company": frm.doc.company
}
}
})
},
refresh: function(frm) {
frm.disable_save();
},
@@ -50,16 +63,6 @@ frappe.ui.form.on("Process Payroll", {
}
})
}
},
account: function(frm) {
var account_types = ["Bank", "Cash"];
return {
filters: {
"account_type": ["in", account_types],
"is_group": 0,
"company": frm.doc.company
}
}
}
})

View File

@@ -2,7 +2,16 @@
// For license information, please see license.txt
frappe.ui.form.on('Salary Component', {
refresh: function(frm) {
setup: function(frm) {
frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {
"root_type": "Expense",
"is_group": 0,
"company": d.company
}
}
})
}
});

View File

@@ -156,11 +156,10 @@ class SalarySlip(TransactionBase):
cond = """and payroll_frequency = '%(payroll_frequency)s'""" % {"payroll_frequency": self.payroll_frequency}
st_name = frappe.db.sql("""select parent from `tabSalary Structure Employee`
where employee=%s
where employee=%s and (from_date <= %s or from_date <= %s)
and (to_date is null or to_date >= %s or to_date >= %s)
and parent in (select name from `tabSalary Structure`
where is_active = 'Yes'
and (from_date <= %s or from_date <= %s)
and (to_date is null or to_date >= %s or to_date >= %s) %s)
where is_active = 'Yes'%s)
"""% ('%s', '%s', '%s','%s','%s', cond),(self.employee, self.start_date, joining_date, self.end_date, relieving_date))
if st_name:

View File

@@ -7,7 +7,7 @@ import frappe
import erpnext
import calendar
from erpnext.accounts.utils import get_fiscal_year
from frappe.utils import getdate, nowdate, add_days
from frappe.utils import getdate, nowdate, add_days, add_months
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
from erpnext.hr.doctype.process_payroll.test_process_payroll import get_salary_component_account
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
@@ -257,7 +257,6 @@ def make_salary_structure(sal_struct, payroll_frequency, employee):
"doctype": "Salary Structure",
"name": sal_struct,
"company": erpnext.get_default_company(),
"from_date": nowdate(),
"employees": get_employee_details(employee),
"earnings": get_earnings_component(),
"deductions": get_deductions_component(),
@@ -270,7 +269,8 @@ def make_salary_structure(sal_struct, payroll_frequency, employee):
sal_struct.append("employees", {"employee": employee,
"employee_name": employee,
"base": 32000,
"variable": 3200
"variable": 3200,
"from_date": add_months(nowdate(),-1)
})
sal_struct.save()
sal_struct = sal_struct.name
@@ -279,7 +279,8 @@ def make_salary_structure(sal_struct, payroll_frequency, employee):
def get_employee_details(employee):
return [{"employee": employee,
"base": 25000,
"variable": 5000
"variable": 5000,
"from_date": add_months(nowdate(),-1)
}
]

View File

@@ -95,37 +95,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Monthly",
"depends_on": "eval:(!doc.salary_slip_based_on_timesheet)",
"fieldname": "payroll_frequency",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Payroll Frequency",
"length": 0,
"no_copy": 0,
"options": "\nMonthly\nFortnightly\nBimonthly\nWeekly\nDaily",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -184,6 +153,37 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Monthly",
"depends_on": "eval:(!doc.salary_slip_based_on_timesheet)",
"fieldname": "payroll_frequency",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Payroll Frequency",
"length": 0,
"no_copy": 0,
"options": "\nMonthly\nFortnightly\nBimonthly\nWeekly\nDaily",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -214,64 +214,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "from_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "From Date",
"length": 0,
"no_copy": 0,
"oldfieldname": "from_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "to_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "To Date",
"length": 0,
"no_copy": 0,
"oldfieldname": "to_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -894,7 +836,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-12-14 02:02:10.848614",
"modified": "2017-02-06 01:32:16.815429",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Structure",

View File

@@ -4,8 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, getdate, cint
from frappe.model.naming import make_autoname
from frappe.utils import flt, cint, getdate
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.model.document import Document
@@ -29,13 +28,13 @@ class SalaryStructure(Document):
def validate_amount(self):
if flt(self.net_pay) < 0 and self.salary_slip_based_on_timesheet:
frappe.throw(_("Net pay cannot be negative"))
def validate_joining_date(self):
for e in self.get('employees'):
joining_date = getdate(frappe.db.get_value("Employee", e.employee, "date_of_joining"))
if getdate(self.from_date) < joining_date:
frappe.throw(_("From Date in Salary Structure cannot be lesser than Employee Joining Date."))
if e.from_date and getdate(e.from_date) < joining_date:
frappe.throw(_("From Date {0} for Employee {1} cannot be before employee's joining Date {2}")
.format(e.from_date, e.employee, joining_date))
@frappe.whitelist()
def make_salary_slip(source_name, target_doc = None, employee = None, as_print = False, print_format = None):

View File

@@ -6,7 +6,7 @@ import frappe
import unittest
import erpnext
from frappe.utils.make_random import get_random
from frappe.utils import nowdate, add_days, add_years, getdate
from frappe.utils import nowdate, add_days, add_years, getdate, add_months
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
from erpnext.hr.doctype.salary_slip.test_salary_slip \
import make_earning_salary_component, make_deduction_salary_component
@@ -94,7 +94,6 @@ def make_salary_structure(sal_struct):
"doctype": "Salary Structure",
"name": sal_struct,
"company": erpnext.get_default_company(),
"from_date": nowdate(),
"employees": get_employee_details(),
"earnings": get_earnings_component(),
"deductions": get_deductions_component(),
@@ -108,11 +107,13 @@ def get_employee_details():
return [{"employee": frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"),
"base": 25000,
"variable": 5000,
"from_date": add_months(nowdate(),-1),
"idx": 1
},
{"employee": frappe.get_value("Employee", {"employee_name":"test_employee_2@salary.com"}, "name"),
"base": 15000,
"variable": 100,
"from_date": add_months(nowdate(),-1),
"idx": 2
}
]

View File

@@ -10,11 +10,13 @@
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee",
"fieldtype": "Link",
"hidden": 0,
@@ -22,6 +24,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Employee",
"length": 0,
"no_copy": 0,
@@ -31,6 +34,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -41,6 +45,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee_name",
"fieldtype": "Data",
"hidden": 0,
@@ -48,6 +53,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Employee Name",
"length": 0,
"no_copy": 0,
@@ -56,6 +62,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -66,14 +73,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base",
"fieldtype": "Currency",
"columns": 0,
"fieldname": "from_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Base",
"in_standard_filter": 0,
"label": "From Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -81,6 +90,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -91,6 +101,63 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "to_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "To Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "base",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Base",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "variable",
"fieldtype": "Currency",
"hidden": 0,
@@ -98,6 +165,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Variable",
"length": 0,
"no_copy": 0,
@@ -106,6 +174,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -123,7 +192,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-08-11 12:18:14.526977",
"modified": "2017-02-06 01:32:38.183131",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Structure Employee",

View File

@@ -2,8 +2,8 @@
{%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")] %}
</div>
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h5 class="text-center">Fiscal Year: {%= filters.fiscal_year %}</h5>
<h5 class="text-center">Month: {%= filters.month %}</h5>
<h5 class="text-center">From Date: {%= filters.from_date %}</h5>
<h5 class="text-center">To Date: {%= filters.to_date %}</h5>
<hr>
<table class="table table-bordered">
<thead>

View File

@@ -323,7 +323,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -378,7 +378,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -976,7 +976,7 @@
"read_only": 0,
"remember_last_selected_value": 1,
"report_hide": 0,
"reqd": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -1271,8 +1271,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-11-21 17:06:49.349654",
"modified_by": "rohit@erpnext.com",
"modified": "2017-02-21 13:10:27.394012",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",
"owner": "Administrator",

View File

@@ -321,9 +321,9 @@ class BOM(Document):
if d.bom_no:
d.rate = self.get_bom_unitcost(d.bom_no)
d.base_rate = d.rate * self.conversion_rate
d.base_rate = flt(d.rate) * flt(self.conversion_rate)
d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
d.base_amount = d.amount * self.conversion_rate
d.base_amount = d.amount * flt(self.conversion_rate)
d.qty_consumed_per_unit = flt(d.qty, self.precision("qty", d)) / flt(self.quantity, self.precision("quantity"))
total_rm_cost += d.amount
base_total_rm_cost += d.base_amount

View File

@@ -42,7 +42,7 @@ class ProductionPlanningTool(Document):
select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
from `tabSales Order` so, `tabSales Order Item` so_item
where so_item.parent = so.name
and so.docstatus = 1 and so.status != "Stopped"
and so.docstatus = 1 and so.status not in ("Stopped", "Closed")
and so.company = %(company)s
and so_item.qty > so_item.delivered_qty {0} {1}
and (exists (select name from `tabBOM` bom where bom.item=so_item.item_code

View File

@@ -363,4 +363,6 @@ erpnext.patches.v7_2.update_website_for_variant
erpnext.patches.v7_2.update_doctype_status
erpnext.patches.v7_2.update_salary_slips
erpnext.patches.v7_2.set_null_value_to_fields
erpnext.patches.v7_2.update_abbr_in_salary_slips
erpnext.patches.v7_2.update_abbr_in_salary_slips
erpnext.patches.v7_2.move_dates_from_salary_structure_to_employee
erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted

View File

@@ -0,0 +1,14 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
for doctype in ["Purchase Order", "Purchase Invoice", "Purchase Receipt"]:
child_table = 'Purchase Receipt Item Supplied' if doctype != 'Purchase Order' else 'Purchase Order Item Supplied'
for data in frappe.db.sql(""" select distinct `tab{doctype}`.name from `tab{doctype}` , `tab{child_table}`
where `tab{doctype}`.name = `tab{child_table}`.parent and `tab{doctype}`.docstatus != 2
and `tab{doctype}`.is_subcontracted = 'No' """.format(doctype = doctype, child_table = child_table), as_dict=1):
frappe.db.sql(""" delete from `tab{child_table}`
where parent = %s and parenttype = %s""".format(child_table= child_table), (data.name, doctype))

View File

@@ -0,0 +1,9 @@
import frappe
def execute():
frappe.reload_doc('hr', 'doctype', 'salary_structure_employee')
salary_structures = frappe.db.sql("""select name, to_date, from_date from `tabSalary Structure`""", as_dict=True)
for salary_structure in salary_structures:
frappe.db.sql(""" update `tabSalary Structure Employee` set from_date = %s, to_date = %s
where parent = %s """, (salary_structure.from_date, salary_structure.to_date or 'null', salary_structure.name))

View File

@@ -7,7 +7,7 @@ import frappe
import unittest
import datetime
from frappe.utils.make_random import get_random
from frappe.utils import now_datetime, nowdate, add_days
from frappe.utils import now_datetime, nowdate, add_days, add_months
from erpnext.projects.doctype.timesheet.timesheet import OverlapError
from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
@@ -88,7 +88,8 @@ def make_salary_structure(employee):
es = salary_structure.append('employees', {
"employee": employee,
"base": 1200
"base": 1200,
"from_date": add_months(nowdate(),-1)
})

View File

@@ -728,7 +728,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
"sales_partner": me.frm.doc.sales_partner,
"ignore_pricing_rule": me.frm.doc.ignore_pricing_rule,
"doctype": me.frm.doc.doctype,
"name": me.frm.doc.name
"name": me.frm.doc.name,
"is_return": cint(me.frm.doc.is_return)
};
},
@@ -781,7 +782,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if(k=="price_list_rate") {
if(flt(v) != flt(d.price_list_rate)) price_list_rate_changed = true;
}
frappe.model.set_value(d.doctype, d.name, k, v);
if(v) {
frappe.model.set_value(d.doctype, d.name, k, v);
}
}
}
@@ -1045,5 +1048,4 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
return method
},
});

View File

@@ -100,7 +100,12 @@ function load_erpnext_slides() {
fy = ["01-01", "12-31"];
next_year = current_year;
}
var year_start_date = current_year + "-" + fy[0];
if(year_start_date > get_today()) {
next_year = current_year
current_year -= 1;
}
slide.get_field("fy_start_date").set_input(current_year + "-" + fy[0]);
slide.get_field("fy_end_date").set_input(next_year + "-" + fy[1]);
}

View File

@@ -47,6 +47,7 @@ $.extend(erpnext, {
fields: [
{
"fieldtype": "Link",
"fieldname": "serial_no",
"options": "Serial No",
"label": __("Serial No"),
"get_query": function () {
@@ -60,6 +61,7 @@ $.extend(erpnext, {
},
{
"fieldtype": "Button",
"fieldname": "add",
"label": __("Add")
}
]

View File

@@ -46,11 +46,26 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) {
frm.updating_party_details = false;
if(callback) callback();
frm.refresh();
erpnext.utils.add_item(frm);
}
}
});
}
erpnext.utils.add_item = function(frm) {
if(frm.is_new()) {
var prev_route = frappe.get_prev_route();
if(prev_route[1]==='Item' && !(frm.doc.items && frm.doc.items.length)) {
// add row
item = frm.add_child('items');
frm.refresh_field('items');
// set item
frappe.model.set_value(item.doctype, item.name, 'item_code', prev_route[2]);
}
}
}
erpnext.utils.get_address_display = function(frm, address_field, display_field, is_your_company_address) {
if(frm.updating_party_details) return;

View File

@@ -34,7 +34,7 @@ class Assessment(Document):
validate_overlap_for(self, "Assessment", "student_group")
validate_overlap_for(self, "Assessment", "room")
validate_overlap_for(self, "Assessment", "supervisor", self.instructor)
validate_overlap_for(self, "Assessment", "supervisor", self.supervisor)
def get_assessment_list(doctype, txt, filters, limit_start, limit_page_length=20):

View File

@@ -4,6 +4,14 @@
{% include 'erpnext/selling/sales_common.js' %}
frappe.ui.form.on('Quotation', {
setup: function(frm) {
frm.custom_make_buttons = {
'Sales Order': 'Make Sales Order'
}
}
});
erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
onload: function(doc, dt, dn) {
var me = this;

View File

@@ -4,6 +4,14 @@
{% include 'erpnext/selling/sales_common.js' %}
frappe.ui.form.on("Sales Order", {
setup: function(frm) {
frm.custom_make_buttons = {
'Delivery Note': 'Delivery',
'Sales Invoice': 'Invoice',
'Material Request': 'Material Request',
'Purchase Order': 'Purchase Order'
}
},
onload: function(frm) {
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);

View File

@@ -50,7 +50,9 @@ class SalesOrder(SellingController):
# validate transaction date v/s delivery date
if self.delivery_date:
if getdate(self.transaction_date) > getdate(self.delivery_date):
frappe.throw(_("Expected Delivery Date cannot be before Sales Order Date"))
frappe.msgprint(_("Expected Delivery Date is be before Sales Order Date"),
indicator='orange',
title=_('Warning'))
def validate_po(self):
# validate p.o date v/s delivery date
@@ -81,7 +83,8 @@ class SalesOrder(SellingController):
unique_chk_list = set(check_list)
if len(unique_chk_list) != len(check_list) and \
not cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
frappe.msgprint(_("Warning: Same item has been entered multiple times."))
frappe.msgprint(_("Same item has been entered multiple times"),
title=_("Warning"), indicator='orange')
def product_bundle_has_stock_item(self, product_bundle):
"""Returns true if product bundle has stock item"""
@@ -442,7 +445,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
target.amount = flt(source.amount) - flt(source.billed_amt)
target.base_amount = target.amount * flt(source_parent.conversion_rate)
target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty
item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1)
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
or item.selling_cost_center \

View File

@@ -202,7 +202,9 @@ erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({
if (posting_date >= from_date && posting_date <= to_date) {
var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
me.item_by_name['Not Set'];
item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
if(item){
item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
}
}
}
});

View File

@@ -22,8 +22,8 @@ def get_domain(domain):
},
'Retail': {
'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Purchase Order', 'Warranty Claim',
'Accounts', 'Buying', 'ToDo'],
'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Purchase Order',
'Warranty Claim', 'Accounts', 'Task', 'Buying', 'ToDo'],
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'],
'properties': [
{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1},
@@ -36,7 +36,7 @@ def get_domain(domain):
},
'Distribution': {
'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order',
'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order', 'Task',
'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR', 'ToDo'],
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'],
'set_value': [
@@ -46,8 +46,8 @@ def get_domain(domain):
},
'Services': {
'desktop_icons': ['Project', 'Timesheet', 'Customer', 'Sales Order', 'Sales Invoice', 'Lead', 'Opportunity',
'Expense Claim', 'Employee', 'HR', 'ToDo'],
'desktop_icons': ['Project', 'Timesheet', 'Customer', 'Sales Order', 'Sales Invoice',
'Lead', 'Opportunity', 'Task', 'Expense Claim', 'Employee', 'HR', 'ToDo'],
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'],
'properties': [
{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
@@ -59,10 +59,10 @@ def get_domain(domain):
},
'Education': {
'desktop_icons': ['Student', 'Program', 'Course', 'Student Group', 'Instructor',
'Fees', 'ToDo', 'Schools'],
'Fees', 'Task', 'ToDo', 'Schools'],
'allow_roles': ['Academics User', 'Accounts User', 'Accounts Manager', 'Item Manager',
'Website Manager', 'HR User', 'HR Manager', 'Purchase User', 'Purchase Manager',
'Student'],
'Student', 'Projects User'],
'default_portal_role': 'Student'
},
}

View File

@@ -6,9 +6,11 @@ from __future__ import unicode_literals
import frappe
from frappe.utils.make_random import add_random_children
import frappe.utils
import random
import random, os, json
from frappe import _
from markdown2 import markdown
def make_sample_data():
def make_sample_data(args):
"""Create a few opportunities, quotes, material requests, issues, todos, projects
to help the user get started"""
items = frappe.get_all("Item", {'is_sales_item': 1})
@@ -22,7 +24,8 @@ def make_sample_data():
make_opportunity(items, customer)
make_quote(items, customer)
make_projects()
make_projects(args.get('domain'))
import_email_alert()
if items and warehouses:
make_material_request(frappe.get_all("Item"))
@@ -84,42 +87,91 @@ def make_material_request(items):
def make_issue():
pass
def make_projects():
def make_projects(domain):
current_date = frappe.utils.nowdate()
project = frappe.get_doc({
"doctype": "Project",
"project_name": "ERPNext Implementation",
})
current_date = frappe.utils.nowdate()
project.set("tasks", [
tasks = [
{
"title": "Explore ERPNext",
"start_date": current_date,
"end_date": current_date,
"file": "explore.md"
}]
if domain == 'Education':
tasks += [
{
"title": "Explore ERPNext",
"start_date": frappe.utils.add_days(current_date, 1),
"end_date": frappe.utils.add_days(current_date, 2)
"title": _("Setup your School in ERPNext"),
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 1),
"file": "school_masters.md"
},
{
"title": "Run Sales Cycle",
"start_date": frappe.utils.add_days(current_date, 2),
"end_date": frappe.utils.add_days(current_date, 3)
"title": "Setup Master Data",
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 1),
"file": "school_masters.md"
}]
else:
tasks += [
{
"title": "Setup Your Company",
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 1),
"file": "masters.md"
},
{
"title": "Run Billing Cycle",
"start_date": frappe.utils.add_days(current_date, 3),
"end_date": frappe.utils.add_days(current_date, 4)
"title": "Start Tracking your Sales",
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 2),
"file": "sales.md"
},
{
"title": "Run Purchase Cycle",
"start_date": frappe.utils.add_days(current_date, 4),
"end_date": frappe.utils.add_days(current_date, 5)
"title": "Start Managing Purchases",
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 3),
"file": "purchase.md"
},
{
"title": "Import Data",
"start_date": frappe.utils.add_days(current_date, 5),
"end_date": frappe.utils.add_days(current_date, 6)
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 4),
"file": "import_data.md"
},
{
"title": "Go Live!",
"start_date": frappe.utils.add_days(current_date, 6),
"end_date": frappe.utils.add_days(current_date, 7)
}])
"start_date": current_date,
"end_date": frappe.utils.add_days(current_date, 5),
"file": "go_live.md"
}]
for t in tasks:
with open (os.path.join(os.path.dirname(__file__), "tasks", t['file'])) as f:
t['description'] = markdown(f.read())
del t['file']
project.append('tasks', t)
project.insert(ignore_permissions=True)
def import_email_alert():
'''Import email alert for task start'''
with open (os.path.join(os.path.dirname(__file__), "tasks/task_alert.json")) as f:
email_alert = frappe.get_doc(json.loads(f.read())[0])
email_alert.insert()
# trigger the first message!
from frappe.email.doctype.email_alert.email_alert import trigger_daily_alerts
trigger_daily_alerts()
def test_sample():
frappe.db.sql('delete from `tabEmail Alert`')
frappe.db.sql('delete from tabProject')
frappe.db.sql('delete from tabTask')
make_projects('Education')
import_email_alert()

View File

@@ -60,7 +60,7 @@ def setup_complete(args=None):
if args.get("add_sample_data"):
try:
make_sample_data()
make_sample_data(args)
frappe.clear_cache()
except:
# clear message

View File

@@ -0,0 +1,7 @@
Thanks for checking this out! ❤️
If you are evaluating an ERP system for the first time, this is going to be quite a task! But don't worry, ERPNext is awesome.
First, get familiar with the surroundings. ERPNext covers a *lot of features*, go to the home page and click on the "Explore" icon.
All the best!

View File

@@ -0,0 +1,18 @@
Ready to go live with ERPNext? 🏁🏁🏁
Here are the steps:
1. Sync up your **Chart of Accounts**
3. Add your opening stock using **Stock Reconciliation**
4. Add your open invoices (both sales and purchase)
3. Add your opening account balances by making a **Journal Entry**
If you need help for going live, sign up for an account at erpnext.com or find a partner to help you with this.
Or you can watch these videos 📺:
Setup your chart of accounts: https://www.youtube.com/watch?v=AcfMCT7wLLo
Add Open Stock: https://www.youtube.com/watch?v=nlHX0ZZ84Lw
Add Opening Balances: https://www.youtube.com/watch?v=nlHX0ZZ84Lw

View File

@@ -0,0 +1,5 @@
Lets import some data! 💪💪
If you are already running a business, you most likely have your Items, Customers or Suppliers in some spreadsheet file somewhere, import it into ERPNext with the Data Import Tool.
Watch this video to get started: https://www.youtube.com/watch?v=Ta2Xx3QoK3E

View File

@@ -0,0 +1,7 @@
Start building a model of your business in ERPNext by adding your Items and Customers.
These videos 📺 will help you get started:
Adding Customers and Suppliers: https://www.youtube.com/watch?v=zsrrVDk6VBs
Adding Items and Prices: https://www.youtube.com/watch?v=FcOsV-e8ymE

View File

@@ -0,0 +1,10 @@
How to manage your purchasing in ERPNext 🛒🛒🛒:
1. Add a few **Suppliers**
2. Find out what you need by making **Material Requests**.
3. Now start placing orders via **Purchase Order**.
4. When your suppliers deliver, make **Purchase Receipts**
Now never run out of stock again! 😎
Watch this video 📺 to get an overview: https://www.youtube.com/watch?v=4TN9kPyfIqM

View File

@@ -0,0 +1,8 @@
Start managing your sales with ERPNext 🔔🔔🔔:
1. Add potential business contacts as **Leads**
2. Udpate your deals in pipeline in **Opportunities**
3. Send proposals to your leads or customers with **Quotations**
4. Track confirmed orders with **Sales Orders**
Watch this video 📺 to get an overview: https://www.youtube.com/watch?v=o9XCSZHJfpA

View File

@@ -0,0 +1,5 @@
Lets import some data! 💪💪
If you are already running a school, you most likely have your Students in some spreadsheet file somewhere. Import it into ERPNext with the Data Import Tool.
Watch this video to get started: https://www.youtube.com/watch?v=Ta2Xx3QoK3E

View File

@@ -0,0 +1,9 @@
Lets start making things in ERPNext that are representative of your institution.
1. Make a list of **Programs** that you offer
1. Add a few **Courses** that your programs cover
1. Create **Academic Terms** and **Academic Years**
1. Start adding **Students**
1. Group your students into **Batches**
Watch this video to learn more about ERPNext Schools: https://www.youtube.com/watch?v=f6foQOyGzdA

View File

@@ -0,0 +1,28 @@
[
{
"attach_print": 0,
"condition": "doc.status in ('Open', 'Overdue')",
"date_changed": "exp_end_date",
"days_in_advance": 0,
"docstatus": 0,
"doctype": "Email Alert",
"document_type": "Task",
"enabled": 1,
"event": "Days After",
"is_standard": 0,
"message": "<p>Task due today:</p>\n\n<div>\n{{ doc.description }}\n</div>\n\n<hr>\n<p style=\"font-size: 85%\">\nThis is a notification for a task that is due today, and a sample <b>Email Alert</b>. In ERPNext you can setup email alerts on anything, Invoices, Orders, Leads, Opportunities, so you never miss a thing.\n<br>To edit this, and setup other alerts, just type <b>Email Alert</b> in the search bar.</p>",
"method": null,
"modified": "2017-03-09 07:34:58.168370",
"module": null,
"name": "Task Due Alert",
"recipients": [
{
"cc": null,
"condition": null,
"email_by_document_field": "owner"
}
],
"subject": "{{ doc.subject }}",
"value_changed": null
}
]

View File

@@ -8,7 +8,7 @@ def get_notification_config():
{
"Issue": {"status": "Open"},
"Warranty Claim": {"status": "Open"},
"Task": {"status": "Overdue"},
"Task": {"status": ("in", ("Open", "Overdue"))},
"Project": {"status": "Open"},
"Item": {"total_projected_qty": ("<", 0)},
"Customer": {"status": "Open"},
@@ -23,11 +23,11 @@ def get_notification_config():
},
"Journal Entry": {"docstatus": 0},
"Sales Invoice": {
"outstanding_amount": (">", 0),
"docstatus": ("<", 2)
"outstanding_amount": (">", 0),
"docstatus": ("<", 2)
},
"Purchase Invoice": {
"outstanding_amount": (">", 0),
"outstanding_amount": (">", 0),
"docstatus": ("<", 2)
},
"Payment Entry": {"docstatus": 0},

View File

@@ -8,6 +8,12 @@ frappe.provide("erpnext.stock.delivery_note");
frappe.ui.form.on("Delivery Note", {
setup: function(frm) {
frm.custom_make_buttons = {
'Packing Slip': 'Packing Slip',
'Installation Note': 'Installation Note',
'Sales Invoice': 'Invoice',
'Stock Entry': 'Return',
},
frm.set_indicator_formatter('item_code',
function(doc) {
return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"

View File

@@ -1476,6 +1476,34 @@
"unique": 0,
"width": "120px"
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1691,7 +1719,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-12-24 12:33:37.728117",
"modified": "2017-02-07 01:22:03.047137",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",

View File

@@ -4,6 +4,13 @@
frappe.provide("erpnext.item");
frappe.ui.form.on("Item", {
setup: function(frm) {
frm.add_fetch('attribute', 'numeric_values', 'numeric_values');
frm.add_fetch('attribute', 'from_range', 'from_range');
frm.add_fetch('attribute', 'to_range', 'to_range');
frm.add_fetch('attribute', 'increment', 'increment');
frm.add_fetch('tax_type', 'tax_rate', 'tax_rate');
},
onload: function(frm) {
erpnext.item.setup_queries(frm);
if (frm.doc.variant_of){
@@ -16,7 +23,6 @@ frappe.ui.form.on("Item", {
},
refresh: function(frm) {
if(frm.doc.is_stock_item) {
frm.add_custom_button(__("Balance"), function() {
frappe.route_options = {
@@ -54,15 +60,15 @@ frappe.ui.form.on("Item", {
}, __("View"));
frm.add_custom_button(__("Variant"), function() {
erpnext.item.make_variant()
erpnext.item.make_variant(frm);
}, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
frm.page.set_inner_btn_group_as_primary(__("Make"));
}
if (frm.doc.variant_of) {
frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set", [frm.doc.variant_of]), true);
}
if (frappe.defaults.get_default("item_naming_by")!="Naming Series") {
if (frappe.defaults.get_default("item_naming_by")!="Naming Series" || frm.doc.variant_of) {
frm.toggle_display("naming_series", false);
} else {
erpnext.toggle_naming_series();
@@ -79,6 +85,17 @@ frappe.ui.form.on("Item", {
frm.toggle_enable("is_fixed_asset", (frm.doc.__islocal || (!frm.doc.is_stock_item &&
((frm.doc.__onload && frm.doc.__onload.asset_exists) ? false : true))));
frm.add_custom_button(__('Duplicate'), function() {
var new_item = frappe.model.copy_doc(frm.doc);
if(new_item.item_name===new_item.item_code) {
new_item.item_name = null;
}
if(new_item.description===new_item.description) {
new_item.description = null;
}
frappe.set_route('Form', 'Item', new_item.name);
});
},
validate: function(frm){
@@ -88,13 +105,13 @@ frappe.ui.form.on("Item", {
image: function(frm) {
refresh_field("image_view");
},
is_fixed_asset: function(frm) {
if (frm.doc.is_fixed_asset) {
frm.set_value("is_stock_item", 0);
}
},
page_name: frappe.utils.warn_page_name_change,
item_code: function(frm) {
@@ -191,15 +208,15 @@ $.extend(erpnext.item, {
frm.fields_dict.reorder_levels.grid.get_field("warehouse").get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
var filters = {
"is_group": 0
}
if (d.parent_warehouse) {
filters.extend({"parent_warehouse": d.warehouse_group})
}
return {
filters: filters
}
@@ -212,7 +229,8 @@ $.extend(erpnext.item, {
return;
frappe.require('assets/js/item-dashboard.min.js', function() {
var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;"><a href="#stock-balance">Stock Levels</a></h5>');
var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;">\
<a href="#stock-balance">Stock Levels</a></h5>');
erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
parent: section,
item_code: frm.doc.name
@@ -234,12 +252,12 @@ $.extend(erpnext.item, {
}
},
make_variant: function(doc) {
make_variant: function(frm) {
var fields = []
for(var i=0;i< cur_frm.doc.attributes.length;i++){
for(var i=0;i< frm.doc.attributes.length;i++){
var fieldtype, desc;
var row = cur_frm.doc.attributes[i];
var row = frm.doc.attributes[i];
if (row.numeric_values){
fieldtype = "Float";
desc = "Min Value: "+ row.from_range +" , Max Value: "+ row.to_range +", in Increments of: "+ row.increment
@@ -268,7 +286,7 @@ $.extend(erpnext.item, {
frappe.call({
method:"erpnext.controllers.item_variant.get_variant",
args: {
"template": cur_frm.doc.name,
"template": frm.doc.name,
"args": d.get_values()
},
callback: function(r) {
@@ -290,7 +308,7 @@ $.extend(erpnext.item, {
frappe.call({
method:"erpnext.controllers.item_variant.create_variant",
args: {
"item": cur_frm.doc.name,
"item": frm.doc.name,
"args": d.get_values()
},
callback: function(r) {
@@ -358,10 +376,3 @@ $.extend(erpnext.item, {
frm.fields_dict.attributes.grid.toggle_enable("attribute_value", !frm.doc.variant_of);
}
});
cur_frm.add_fetch('attribute', 'numeric_values', 'numeric_values');
cur_frm.add_fetch('attribute', 'from_range', 'from_range');
cur_frm.add_fetch('attribute', 'to_range', 'to_range');
cur_frm.add_fetch('attribute', 'increment', 'increment');
cur_frm.add_fetch('tax_type', 'tax_rate', 'tax_rate');

View File

@@ -87,7 +87,7 @@
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 1,
"no_copy": 0,
"oldfieldname": "item_code",
"oldfieldtype": "Data",
"permlevel": 0,
@@ -134,7 +134,7 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "item_name",
@@ -156,7 +156,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
@@ -2713,7 +2713,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2017-01-18 17:43:20.262925",
"modified": "2017-02-17 04:00:38.825621",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@@ -7,7 +7,7 @@ import erpnext
import json
import itertools
from frappe import msgprint, _
from frappe.utils import cstr, flt, cint, getdate, now_datetime, formatdate, strip
from frappe.utils import cstr, flt, cint, getdate, now_datetime, formatdate, strip, get_timestamp
from frappe.website.website_generator import WebsiteGenerator
from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for, get_parent_item_groups
from frappe.website.render import clear_cache
@@ -63,6 +63,9 @@ class Item(WebsiteGenerator):
def validate(self):
super(Item, self).validate()
if not self.item_name:
self.item_name = self.item_code
if not self.description:
self.description = self.item_name
@@ -93,7 +96,6 @@ class Item(WebsiteGenerator):
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
def on_update(self):
super(Item, self).on_update()
invalidate_cache_for_item(self)
self.validate_name_with_item_group()
self.update_item_price()
@@ -452,24 +454,32 @@ class Item(WebsiteGenerator):
"valuation_method", "has_batch_no", "is_fixed_asset")
vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True)
if not vals.get('valuation_method') and self.get('valuation_method'):
vals['valuation_method'] = frappe.db.get_single_value("Stock Settings", "valuation_method") or "FIFO"
if vals:
for key in to_check:
if self.get(key) != vals.get(key):
if not self.check_if_linked_document_exists():
if cstr(self.get(key)) != cstr(vals.get(key)):
if not self.check_if_linked_document_exists(key):
break # no linked document, allowed
else:
frappe.throw(_("As there are existing transactions for this item, you can not change the value of {0}").format(frappe.bold(self.meta.get_label(key))))
frappe.throw(_("As there are existing transactions against item {0}, you can not change the value of {1}").format(self.name, frappe.bold(self.meta.get_label(key))))
if vals and not self.is_fixed_asset and self.is_fixed_asset != vals.is_fixed_asset:
asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1)
if asset:
frappe.throw(_('"Is Fixed Asset" cannot be unchecked, as Asset record exists against the item'))
def check_if_linked_document_exists(self):
for doctype in ("Sales Order Item", "Delivery Note Item", "Sales Invoice Item",
"Material Request Item", "Purchase Order Item", "Purchase Receipt Item",
"Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"):
def check_if_linked_document_exists(self, key):
linked_doctypes = ["Delivery Note Item", "Sales Invoice Item", "Purchase Receipt Item",
"Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"]
# For "Is Stock Item", following doctypes is important
# because reserved_qty, ordered_qty and requested_qty updated from these doctypes
if key == "is_stock_item":
linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"]
for doctype in linked_doctypes:
if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \
frappe.db.get_value("Production Order",
filters={"production_item": self.name, "docstatus": 1}):
@@ -660,10 +670,17 @@ class Item(WebsiteGenerator):
def get_timeline_data(doctype, name):
'''returns timeline data based on stock ledger entry'''
return dict(frappe.db.sql('''select unix_timestamp(posting_date), count(*)
out = {}
items = dict(frappe.db.sql('''select posting_date, count(*)
from `tabStock Ledger Entry` where item_code=%s
and posting_date > date_sub(curdate(), interval 1 year)
group by posting_date''', name))
for date, count in items.iteritems():
timestamp = get_timestamp(date)
out.update({ timestamp: count })
return out
def validate_end_of_life(item_code, end_of_life=None, disabled=None, verbose=1):
if (not end_of_life) or (disabled is None):

View File

@@ -162,14 +162,14 @@ class TestItem(unittest.TestCase):
variant = create_variant("_Test Numeric Template Item",
{"Test Size": "Large", "Test Item Length": 1.1})
self.assertEquals(variant.item_code, None)
self.assertEquals(variant.item_code, "_Test Numeric Template Item-L-1.1")
variant.item_code = "_Test Numeric Variant-L-1.1"
variant.item_name = "_Test Numeric Variant Large 1.1m"
self.assertRaises(InvalidItemAttributeValueError, variant.save)
variant = create_variant("_Test Numeric Template Item",
{"Test Size": "Large", "Test Item Length": 1.5})
self.assertEquals(variant.item_code, None)
self.assertEquals(variant.item_code, "_Test Numeric Template Item-L-1.5")
variant.item_code = "_Test Numeric Variant-L-1.5"
variant.item_name = "_Test Numeric Variant Large 1.5m"
variant.save()

View File

@@ -69,6 +69,33 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -151,6 +178,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Currency",
"length": 0,
"no_copy": 0,
"options": "Currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -211,34 +266,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Currency",
"length": 0,
"no_copy": 0,
"options": "Currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -318,61 +345,6 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_12",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "bulk_import_help",
"fieldtype": "HTML",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Bulk Import Help",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@@ -386,7 +358,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-12-15 14:52:09.842544",
"modified": "2017-02-17 04:24:30.453863",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Price",
@@ -435,7 +407,7 @@
"write": 1
}
],
"quick_entry": 0,
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"sort_order": "ASC",

View File

@@ -4,7 +4,19 @@
{% include 'erpnext/buying/doctype/purchase_common/purchase_common.js' %};
frappe.ui.form.on('Material Request', {
setup: function(frm) {
frm.custom_make_buttons = {
'Stock Entry': 'Issue Material',
'Purchase Order': 'Purchase Order',
'Request for Quotation': 'Request for Quotation',
'Supplier Quotation': 'Supplier Quotation',
'Production Order': 'Production Order'
}
},
onload: function(frm) {
// add item, if previous view was item
erpnext.utils.add_item(frm);
// formatter for material request item
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" }),
@@ -71,7 +83,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
if(doc.material_request_type === "Manufacture" && doc.status === "Submitted")
cur_frm.add_custom_button(__("Production Order"),
this.raise_production_orders, __("Make"));
function() { me.raise_production_orders() }, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
@@ -202,10 +214,16 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
},
raise_production_orders: function() {
var me = this;
frappe.call({
method:"erpnext.stock.doctype.material_request.material_request.raise_production_orders",
args: {
"material_request": cur_frm.doc.name
"material_request": me.frm.doc.name
},
callback: function(r) {
if(r.message.length) {
me.frm.reload_doc();
}
}
});
}

View File

@@ -6,6 +6,12 @@
frappe.provide("erpnext.stock");
frappe.ui.form.on("Purchase Receipt", {
setup: function(frm) {
frm.custom_make_buttons = {
'Stock Entry': 'Return',
'Purchase Invoice': 'Invoice'
}
},
onload: function(frm) {
$.each(["warehouse", "rejected_warehouse"], function(i, field) {
frm.set_query(field, "items", function() {
@@ -26,7 +32,7 @@ frappe.ui.form.on("Purchase Receipt", {
]
}
});
}
});

View File

@@ -1574,6 +1574,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1885,7 +1913,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-16 16:04:21.778869",
"modified": "2017-02-07 01:21:36.348032",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

View File

@@ -66,6 +66,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
this.show_general_ledger();
}
erpnext.hide_company();
erpnext.utils.add_item(this.frm);
},
on_submit: function() {
@@ -176,7 +177,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
excise.voucher_type = 'Excise Entry';
frappe.set_route('Form', 'Journal Entry', excise.name);
}, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
},
items_add: function(doc, cdt, cdn) {

View File

@@ -10,6 +10,7 @@
"doctype": "DocType",
"document_type": "Other",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
@@ -23,6 +24,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Barcode",
"length": 0,
"no_copy": 0,
@@ -50,6 +52,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -76,6 +79,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Source Warehouse",
"length": 0,
"no_copy": 0,
@@ -105,6 +109,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -130,6 +135,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Target Warehouse",
"length": 0,
"no_copy": 0,
@@ -159,6 +165,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -184,6 +191,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 0,
@@ -213,6 +221,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -238,6 +247,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
@@ -264,6 +274,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -291,6 +302,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -321,6 +333,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -347,6 +360,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@@ -374,6 +388,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image View",
"length": 0,
"no_copy": 0,
@@ -402,6 +417,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quantity and Rate",
"length": 0,
"no_copy": 0,
@@ -420,7 +436,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 1,
"columns": 3,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -428,6 +444,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Qty",
"length": 0,
"no_copy": 0,
@@ -448,14 +465,15 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 2,
"columns": 0,
"fieldname": "basic_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Basic Rate (as per Stock UOM)",
"length": 0,
"no_copy": 0,
@@ -485,6 +503,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Basic Amount",
"length": 0,
"no_copy": 0,
@@ -513,6 +532,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Additional Cost",
"length": 0,
"no_copy": 0,
@@ -541,6 +561,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amount",
"length": 0,
"no_copy": 0,
@@ -570,6 +591,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Rate",
"length": 0,
"no_copy": 0,
@@ -598,6 +620,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -623,6 +646,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "UOM",
"length": 0,
"no_copy": 0,
@@ -652,6 +676,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Conversion Factor",
"length": 0,
"no_copy": 0,
@@ -680,6 +705,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Stock UOM",
"length": 0,
"no_copy": 0,
@@ -709,6 +735,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Qty as per Stock UOM",
"length": 0,
"no_copy": 0,
@@ -737,6 +764,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial No / Batch",
"length": 0,
"no_copy": 0,
@@ -763,6 +791,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial No",
"length": 0,
"no_copy": 1,
@@ -791,6 +820,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -816,6 +846,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Batch No",
"length": 0,
"no_copy": 0,
@@ -845,6 +876,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Accounting",
"length": 0,
"no_copy": 0,
@@ -872,6 +904,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Difference Account",
"length": 0,
"no_copy": 0,
@@ -899,6 +932,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -926,6 +960,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Cost Center",
"length": 0,
"no_copy": 0,
@@ -953,6 +988,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "More Information",
"length": 0,
"no_copy": 0,
@@ -967,6 +1003,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
@@ -979,6 +1043,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Actual Qty (at source/target)",
"length": 0,
"no_copy": 1,
@@ -1008,6 +1073,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "BOM No",
"length": 0,
"no_copy": 0,
@@ -1035,6 +1101,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1061,6 +1128,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Material Request",
"length": 0,
"no_copy": 1,
@@ -1088,6 +1156,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Material Request Item",
"length": 0,
"no_copy": 1,
@@ -1114,7 +1183,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-27 15:19:26.597414",
"modified": "2017-02-07 01:21:14.367586",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@@ -258,11 +258,14 @@ class update_entries_after(object):
if not self.valuation_rate and actual_qty > 0:
self.valuation_rate = sle.incoming_rate
# Get valuation rate from previous SLE or Item master, if item is not a sample item
if not self.valuation_rate and sle.voucher_detail_no:
is_sample_item = self.check_if_sample_item(sle.voucher_type, sle.voucher_detail_no)
if not is_sample_item:
self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no, self.allow_zero_rate)
if not self.valuation_rate:
self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no, self.allow_zero_rate)
def get_fifo_values(self, sle):
incoming_rate = flt(sle.incoming_rate)
actual_qty = flt(sle.actual_qty)
@@ -286,8 +289,13 @@ class update_entries_after(object):
while qty_to_pop:
if not self.stock_queue:
# Get valuation rate from last sle if exists or from valuation rate field in item master
_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no, self.allow_zero_rate)
is_sample_item = self.check_if_sample_item(sle.voucher_type, sle.voucher_detail_no)
if not is_sample_item:
_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no, self.allow_zero_rate)
else:
_rate = 0
self.stock_queue.append([0, _rate])
index = None
@@ -333,7 +341,11 @@ class update_entries_after(object):
if not self.stock_queue:
self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate])
def check_if_sample_item(self, voucher_type, voucher_detail_no):
ref_item_dt = voucher_type + (" Detail" if voucher_type == "Stock Entry" else " Item")
return frappe.db.get_value(ref_item_dt, voucher_detail_no, "is_sample_item")
def get_sle_before_datetime(self):
"""get previous stock ledger entry before current time-bucket"""
return get_stock_ledger_entries(self.args, "<", "desc", "limit 1", for_update=False)
@@ -432,7 +444,6 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no, allow_zer
if not allow_zero_rate and not valuation_rate \
and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries (for booking expenses). Please create an incoming stock transaction or mention valuation rate in Item record, and then try submiting {1} {2}")
.format(item_code, voucher_type, voucher_no))
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a sample item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry").format(item_code, voucher_type, voucher_no))
return valuation_rate

View File

@@ -15,7 +15,7 @@
{% endif %}
<p style='margin-top: 30px'>
<a class='btn btn-primary'
href='/job_application?job_title={{ doc.name }}'>
href='/job_application?new=1&job_title={{ doc.name }}'>
{{ _("Apply Now") }}</a>
</p>

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
## temp utility
import frappe
from erpnext.utilities.activation import get_level
def update_doctypes():
for d in frappe.db.sql("""select df.parent, df.fieldname
@@ -29,5 +30,6 @@ def get_site_info(site_info):
return {
'company': company,
'domain': domain
'domain': domain,
'activation': get_level()
}

View File

@@ -0,0 +1,151 @@
import frappe, erpnext
from frappe import _
def get_level():
activation_level = 0
if frappe.db.get_single_value('System Settings', 'setup_complete'):
activation_level = 1
if frappe.db.count('Item') > 5:
activation_level += 1
if frappe.db.count('Customer') > 5:
activation_level += 1
if frappe.db.count('Sales Order') > 2:
activation_level += 1
if frappe.db.count('Purchase Order') > 2:
activation_level += 1
if frappe.db.count('Employee') > 3:
activation_level += 1
if frappe.db.count('Lead') > 3:
activation_level += 1
if frappe.db.count('Payment Entry') > 2:
activation_level += 1
if frappe.db.count('Communication', dict(communication_medium='Email')) > 10:
activation_level += 1
if frappe.db.count('User') > 5:
activation_level += 1
if frappe.db.count('Student') > 5:
activation_level += 1
if frappe.db.count('Student Batch') > 5:
activation_level += 1
if frappe.db.count('Instructor') > 5:
activation_level += 1
# recent login
if frappe.db.sql('select name from tabUser where last_login > date_sub(now(), interval 2 day) limit 1'):
activation_level += 1
return activation_level
def get_help_messages():
'''Returns help messages to be shown on Desktop'''
if get_level() > 6:
return []
messages = []
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
message_settings = [
frappe._dict(
doctype='Lead',
title=_('Create Leads'),
description=_('Leads help you get business, add all your contacts and more as your leads'),
action=_('Make Lead'),
route='List/Lead',
domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
),
frappe._dict(
doctype='Quotation',
title=_('Create customer quotes'),
description=_('Quotations are proposals, bids you have sent to your customers'),
action=_('Make Quotation'),
route='List/Quotation',
domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
),
frappe._dict(
doctype='Sales Order',
title=_('Manage your orders'),
description=_('Make Sales Orders to help you plan your work and deliver on-time'),
action=_('Make Sales Order'),
route='List/Sales Order',
domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
),
frappe._dict(
doctype='Purchase Order',
title=_('Create Purchase Orders'),
description=_('Purchase orders help you plan and follow up on your purchases'),
action=_('Make Purchase Order'),
route='List/Purchase Order',
domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
),
frappe._dict(
doctype='User',
title=_('Create Users'),
description=_('Add the rest of your organization as your users. You can also add invite Customers to your portal by adding them from Contacts'),
action=_('Make User'),
route='List/User',
domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
),
frappe._dict(
doctype='Timesheet',
title=_('Add Timesheets'),
description=_('Timesheets help keep track of time, cost and billing for activites done by your team'),
action=_('Make Timesheet'),
route='List/Timesheet',
domain=('Services',),
target=5
),
frappe._dict(
doctype='Student',
title=_('Add Students'),
description=_('Students are at the heart of the system, add all your students'),
action=_('Make Student'),
route='List/Student',
domain=('Education',),
target=5
),
frappe._dict(
doctype='Student Batch',
title=_('Group your students in batches'),
description=_('Student Batches help you track attendance, assessments and fees for students'),
action=_('Make Student Batch'),
route='List/Student Batch',
domain=('Education',),
target=3
),
frappe._dict(
doctype='Employee',
title=_('Create Employee Records'),
description=_('Create Employee records to manage leaves, expense claims and payroll'),
action=_('Make Employee'),
route='List/Employee',
target=3
)
]
for m in message_settings:
if not m.domain or domain in m.domain:
m.count = frappe.db.count(m.doctype)
if m.count < m.target:
messages.append(m)
return messages