Compare commits

...

121 Commits

Author SHA1 Message Date
Nabin Hait
0725eab858 Merge branch 'hotfix' 2018-02-07 16:07:19 +05:30
Nabin Hait
67d6dc1ac6 bumped to version 10.0.20 2018-02-07 16:37:19 +06:00
Nabin Hait
33f967d97c Account name length fixed in HUngary and Germen COA 2018-02-07 16:00:42 +05:30
rohitwaghchaure
9a5037193f Removed DR/CR from balance column (#12791)
* Removed DR/CR from balance column

* Update general_ledger.html

* Update general_ledger.py
2018-02-07 12:10:14 +05:30
Shreya Shah
80423de611 posting date in journal entry should not be nowdate (#12801) 2018-02-07 12:08:08 +05:30
Manas Solanki
b4693c6957 fix for making the invoice from the timesheet (#12803) 2018-02-07 12:07:27 +05:30
rohitwaghchaure
ba31369764 Merge pull request #12773 from rohitwaghchaure/change_amount_issue
[Fix] Incorrect change amount if enabled rounded total
2018-02-06 17:27:04 +05:30
Rohit Waghchaure
e8d22bb999 [Fix] Incorrect change amount if enabled rounded total 2018-02-05 18:13:29 +05:30
Vishal Dhayagude
cce29fabf4 [fix] validation between Selling Price and Valuation Rate should not be validated in the Sales Return entry (#12767) 2018-02-05 12:25:51 +05:30
rohitwaghchaure
0f5c18ca81 [Fix] For non stock item, not able to place an order from shopping cart (#12758) 2018-02-05 12:25:02 +05:30
rohitwaghchaure
a4c40e0fd6 [Fix] After accesing POS page, it does not work when going back from another page (#12763) 2018-02-05 12:24:06 +05:30
Nabin Hait
59aca770c1 Merge branch 'hotfix' 2018-02-03 09:13:12 +05:30
Nabin Hait
9d2f04139c bumped to version 10.0.19 2018-02-03 09:43:12 +06:00
Saurabh
41c47e3ffa Merge pull request #12677 from tundebabzy/issue-12535-1
Website Cart Should Not Show Expired Items As 'In Stock' #12535
2018-02-02 15:58:07 +05:30
rohitwaghchaure
cf6360d825 Merge pull request #12739 from jay-parikh/hotfix
Enable/Disable Discount in POS using POS Profile #11748
2018-02-02 13:12:38 +05:30
Jay Parikh
2c95ab3897 Code fix for Enable/Disable Discount in POS using POS Profile #11748 2018-02-01 22:52:58 -08:00
Jay Parikh
171e5af995 Fixed indentation issue in pull # 11748 2018-02-01 21:39:20 -08:00
tundebabzy
5df64d84a1 code review fix 2018-02-01 17:05:54 +01:00
tundebabzy
a829d5a4d5 Merge branch 'hotfix' into issue-12535-1 2018-02-01 16:56:05 +01:00
Nabin Hait
91c5e4c429 Validate rate in PO with supplier quotation only if checking is enabled via Buying Settings (#12734) 2018-02-01 18:58:22 +05:30
Nabin Hait
cae13bf048 Fixes in purchase register report (#12737) 2018-02-01 18:58:14 +05:30
Nabin Hait
2aba97bff1 Fetch items from BOM in Material Request 2018-02-01 18:52:50 +05:30
Jay Parikh
d4359faa31 Enable/Disable Discount in POS using POS Profile #11748 2018-02-01 04:26:24 -08:00
rohitwaghchaure
c830344ca7 Merge pull request #12738 from rohitwaghchaure/hotfix_pos_issue
[Fix] Pay button not working in pos
2018-02-01 17:39:33 +05:30
Rohit Waghchaure
d85247cd7a [Fix] Pay button not working in pos 2018-02-01 17:18:38 +05:30
Nabin Hait
b9ce104b09 Opening balance in stock ledger report (#12729) 2018-02-01 14:58:50 +05:30
Rushabh Mehta
82fa04ce32 Update projects.py 2018-01-31 22:20:14 +05:30
rohitwaghchaure
32a5f38595 Merge pull request #12633 from vishdha/issue_12388
[fix] Sales order link to purchase order not working fixed
2018-01-31 17:30:43 +05:30
tundebabzy
4990cf7783 remove stray code 2018-01-31 11:35:56 +01:00
Nabin Hait
8f38a17c14 Merge branch 'hotfix' 2018-01-31 15:39:15 +05:30
Nabin Hait
bff1971bb2 bumped to version 10.0.18 2018-01-31 16:09:15 +06:00
Zarrar
4e05f02038 error in throw message rectify (#12719) 2018-01-31 15:33:51 +05:30
Nabin Hait
7918b92d95 Invalid date value comparison, fixes for mariadb 10.2.3+ 2018-01-31 15:30:03 +05:30
tundebabzy
29c8142678 refactor adjust_for_expired_items and others as per code review
use get_all instead of get_list

rename `adjust_for_expired_items` to `adjust_qty_for_expired_items`
2018-01-31 10:51:06 +01:00
vishdha
df1653827f [fix] Patch for material request to purchase order added 2018-01-31 15:11:24 +05:30
Vishal
fc05cc4e70 [fix] link with supplier quotation to purchase order 2018-01-31 15:10:39 +05:30
Vishal
4dc329f5ea [fix] Sales order link to purchase order not working fixed 2018-01-31 15:10:39 +05:30
Nabin Hait
e37e5d6134 minor fix in patch for mariadb version 2018-01-31 15:00:18 +05:30
Zarrar
dea99cc3a8 treeview not set when routed from bom form (#12707) 2018-01-31 13:07:04 +05:30
Nabin Hait
bc640fe6a6 minor fix in old patch 2018-01-30 19:26:28 +05:30
Nabin Hait
dba5e7645b Minor fix in old patch 2018-01-30 16:38:47 +05:30
Nabin Hait
927d13fadb Minor fix in old patch 2018-01-30 15:59:44 +05:30
Nabin Hait
0f75a022f2 Minor fix in old patch 2018-01-30 15:32:17 +05:30
Nabin Hait
4eae6c985c Fixed test records for supplier 2018-01-30 15:27:29 +05:30
Nabin Hait
b9e8b917b6 Removed ui-tests from travis 2018-01-30 15:08:33 +05:30
tundebabzy
2f4854ad1a create new dialog everytime (#12696) 2018-01-30 12:18:15 +05:30
Nabin Hait
585254456e Check credit limit while making DN, if bypassed on SO (#12702) 2018-01-30 12:11:22 +05:30
rohitwaghchaure
ce5b93ca77 [Fix] Allow user to edit rate in online POS (#12701) 2018-01-30 10:39:46 +05:30
Saurabh
32c2c474fd Merge branch 'hotfix' 2018-01-29 18:53:53 +05:30
Saurabh
f3d30c5bb9 bumped to version 10.0.17 2018-01-29 19:23:53 +06:00
Saurabh
8df20f6501 Merge pull request #12695 from Zlash65/fix-dn
[Hotfix] Stock entry issue
2018-01-29 18:52:32 +05:30
Zlash65
f7a4d4221b check precision with qty 2018-01-29 18:47:21 +05:30
Shreya Shah
406d449e12 fix posting date in journal entry on load (#12694) 2018-01-29 18:01:20 +05:30
Saurabh
e2021252d9 Merge branch 'hotfix' 2018-01-29 17:42:37 +05:30
Saurabh
373066e0ca bumped to version 10.0.16 2018-01-29 18:12:37 +06:00
rohitwaghchaure
52beb77539 Don't validate payment terms for POS (#12692) 2018-01-29 17:40:44 +05:30
Saurabh
e1e690541c set payment term name in payment_terms (#12693) 2018-01-29 17:39:56 +05:30
rohitwaghchaure
86c7ede321 Merge pull request #12690 from rohitwaghchaure/subscription_sent_email_issue
[Fix] Subscription send notification issue
2018-01-29 17:01:00 +05:30
Rohit Waghchaure
7e033aae11 [Fix] Subscription send notification issue 2018-01-29 16:53:37 +05:30
Zarrar
5bf77beb83 precision while checking qty (#12688) 2018-01-29 16:47:52 +05:30
Nabin Hait
1e1b2364ab Optimization: don't update outstanding amount while cancelling payment entry for advance adjustment (#12689) 2018-01-29 16:45:43 +05:30
Saurabh
4d50fac869 Merge branch 'hotfix' 2018-01-29 16:24:55 +05:30
Saurabh
05eed01eec bumped to version 10.0.15 2018-01-29 16:54:55 +06:00
Nabin Hait
cfa9d1adb7 Patch: Create Payment Terms based on default credit days set in company and use it while setting due_date (#12685)
* Patch: Create Payment Terms based on default credit days set in company and use it while setting due_date

* Payment Terms patch for credit days defined in customer group
2018-01-29 16:07:21 +05:30
tundebabzy
c7c1defe64 after adjusting stock_qty for expired, set in_stock flag 2018-01-27 12:16:13 +01:00
tundebabzy
c14f1f145b adjust stock_qty for expired quantities
adjust based on warehouse

add parameters to `get_qty_in_stock` so it can be useful in other parts of the code base
2018-01-27 12:16:13 +01:00
tundebabzy
186bea6e95 Merge pull request #12674 from tundebabzy/issue-12673-1
Batch List Shows Wrong Expired Status For Batches #12673
2018-01-27 07:50:12 +01:00
tundebabzy
794ecda618 corrected wrong get_diff arguments 2018-01-27 05:54:40 +01:00
Manas Solanki
8985077652 Assessment Module Report (#12605)
* updated course wise assessment report

* added new report Final assessment grades
2018-01-26 11:20:33 +05:30
rohitwaghchaure
bfa898ff9b [Fix] System pull the valuation rate even if allow zero valuation rate is enabled (#12537) 2018-01-26 10:59:00 +05:30
tundebabzy
0a33a359ca Merge pull request #12659 from tundebabzy/issue-12658
set batch number only in Sales Invoice and Delivery Note - #12659
2018-01-26 06:10:13 +01:00
tundebabzy
f9b5c74871 set batch number only in Sales Invoice and Delivery Note 2018-01-25 19:21:05 +01:00
Prateeksha Singh
4c58299eb0 [fix] encode if letterhead 2018-01-25 17:29:57 +05:30
rohitwaghchaure
fc318ebeff Merge pull request #12642 from mntechnique/fix-to-issue-#12512
Fix to issue #12512
2018-01-25 17:13:05 +05:30
rohitwaghchaure
3574c96c8c Update item_dashboard_list.html 2018-01-25 17:11:52 +05:30
Vinayak Jethe
5743ce2b6b Made changes as per suggestions 2018-01-25 13:37:20 +05:30
Vinayak Jethe
84f7727432 Merge branch 'hotfix' of https://github.com/frappe/erpnext into fix-to-issue-#12512 2018-01-24 19:48:24 +05:30
Vinayak Jethe
549c196beb Fixes issue #12512 2018-01-24 19:47:59 +05:30
rohitwaghchaure
1bf4015567 Merge pull request #12632 from mntechnique/solves_issue_#12588
Solves issue #12588
2018-01-24 18:26:39 +05:30
Saurabh
cadd31cb0c [Fix] Solves issue #12588 2018-01-24 16:38:22 +05:30
Vinayak Jethe
46c82c45e0 Revised changes for codacy 2018-01-24 14:24:58 +05:30
Vinayak Jethe
2c8ce5a717 Fixes issue #12512 2018-01-24 13:51:26 +05:30
Saurabh
6c3289dbcd Merge branch 'hotfix' 2018-01-24 11:22:54 +05:30
Saurabh
381d452b78 bumped to version 10.0.14 2018-01-24 11:52:53 +06:00
Saurabh
769874d0e9 Merge pull request #12628 from saurabh6790/enable_rename_option
[fix] enable rename for payment terms and payment term template
2018-01-24 11:15:53 +05:30
Saurabh
6cc10104f0 [fix] enable rename for payment terms and payment term template 2018-01-24 11:15:02 +05:30
Saurabh
5b67f4d953 Merge pull request #12626 from saurabh6790/item_price_stock_report_fix
[fix] If buying or selling price list not found, return empty dict
2018-01-24 10:55:51 +05:30
Saurabh
4b9a55b0ef [fix] If buying or selling price list not found, return empty dict 2018-01-24 07:48:56 +05:30
Saurabh
c8399fd093 Merge pull request #12614 from rohitwaghchaure/removed_set_only_once_for_batch_serialno
Disabled property set only once for has serial no and has batch no field in item doctype
2018-01-23 18:08:56 +05:30
Rohit Waghchaure
266e66cd1b Disabled property set only once for has serial no and has batch no field in item doctype 2018-01-23 18:06:12 +05:30
rohitwaghchaure
f3a452850e Merge pull request #12617 from saurabh6790/ux_fix
parse value before setting it to dissable_rounded_total on Purchase Invoice
2018-01-23 17:35:16 +05:30
Saurabh
57df096725 Merge pull request #12600 from vishdha/allow_rename
[new] Allow Rename and Member link with user
2018-01-23 16:49:48 +05:30
Saurabh
db2d02a3e3 Merge pull request #12618 from shreyashah115/warehouse-list
Disabled field in list view - Warehouse DocType
2018-01-23 16:48:59 +05:30
Shreya
dfae11bcee disabled warehouse in list view 2018-01-23 16:46:24 +05:30
rohitwaghchaure
d78e6e04ea Run country fixtures if country changed in the company (#12494) 2018-01-23 15:42:46 +05:30
Saurabh
3959aeb848 [fix] parse value before setting it to dissable_rounded_total on Purchase Invoice 2018-01-23 15:40:43 +05:30
rohitwaghchaure
51293390e4 Merge pull request #12611 from shreyashah115/fetch-conversion-factor
[Fix] Fetch uom conversion factor in material request
2018-01-23 12:41:01 +05:30
rohitwaghchaure
63f4da4402 Merge pull request #12612 from shreyashah115/fix-validation
Fix validation message for overbilling
2018-01-23 12:35:37 +05:30
Shreya
a137fe82a1 fix error message 2018-01-23 11:00:58 +05:30
Shreya
e2b31085a7 fetch uom conversion factor in material request 2018-01-23 10:54:23 +05:30
Vishal
a54815fd9d [new] Allow Rename and Member link with user 2018-01-22 16:02:45 +05:30
Saurabh
4f927ac3e8 Merge branch 'hotfix' 2018-01-22 15:29:14 +05:30
Saurabh
b9f678b350 bumped to version 10.0.13 2018-01-22 15:59:14 +06:00
Saurabh
fb4caff0b2 Merge pull request #12573 from rohitwaghchaure/reorder_issue
[Fix] Wrong projected qty for warehouse group in the process of reorder item, which making extra material requests
2018-01-22 16:49:54 +07:00
Saurabh
e72915847c Merge pull request #12570 from rohitwaghchaure/currency_in_balance_column
Added currency in balance column in general ledger print
2018-01-22 16:35:37 +07:00
rohitwaghchaure
1d93bd50eb Merge pull request #12585 from rohitwaghchaure/sales_income_account_issue
[Fix] Income account can not be group
2018-01-22 15:04:46 +05:30
rohitwaghchaure
8e998875a5 Merge pull request #12590 from shreyashah115/total-on-items-remove
[Fix] Calculate taxes when shipping rule not present at removal of item
2018-01-22 15:03:11 +05:30
rohitwaghchaure
c87a3370cd Merge pull request #12595 from rohitwaghchaure/image_path_in_item_search
[Fix] Image path showing in the item link
2018-01-22 15:01:58 +05:30
Rohit Waghchaure
c4c2bf0bfb [Fix] Image patch showing in the item link 2018-01-22 13:47:28 +05:30
Shreya
39adc8f85f calculate total when items are removed 2018-01-22 13:08:05 +05:30
Rohit Waghchaure
8676590cfe [Fix] Income account can not be group 2018-01-22 12:35:36 +05:30
rohitwaghchaure
cf7b6511ba Merge pull request #12574 from rohitwaghchaure/sales_payment_summary_issue
[Fix] Sales payment summary issue
2018-01-20 17:02:13 +05:30
Rohit Waghchaure
bc94914338 [Fix] Sales payment summary issue 2018-01-20 17:01:31 +05:30
Rohit Waghchaure
f83f6aae22 [Fix] Wrong projected qty for warehouse group in the process of reorder item making extra material requests 2018-01-20 15:44:38 +05:30
rohitwaghchaure
6a81acfddf Merge pull request #12563 from Zlash65/general-ledger-fix
[Hotfix] General Ledger report not working for group_by_account filter
2018-01-20 12:55:35 +05:30
Rohit Waghchaure
edef642794 Added currency in balance column in general ledger print 2018-01-20 12:54:25 +05:30
Zlash65
93344dff26 group_by_account not displayed fix 2018-01-19 19:06:39 +05:30
Rohit Waghchaure
03adf84a8d Merge branch 'hotfix' 2018-01-19 15:49:29 +05:30
Rohit Waghchaure
0e61b52022 bumped to version 10.0.12 2018-01-19 16:19:28 +06:00
rohitwaghchaure
0efd7934b8 Merge pull request #12530 from frappe/manassolanki-patch-2
Issue in the data import while importing the invoice
2018-01-19 15:35:23 +05:30
Manas Solanki
c6d5611408 Issue in the data import while importing the invoice 2018-01-18 11:20:24 +05:30
90 changed files with 981 additions and 525 deletions

View File

@@ -1,13 +1,6 @@
language: python
dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
python:
- "2.7"
@@ -29,15 +22,6 @@ install:
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
before_script:
- wget http://chromedriver.storage.googleapis.com/2.33/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo apt-get install libnss3
- sudo apt-get --only-upgrade install google-chrome-stable
- sudo cp chromedriver /usr/local/bin/.
- sudo chmod +x /usr/local/bin/chromedriver
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
- mysql -u root -ptravis -e 'create database test_frappe'
- echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis
- echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis
@@ -58,24 +42,6 @@ jobs:
- set -e
- bench run-tests
env: Server Side Test
- # stage
script:
- bench --verbose run-setup-wizard-ui-test
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
- bench run-ui-tests --app erpnext
env: Client Side Test
- # stage
script:
- bench --verbose run-setup-wizard-ui-test
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
- bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/tests2.txt
env: Client Side Test - 2
- # stage
script:
- bench --verbose run-setup-wizard-ui-test
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
- bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/agriculture.txt
env: Agriculture Client Side Test
- # stage
script:
- wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz

View File

@@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '10.0.11'
__version__ = '10.0.20'
def get_default_company(user=None):
'''Get default company for user'''

View File

@@ -176,7 +176,7 @@
"Eingeforderte Nachsch\u00fcsse (gegenkonto 2929)": {}
},
"Eingeforderte- noch ausstehende Kapitaleinlagen": {
"Ausstehende Einlagen auf das gezeichnete Kapital- eingefordert (Forderungen- nicht eingeforderte ausstehende Einlagen s. Konto 2910)": {}
"Ausstehende Einlagen auf das gezeichnete Kapital- eingefordert": {}
},
"Forderungen aus Lieferungen und Leistungen H-Saldo": {
"Einzelwertberechtigungen zu Forderungen mit einer Restlaufzeit bis zu 1 Jahr": {},
@@ -685,7 +685,6 @@
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 16%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 19%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ohne Vorsteuerabzug": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb von Neufahrzeugen von Lieferanten ohne Umsatzsteuer-Identifikationsnummer": {},
"Umsatzsteuer fr\u00fchere Jahre": {},
"Umsatzsteuer laufendes Jahr": {},
"Umsatzsteuer nach \u00a713b UStG": {},
@@ -747,7 +746,7 @@
"Verbindlichkeiten gegen\u00fcber Kreditinstituten ": {
"Gegenkonto 3159-3209 bei Aufteilung der Konten 3210-3248": {}
},
"Verbindlichkeiten gegen\u00fcber Kreditinstituten oder Kassenbestand- Bundesbankguthaben- Guthaben bei Kreditinstituten und Schecks": {
"Verbindlichkeiten gegen\u00fcber Kreditinstituten - Bundesbankguthaben- Guthaben bei Kreditinstituten und Schecks": {
"Verbindlichkeiten gegen\u00fcber Kreditinstituten 1": {
"(frei- in Bilanz kein Restlaufzeit vermerkt) 1": {},
"Verbindlichkeiten gegen\u00fcber Kreditinstituten Restlaufzeit 1 bis 5 Jahre": {},
@@ -778,8 +777,8 @@
},
"Gewinn u. Verlust - Aufwendungen": {
"Betriebliche Aufwendungen": {
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Kapitalgesellschaft \u00fcblichen Abschreibungen \u00fcberschreiten": {
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Kapitalgesellschaft \u00fcblichen Abschreibungen \u00fcberschreiten": {
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Abschreibungen \u00fcberschreiten": {
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Abschreibungen \u00fcberschreiten": {
"Abschreibungen auf Umlaufverm\u00f6gen- steuerrechtlich bedingt (soweit un\u00fcblich hoch)": {},
"Abschreibungen auf Verm\u00f6gensgegenst\u00e4nde des Umlaufverm\u00f6gens (soweit un\u00fcblich hoch)": {},
"Forderungsverluste (soweit un\u00fcblich hoch)": {},
@@ -852,7 +851,7 @@
"Sonstige betriebliche Aufwendungen 3": {
"Sonstige betriebliche Aufwendungen 4": {
"Abgaben f\u00fcr betrieblich genutzten Grundbesitz": {},
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.) nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.) nach": {},
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
"Abschluss- und Pr\u00fcfungskosten": {},
"Abschreibung auf Umlaufverm\u00f6gen au\u00dfer Vorr\u00e4te und Wertpapieren des UV (\u00fcbliche H\u00f6he)": {},
@@ -867,7 +866,7 @@
"Aufwendungen aus Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.)": {},
"Aufwendungen aus Bewertung Finanzmittelfonds": {},
"Aufwendungen aus Kursdifferenzen": {},
"Aufwendungen aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
"Aufwendungen aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig": {},
"Aufwendungen aus der Zuschreibung von steuertlich niedriger bewerteten R\u00fcckstellungen": {},
"Aufwendungen aus der Zuschreibung von steuertlich niedriger bewerteten Verbindlichkeiten": {},
"Aufwendungen f\u00fcr Abraum- und Abfallbeseitigung": {},
@@ -987,9 +986,9 @@
"Verg\u00fctungen an Mitunternehmer \u00a7 15 EStG": {},
"Verkaufsprovisionen": {},
"Verluste aus dem Abgang von Gegenst\u00e4nden des Anlageverm\u00f6gens": {},
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens (au\u00dfer Vorr\u00e4te) 100% / 50% nicht anzugsf\u00e4hig (inlandische Kap. Ges.)": {},
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens (au\u00dfer Vorr\u00e4te) 100%/50% nicht anzugsf\u00e4hig": {},
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens au\u00dfer Vorr\u00e4te": {},
"Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
"Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig": {},
"Verpackungsmaterial": {},
"Versicherungen": {},
"Versicherungen f\u00fcr Geb\u00e4ude": {},
@@ -1020,10 +1019,10 @@
},
"Abschreibungen auf Finanzanlagen 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften": {},
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften 100% / 50% nicht abzugsf\u00e4hig": {},
"Abschreibungen auf Grund von Verlustanteilen an Mitunternehmerschaften \u00a7 8 GewStG": {},
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens": {},
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig": {},
"Vorwegnahme k\u00fcnftiger Wertschwankungen bei Wertpapieren des Umlaufverm\u00f6gens": {}
},
"account_type": "Depreciation"
@@ -1123,15 +1122,15 @@
}
},
"Erh\u00f6hung oder Verminderung des Bestands an fertigen und unfertige Erzeugnissen": {
"Erh\u00f6hung des Bestands an fertigen und unfertigen Erzeugnissen oder Verminderung des Bestands an fertigen und unfertigen Erzeugnissen": {
"Erh\u00f6hung / Verminderung des Bestands an fertigen und unfertigen Erzeugnissen": {
"Bestandsver\u00e4nderungen - fertige Erzeugnisse": {},
"Bestandsver\u00e4nderungen - unfertige Erzeugnisse": {},
"Bestandsver\u00e4nderungen - unfertige Leistungen": {}
},
"Erh\u00f6hung des Bestands in Arbeit befindlicher Auftr\u00e4ge oder Verminderung des Bestands in Arbeit befindlicher Auftr\u00e4ge": {
"Erh\u00f6hung / Verminderung des Bestands in Arbeit befindlicher Auftr\u00e4ge": {
"Bestandsver\u00e4nderungen in Arbeit befindlicher Auftr\u00e4ge": {}
},
"Erh\u00f6hung des Bestands in Ausf\u00fchrung befindlicher Bauaftr\u00e4ge oder Verminderung des Bestands in Ausf\u00fchrung befindlicher Bauauftr\u00e4ge": {
"Erh\u00f6hung / Verminderung des Bestands in Ausf\u00fchrung befindlicher Bauaftr\u00e4ge": {
"Bestandsver\u00e4nderungen in Ausf\u00fchrung befindliche Bauauftr\u00e4ge": {}
}
},
@@ -1384,8 +1383,8 @@
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 1": {
"Diskontertr\u00e4ge": {},
"Diskontertr\u00e4ge aus verbundenen Unternehmen": {},
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (Umlaufverm\u00f6gen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (verbundene Unternehmen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {},
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {},
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 2": {},
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge aus verbundenen Unternehmen": {},
"Sonstige Zinsertr\u00e4ge": {},

View File

@@ -588,7 +588,6 @@
"5592. Munk\u00e1ltat\u00f3 \u00e1ltal \u00f6nk\u00e9ntes p\u00e9nzt\u00e1rba befizetett munk\u00e1ltat\u00f3i tagd\u00edj hozz\u00e1j\u00e1rul\u00e1s": {},
"5593. Munk\u00e1ltat\u00f3t terhel\u0151 szem\u00e9lyi j\u00f6vedelemad\u00f3": {},
"5594. Munk\u00e1ltat\u00f3i hozz\u00e1j\u00e1rul\u00e1s a korengedm\u00e9nyes nyugd\u00edj ig\u00e9nybev\u00e9tel\u00e9hez": {},
"5595. Tal\u00e1lm\u00e1nyi d\u00edj, szabadalom v\u00e9tel\u00e1ra \u00e9s hasznos\u00edt\u00e1si d\u00edja, az \u00faj\u00edt\u00e1si d\u00edj \u00e9s ezekkel kapcsolatos k\u00f6zrem\u0171k\u00f6d\u00e9si d\u00edjak": {},
"5596. Fizetett szerz\u0151i, \u00edr\u00f3i \u00e9s m\u00e1s jogv\u00e9delmet \u00e9lvez\u0151 munk\u00e1k d\u00edjai \u00e9s ezekkel kapcsolatos k\u00f6zrem\u0171k\u00f6d\u0151i d\u00edjak": {},
"5597. Fizetett \u00f6szt\u00f6nd\u00edjak": {},
"5598. Reprezent\u00e1ci\u00f3s k\u00f6lts\u00e9gek, \u00e9tkez\u00e9si hozz\u00e1j\u00e1rul\u00e1s": {},
@@ -731,7 +730,7 @@
"8684. K\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {}
},
"869. K\u00fcl\u00f6nf\u00e9le egy\u00e9b r\u00e1ford\u00edt\u00e1sok": {
"8691. T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kpap\u00edrnak vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont. k\u00f6nyv szerinti \u00e9s l\u00e9t. okir. meghat. veszt. k\u00fcl\u00f6nb\u00f6zet": {},
"8691. T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kpap\u00edrnak vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont.": {},
"8692. Ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g szerz\u0151d\u00e9s szerinti \u00f6sszege": {},
"8693. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl \u00e1tadott, r\u00e9szesed\u00e9snek vagy \u00e9rt\u00e9kpap\u00edrnak nem min\u0151s\u00fcl\u0151 eszk\u00f6z\u00f6k nyilv\u00e1ntart\u00e1s szerinti \u00e9rt\u00e9ke": {},
"8694. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl ny\u00fajtott szolg\u00e1ltat\u00e1sok beker\u00fcl\u00e9si \u00e9rt\u00e9ke": {},
@@ -813,12 +812,7 @@
"9684. R\u00e9szesed\u00e9sek \u00e9rt\u00e9kveszt\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {}
},
"969. K\u00fcl\u00f6nf\u00e9le egy\u00e9b bev\u00e9telek": {
"9691. Gazdas\u00e1gi t\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kp. vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont. \u00e9rt\u00e9ke \u00e9s l\u00e9tes\u00edt\u0151 okir. \u00e9rt. nyer. jell . k\u00fcl\u00f6nb.": {},
"9692. El\u00e9v\u00fclt k\u00f6telezetts\u00e9g k\u00f6nyv szerinti \u00e9rt\u00e9ke": {},
"9693. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl \u00e1tvett, aj\u00e1nd\u00e9kk\u00e9nt, hagyat\u00e9kk\u00e9nt kapott, fellelt eszk\u00f6z\u00f6k piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {},
"9694. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl kapott szolg\u00e1ltat\u00e1sok piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {},
"9695. Elengedett \u00e9s ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g \u00e9rt\u00e9ke": {},
"9696. Egy\u00e9b, vagyonn\u00f6veked\u00e9ssel j\u00e1r\u00f3 bev\u00e9telek": {}
"is_group": 1
}
},
"97. P\u00c9NZ\u00dcGYI M\u0170VELETEK BEV\u00c9TELEI": {

View File

@@ -82,8 +82,8 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
$.each(this.frm.doc.accounts || [], function(i, jvd) {
frappe.model.set_default_values(jvd);
});
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || frappe.datetime.get_today();
var posting_date = this.frm.posting_date;
if(!this.frm.doc.amended_from) this.frm.set_value('posting_date', posting_date || frappe.datetime.get_today());
}
},

View File

@@ -1,8 +1,8 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:payment_term_name",
"beta": 0,
"creation": "2017-08-10 15:24:54.876365",
@@ -265,7 +265,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-08-10 16:26:03.581501",
"modified": "2018-01-24 11:13:42.800048",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Term",

View File

@@ -1,8 +1,8 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:template_name",
"beta": 0,
"creation": "2017-08-10 15:34:28.058054",
@@ -85,7 +85,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-08-10 15:46:33.877884",
"modified": "2018-01-24 11:13:31.158613",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Terms Template",

View File

@@ -254,6 +254,36 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_user_to_edit_discount",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow user to edit Discount",
"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_bulk_edit": 0,
"allow_on_submit": 0,
@@ -1476,7 +1506,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-03 17:30:45.198147",
"modified": "2018-01-31 19:33:11.765731",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",

View File

@@ -18,7 +18,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
this.frm.set_df_property("credit_to", "print_hide", 0);
}
} else {
this.frm.set_value("disable_rounded_total", frappe.sys_defaults.disable_rounded_total);
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
}
// formatter for material request item

View File

@@ -96,7 +96,7 @@ class PurchaseInvoice(BuyingController):
if not self.credit_to:
self.credit_to = get_party_account("Supplier", self.supplier, self.company)
if not self.due_date:
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier)
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier, self.company)
super(PurchaseInvoice, self).set_missing_values(for_validate)

View File

@@ -224,12 +224,17 @@ class SalesInvoice(SellingController):
from erpnext.selling.doctype.customer.customer import check_credit_limit
validate_against_credit_limit = False
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer,
"bypass_credit_limit_check_at_sales_order"))
if bypass_credit_limit_check_at_sales_order:
validate_against_credit_limit = True
for d in self.get("items"):
if not (d.sales_order or d.delivery_note):
validate_against_credit_limit = True
break
if validate_against_credit_limit:
check_credit_limit(self.customer, self.company)
check_credit_limit(self.customer, self.company, bypass_credit_limit_check_at_sales_order)
def set_missing_values(self, for_validate=False):
pos = self.set_pos_fields(for_validate)
@@ -237,12 +242,16 @@ class SalesInvoice(SellingController):
if not self.debit_to:
self.debit_to = get_party_account("Customer", self.customer, self.company)
if not self.due_date and self.customer:
self.due_date = get_due_date(self.posting_date, "Customer", self.customer)
self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.company)
super(SalesInvoice, self).set_missing_values(for_validate)
if pos:
return {"print_format": pos.get("print_format_for_online") }
return {
"print_format": pos.get("print_format_for_online"),
"allow_edit_rate": pos.get("allow_user_to_edit_rate"),
"allow_edit_discount": pos.get("allow_user_to_edit_discount")
}
def update_time_sheet(self, sales_invoice):
for d in self.timesheets:

View File

@@ -232,6 +232,8 @@ def get_next_date(dt, mcount, day=None):
def send_notification(new_rv, subscription_doc, print_format='Standard'):
"""Notify concerned persons about recurring document generation"""
print_format = print_format
subject = subscription_doc.subject or ''
message = subscription_doc.message or ''
if not subscription_doc.subject:
subject = _("New {0}: #{1}").format(new_rv.doctype, new_rv.name)

View File

@@ -130,8 +130,8 @@ def get_party_details(party, party_type, args=None):
def get_tax_template(posting_date, args):
"""Get matching tax rule"""
args = frappe._dict(args)
conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}')
and (to_date is null or to_date = '' or to_date >= '{0}')""".format(posting_date)]
conditions = ["""(from_date is null or from_date <= '{0}')
and (to_date is null or to_date >= '{0}')""".format(posting_date)]
for key, value in args.iteritems():
if key=="use_for_shopping_cart":

View File

@@ -191,8 +191,9 @@ def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
for entry in gl_entries:
validate_frozen_account(entry["account"], adv_adj)
validate_balance_type(entry["account"], adv_adj)
validate_expense_against_budget(entry)
if not adv_adj:
validate_expense_against_budget(entry)
if entry.get("against_voucher") and update_outstanding == 'Yes':
if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj:
update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
entry.get("against_voucher"), on_cancel=True)

View File

@@ -15,6 +15,7 @@ frappe.pages['pos'].on_page_load = function (wrapper) {
cur_pos = wrapper.pos;
} else {
// online
frappe.flags.is_online = true
frappe.set_route('point-of-sale');
}
});
@@ -24,6 +25,10 @@ frappe.pages['pos'].refresh = function (wrapper) {
window.onbeforeunload = function () {
return wrapper.pos.beforeunload()
}
if (frappe.flags.is_online) {
frappe.set_route('point-of-sale');
}
}
erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({

View File

@@ -51,7 +51,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
set_other_values(out, party, party_type)
set_price_list(out, party, party_type, price_list)
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type)
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company)
if not out.get("currency"):
out["currency"] = currency
@@ -164,7 +164,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
out = {
party_type.lower(): party,
account_fieldname : account,
"due_date": get_due_date(posting_date, party_type, party)
"due_date": get_due_date(posting_date, party_type, party, company)
}
return out
@@ -267,12 +267,12 @@ def validate_party_accounts(doc):
@frappe.whitelist()
def get_due_date(posting_date, party_type, party):
def get_due_date(posting_date, party_type, party, company=None):
"""Get due date from `Payment Terms Template`"""
due_date = None
if posting_date and party:
due_date = posting_date
template_name = get_pyt_term_template(party, party_type)
template_name = get_pyt_term_template(party, party_type, company)
if template_name:
due_date = get_due_date_from_template(template_name, posting_date).strftime("%Y-%m-%d")
else:
@@ -305,12 +305,11 @@ def get_due_date_from_template(template_name, posting_date):
return due_date
def validate_due_date(posting_date, due_date, party_type, party):
def validate_due_date(posting_date, due_date, party_type, party, company=None):
if getdate(due_date) < getdate(posting_date):
frappe.throw(_("Due Date cannot be before Posting Date"))
else:
default_due_date = get_due_date(posting_date, party_type, party)
default_due_date = get_due_date(posting_date, party_type, party, company)
if not default_due_date:
return
@@ -360,14 +359,32 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
@frappe.whitelist()
def get_pyt_term_template(party_name, party_type):
def get_pyt_term_template(party_name, party_type, company=None):
if party_type not in ("Customer", "Supplier"):
return
template = None
if party_type in ('Customer', 'Supplier'):
template = frappe.db.get_value(party_type, party_name, fieldname='payment_terms')
if party_type == 'Customer':
customer = frappe.db.get_value("Customer", party_name,
fieldname=['payment_terms', "customer_group"], as_dict=1)
template = customer.payment_terms
if not template and customer.customer_group:
template = frappe.db.get_value("Customer Group",
customer.customer_group, fieldname='payment_terms')
else:
supplier = frappe.db.get_value("Supplier", party_name,
fieldname=['payment_terms', "supplier_type"], as_dict=1)
template = supplier.payment_terms
if not template and supplier.supplier_type:
template = frappe.db.get_value("Supplier Type", supplier.supplier_type, fieldname='payment_terms')
if not template and company:
template = frappe.db.get_value("Company", company, fieldname='payment_terms')
return template
def validate_party_frozen_disabled(party_type, party_name):
if party_type and party_name:
if party_type in ("Customer", "Supplier"):

View File

@@ -17,12 +17,12 @@
<table class="table table-bordered">
<thead>
<tr>
<th style="width: 15%">{%= __("Date") %}</th>
<th style="width: 12%">{%= __("Date") %}</th>
<th style="width: 15%">{%= __("Ref") %}</th>
<th style="width: 25%">{%= __("Party") %}</th>
<th style="width: 15%">{%= __("Debit") %}</th>
<th style="width: 15%">{%= __("Credit") %}</th>
<th style="width: 15%">{%= __("Balance") %}</th>
<th style="width: 18%">{%= __("Balance (Dr - Cr)") %}</th>
</tr>
</thead>
<tbody>
@@ -76,9 +76,11 @@
{% } %}
{% } %}
{% if(filters.print_in_account_currency) { %}
<td style="text-align: right">{%= data[i].balance_in_account_currency %}</td>
<td style="text-align: right">
{%= format_currency(data[i].balance_in_account_currency, data[i].account_currency) %}
</td>
{% } else { %}
<td style="text-align: right">{%= data[i].balance %}</td>
<td style="text-align: right">{%= format_currency(data[i].balance) %}</td>
{% } %}
</tr>
{% } %}

View File

@@ -238,23 +238,23 @@ def get_result_as_list(data, filters):
inv_details = get_supplier_invoice_details()
for d in data:
if not d.posting_date:
if not d.get('posting_date'):
balance, balance_in_account_currency = 0, 0
balance, label = get_balance(d, balance, 'debit', 'credit')
d['balance'] = '{0} {1}'.format(fmt_money(abs(balance)), label)
balance = get_balance(d, balance, 'debit', 'credit')
d['balance'] = balance
if filters.get("show_in_account_currency"):
balance_in_account_currency, label = get_balance(d, balance_in_account_currency,
balance_in_account_currency = get_balance(d, balance_in_account_currency,
'debit_in_account_currency', 'credit_in_account_currency')
d['balance_in_account_currency'] = '{0} {1}'.format(fmt_money(abs(balance_in_account_currency)), label)
d['balance_in_account_currency'] = balance_in_account_currency
else:
d['debit_in_account_currency'] = d.get('debit', 0)
d['credit_in_account_currency'] = d.get('credit', 0)
d['balance_in_account_currency'] = d.get('balance')
d['account_currency'] = filters.account_currency
d['bill_no'] = inv_details.get(d.against_voucher, '')
d['bill_no'] = inv_details.get(d.get('against_voucher'), '')
return data
@@ -268,9 +268,8 @@ def get_supplier_invoice_details():
def get_balance(row, balance, debit_field, credit_field):
balance += (row.get(debit_field, 0) - row.get(credit_field, 0))
label = 'DR' if balance > 0 else 'CR'
return balance, label
return balance
def get_columns(filters):
columns = [
@@ -300,10 +299,10 @@ def get_columns(filters):
"width": 100
},
{
"label": _("Balance"),
"label": _("Balance (Dr - Cr)"),
"fieldname": "balance",
"fieldtype": "Data",
"width": 100
"fieldtype": "Float",
"width": 130
}
]

View File

@@ -168,11 +168,11 @@ def get_tax_accounts(item_list, columns, company_currency,
for d in item_list:
invoice_item_row.setdefault(d.parent, []).append(d)
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d)
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code or d.item_name, []).append(d)
conditions = ""
if doctype == "Purchase Invoice":
conditions = " and category in ('Total', 'Valuation and Total')"
conditions = " and category in ('Total', 'Valuation and Total') and base_tax_amount_after_discount_amount != 0"
tax_details = frappe.db.sql("""
select

View File

@@ -172,6 +172,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount
from `tabPurchase Taxes and Charges`
where parent in (%s) and category in ('Total', 'Valuation and Total')
and base_tax_amount_after_discount_amount != 0
group by parent, account_head, add_deduct_tax
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)

View File

@@ -37,7 +37,7 @@ def get_sales_payment_data(filters, columns):
def get_conditions(filters):
conditions = "1=1"
if filters.get("from_date"): conditions += "a.posting_date >= %(from_date)s"
if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
if filters.get("company"): conditions += " and a.company=%(company)s"
if filters.get("customer"): conditions += " and a.customer = %(customer)s"

View File

@@ -68,12 +68,16 @@ class PurchaseOrder(BuyingController):
},
"Supplier Quotation Item": {
"ref_dn_field": "supplier_quotation_item",
"compare_fields": [["rate", "="], ["project", "="], ["item_code", "="],
"compare_fields": [["project", "="], ["item_code", "="],
["uom", "="], ["conversion_factor", "="]],
"is_child_table": True
}
})
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')):
self.validate_rate_with_reference_doc([["Supplier Quotation", "supplier_quotation", "supplier_quotation_item"]])
def validate_supplier(self):
prevent_po = frappe.db.get_value("Supplier", self.supplier, 'prevent_pos')
if prevent_po:

View File

@@ -8,8 +8,7 @@
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier P",
"supplier_type": "_Test Supplier Type",
"credit_days_based_on": "Fixed Days"
"supplier_type": "_Test Supplier Type"
},
{
"doctype": "Supplier",

View File

@@ -124,7 +124,8 @@ def make_purchase_order(source_name, target_doc=None):
["name", "supplier_quotation_item"],
["parent", "supplier_quotation"],
["material_request", "material_request"],
["material_request_item", "material_request_item"]
["material_request_item", "material_request_item"],
["sales_order", "sales_order"]
],
"postprocess": update_item
},

View File

@@ -1326,6 +1326,37 @@
"unique": 0,
"width": "120px"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "sales_order",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Sales Order",
"length": 0,
"no_copy": 0,
"options": "Sales Order",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@@ -1614,7 +1645,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-12-14 09:37:47.427897",
"modified": "2018-01-25 15:04:40.171617",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",

View File

@@ -15,7 +15,7 @@ def get_data():
{
"type": "doctype",
"name": "Task",
"route": "Tree/Task",
"route": "List/Task",
"description": _("Project activity / task."),
},
{

View File

@@ -135,9 +135,9 @@ class AccountsController(TransactionBase):
if not self.due_date:
frappe.throw(_("Due Date is mandatory"))
validate_due_date(self.posting_date, self.due_date, "Customer", self.customer)
validate_due_date(self.posting_date, self.due_date, "Customer", self.customer, self.company)
elif self.doctype == "Purchase Invoice":
validate_due_date(self.posting_date, self.due_date, "Supplier", self.supplier)
validate_due_date(self.posting_date, self.due_date, "Supplier", self.supplier, self.company)
def set_price_list_currency(self, buying_or_selling):
if self.meta.get_field("posting_date"):
@@ -484,7 +484,7 @@ class AccountsController(TransactionBase):
max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100)
if total_billed_amt - max_allowed_amt > 0.01:
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set in Buying Settings").format(item.item_code, item.idx, max_allowed_amt))
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set in Stock Settings").format(item.item_code, item.idx, max_allowed_amt))
def get_company_default(self, fieldname):
from erpnext.accounts.utils import get_company_default

View File

@@ -152,7 +152,7 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
conditions = []
return frappe.db.sql("""select tabItem.name, tabItem.item_group, tabItem.image,
return frappe.db.sql("""select tabItem.name, tabItem.item_group,
if(length(tabItem.item_name) > 40,
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
if(length(tabItem.description) > 40, \
@@ -257,7 +257,7 @@ def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len,
def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
cond = ""
if filters.get("posting_date"):
cond = "and (ifnull(batch.expiry_date, '')='' or batch.expiry_date >= %(posting_date)s)"
cond = "and (batch.expiry_date is null or batch.expiry_date >= %(posting_date)s)"
batch_nos = None
args = {

View File

@@ -156,7 +156,7 @@ class SellingController(StockController):
last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.item_code, ["last_purchase_rate", "is_stock_item"])
last_purchase_rate_in_sales_uom = last_purchase_rate / (it.conversion_factor or 1)
if flt(it.base_rate) < flt(last_purchase_rate_in_sales_uom):
if flt(it.base_rate) < flt(last_purchase_rate_in_sales_uom) and not self.is_return:
throw_message(it.item_name, last_purchase_rate_in_sales_uom, "last purchase rate")
last_valuation_rate = frappe.db.sql("""
@@ -166,7 +166,7 @@ class SellingController(StockController):
""", (it.item_code, it.warehouse))
if last_valuation_rate:
last_valuation_rate_in_sales_uom = last_valuation_rate[0][0] / (it.conversion_factor or 1)
if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate_in_sales_uom):
if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate_in_sales_uom) and not self.is_return:
throw_message(it.name, last_valuation_rate_in_sales_uom, "valuation rate")

View File

@@ -491,11 +491,13 @@ class calculate_taxes_and_totals(object):
if self.doc.doctype == "Sales Invoice" \
and self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
and any([d.type == "Cash" for d in self.doc.payments]):
grand_total = self.doc.rounded_total or self.doc.grand_total
base_grand_total = self.doc.base_rounded_total or self.doc.base_grand_total
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
self.doc.change_amount = flt(self.doc.paid_amount - grand_total +
self.doc.write_off_amount, self.doc.precision("change_amount"))
self.doc.base_change_amount = flt(self.doc.base_paid_amount - self.doc.base_grand_total +
self.doc.base_change_amount = flt(self.doc.base_paid_amount - base_grand_total +
self.doc.base_write_off_amount, self.doc.precision("base_change_amount"))
def calculate_write_off_amount(self):

View File

@@ -269,7 +269,10 @@ def get_grade(grading_scale, percentage):
:param Percentage: Score Percentage Percentage
"""
grading_scale_intervals = {}
for d in frappe.get_all("Grading Scale Interval", fields=["grade_code", "threshold"], filters={"parent": grading_scale}):
if not hasattr(frappe.local, 'grading_scale'):
grading_scale = frappe.get_all("Grading Scale Interval", fields=["grade_code", "threshold"], filters={"parent": grading_scale})
frappe.local.grading_scale = grading_scale
for d in frappe.local.grading_scale:
grading_scale_intervals.update({d.threshold:d.grade_code})
intervals = sorted(grading_scale_intervals.keys(), key=float, reverse=True)
for interval in intervals:

View File

@@ -6,5 +6,9 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
STD_CRITERIA = ["total", "total score", "total grade", "maximum score", "score", "grade"]
class AssessmentCriteria(Document):
pass
def validate(self):
if self.assessment_criteria.lower() in STD_CRITERIA:
frappe.throw("Can't create standard criteria. Please rename the criteria")

View File

@@ -6,9 +6,15 @@
{% } %}
<h4 class="text-center">{%= __("Assessment Report") %}</h4>
<hr>
<h5 class="text-center">{%= __("Academic Year: ") %} {%= filters.academic_year %} </h5>
{% if (filters.academic_term){ %}
<h5 class="text-center">{%= __("Academic Term: ") %} {%= filters.academic_term %} </h5>
{% } %}
<h5 class="text-center">{%= __("Course Code: ") %} {%= filters.course %}</h5>
<h5 class="text-center">{%= __("Assessment Group: ") %} {%= filters.assessment_group %}</h5>
<h5 class="text-center">{%= __("Assessment Plan: ") %} {%= data_to_be_printed[0]["assessment_plan"] %} </h5>
{% if (filters.student_group){ %}
<h5 class="text-center">{%= __("Student Group: ") %} {%= filters.student_group %} </h5>
{% } %}
<hr>
<table class="table table-bordered">

View File

@@ -4,18 +4,17 @@
frappe.query_reports["Course wise Assessment Report"] = {
"filters": [
{
"fieldname":"assessment_group",
"label": __("Assessment Group"),
"fieldname":"academic_year",
"label": __("Academic Year"),
"fieldtype": "Link",
"options": "Assessment Group",
"reqd": 1,
"get_query": function() {
return{
filters: {
'is_group': 0
}
};
}
"options": "Academic Year",
"reqd": 1
},
{
"fieldname":"academic_term",
"label": __("Academic Term"),
"fieldtype": "Link",
"options": "Academic Term"
},
{
"fieldname":"course",
@@ -29,6 +28,13 @@ frappe.query_reports["Course wise Assessment Report"] = {
"label": __("Student Group"),
"fieldtype": "Link",
"options": "Student Group"
},
{
"fieldname":"assessment_group",
"label": __("Assessment Group"),
"fieldtype": "Link",
"options": "Assessment Group",
"reqd": 1
}
]
};

View File

@@ -5,129 +5,189 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from collections import defaultdict
from collections import defaultdict, OrderedDict
from erpnext.education.api import get_grade
def execute(filters=None):
data = []
data, chart, grades = [], [], []
args = frappe._dict()
grade_wise_analysis = defaultdict(dict)
args["academic_year"] = filters.get("academic_year")
args["course"] = filters.get("course")
args["assessment_group"] = filters.get("assessment_group")
args["academic_term"] = filters.get("academic_term")
args["student_group"] = filters.get("student_group")
if args["assessment_group"] == "All Assessment Groups":
frappe.throw(_("Please select the assessment group other than 'All Assessment Groups'"))
args["course"] = filters.get("course")
args["student_group"] = filters.get("student_group")
returned_values = get_formatted_result(args, get_assessment_criteria=True)
student_dict = returned_values["student_details"]
result_dict = returned_values["assessment_result"]
assessment_criteria_dict = returned_values["assessment_criteria"]
for student in result_dict:
student_row = {}
student_row["student"] = student
student_row["student_name"] = student_dict[student]
for criteria in assessment_criteria_dict:
scrub_criteria = frappe.scrub(criteria)
if criteria in result_dict[student][args.course][args.assessment_group]:
student_row[scrub_criteria] = result_dict[student][args.course][args.assessment_group][criteria]["grade"]
student_row[scrub_criteria + "_score"] = result_dict[student][args.course][args.assessment_group][criteria]["score"]
# create the list of possible grades
if student_row[scrub_criteria] not in grades:
grades.append(student_row[scrub_criteria])
# create the dict of for gradewise analysis
if student_row[scrub_criteria] not in grade_wise_analysis[criteria]:
grade_wise_analysis[criteria][student_row[scrub_criteria]] = 1
else:
grade_wise_analysis[criteria][student_row[scrub_criteria]] += 1
else:
student_row[frappe.scrub(criteria)] = ""
student_row[frappe.scrub(criteria)+ "_score"] = ""
data.append(student_row)
assessment_criteria_list = [d for d in assessment_criteria_dict]
columns = get_column(assessment_criteria_dict)
chart = get_chart_data(grades, assessment_criteria_list, grade_wise_analysis)
return columns, data, None, chart
# find all assessment plan and related details linked with the given filters
def get_assessment_details():
if args["student_group"]:
cond = "and ap.student_group=%(student_group)s"
def get_formatted_result(args, get_assessment_criteria=False, get_course=False):
cond, cond1, cond2, cond3, cond4 = " ", " ", " ", " ", " "
args_list = [args.academic_year]
if args.course:
cond = " and ar.course=%s"
args_list.append(args.course)
if args.academic_term:
cond1 = " and ar.academic_term=%s"
args_list.append(args.academic_term)
if args.student_group:
cond2 = " and ar.student_group=%s"
args_list.append(args.student_group)
create_total_dict = False
group_type = frappe.get_value("Assessment Group", args.assessment_group, "is_group")
if group_type:
from frappe.desk.treeview import get_children
assessment_groups = [d.get("value") for d in get_children("Assessment Group",
args.assessment_group) if d.get("value") and not d.get("expandable")]
cond3 = " and ar.assessment_group in (%s)"%(', '.join(['%s']*len(assessment_groups)))
else:
assessment_groups = [args.assessment_group]
cond3 = " and ar.assessment_group=%s"
args_list += assessment_groups
if args.students:
cond4 = " and ar.student in (%s)"%(', '.join(['%s']*len(args.students)))
args_list += args.students
assessment_result = frappe.db.sql('''
SELECT
ar.student, ar.student_name, ar.academic_year, ar.academic_term, ar.program, ar.course,
ar.assessment_plan, ar.grading_scale, ar.assessment_group, ar.student_group,
ard.assessment_criteria, ard.maximum_score, ard.grade, ard.score
FROM
`tabAssessment Result` ar, `tabAssessment Result Detail` ard
WHERE
ar.name=ard.parent and ar.docstatus=1 and ar.academic_year=%s {0} {1} {2} {3} {4}
ORDER BY
ard.assessment_criteria'''.format(cond, cond1, cond2, cond3, cond4),
tuple(args_list), as_dict=1)
# create the nested dictionary structure as given below:
# <variable_name>.<student_name>.<course>.<assessment_group>.<assessment_criteria>.<grade/score/max_score>
# "Total Score" -> assessment criteria used for totaling and args.assessment_group -> for totaling all the assesments
student_details = {}
formatted_assessment_result = defaultdict(dict)
assessment_criteria_dict = OrderedDict()
course_dict = OrderedDict()
total_maximum_score = None
if not (len(assessment_groups) == 1 and assessment_groups[0] == args.assessment_group):
create_total_dict = True
# add the score for a given score and recalculate the grades
def add_score_and_recalculate_grade(result, assessment_group, assessment_criteria):
formatted_assessment_result[result.student][result.course][assessment_group]\
[assessment_criteria]["maximum_score"] += result.maximum_score
formatted_assessment_result[result.student][result.course][assessment_group]\
[assessment_criteria]["score"] += result.score
tmp_grade = get_grade(result.grading_scale, ((formatted_assessment_result[result.student][result.course]
[assessment_group][assessment_criteria]["score"])/(formatted_assessment_result[result.student]
[result.course][assessment_group][assessment_criteria]["maximum_score"]))*100)
formatted_assessment_result[result.student][result.course][assessment_group]\
[assessment_criteria]["grade"] = tmp_grade
# create the assessment criteria "Total Score" with the sum of all the scores of the assessment criteria in a given assessment group
def add_total_score(result, assessment_group):
if "Total Score" not in formatted_assessment_result[result.student][result.course][assessment_group]:
formatted_assessment_result[result.student][result.course][assessment_group]["Total Score"] = frappe._dict({
"assessment_criteria": "Total Score", "maximum_score": result.maximum_score, "score": result.score, "grade": result.grade})
else:
cond = ''
add_score_and_recalculate_grade(result, assessment_group, "Total Score")
assessment_plan = frappe.db.sql('''
select
ap.name, ap.student_group, ap.grading_scale, apc.assessment_criteria, apc.maximum_score as max_score
from
`tabAssessment Plan` ap, `tabAssessment Plan Criteria` apc
where
ap.assessment_group=%(assessment_group)s and ap.course=%(course)s and
ap.name=apc.parent and ap.docstatus=1 {0}
order by
apc.assessment_criteria'''.format(cond), (args), as_dict=1)
for result in assessment_result:
if result.student not in student_details:
student_details[result.student] = result.student_name
assessment_plan_list = list(set([d["name"] for d in assessment_plan]))
if not assessment_plan_list:
frappe.throw(_("No assessment plan linked with this assessment group"))
assessment_criteria_details = frappe._dict({"assessment_criteria": result.assessment_criteria,
"maximum_score": result.maximum_score, "score": result.score, "grade": result.grade})
assessment_criteria_list = list(set([(d["assessment_criteria"],d["max_score"]) for d in assessment_plan]))
student_group_list = list(set([d["student_group"] for d in assessment_plan]))
total_maximum_score = flt(sum([flt(d[1]) for d in assessment_criteria_list]))
grading_scale = assessment_plan[0]["grading_scale"]
if not formatted_assessment_result[result.student]:
formatted_assessment_result[result.student] = defaultdict(dict)
if not formatted_assessment_result[result.student][result.course]:
formatted_assessment_result[result.student][result.course] = defaultdict(dict)
return assessment_plan_list, assessment_criteria_list, total_maximum_score, grading_scale, student_group_list
if not create_total_dict:
formatted_assessment_result[result.student][result.course][result.assessment_group]\
[result.assessment_criteria] = assessment_criteria_details
add_total_score(result, result.assessment_group)
# create the total of all the assessment groups criteria-wise
elif create_total_dict:
if not formatted_assessment_result[result.student][result.course][args.assessment_group]:
formatted_assessment_result[result.student][result.course][args.assessment_group] = defaultdict(dict)
formatted_assessment_result[result.student][result.course][args.assessment_group]\
[result.assessment_criteria] = assessment_criteria_details
elif result.assessment_criteria not in formatted_assessment_result[result.student][result.course][args.assessment_group]:
formatted_assessment_result[result.student][result.course][args.assessment_group]\
[result.assessment_criteria] = assessment_criteria_details
elif result.assessment_criteria in formatted_assessment_result[result.student][result.course][args.assessment_group]:
add_score_and_recalculate_grade(result, args.assessment_group, result.assessment_criteria)
add_total_score(result, args.assessment_group)
total_maximum_score = formatted_assessment_result[result.student][result.course][args.assessment_group]\
["Total Score"]["maximum_score"]
if get_assessment_criteria:
assessment_criteria_dict[result.assessment_criteria] = formatted_assessment_result[result.student][result.course]\
[args.assessment_group][result.assessment_criteria]["maximum_score"]
if get_course:
course_dict[result.course] = total_maximum_score
if get_assessment_criteria and total_maximum_score:
assessment_criteria_dict["Total Score"] = total_maximum_score
return {
"student_details": student_details,
"assessment_result": formatted_assessment_result,
"assessment_criteria": assessment_criteria_dict,
"course_dict": course_dict
}
# get all the result and make a dict map student as the key and value as dict of result
def get_result_map():
result_dict = defaultdict(dict)
kounter = defaultdict(dict)
assessment_result = frappe.db.sql('''select ar.student, ard.assessment_criteria, ard.grade, ard.score
from `tabAssessment Result` ar, `tabAssessment Result Detail` ard
where ar.assessment_plan in (%s) and ar.name=ard.parent and ar.docstatus=1
order by ard.assessment_criteria''' %', '.join(['%s']*len(assessment_plan_list)),
tuple(assessment_plan_list), as_dict=1)
for result in assessment_result:
if "total_score" in result_dict[result.student]:
total_score = result_dict[result.student]["total_score"] + result.score
else:
total_score = result.score
total = get_grade(grading_scale, (total_score/total_maximum_score)*100)
if result.grade in kounter[result.assessment_criteria]:
kounter[result.assessment_criteria][result.grade] += 1
else:
kounter[result.assessment_criteria].update({result.grade: 1})
if "Total" not in kounter:
kounter["Total"] = {}
if "total" in result_dict[result.student]:
prev_grade = result_dict[result.student]["total"]
prev_grade_count = kounter["Total"].get(prev_grade) - 1
kounter["Total"].update({prev_grade: prev_grade_count})
latest_grade_count = kounter["Total"].get(total)+1 if kounter["Total"].get(total) else 1
kounter["Total"].update({total: latest_grade_count})
result_dict[result.student].update({
frappe.scrub(result.assessment_criteria): result.grade,
frappe.scrub(result.assessment_criteria)+"_score": result.score,
"total_score": total_score,
"total": total
})
return result_dict, kounter
# make data from the result dict
def get_data():
student_list = frappe.db.sql('''select sgs.student, sgs.student_name
from `tabStudent Group` sg, `tabStudent Group Student` sgs
where sg.name = sgs.parent and sg.name in (%s)
order by sgs.group_roll_number asc''' %', '.join(['%s']*len(student_group_list)),
tuple(student_group_list), as_dict=1)
for student in student_list:
student.update(result_dict[student.student])
return student_list
# get chart data
def get_chart():
grading_scale = frappe.db.get_value("Assessment Plan", list(assessment_plan_list)[0], "grading_scale")
grades = frappe.db.sql_list('''select grade_code from `tabGrading Scale Interval` where parent=%s''',
(grading_scale))
criteria_list = [d[0] for d in assessment_criteria_list] + ["Total"]
return get_chart_data(grades, criteria_list, kounter)
assessment_plan_list, assessment_criteria_list, total_maximum_score, grading_scale,\
student_group_list = get_assessment_details()
result_dict, kounter = get_result_map()
data = get_data()
columns = get_column(assessment_criteria_list, total_maximum_score)
chart = get_chart()
data_to_be_printed = [{
"assessment_plan": ", ".join(assessment_plan_list)
}]
return columns, data, None, chart, data_to_be_printed
def get_column(assessment_criteria, total_maximum_score):
def get_column(assessment_criteria):
columns = [{
"fieldname": "student",
"label": _("Student ID"),
@@ -143,40 +203,28 @@ def get_column(assessment_criteria, total_maximum_score):
}]
for d in assessment_criteria:
columns.append({
"fieldname": frappe.scrub(d[0]),
"label": d[0],
"fieldname": frappe.scrub(d),
"label": d,
"fieldtype": "Data",
"width": 110
})
columns.append({
"fieldname": frappe.scrub(d[0]) +"_score",
"label": "Score(" + str(int(d[1])) + ")",
"fieldname": frappe.scrub(d) +"_score",
"label": "Score(" + str(int(assessment_criteria[d])) + ")",
"fieldtype": "Float",
"width": 100
})
columns += [{
"fieldname": "total",
"label": "Total",
"fieldtype": "Data",
"width": 100
},
{
"fieldname": "total_score",
"label": "Total Score("+ str(int(total_maximum_score)) + ")",
"fieldtype": "Float",
"width": 110
}]
return columns
def get_chart_data(grades, assessment_criteria_list, kounter):
def get_chart_data(grades, criteria_list, kounter):
grades = sorted(grades)
datasets = []
for grade in grades:
tmp = frappe._dict({"values":[], "title": grade})
for criteria in assessment_criteria_list:
for criteria in criteria_list:
if grade in kounter[criteria]:
tmp["values"].append(kounter[criteria][grade])
else:
@@ -185,7 +233,7 @@ def get_chart_data(grades, assessment_criteria_list, kounter):
return {
"data": {
"labels": assessment_criteria_list,
"labels": criteria_list,
"datasets": datasets
},
"type": 'bar',

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Final Assessment Grades"] = {
"filters": [
{
"fieldname":"academic_year",
"label": __("Academic Year"),
"fieldtype": "Link",
"options": "Academic Year",
"reqd": 1
},
{
"fieldname":"student_group",
"label": __("Student Group"),
"fieldtype": "Link",
"options": "Student Group",
"reqd": 1,
"get_query": function() {
return{
filters: {
"group_based_on": "Batch",
"academic_year": frappe.query_report_filters_by_name.academic_year.value
}
};
}
},
{
"fieldname":"assessment_group",
"label": __("Assessment Group"),
"fieldtype": "Link",
"options": "Assessment Group",
"reqd": 1
}
]
}

View File

@@ -0,0 +1,20 @@
{
"add_total_row": 0,
"apply_user_permissions": 1,
"creation": "2018-01-22 17:04:43.412054",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"letter_head": "Shishuvan Secondary School",
"modified": "2018-01-22 17:04:43.412054",
"modified_by": "Administrator",
"module": "Education",
"name": "Final Assessment Grades",
"owner": "Administrator",
"ref_doctype": "Assessment Result",
"report_name": "Final Assessment Grades",
"report_type": "Script Report",
"roles": []
}

View File

@@ -0,0 +1,85 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from collections import defaultdict
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_formatted_result
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_chart_data
def execute(filters=None):
columns, data, grades = [], [], []
args = frappe._dict()
course_wise_analysis = defaultdict(dict)
args["academic_year"] = filters.get("academic_year")
assessment_group = args["assessment_group"] = filters.get("assessment_group")
student_group = filters.get("student_group")
args.students = frappe.db.sql_list("select student from `tabStudent Group Student` where parent=%s", (student_group))
values = get_formatted_result(args, get_course=True)
student_details = values.get("student_details")
assessment_result = values.get("assessment_result")
course_dict = values.get("course_dict")
for student in args.students:
student_row = {}
student_row["student"] = student
student_row["student_name"] = student_details[student]
for course in course_dict:
scrub_course = frappe.scrub(course)
if assessment_group in assessment_result[student][course]:
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
# create the list of possible grades
if student_row["grade_" + scrub_course] not in grades:
grades.append(student_row["grade_" + scrub_course])
# create the dict of for gradewise analysis
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
else:
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
data.append(student_row)
course_list = [d for d in course_dict]
columns = get_column(course_dict)
chart = get_chart_data(grades, course_list, course_wise_analysis)
return columns, data, None, chart
def get_column(course_dict):
columns = [{
"fieldname": "student",
"label": _("Student ID"),
"fieldtype": "Link",
"options": "Student",
"width": 90
},
{
"fieldname": "student_name",
"label": _("Student Name"),
"fieldtype": "Data",
"width": 160
}]
for course in course_dict:
columns.append({
"fieldname": "grade_" + frappe.scrub(course),
"label": course,
"fieldtype": "Data",
"width": 110
})
columns.append({
"fieldname": "score_" + frappe.scrub(course),
"label": "Score(" + str(course_dict[course]) + ")",
"fieldtype": "Float",
"width": 100
})
return columns

View File

@@ -321,7 +321,7 @@ class PayrollEntry(Document):
journal_entry.user_remark = _('Payment of salary from {0} to {1}')\
.format(self.start_date, self.end_date)
journal_entry.company = self.company
journal_entry.posting_date = nowdate()
journal_entry.posting_date = self.posting_date
payment_amount = flt(total_salary_amount.rounded_total, precision)

View File

@@ -544,7 +544,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
group by item_code, stock_uom
order by idx"""
if fetch_exploded:
if cint(fetch_exploded):
query = query.format(table="BOM Explosion Item",
where_conditions="",
select_columns = ", bom_item.source_warehouse, (Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s ) as idx")
@@ -592,7 +592,7 @@ def validate_bom_no(item, bom_no):
@frappe.whitelist()
def get_children(doctype, parent=None, is_root=False, **filters):
if not parent:
if not parent or parent=="BOM":
frappe.msgprint(_('Please select a BOM'))
return

View File

@@ -11,7 +11,8 @@ frappe.treeview_settings["BOM"] = {
title: "BOM",
breadcrumb: "Manufacturing",
disable_add_node: true,
root_label: "All Bill of Materials", //fieldname from filters
root_label: "BOM", //fieldname from filters
get_tree_root: false,
get_label: function(node) {
if(node.data.qty) {
return node.data.qty + " x " + node.data.item_code;
@@ -19,6 +20,23 @@ frappe.treeview_settings["BOM"] = {
return node.data.item_code || node.data.value;
}
},
onload: function(me) {
var label = frappe.get_route()[0] + "/" + frappe.get_route()[1];
if(frappe.pages[label]) {
delete frappe.pages[label];
}
var filter = me.opts.filters[0];
if(frappe.route_options && frappe.route_options[filter.fieldname]) {
var val = frappe.route_options[filter.fieldname];
delete frappe.route_options[filter.fieldname];
filter.default = "";
me.args[filter.fieldname] = val;
me.root_label = val;
me.page.set_title(val);
}
me.make_tree();
},
toolbar: [
{ toggle_btn: true },
{

View File

@@ -490,7 +490,7 @@ class ProductionOrder(Document):
and detail.parent = entry.name
and detail.item_code = %s''', (self.name, d.item_code))[0][0]
d.db_set('transferred_qty', transferred_qty, update_modified = False)
d.db_set('transferred_qty', flt(transferred_qty), update_modified = False)
@frappe.whitelist()

View File

@@ -2,7 +2,7 @@
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "field:email",
"beta": 0,
"creation": "2017-09-19 16:20:27.510196",
@@ -295,7 +295,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-15 09:40:41.153561",
"modified": "2018-01-22 15:53:35.059946",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Donor",

View File

@@ -2,7 +2,7 @@
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "field:email",
"beta": 0,
"creation": "2017-09-11 09:24:52.898356",
@@ -140,7 +140,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "email",
"fieldtype": "Data",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -151,6 +151,7 @@
"label": "Email",
"length": 0,
"no_copy": 0,
"options": "User",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -325,7 +326,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-15 09:38:41.878167",
"modified": "2018-01-22 15:58:46.507509",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Member",

View File

@@ -2,7 +2,7 @@
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "field:email",
"beta": 0,
"creation": "2017-09-19 16:16:45.676019",
@@ -506,7 +506,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-15 09:40:25.229551",
"modified": "2018-01-22 15:53:46.480182",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Volunteer",

View File

@@ -183,7 +183,6 @@ erpnext.patches.v5_0.index_on_account_and_gl_entry
execute:frappe.db.sql("""delete from `tabProject Task`""")
erpnext.patches.v5_0.update_item_desc_in_invoice
erpnext.patches.v5_1.fix_against_account
erpnext.patches.v5_1.fix_credit_days_based_on
execute:frappe.rename_doc("DocType", "Salary Manager", "Process Payroll", force=True)
erpnext.patches.v5_1.rename_roles
erpnext.patches.v5_1.default_bom
@@ -346,7 +345,7 @@ erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
erpnext.patches.v7_1.set_prefered_contact_email
execute:frappe.reload_doc('accounts', 'doctype', 'accounts_settings')
execute:frappe.db.set_value("Accounts Settings", "Accounts Settings", "unlink_payment_on_cancellation_of_invoice", 0)
execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')")
execute:frappe.db.sql("update `tabStock Entry` set total_amount = 0 where purpose in('Repack', 'Manufacture')")
erpnext.patches.v7_1.save_stock_settings
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
erpnext.patches.v7_1.add_account_user_role_for_timesheet
@@ -487,3 +486,5 @@ erpnext.patches.v10_0.add_guardian_role_for_parent_portal
erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank
erpnext.patches.v10_0.update_assessment_plan
erpnext.patches.v10_0.update_assessment_result
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order

View File

@@ -0,0 +1,37 @@
from __future__ import unicode_literals
import frappe
from erpnext.patches.v8_10.change_default_customer_credit_days import make_payment_term, make_template
def execute():
for dt in ("Company", "Customer Group"):
frappe.reload_doc("setup", "doctype", frappe.scrub(dt))
credit_records = frappe.db.sql("""
SELECT DISTINCT `credit_days`, `credit_days_based_on`, `name`
from `tab{0}`
where
((credit_days_based_on='Fixed Days' or credit_days_based_on is null) and credit_days is not null)
or credit_days_based_on='Last Day of the Next Month'
""".format(dt), as_dict=1)
for d in credit_records:
template = create_payment_terms_template(d)
frappe.db.sql("""
update `tab{0}`
set `payment_terms` = %s
where name = %s
""".format(dt), (template.name, d.name))
def create_payment_terms_template(data):
if data.credit_days_based_on == "Fixed Days":
pyt_template_name = 'Default Payment Term - N{0}'.format(data.credit_days)
else:
pyt_template_name = 'Default Payment Term - EO2M'
if not frappe.db.exists("Payment Terms Template", pyt_template_name):
payment_term = make_payment_term(data.credit_days, data.credit_days_based_on)
template = make_template(payment_term)
else:
template = frappe.get_doc("Payment Terms Template", pyt_template_name)
return template

View File

@@ -0,0 +1,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("buying", "doctype", "supplier_quotation_item")
for doctype in ['Purchase Order','Supplier Quotation']:
frappe.db.sql("""
Update
`tab{doctype} Item`, `tabMaterial Request Item`
set
`tab{doctype} Item`.sales_order = `tabMaterial Request Item`.sales_order
where
`tab{doctype} Item`.material_request= `tabMaterial Request Item`.parent
and `tab{doctype} Item`.material_request_item = `tabMaterial Request Item`.name
and `tabMaterial Request Item`.sales_order is not null""".format(doctype=doctype))

View File

@@ -1,9 +0,0 @@
from __future__ import unicode_literals
import frappe
def execute():
for dt in ("Customer", "Customer Group", "Company"):
frappe.reload_doctype(dt, force=True)
frappe.db.sql("""update `tab{0}` set credit_days_based_on='Fixed Days'
where ifnull(credit_days, 0) > 0""".format(dt))

View File

@@ -20,7 +20,10 @@ def update_po_per_received_per_billed():
where parent = `tabPurchase Order`.name), 2),
`tabPurchase Order`.per_billed = ifnull(round((select sum( if(amount > ifnull(billed_amt, 0),
ifnull(billed_amt, 0), amount)) / sum(amount) *100 from `tabPurchase Order Item`
where parent = `tabPurchase Order`.name), 2), 0)""")
where parent = `tabPurchase Order`.name), 2), 0)
where
net_total > 0
""")
def update_so_per_delivered_per_billed():
frappe.db.sql("""
@@ -32,7 +35,10 @@ def update_so_per_delivered_per_billed():
where parent = `tabSales Order`.name), 2),
`tabSales Order`.per_billed = ifnull(round((select sum( if(amount > ifnull(billed_amt, 0),
ifnull(billed_amt, 0), amount)) / sum(amount) *100 from `tabSales Order Item`
where parent = `tabSales Order`.name), 2), 0)""")
where parent = `tabSales Order`.name), 2), 0)
where
net_total > 0
""")
def update_status():
frappe.db.sql("""

View File

@@ -5,5 +5,5 @@ def execute():
frappe.db.sql("""
update `tabCurrency Exchange`
set `date` = '2010-01-01'
where date is null or date = '' or date = '0000-00-00'
where date is null or date = '0000-00-00'
""")

View File

@@ -7,7 +7,7 @@ def execute():
frappe.reload_doc("hr", "doctype", "attendance")
frappe.db.sql("""update `tabAttendance`
set attendance_date = att_date
where attendance_date is null or attendance_date = '' or attendance_date = '0000-00-00'""")
where attendance_date is null or attendance_date = '0000-00-00'""")
update_reports("Attendance", "att_date", "attendance_date")
update_users_report_view_settings("Attendance", "att_date", "attendance_date")

View File

@@ -9,8 +9,7 @@ def execute():
salary_slips = frappe.db.sql("""select month, name, fiscal_year from `tabSalary Slip`
where (month is not null and month != '') and
(start_date is null or start_date = '') and
(end_date is null or end_date = '') and docstatus != 2""", as_dict=True)
start_date is null and end_date is null and docstatus != 2""", as_dict=True)
for salary_slip in salary_slips:
if not cint(salary_slip.month):

View File

@@ -8,7 +8,7 @@ def execute():
frappe.db.sql("""
update `tabSales Order`
set delivery_date = final_delivery_date
where (delivery_date is null or delivery_date = '' or delivery_date = '0000-00-00')
where (delivery_date is null or delivery_date = '0000-00-00')
and order_type = 'Sales'""")
frappe.db.sql("""
@@ -16,8 +16,6 @@ def execute():
set so_item.delivery_date = so.delivery_date
where so.name = so_item.parent
and so.order_type = 'Sales'
and (so_item.delivery_date is null or so_item.delivery_date = ''
or so_item.delivery_date = '0000-00-00')
and (so.delivery_date is not null and so.delivery_date != ''
and so.delivery_date != '0000-00-00')
""")
and (so_item.delivery_date is null or so_item.delivery_date = '0000-00-00')
and (so.delivery_date is not null and so.delivery_date != '0000-00-00')
""")

View File

@@ -17,7 +17,8 @@ def execute():
SELECT DISTINCT `credit_days`, `credit_days_based_on`, `name`
from `tab{0}`
where
(credit_days_based_on='Fixed Days' and credit_days is not null)
((credit_days_based_on='Fixed Days' or credit_days_based_on is null)
and credit_days is not null)
or credit_days_based_on='Last Day of the Next Month'
""".format(doctype))

View File

@@ -39,7 +39,7 @@ frappe.ui.form.on("Timesheet", {
refresh: function(frm) {
if(frm.doc.docstatus==1) {
if(frm.doc.per_billed < 100){
if(frm.doc.per_billed < 100 && frm.doc.total_billable_hours && frm.doc.total_billable_hours > frm.doc.total_billed_hours){
frm.add_custom_button(__("Make Sales Invoice"), function() { frm.trigger("make_invoice") },
"fa fa-file-alt");
}

View File

@@ -310,16 +310,16 @@ def get_timesheet(doctype, txt, searchfield, start, page_len, filters):
@frappe.whitelist()
def get_timesheet_data(name, project):
data = None
if project and project!='':
data = get_projectwise_timesheet_data(project, name)
else:
data = frappe.get_all('Timesheet',
fields = ["(total_billable_amount - total_billed_amount) as billing_amt", "total_billable_hours as billing_hours"], filters = {'name': name})
return {
'billing_hours': data[0].billing_hours,
'billing_amount': data[0].billing_amt,
'timesheet_detail': data[0].name if project and project!= '' else None
'billing_hours': data[0].billing_hours if data else None,
'billing_amount': data[0].billing_amt if data else None,
'timesheet_detail': data[0].name if data and project and project!= '' else None
}
@frappe.whitelist()
@@ -327,6 +327,12 @@ def make_sales_invoice(source_name, item_code=None, customer=None):
target = frappe.new_doc("Sales Invoice")
timesheet = frappe.get_doc('Timesheet', source_name)
if not timesheet.total_billable_hours:
frappe.throw(_("Invoice can't be made for zero billing hour"))
if timesheet.total_billable_hours == timesheet.total_billed_hours:
frappe.throw(_("Invoice already created for all billing hours"))
hours = flt(timesheet.total_billable_hours) - flt(timesheet.total_billed_hours)
billing_amount = flt(timesheet.total_billable_amount) - flt(timesheet.total_billed_amount)
billing_rate = billing_amount / hours

View File

@@ -653,11 +653,14 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
var payment_types = $.map(this.frm.doc.payments, function(d) { return d.type; });
if (in_list(payment_types, 'Cash')) {
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
var base_grand_total = this.frm.doc.base_rounded_total || this.frm.doc.base_grand_total;
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - grand_total +
this.frm.doc.write_off_amount, precision("change_amount"));
this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount -
this.frm.doc.base_grand_total + this.frm.doc.base_write_off_amount,
base_grand_total + this.frm.doc.base_write_off_amount,
precision("base_change_amount"));
}
}

View File

@@ -523,7 +523,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
},
callback: function(r, rt) {
if(r.message) {
me.frm.set_value("due_date", r.message);
me.frm.doc.due_date = r.message;
refresh_field("due_date");
frappe.ui.form.trigger(me.frm.doc.doctype, "currency");
me.recalculate_terms();
}
@@ -538,8 +539,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
due_date: function() {
// due_date is to be changed, payment terms template and/or payment schedule must
// be removed as due_date is automatically changed based on payment terms
if (this.frm.doc.due_date) {
if (this.frm.doc.payment_terms_template || this.frm.doc.payment_schedule.length) {
if (this.frm.doc.due_date && !this.frm.updating_party_details && !this.frm.doc.is_pos) {
if (this.frm.doc.payment_terms_template ||
(this.frm.doc.payment_schedule && this.frm.doc.payment_schedule.length)) {
var message1 = "";
var message2 = "";
var final_message = "Please clear the ";
@@ -554,11 +556,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if (message1.length !== 0) message2 = " and " + message2;
final_message = final_message + message2;
}
frappe.msgprint(final_message);
}
}
}
},
recalculate_terms: function() {
@@ -648,6 +648,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}
}).fail(() => this.frm.set_value('shipping_rule', ''));
}
else {
me.calculate_taxes_and_totals();
}
},
set_actual_charges_based_on_currency: function() {

View File

@@ -43,7 +43,7 @@ frappe.ui.form.on("Customer", {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Customer'}
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
frm.toggle_display(['address_html','contact_html','primary_contact_detail'], !frm.doc.__islocal);
if(!frm.doc.__islocal) {
frappe.contacts.render_address_and_contact(frm);

View File

@@ -1002,9 +1002,9 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "payment_terms",
"fieldtype": "Link",
"default": "0",
"fieldname": "bypass_credit_limit_check_at_sales_order",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1012,10 +1012,9 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Payment Terms Template",
"label": "Bypass credit limit check at Sales Order",
"length": 0,
"no_copy": 0,
"options": "Payment Terms Template",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -1034,9 +1033,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fieldname": "bypass_credit_limit_check_at_sales_order",
"fieldtype": "Check",
"fieldname": "column_break_34",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1044,7 +1042,6 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Bypass credit limit check at Sales Order",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1059,6 +1056,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "payment_terms",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Payment Terms Template",
"length": 0,
"no_copy": 0,
"options": "Payment Terms Template",
"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_bulk_edit": 0,
"allow_on_submit": 0,
@@ -1354,7 +1383,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-12-13 18:17:19.894331",
"modified": "2018-01-30 11:52:05.497363",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",

View File

@@ -185,12 +185,14 @@ def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
("%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, start, page_len))
def check_credit_limit(customer, company):
customer_outstanding = get_customer_outstanding(customer, company)
def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, extra_amount=0):
customer_outstanding = get_customer_outstanding(customer, company, ignore_outstanding_sales_order)
if extra_amount > 0:
customer_outstanding += flt(extra_amount)
credit_limit = get_credit_limit(customer, company)
if credit_limit > 0 and flt(customer_outstanding) > credit_limit:
msgprint(_("Credit limit has been crossed for customer {0} {1}/{2}")
msgprint(_("Credit limit has been crossed for customer {0} ({1}/{2})")
.format(customer, customer_outstanding, credit_limit))
# If not authorized person raise exception
@@ -231,7 +233,8 @@ def get_customer_outstanding(customer, company, ignore_outstanding_sales_order=F
and dn.customer=%s and dn.company=%s
and dn.docstatus = 1 and dn.status not in ('Closed', 'Stopped')
and ifnull(dn_item.against_sales_order, '') = ''
and ifnull(dn_item.against_sales_invoice, '') = ''""", (customer, company), as_dict=True)
and ifnull(dn_item.against_sales_invoice, '') = ''
""", (customer, company), as_dict=True)
outstanding_based_on_dn = 0.0

View File

@@ -484,11 +484,6 @@ def make_delivery_note(source_name, target_doc=None):
else:
target.po_no = source.po_no
# Since the credit limit check is bypassed at sales order level,
# we need to check it at delivery note
if cint(frappe.db.get_value("Customer", source.customer, "bypass_credit_limit_check_at_sales_order")):
check_credit_limit(source.customer, source.company)
target.ignore_pricing_rule = 1
target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")
@@ -553,10 +548,6 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")
# Since the credit limit check is bypassed at sales order level, we need to check it at sales invoice
if cint(frappe.db.get_value("Customer", source.customer, "bypass_credit_limit_check_at_sales_order")):
check_credit_limit(source.customer, source.company)
# set company address
target.update(get_company_address(target.company))
if target.company_address:

View File

@@ -15,6 +15,7 @@ frappe.pages['point-of-sale'].on_page_load = function(wrapper) {
window.cur_pos = wrapper.pos;
} else {
// offline
frappe.flags.is_offline = true;
frappe.set_route('pos');
}
});
@@ -24,6 +25,10 @@ frappe.pages['point-of-sale'].refresh = function(wrapper) {
if (wrapper.pos) {
cur_frm = wrapper.pos.frm;
}
if (frappe.flags.is_offline) {
frappe.set_route('pos');
}
}
erpnext.pos.PointOfSale = class PointOfSale {
@@ -463,6 +468,8 @@ erpnext.pos.PointOfSale = class PointOfSale {
if (r.message) {
this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice';
this.frm.allow_edit_rate = r.message.allow_edit_rate;
this.frm.allow_edit_discount = r.message.allow_edit_discount;
}
}
@@ -552,9 +559,9 @@ class POSCart {
<div class="taxes-and-totals">
${this.get_taxes_and_totals()}
</div>
<div class="discount-amount">
${this.get_discount_amount()}
</div>
<div class="discount-amount">`+
(!this.frm.allow_edit_discount ? `` : `${this.get_discount_amount()}`)+
`</div>
<div class="grand-total">
${this.get_grand_total()}
</div>
@@ -583,6 +590,7 @@ class POSCart {
this.numpad && this.numpad.reset_value();
this.customer_field.set_value("");
this.$discount_amount.find('input:text').val('');
this.wrapper.find('.grand-total-value').text(
format_currency(this.frm.doc.grand_total, this.frm.currency));
this.wrapper.find('.rounded-total-value').text(
@@ -713,6 +721,17 @@ class POSCart {
this.customer_field.set_value(this.frm.doc.customer);
}
disable_numpad_control() {
let disabled_btns = [];
if(!this.frm.allow_edit_rate) {
disabled_btns.push('Rate');
}
if(!this.frm.allow_edit_discount) {
disabled_btns.push('Disc');
}
return disabled_btns;
}
make_numpad() {
this.numpad = new NumberPad({
button_array: [
@@ -727,6 +746,7 @@ class POSCart {
disable_highlight: ['Qty', 'Disc', 'Rate', 'Pay'],
reset_btns: ['Qty', 'Disc', 'Rate', 'Pay'],
del_btn: 'Del',
disable_btns: this.disable_numpad_control(),
wrapper: this.wrapper.find('.number-pad-container'),
onclick: (btn_value) => {
// on click
@@ -1257,7 +1277,7 @@ class NumberPad {
constructor({
wrapper, onclick, button_array,
add_class={}, disable_highlight=[],
reset_btns=[], del_btn='',
reset_btns=[], del_btn='', disable_btns
}) {
this.wrapper = wrapper;
this.onclick = onclick;
@@ -1266,6 +1286,7 @@ class NumberPad {
this.disable_highlight = disable_highlight;
this.reset_btns = reset_btns;
this.del_btn = del_btn;
this.disable_btns = disable_btns || [];
this.make_dom();
this.bind_events();
this.value = '';
@@ -1296,6 +1317,16 @@ class NumberPad {
}
this.set_class();
if(this.disable_btns) {
this.disable_btns.forEach((btn) => {
const $btn = this.get_btn(btn);
$btn.prop("disabled", true)
$btn.hover(() => {
$btn.css('cursor','not-allowed');
})
})
}
}
set_class() {

View File

@@ -340,7 +340,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
conversion_factor: function(doc, cdt, cdn, dont_fetch_price_list_rate) {
this._super(doc, cdt, cdn, dont_fetch_price_list_rate);
if(frappe.meta.get_docfield(cdt, "stock_qty", cdn)) {
if(frappe.meta.get_docfield(cdt, "stock_qty", cdn) &&
in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
this.set_batch_number(cdt, cdn);
}
},

View File

@@ -1180,6 +1180,35 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_26",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 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_bulk_edit": 0,
"allow_on_submit": 0,
@@ -1219,8 +1248,9 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_26",
"fieldtype": "Column Break",
"depends_on": "",
"fieldname": "payment_terms",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1228,8 +1258,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Payment Terms Template",
"length": 0,
"no_copy": 0,
"options": "Payment Terms Template",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -1242,69 +1274,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "credit_days_based_on",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Credit Days Based On",
"length": 0,
"no_copy": 0,
"options": "\nFixed Days\nLast Day of the Next Month",
"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_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')",
"fieldname": "credit_days",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Credit Days",
"length": 0,
"no_copy": 0,
"oldfieldname": "credit_days",
"oldfieldtype": "Int",
"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_bulk_edit": 0,
"allow_on_submit": 0,
@@ -2052,7 +2021,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-12-07 18:40:24.646920",
"modified": "2018-01-29 12:40:24.646920",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@@ -34,6 +34,7 @@ class Company(Document):
self.validate_currency()
self.validate_coa_input()
self.validate_perpetual_inventory()
self.check_country_change()
def validate_abbr(self):
if not self.abbr:
@@ -80,9 +81,12 @@ class Company(Document):
if not frappe.db.sql("""select name from tabAccount
where company=%s and docstatus<2 limit 1""", self.name):
if not frappe.local.flags.ignore_chart_of_accounts:
frappe.flags.country_change = True
self.create_default_accounts()
self.create_default_warehouses()
install_country_fixtures(self.name)
if frappe.flags.country_change:
install_country_fixtures(self.name)
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
self.create_default_cost_center()
@@ -147,6 +151,13 @@ class Company(Document):
frappe.msgprint(_("Set default inventory account for perpetual inventory"),
alert=True, indicator='orange')
def check_country_change(self):
frappe.flags.country_change = False
if not self.get('__islocal') and \
self.country != frappe.db.get_value('Company', self.name, 'country'):
frappe.flags.country_change = True
def set_default_accounts(self):
self._set_default_account("default_cash_account", "Cash")
self._set_default_account("default_bank_account", "Bank")
@@ -162,8 +173,14 @@ class Company(Document):
self._set_default_account("default_expense_account", "Cost of Goods Sold")
if not self.default_income_account:
self.db_set("default_income_account", frappe.db.get_value("Account",
{"account_name": _("Sales"), "company": self.name}))
income_account = frappe.db.get_value("Account",
{"account_name": _("Sales"), "company": self.name, "is_group": 0})
if not income_account:
income_account = frappe.db.get_value("Account",
{"account_name": _("Sales Account"), "company": self.name})
self.db_set("default_income_account", income_account)
if not self.default_payable_account:
self.db_set("default_payable_account", self.default_payable_account)

View File

@@ -162,12 +162,14 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "credit_days_based_on",
"fieldtype": "Select",
"depends_on": "",
"fieldname": "payment_terms",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -175,10 +177,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Credit Days Based On",
"label": "Default Payment Terms Template",
"length": 0,
"no_copy": 0,
"options": "\nFixed Days\nLast Day of the Next Month",
"options": "Payment Terms Template",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -191,35 +193,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.credit_days_based_on=='Fixed Days'",
"fieldname": "credit_days",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Credit Days",
"length": 0,
"no_copy": 0,
"permlevel": 1,
"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,
@@ -411,7 +384,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-02-20 13:25:31.549874",
"modified": "2018-01-29 13:25:31.549874",
"modified_by": "Administrator",
"module": "Setup",
"name": "Customer Group",

View File

@@ -9,6 +9,7 @@ from frappe.utils.nestedset import NestedSet
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
from erpnext.utilities.product import get_qty_in_stock
class ItemGroup(NestedSet, WebsiteGenerator):
@@ -83,7 +84,8 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non
# base query
query = """select I.name, I.item_name, I.item_code, I.route, I.image, I.website_image, I.thumbnail, I.item_group,
I.description, I.web_long_description as website_description, I.is_stock_item,
case when (S.actual_qty - S.reserved_qty) > 0 then 1 else 0 end as in_stock
case when (S.actual_qty - S.reserved_qty) > 0 then 1 else 0 end as in_stock, I.website_warehouse,
I.has_batch_no
from `tabItem` I
left join tabBin S on I.item_code = S.item_code and I.website_warehouse = S.warehouse
where I.show_in_website = 1
@@ -104,8 +106,26 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non
data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1)
data = adjust_qty_for_expired_items(data)
return [get_item_for_list_in_html(r) for r in data]
def adjust_qty_for_expired_items(data):
adjusted_data = []
for item in data:
if item.get('has_batch_no') and item.get('website_warehouse'):
stock_qty_dict = get_qty_in_stock(
item.get('name'), 'website_warehouse', item.get('website_warehouse'))
qty = stock_qty_dict.stock_qty[0][0]
item['in_stock'] = 1 if qty else 0
adjusted_data.append(item)
return adjusted_data
def get_child_groups(item_group_name):
item_group = frappe.get_doc("Item Group", item_group_name)
return frappe.db.sql("""select name

View File

@@ -65,10 +65,13 @@ def place_order():
from erpnext.selling.doctype.quotation.quotation import _make_sales_order
sales_order = frappe.get_doc(_make_sales_order(quotation.name, ignore_permissions=True))
for item in sales_order.get("items"):
item.reserved_warehouse = frappe.db.get_value("Item", item.item_code, "website_warehouse") or None
item_stock = get_qty_in_stock(item.item_code, "website_warehouse")
if item.qty > item_stock.stock_qty[0][0]:
throw(_("Only {0} in stock for item {1}").format(item_stock.stock_qty[0][0], item.item_code))
item.reserved_warehouse, is_stock_item = frappe.db.get_value("Item",
item.item_code, ["website_warehouse", "is_stock_item"]) or None, None
if is_stock_item:
item_stock = get_qty_in_stock(item.item_code, "website_warehouse")
if item.qty > item_stock.stock_qty[0][0]:
throw(_("Only {0} in stock for item {1}").format(item_stock.stock_qty[0][0], item.item_code))
sales_order.flags.ignore_permissions = True
sales_order.insert()

View File

@@ -75,7 +75,7 @@ erpnext.stock.ItemDashboard = Class.extend({
this.content.find('.more').addClass('hidden');
}
// If not any stock in any warehouses provide a message to end user
// If not any stock in any warehouses provide a message to end user
if (context.data.length > 0) {
$(frappe.render_template('item_dashboard_list', context)).appendTo(this.result);
} else {
@@ -86,6 +86,7 @@ erpnext.stock.ItemDashboard = Class.extend({
get_item_dashboard_data: function(data, max_count, show_item) {
if(!max_count) max_count = 0;
if(!data) data = [];
data.forEach(function(d) {
d.actual_or_pending = d.projected_qty + d.reserved_qty + d.reserved_qty_for_production;
d.pending_qty = 0;
@@ -97,9 +98,16 @@ erpnext.stock.ItemDashboard = Class.extend({
max_count = Math.max(d.actual_or_pending, d.actual_qty,
d.total_reserved, max_count);
});
var can_write = 0;
if(frappe.boot.user.can_write.indexOf("Stock Entry")>=0){
can_write = 1;
}
return {
data: data,
max_count: max_count,
can_write:can_write,
show_item: show_item || false
}
}
@@ -187,4 +195,4 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb
frappe.set_route('Form', doc.doctype, doc.name);
})
});
}
}

View File

@@ -39,6 +39,7 @@
</span>
</span>
</div>
{% if can_write %}
<div class="col-sm-2 text-right" style="margin-top: 8px;">
{% if d.actual_qty %}
<button class="btn btn-default btn-xs btn-move"
@@ -52,6 +53,7 @@
data-item="{{ d.item_code }}"
data-rate="{{ d.valuation_rate }}">{{ __("Add") }}</a>
</div>
{% endif %}
</div>
</div>
{% endfor %}

View File

@@ -47,7 +47,6 @@ def get_batch_qty(batch_no=None, warehouse=None, item_code=None):
:param batch_no: Optional - give qty for this batch no
:param warehouse: Optional - give qty for this warehouse
:param item_code: Optional - give qty for this item'''
frappe.has_permission('Batch', throw=True)
out = 0
if batch_no and warehouse:
out = float(frappe.db.sql("""select sum(actual_qty)
@@ -115,8 +114,8 @@ def set_batch_nos(doc, warehouse_field, throw = False):
d.batch_no = get_batch_no(d.item_code, warehouse, qty, throw)
else:
batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse)
if flt(batch_qty) < flt(qty):
frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.qty))
if flt(batch_qty, d.precision("qty")) < flt(qty, d.precision("qty")):
frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, qty))
@frappe.whitelist()
def get_batch_no(item_code, warehouse, qty=1, throw=False):

View File

@@ -1,7 +1,7 @@
frappe.listview_settings['Batch'] = {
add_fields: ["item", "expiry_date"],
get_indicator: function(doc) {
if(doc.expiry_date && frappe.datetime.get_diff(doc.expiry_date) <= 0) {
if(doc.expiry_date && frappe.datetime.get_diff(doc.expiry_date, frappe.datetime.nowdate()) <= 0) {
return [__("Expired"), "red", "expiry_date,>=,Today"]
} else if(doc.expiry_date) {
return [__("Not Expired"), "green", "expiry_date,<,Today"]

View File

@@ -235,13 +235,22 @@ class DeliveryNote(SellingController):
def check_credit_limit(self):
from erpnext.selling.doctype.customer.customer import check_credit_limit
extra_amount = 0
validate_against_credit_limit = False
for d in self.get("items"):
if not (d.against_sales_order or d.against_sales_invoice):
validate_against_credit_limit = True
break
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer,
"bypass_credit_limit_check_at_sales_order"))
if bypass_credit_limit_check_at_sales_order:
validate_against_credit_limit = True
extra_amount = self.base_grand_total
else:
for d in self.get("items"):
if not (d.against_sales_order or d.against_sales_invoice):
validate_against_credit_limit = True
break
if validate_against_credit_limit:
check_credit_limit(self.customer, self.company)
check_credit_limit(self.customer, self.company,
bypass_credit_limit_check_at_sales_order, extra_amount)
def validate_packed_qty(self):
"""

View File

@@ -106,6 +106,13 @@ frappe.ui.form.on("Item", {
frappe.set_route("Form", "Item Variant Settings");
}, __("View"));
}
const stock_exists = (frm.doc.__onload
&& frm.doc.__onload.stock_exists) ? 1 : 0;
['has_serial_no', 'has_batch_no'].forEach((fieldname) => {
frm.set_df_property(fieldname, 'read_only', stock_exists);
});
},
validate: function(frm){
@@ -310,11 +317,6 @@ $.extend(erpnext.item, {
show_multiple_variants_dialog: function(frm) {
var me = this;
if(me.multiple_variant_dialog) {
me.multiple_variant_dialog.show();
return;
}
let promises = [];
let attr_val_fields = {};

View File

@@ -1180,7 +1180,7 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
"set_only_once": 0,
"unique": 0
},
{
@@ -1370,7 +1370,7 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
"set_only_once": 0,
"unique": 0
},
{
@@ -3453,7 +3453,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2017-12-27 15:47:17.039337",
"modified": "2018-01-23 12:21:16.641517",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@@ -65,7 +65,7 @@ class MaterialRequest(BuyingController):
self.status = "Draft"
from erpnext.controllers.status_updater import validate_status
validate_status(self.status,
validate_status(self.status,
["Draft", "Submitted", "Stopped", "Cancelled", "Pending",
"Partially Ordered", "Ordered", "Issued", "Transferred"])
@@ -240,7 +240,8 @@ def make_purchase_order(source_name, target_doc=None):
["name", "material_request_item"],
["parent", "material_request"],
["uom", "stock_uom"],
["uom", "uom"]
["uom", "uom"],
["sales_order", "sales_order"]
],
"postprocess": update_item,
"condition": lambda doc: doc.ordered_qty < doc.stock_qty
@@ -344,7 +345,8 @@ def make_supplier_quotation(source_name, target_doc=None):
"doctype": "Supplier Quotation Item",
"field_map": {
"name": "material_request_item",
"parent": "material_request"
"parent": "material_request",
"sales_order": "sales_order"
}
}
}, target_doc, postprocess)

View File

@@ -72,6 +72,7 @@ frappe.ui.form.on('Stock Entry', {
mr_item.item_code = item.item_code;
mr_item.item_name = item.item_name;
mr_item.uom = item.uom;
mr_item.conversion_factor = item.conversion_factor;
mr_item.item_group = item.item_group;
mr_item.description = item.description;
mr_item.image = item.image;

View File

@@ -288,7 +288,7 @@ class StockEntry(StockController):
# get basic rate
if not d.bom_no:
if not flt(d.basic_rate) or d.s_warehouse or force:
if (not flt(d.basic_rate) and not d.allow_zero_valuation_rate) or d.s_warehouse or force:
basic_rate = flt(get_incoming_rate(args), self.precision("basic_rate", d))
if basic_rate > 0:
d.basic_rate = basic_rate
@@ -299,7 +299,8 @@ class StockEntry(StockController):
# get scrap items basic rate
if d.bom_no:
if not flt(d.basic_rate) and getattr(self, "pro_doc", frappe._dict()).scrap_warehouse == d.t_warehouse:
if not flt(d.basic_rate) and not d.allow_zero_valuation_rate and \
getattr(self, "pro_doc", frappe._dict()).scrap_warehouse == d.t_warehouse:
basic_rate = flt(get_incoming_rate(args), self.precision("basic_rate", d))
if basic_rate > 0:
d.basic_rate = basic_rate

View File

@@ -150,7 +150,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Disabled",
"length": 0,
@@ -699,7 +699,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-08-21 02:12:33.652689",
"modified": "2018-01-23 16:45:45.546649",
"modified_by": "Administrator",
"module": "Stock",
"name": "Warehouse",

View File

@@ -472,8 +472,8 @@ def get_projected_qty(item_code, warehouse):
@frappe.whitelist()
def get_bin_details(item_code, warehouse):
return frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse},
["projected_qty", "actual_qty"], as_dict=True) \
or {"projected_qty": 0, "actual_qty": 0}
["projected_qty", "actual_qty", "ordered_qty"], as_dict=True) \
or {"projected_qty": 0, "actual_qty": 0, "ordered_qty": 0}
@frappe.whitelist()
def get_serial_no_details(item_code, warehouse, stock_qty, serial_no):

View File

@@ -85,18 +85,22 @@ def get_item_warehouse_projected_qty(items_to_consider):
from tabBin where item_code in ({0})
and (warehouse != "" and warehouse is not null)"""\
.format(", ".join(["%s"] * len(items_to_consider))), items_to_consider):
item_warehouse_projected_qty.setdefault(item_code, {})[warehouse] = flt(projected_qty)
if item_code not in item_warehouse_projected_qty:
item_warehouse_projected_qty.setdefault(item_code, {})
if warehouse not in item_warehouse_projected_qty.get(item_code):
item_warehouse_projected_qty[item_code][warehouse] = flt(projected_qty)
warehouse_doc = frappe.get_doc("Warehouse", warehouse)
while warehouse_doc.parent_warehouse:
if not item_warehouse_projected_qty.get(item_code, {}).get(warehouse_doc.parent_warehouse):
item_warehouse_projected_qty.setdefault(item_code, {})[warehouse_doc.parent_warehouse] = flt(projected_qty)
else:
item_warehouse_projected_qty[item_code][warehouse_doc.parent_warehouse] += flt(projected_qty)
warehouse_doc = frappe.get_doc("Warehouse", warehouse_doc.parent_warehouse)
return item_warehouse_projected_qty
def create_material_request(material_requests):

View File

@@ -66,7 +66,6 @@ def get_data(filters, columns):
return item_price_qty_data
def get_item_price_qty_data(filters):
item_dicts = []
conditions = ""
if filters.get("item_code"):
conditions += "where a.item_code=%(item_code)s"
@@ -78,11 +77,10 @@ def get_item_price_qty_data(filters):
{conditions}"""
.format(conditions=conditions), filters, as_dict=1)
price_list_names = ",".join(['"' + frappe.db.escape(item['price_list_name']) + '"'
for item in item_results])
price_list_names = list(set([frappe.db.escape(item.price_list_name) for item in item_results]))
buying_price_map = get_buying_price_map(price_list_names)
selling_price_map = get_selling_price_map(price_list_names)
buying_price_map = get_price_map(price_list_names, buying=1)
selling_price_map = get_price_map(price_list_names, selling=1)
result = []
if item_results:
@@ -109,40 +107,31 @@ def get_item_price_qty_data(filters):
return result
def get_buying_price_map(price_list_names):
buying_price = frappe.db.sql("""
def get_price_map(price_list_names, buying=0, selling=0):
price_map = {}
if not price_list_names:
return price_map
rate_key = "Buying Rate" if buying else "Selling Rate"
price_list_key = "Buying Price List" if buying else "Selling Price List"
price_list_condition = " and buying=1" if buying else " and selling=1"
pricing_details = frappe.db.sql("""
select
name,price_list,price_list_rate
from
`tabItem Price`
where
name in ({price_list_names}) and buying=1
""".format(price_list_names=price_list_names), as_dict=1)
name in ({price_list_names}) {price_list_condition}
""".format(price_list_names=', '.join(['%s']*len(price_list_names)),
price_list_condition=price_list_condition), price_list_names, as_dict=1)
buying_price_map = {}
for d in buying_price:
for d in pricing_details:
name = d["name"]
buying_price_map[name] = {
"Buying Price List" :d["price_list"],
"Buying Rate" :d["price_list_rate"]
price_map[name] = {
price_list_key :d["price_list"],
rate_key :d["price_list_rate"]
}
return buying_price_map
def get_selling_price_map(price_list_names):
selling_price = frappe.db.sql("""
select
name,price_list,price_list_rate
from
`tabItem Price`
where
name in ({price_list_names}) and selling=1
""".format(price_list_names=price_list_names), as_dict=1)
selling_price_map = {}
for d in selling_price:
name = d["name"]
selling_price_map[name] = {
"Selling Price List" :d["price_list"],
"Selling Rate" :d["price_list_rate"]
}
return selling_price_map
return price_map

View File

@@ -106,11 +106,10 @@ def get_opening_balance(filters, columns):
from erpnext.stock.stock_ledger import get_previous_sle
last_entry = get_previous_sle({
"item_code": filters.item_code,
"warehouse": get_warehouse_condition(filters.warehouse),
"warehouse_condition": get_warehouse_condition(filters.warehouse),
"posting_date": filters.from_date,
"posting_time": "00:00:00"
})
row = [""]*len(columns)
row[1] = _("'Opening'")
for i, v in ((9, 'qty_after_transaction'), (11, 'valuation_rate'), (12, 'stock_value')):
@@ -122,7 +121,7 @@ def get_warehouse_condition(warehouse):
warehouse_details = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"], as_dict=1)
if warehouse_details:
return " exists (select name from `tabWarehouse` wh \
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(warehouse_details.lft,
where wh.lft >= %s and wh.rgt <= %s and warehouse = wh.name)"%(warehouse_details.lft,
warehouse_details.rgt)
return ''

View File

@@ -407,7 +407,12 @@ def get_previous_sle(args, for_update=False):
def get_stock_ledger_entries(previous_sle, operator=None, order="desc", limit=None, for_update=False, debug=False):
"""get stock ledger entries filtered by specific posting datetime conditions"""
conditions = "timestamp(posting_date, posting_time) {0} timestamp(%(posting_date)s, %(posting_time)s)".format(operator)
conditions = " and timestamp(posting_date, posting_time) {0} timestamp(%(posting_date)s, %(posting_time)s)".format(operator)
if previous_sle.get("warehouse"):
conditions += " and warehouse = %(warehouse)s"
elif previous_sle.get("warehouse_condition"):
conditions += " and " + previous_sle.get("warehouse_condition")
if not previous_sle.get("posting_date"):
previous_sle["posting_date"] = "1900-01-01"
if not previous_sle.get("posting_time"):
@@ -418,9 +423,8 @@ def get_stock_ledger_entries(previous_sle, operator=None, order="desc", limit=No
return frappe.db.sql("""select *, timestamp(posting_date, posting_time) as "timestamp" from `tabStock Ledger Entry`
where item_code = %%(item_code)s
and warehouse = %%(warehouse)s
and ifnull(is_cancelled, 'No')='No'
and %(conditions)s
%(conditions)s
order by timestamp(posting_date, posting_time) %(order)s, name %(order)s
%(limit)s %(for_update)s""" % {
"conditions": conditions,

View File

@@ -4,25 +4,70 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, fmt_money, flt
from frappe.utils import cint, fmt_money, flt, nowdate, getdate
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item
from erpnext.stock.doctype.batch.batch import get_batch_qty
def get_qty_in_stock(item_code, item_warehouse_field):
def get_qty_in_stock(item_code, item_warehouse_field, warehouse=None):
in_stock, stock_qty = 0, ''
template_item_code, is_stock_item = frappe.db.get_value("Item", item_code, ["variant_of", "is_stock_item"])
warehouse = frappe.db.get_value("Item", item_code, item_warehouse_field)
if not warehouse:
warehouse = frappe.db.get_value("Item", item_code, item_warehouse_field)
if not warehouse and template_item_code and template_item_code != item_code:
warehouse = frappe.db.get_value("Item", template_item_code, item_warehouse_field)
if warehouse:
stock_qty = frappe.db.sql("""select GREATEST(actual_qty - reserved_qty, 0) from tabBin where
item_code=%s and warehouse=%s""", (item_code, warehouse))
if stock_qty:
if stock_qty:
stock_qty = adjust_qty_for_expired_items(item_code, stock_qty, warehouse)
if stock_qty:
in_stock = stock_qty[0][0] > 0 and 1 or 0
if stock_qty:
in_stock = stock_qty[0][0] > 0 and 1 or 0
return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty, "is_stock_item": is_stock_item})
def adjust_qty_for_expired_items(item_code, stock_qty, warehouse):
batches = frappe.get_all('Batch', filters=[{'item': item_code}], fields=['expiry_date', 'name'])
expired_batches = get_expired_batches(batches)
stock_qty = [list(item) for item in stock_qty]
for batch in expired_batches:
if warehouse:
stock_qty[0][0] = max(0, stock_qty[0][0] - get_batch_qty(batch, warehouse))
else:
stock_qty[0][0] = max(0, stock_qty[0][0] - qty_from_all_warehouses(get_batch_qty(batch)))
if not stock_qty[0][0]:
break
return stock_qty
def get_expired_batches(batches):
"""
:param batches: A list of dict in the form [{'expiry_date': datetime.date(20XX, 1, 1), 'name': 'batch_id'}, ...]
"""
return [b.name for b in batches if b.expiry_date and b.expiry_date <= getdate(nowdate())]
def qty_from_all_warehouses(batch_info):
"""
:param batch_info: A list of dict in the form [{u'warehouse': u'Stores - I', u'qty': 0.8}, ...]
"""
qty = 0
for batch in batch_info:
qty = qty + batch.qty
return qty
def get_price(item_code, price_list, customer_group, company, qty=1):
template_item_code = frappe.db.get_value("Item", item_code, "variant_of")

View File

@@ -26,7 +26,7 @@ class TransactionBase(StatusUpdater):
now = now_datetime()
self.posting_date = now.strftime('%Y-%m-%d')
self.posting_time = now.strftime('%H:%M:%S.%f')
else:
elif self.posting_time:
try:
get_time(self.posting_time)
except ValueError:

View File

@@ -40,12 +40,12 @@ def create_customers(args_data):
@frappe.whitelist()
def create_letterhead(args_data):
args = json.loads(args_data)
letterhead = args.get("letterhead").encode('utf-8')
letterhead = args.get("letterhead")
if letterhead:
try:
frappe.get_doc({
"doctype":"Letter Head",
"content":"""<div><img src="{0}" style='max-width: 100%%;'><br></div>""".format(letterhead),
"content":"""<div><img src="{0}" style='max-width: 100%%;'><br></div>""".format(letterhead.encode('utf-8')),
"letter_head_name": _("Standard"),
"is_default": 1
}).insert()