Compare commits

..

150 Commits

Author SHA1 Message Date
Nabin Hait
b09c87bd0f Merge branch 'hotfix' 2016-06-03 11:50:19 +05:30
Nabin Hait
ef7b6ab8ef bumped to version 6.27.22 2016-06-03 12:20:19 +06:00
Nabin Hait
b0f7e5b23f Merge pull request #5424 from shreyasp/issue/delete-root-account
[Fix] User allowed to delete the root account in Chart of Accounts
2016-05-31 17:37:08 +05:30
shreyas
2bb845e53f [Fix] User allowed to delete the root account in Chart of Accounts 2016-05-31 17:15:28 +05:30
Nabin Hait
29628f3bb1 Merge pull request #5407 from neilLasrado/hotfix-1
Fixed error in bom autoname
2016-05-27 16:22:32 +05:30
Neil Trini Lasrado
45328f7729 Fixed error in bom autoname 2016-05-27 13:04:20 +05:30
Nabin Hait
fd5d0db6e2 Merge branch 'hotfix' 2016-05-26 16:55:34 +05:30
Nabin Hait
01eb7d02cc bumped to version 6.27.21 2016-05-26 17:25:34 +06:00
Nabin Hait
5af737dd67 Update sales_order.py 2016-05-26 16:54:25 +05:30
Nabin Hait
1c383c3664 Merge branch 'hotfix' 2016-05-26 15:45:34 +05:30
Nabin Hait
c5d186c497 bumped to version 6.27.20 2016-05-26 16:15:34 +06:00
Nabin Hait
40d63d0675 Merge pull request #5378 from saurabh6790/hotfix
[fix] update setup wizard access
2016-05-24 11:47:31 +05:30
Nabin Hait
05997b9138 Merge pull request #5380 from rohitwaghchaure/hotfix_material_request_issue
[Fix] during making of material request from sales order, system fetching product bundle items only if so has both product bundle and purchase item
2016-05-23 12:31:17 +05:30
Rohit Waghchaure
62dbbfba0d [Fix] during making of material request from sales order, system fetching product bundle items only if so has both product bundle and purchase item 2016-05-20 17:09:29 +05:30
Nabin Hait
04f3286c04 Update company.py 2016-05-20 15:47:56 +05:30
Saurabh
31c0d43b95 [fix] update setup wizard access 2016-05-20 15:30:00 +05:30
Nabin Hait
6558e1dd80 Merge branch 'hotfix' 2016-05-20 15:15:20 +05:30
Nabin Hait
a54a2a99f4 bumped to version 6.27.19 2016-05-20 15:45:20 +06:00
Nabin Hait
eb04405d6b Merge pull request #5377 from nabinhait/setup_wizard_access
[hotfix] setup wizard access
2016-05-20 15:13:28 +05:30
Nabin Hait
d112417301 [hotfix] setup wizard access 2016-05-20 15:12:45 +05:30
Nabin Hait
de974c684c Merge branch 'hotfix' 2016-05-20 12:18:27 +05:30
Nabin Hait
6c5a9bbe6b bumped to version 6.27.18 2016-05-20 12:48:27 +06:00
Nabin Hait
2edf6b84d6 Merge pull request #5364 from rohitwaghchaure/setup_wizard_access_issue
[Fix] Restrict access to setup wizard page if setup is already completed
2016-05-20 11:40:00 +05:30
Nabin Hait
58e493ad51 Merge pull request #5372 from rohitwaghchaure/setup_wizard_translation_issue
[Translation] [Fix] Exception in setup wizard, item attributes Large and Extra Large has same translation
2016-05-20 11:35:53 +05:30
Nabin Hait
a1f7e070ec Merge pull request #5373 from rohitwaghchaure/tax_rule_fixes
[Fixes] tax rule, tax rule working even if tax template inside the rule is disabled.
2016-05-20 11:35:37 +05:30
Rohit Waghchaure
9333b6208a [Translation] [Fix] Exception in setup wizard, item attributes Large and Extra Large has same translation 2016-05-19 17:01:49 +05:30
Rohit Waghchaure
d818bcd888 [Fixes] tax rule, tax rule working even if tax template inside the rule is disabled. 2016-05-19 16:53:01 +05:30
Rohit Waghchaure
d2e02a3023 [Fix] Restrict access to setup wizard page if setup is already completed 2016-05-18 14:52:57 +05:30
Nabin Hait
1daebc04d0 Merge pull request #5360 from neilLasrado/hotfix
Fixed reports
2016-05-18 10:39:19 +05:30
Neil Trini Lasrado
4668a69cf5 Fixed reports 2016-05-17 19:04:08 +05:30
Anand Doshi
97a70b226a Merge pull request #5332 from anandpdoshi/fix/validate-account-company
[fix] Validate Company in Account autoname
2016-05-14 13:10:42 +05:30
Anand Doshi
19fec06366 [fix] Validate Company in Account autoname 2016-05-11 13:27:18 +05:30
Nabin Hait
f2f15629ab Merge branch 'hotfix' 2016-05-11 12:43:39 +05:30
Nabin Hait
a1fcded0ba bumped to version 6.27.17 2016-05-11 13:13:39 +06:00
Nabin Hait
719504a0fe Merge pull request #5325 from nabinhait/return_fix_2
In Purchase Return entry, make sle and gle as per actual inward entry's valuation rate
2016-05-11 12:38:58 +05:30
Nabin Hait
1997350364 [fix] Divisional loss in purchase receipt 2016-05-11 12:06:29 +05:30
Nabin Hait
9b5a049fff Merge pull request #5327 from nabinhait/pp_tool
[fix] Create Material Requests for All Required Qty via Production Planning Tool
2016-05-10 17:18:38 +05:30
Nabin Hait
2f88c67a94 Merge pull request #5328 from nabinhait/sales_register_cols
Mode of Payment columns and filters added in sales/purchase register
2016-05-10 17:17:44 +05:30
Nabin Hait
3323d06be0 Mode of Payment columns and filters added in sales/purchase register 2016-05-10 13:17:02 +05:30
Nabin Hait
43d75448ea [fix] Create Material Requests for All Required Qty via Production Plannign Tool 2016-05-10 12:57:24 +05:30
Nabin Hait
a9c4c8fc31 In Purchase Return entry, make sle and gle as per actual inward entry's valuation rate 2016-05-09 17:34:47 +05:30
Nabin Hait
80c02640a1 Merge branch 'hotfix' 2016-05-06 16:13:34 +05:30
Nabin Hait
42800d24cc bumped to version 6.27.16 2016-05-06 16:43:34 +06:00
Nabin Hait
845a980a79 Merge pull request #5320 from nabinhait/return_fix_1
[fix] In purchase return entry, consider outgoing rate for serialized items
2016-05-06 16:09:55 +05:30
Nabin Hait
397805f992 Merge pull request #5319 from nabinhait/return_fix
[fix] Validate returned serial nos and batch nos with original document
2016-05-06 15:49:18 +05:30
Nabin Hait
e67c1cdf12 [fix] In purchase return entry, consider outgoing rate for serialized items 2016-05-06 15:46:31 +05:30
Nabin Hait
8704bead49 [fix] Validate returned serial nos and batch nos with original document 2016-05-06 15:30:10 +05:30
Nabin Hait
09fec7a15e Merge pull request #5313 from shreyasp/support-week-hotfix
[Hotfixes] Payment tool and Leave Allocation Tool
2016-05-05 16:44:40 +05:30
shreyas
c2a49211a5 [Fix] Payment Tool, Fetch due date when user does 'Get Outstanding Vouchers' 2016-05-05 15:56:48 +05:30
shreyas
55cbd52200 [Fix] Allocate leaves only to active employees 2016-05-05 15:16:39 +05:30
shreyas
622fe3f1e3 [Fix] Fetch due date for Sales/Purchase invoice in payment tool 2016-05-05 15:11:04 +05:30
Anand Doshi
c3213b198c Merge pull request #5312 from vjFaLk/leave-app-fix
Fixed Leave Approver issue
2016-05-05 14:39:42 +05:30
Valmik Jangla
a0b9c4cdeb Fixed Leave Application issue 2016-05-05 01:20:47 -07:00
Anand Doshi
a110a06f38 Merge pull request #5300 from neilLasrado/hotfix
redirect issues of erpnext to erpnext repository
2016-05-04 15:49:10 +05:30
Neil Trini Lasrado
728d01945c redirect issues of erpnext to erpnext repository 2016-05-02 18:37:47 +05:30
Nabin Hait
9b6198436b Merge branch 'hotfix' 2016-05-02 15:19:16 +05:30
Nabin Hait
d824fbbddd bumped to version 6.27.15 2016-05-02 15:49:16 +06:00
Nabin Hait
2460becc50 Merge pull request #5297 from vjFaLk/reset-values
Reset Values in Tools
2016-05-02 15:16:28 +05:30
Valmik Jangla
651dc5b345 Reset Values in Tools 2016-05-02 12:00:06 +05:30
Nabin Hait
e089ffa1fe Merge branch 'hotfix' 2016-04-29 18:26:45 +05:30
Nabin Hait
ab7f6870cb bumped to version 6.27.14 2016-04-29 18:56:45 +06:00
Nabin Hait
abfcefb52f Merge pull request #5292 from neilLasrado/sales_purchase_register
Itemwise purchase and Itemwise sales
2016-04-29 18:24:59 +05:30
Neil Trini Lasrado
c33b5b74c6 Itemwise purchase and Itemwise sales 2016-04-29 18:21:51 +05:30
Nabin Hait
efbcd7c788 Merge branch 'hotfix' 2016-04-29 11:44:54 +05:30
Nabin Hait
cfe14d9814 bumped to version 6.27.13 2016-04-29 12:14:54 +06:00
Nabin Hait
d8df0d3a8f Merge pull request #5278 from nabinhait/report_fix1
Sales / Purchase Register report fix and on item rename update item-tax json
2016-04-29 11:41:53 +05:30
Nabin Hait
761a7a8e7c [fix] On rename update item code in item_wise_tax_detail json in tax table 2016-04-28 17:33:49 +05:30
Nabin Hait
314246939f [report][fix] Item-wise tax calculation if item appears multiple times in the same invoice 2016-04-28 17:32:36 +05:30
Nabin Hait
b7b7f0062d [report][fix] Consider taxes only the tax contributed in invoice total 2016-04-28 17:31:27 +05:30
Anand Doshi
1e2a3f58c1 Merge branch 'hotfix' 2016-04-27 15:43:21 +05:30
Anand Doshi
08de396d46 bumped to version 6.27.12 2016-04-27 16:13:21 +06:00
Anand Doshi
b5e700f3af Merge pull request #5248 from saurabh6790/hotfix
[fixes] raise exception on deletion of fiscal year if fiscal year is set as Default
2016-04-27 14:25:58 +05:30
Neil Trini Lasrado
4c95ed49ed Fixed Currency Symbol in Trial Balance and Trial Balance for Party reports 2016-04-27 13:09:17 +05:30
Saurabh
9be40ee7c3 [fixes] raise exception while deleting fiscal year if fiscal year is set as default in Global Settings and while calculating get_month_details if year_start_date not found 2016-04-27 12:58:40 +05:30
Anand Doshi
19063db1bd Merge pull request #5267 from neilLasrado/trans
Fixed arabic translation
2016-04-27 12:33:48 +05:30
Neil Trini Lasrado
ea7181e1b5 Fixed arabic translation 2016-04-25 19:21:39 +05:30
Nabin Hait
2cda7fd834 Merge branch 'hotfix' 2016-04-22 12:15:35 +05:30
Nabin Hait
054e2952c8 bumped to version 6.27.11 2016-04-22 12:45:35 +06:00
Nabin Hait
b4f1f1e8b8 Merge pull request #5255 from nabinhait/hotfix1
[fix] Fixed ambiguous column name in query
2016-04-22 12:12:47 +05:30
Nabin Hait
3ab6181a4f [fix] Fixed ambiguous column name in query 2016-04-22 11:26:44 +05:30
Anand Doshi
18433591c3 Merge branch 'hotfix' 2016-04-20 16:43:00 +05:30
Anand Doshi
25dd38c8f2 bumped to version 6.27.10 2016-04-20 17:13:00 +06:00
Nabin Hait
88742e0912 Merge pull request #5241 from neilLasrado/lead
Removed no-copy from source in lead
2016-04-20 13:02:12 +05:30
Neil Trini Lasrado
ab822c5d16 Removed no-copy from source in lead 2016-04-20 11:03:15 +05:30
Nabin Hait
4058af24e2 Merge branch 'hotfix' 2016-04-15 11:01:32 +05:30
Nabin Hait
66953941ea bumped to version 6.27.9 2016-04-15 11:31:32 +06:00
Nabin Hait
36c9d11bee Merge pull request #5211 from nabinhait/jv_precision_fix
[fix] Set debit / credit as per field precision
2016-04-15 10:58:49 +05:30
Nabin Hait
e393c62086 [fix] Set debit / credit as per field precision 2016-04-14 18:15:42 +05:30
Nabin Hait
9f553e7206 Merge branch 'hotfix' 2016-04-13 16:04:37 +05:30
Nabin Hait
ba7d8b0cac bumped to version 6.27.8 2016-04-13 16:34:37 +06:00
Nabin Hait
1ce6df8ff6 Merge pull request #5203 from nabinhait/credit_limit_fix
[fix] Ignore closed sales order in credit limit validation
2016-04-13 15:36:33 +05:30
Nabin Hait
7132bd3659 [fix] Ignore closed sales order in credit limit validation 2016-04-13 15:19:37 +05:30
Nabin Hait
13a2574bd6 Merge pull request #5159 from neilLasrado/setup-wizard-fix
Fixed setup wizard
2016-04-13 12:06:55 +05:30
Nabin Hait
09855fc3cc Merge pull request #5158 from neilLasrado/hotfix
Removed education as a domain in ERPNext setup wizard
2016-04-13 12:05:11 +05:30
Nabin Hait
55f6308169 Merge branch 'anandpdoshi-fix/quotation-lead-tax-rule' into hotfix 2016-04-13 12:03:22 +05:30
Nabin Hait
c2ae1a7375 fixed merge conflict 2016-04-13 11:55:15 +05:30
Nabin Hait
c792e65d99 Merge pull request #5196 from nabinhait/report_fix34
[fix] Fixed pending so items for material request report
2016-04-13 11:40:34 +05:30
Nabin Hait
471908ab9f Merge pull request #5194 from nabinhait/gross_profit_fix
Gross profit fix
2016-04-12 18:57:45 +05:30
Nabin Hait
9fef3df6a0 [fix] Fixed pending so items for material request report 2016-04-12 18:46:47 +05:30
Nabin Hait
8a686ba982 [fix] Prevent from directly creating payment request 2016-04-12 17:02:15 +05:30
Nabin Hait
f509d13d28 [fix] Get average selling rate based on group by 2016-04-12 17:01:39 +05:30
Nabin Hait
96d7905383 Merge pull request #5177 from rohitwaghchaure/support_hot_fix
[Fix] Default letter head
2016-04-12 11:03:18 +05:30
Rohit Waghchaure
b2e7a1f605 [Fix] Default letter head 2016-04-11 17:30:44 +05:30
Nabin Hait
3912a31a6f Merge pull request #5176 from nabinhait/ar_ap_print_currency
Currency column in AR/AP and Sales/Purchase register report
2016-04-11 17:13:04 +05:30
Nabin Hait
b713406e22 Merge pull request #5180 from nabinhait/stock_entry_actual_qty
[fix] Set actual qty onload of the draft stock entry. Fixed #5172
2016-04-11 17:12:34 +05:30
Nabin Hait
32b2a7795e [fix] Set actual qty onload of the draft stock entry. Fixed #5172 2016-04-11 15:14:05 +05:30
Nabin Hait
f945e10cce Currency column in AR/AP and sales/purchase register report 2016-04-11 11:56:57 +05:30
Anand Doshi
2f957f27b0 [fix] apply Tax Rule for lead 2016-04-08 17:43:08 +05:30
Neil Trini Lasrado
7b46e5148a Fixed setup wizard 2016-04-08 17:28:44 +05:30
Anand Doshi
79a415e3b8 [fix] Use for shopping cart validation in Tax Rule 2016-04-08 17:08:26 +05:30
Neil Trini Lasrado
ce893499d7 Removed education as a domain in ERPNext setup wizard 2016-04-08 16:52:53 +05:30
Anand Doshi
d89152e4a5 Merge pull request #5151 from anandpdoshi/fix/travis-frappe-branch
[fix] bench init using correct frappe branch
2016-04-07 19:56:49 +05:30
Anand Doshi
6677fd58ef [fix] bench init using correct frappe branch 2016-04-07 19:33:04 +05:30
Anand Doshi
c6a695d0f3 Merge branch 'hotfix' 2016-04-07 17:41:48 +05:30
Anand Doshi
54910000d4 bumped to version 6.27.7 2016-04-07 18:11:48 +06:00
Anand Doshi
1f2f82fcc2 Merge pull request #5147 from vjFaLk/leave-allocation-fix
[Fix] Leave Allocation now includes To Date in Difference
2016-04-07 16:53:29 +05:30
Anand Doshi
1a0d32cdfb [fix] [minor] Learn link in welcome to ERPNext 2016-04-07 16:28:01 +05:30
Valmik Jangla
c33e96f860 Leave Allocation Fix 2016-04-07 12:02:31 +05:30
Anand Doshi
ca95384f05 [fix] Salary Slip: use accounts.utils.get_fiscal_year 2016-04-06 12:31:01 +05:30
Anand Doshi
4b207647db [fix] sanitize html of product bundle description 2016-04-05 18:34:11 +05:30
Anand Doshi
ade5b82167 Merge branch 'hotfix' 2016-04-04 17:54:48 +05:30
Anand Doshi
bcbfeb0d53 bumped to version 6.27.6 2016-04-04 18:24:48 +06:00
Anand Doshi
710c38ffe1 Merge pull request #5120 from nabinhait/report_fix
[fix] received and delivered items to be billed report based on percentage billed
2016-04-04 17:43:24 +05:30
Nabin Hait
94360cca20 [fix] received and delivered items to be billed report based on percentage billed 2016-04-04 17:40:33 +05:30
Anand Doshi
f1b276122e Merge pull request #5117 from nabinhait/report_modified_change
[fix] Modified date changed in query report due to project field renaming
2016-04-04 17:04:14 +05:30
Anand Doshi
62be8dfd21 Merge pull request #5131 from shreyasp/creditnote-print-format
[Fix] Correct amount shown in credit note print format
2016-04-04 15:37:31 +05:30
Anand Doshi
1a922196fa Merge pull request #5130 from anandpdoshi/fix/validate-pos-paid-amount
[fix] POS paid amount validation using grand total
2016-04-04 15:22:51 +05:30
shreyas
c6b47bcdda [Fix] Show amount in credit note print format 2016-04-04 15:13:03 +05:30
Anand Doshi
15f7b1ee1a [fix] POS paid amount validation using grand total 2016-04-04 15:03:28 +05:30
Anand Doshi
08b39b1ff8 [fix] escape fg_item in production planning's get_so_items 2016-04-04 13:16:56 +05:30
Anand Doshi
da7d1667d5 [travis] 2016-04-04 12:36:52 +05:30
Nabin Hait
4f10f15686 [fix] Modified date changed in query report due to project field renaming 2016-04-01 17:59:06 +05:30
Rushabh Mehta
d02038f591 Merge pull request #5110 from nabinhait/warranty_claim_fix
[fix] Get query for item in warranty claim
2016-04-01 11:44:48 +05:30
Nabin Hait
83e61bf368 [fix] Get query for item in warranty claim 2016-04-01 11:10:27 +05:30
Nabin Hait
d95c376d57 Merge pull request #5094 from nabinhait/item_query_fix
[fix] Item query in bom
2016-03-31 11:53:24 +05:30
Nabin Hait
c6285069dc [fix] Item query in bom 2016-03-30 13:10:25 +05:30
Rushabh Mehta
4ccf692f7c Merge branch 'hotfix' 2016-03-29 10:49:46 +05:30
Rushabh Mehta
8573aee8b8 bumped to version 6.27.5 2016-03-29 11:19:46 +06:00
Rushabh Mehta
dab3cdc106 Merge pull request #5071 from neilLasrado/pricing-rule-fix
Fixed Issues in Pricing rule
2016-03-29 10:18:03 +05:30
Rushabh Mehta
2de1f86009 Merge pull request #5070 from vjFaLk/hotfix
Fix for Holiday List in Maintenance Schedule
2016-03-29 10:17:27 +05:30
Neil Trini Lasrado
b176dea74e Fixed issues in Pricing Rule if multiple pricing rules existed with same priority 2016-03-28 13:23:47 +05:30
Valmik Jangla
47b89756d9 Fix for Holiday List in Maintenance Schedule 2016-03-28 12:34:21 +05:30
Rushabh Mehta
aabc634afd Merge branch 'hot-fix-leave-application' 2016-03-25 11:30:22 +05:30
Rushabh Mehta
3becd4239f bumped to version 6.27.4 2016-03-25 12:00:22 +06:00
Rushabh Mehta
1b5edcbbd8 [fix] holiday_list issues in maintenance schedule too 2016-03-25 11:22:15 +05:30
Rushabh Mehta
51135a1522 [fix] fix get holidays in leave application 2016-03-25 11:13:11 +05:30
Rushabh Mehta
97e523b4a4 Merge branch 'develop' 2016-03-21 17:25:09 +05:30
Rushabh Mehta
09ec13f7cf bumped to version 6.27.3 2016-03-21 17:55:09 +06:00
Rushabh Mehta
2179cd97c8 Merge pull request #5026 from nabinhait/modified_fix
[fix] Updated modified datetime
2016-03-21 17:23:28 +05:30
Nabin Hait
c8baa01e9c [fix] Updated modified datetime 2016-03-21 17:20:03 +05:30
88 changed files with 908 additions and 486 deletions

View File

@@ -16,16 +16,13 @@ install:
- sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis
- sudo pip install --upgrade pip
- rm $TRAVIS_BUILD_DIR/.git/shallow
- cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch develop
- bash $TRAVIS_BUILD_DIR/travis/bench_init.sh
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
script:
- cd ~/frappe-bench
- bench get-app erpnext $TRAVIS_BUILD_DIR
- bench use test_site
- bench setup redis-cache
- bench setup redis-async-broker
- bench setup procfile --with-celery-broker
- bench reinstall
- bench build
- bench build-website

View File

@@ -1,11 +0,0 @@
#!/bin/bash
# stolen from http://cgit.drupalcode.org/octopus/commit/?id=db4f837
includedir=`mysql_config --variable=pkgincludedir`
thiscwd=`pwd`
_THIS_DB_VERSION=`mysql -V 2>&1 | tr -d "\n" | cut -d" " -f6 | awk '{ print $1}' | cut -d"-" -f1 | awk '{ print $1}' | sed "s/[\,']//g"`
if [ "$_THIS_DB_VERSION" = "5.5.40" ] && [ ! -e "$includedir-$_THIS_DB_VERSION-fixed.log" ] ; then
cd $includedir
sudo patch -p1 < $thiscwd/ci/my_config.h.patch &> /dev/null
sudo touch $includedir-$_THIS_DB_VERSION-fixed.log
fi

View File

@@ -1,22 +0,0 @@
diff -burp a/my_config.h b/my_config.h
--- a/my_config.h 2014-10-09 19:32:46.000000000 -0400
+++ b/my_config.h 2014-10-09 19:35:12.000000000 -0400
@@ -641,17 +641,4 @@
#define SIZEOF_TIME_T 8
/* #undef TIME_T_UNSIGNED */
-/*
- stat structure (from <sys/stat.h>) is conditionally defined
- to have different layout and size depending on the defined macros.
- The correct macro is defined in my_config.h, which means it MUST be
- included first (or at least before <features.h> - so, practically,
- before including any system headers).
-
- __GLIBC__ is defined in <features.h>
-*/
-#ifdef __GLIBC__
-#error <my_config.h> MUST be included first!
-#endif
-
#endif

View File

@@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '6.27.2'
__version__ = '6.27.22'

View File

@@ -19,8 +19,12 @@ class Account(Document):
self.get("__onload").can_freeze_account = True
def autoname(self):
self.name = self.account_name.strip() + ' - ' + \
frappe.db.get_value("Company", self.company, "abbr")
# first validate if company exists
company = frappe.db.get_value("Company", self.company, ["abbr", "name"], as_dict=True)
if not company:
frappe.throw(_('Company {0} does not exist').format(self.company))
self.name = self.account_name.strip() + ' - ' + company.abbr
def validate(self):
if frappe.local.flags.allow_unverified_charts:
@@ -68,7 +72,7 @@ class Account(Document):
if self.root_type != db_value.root_type:
frappe.db.sql("update `tabAccount` set root_type=%s where lft > %s and rgt < %s",
(self.root_type, self.lft, self.rgt))
if self.root_type and not self.report_type:
self.report_type = "Balance Sheet" \
if self.root_type in ("Asset", "Liability", "Equity") else "Profit and Loss"
@@ -78,14 +82,14 @@ class Account(Document):
if frappe.db.exists("Account", self.name):
if not frappe.db.get_value("Account", self.name, "parent_account"):
throw(_("Root cannot be edited."), RootNotEditable)
if not self.parent_account and not self.is_group:
frappe.throw(_("Root Account must be a group"))
def validate_group_or_ledger(self):
if self.get("__islocal"):
return
existing_is_group = frappe.db.get_value("Account", self.name, "is_group")
if self.is_group != existing_is_group:
if self.check_gle_exists():
@@ -153,7 +157,7 @@ class Account(Document):
def validate_mandatory(self):
if not self.root_type:
throw(_("Root Type is mandatory"))
if not self.report_type:
throw(_("Report Type is mandatory"))
@@ -189,9 +193,6 @@ class Account(Document):
def validate_trash(self):
"""checks gl entries and if child exists"""
if not self.parent_account:
throw(_("Root account can not be deleted"))
if self.check_gle_exists():
throw(_("Account with existing transaction can not be deleted"))
if self.check_if_child_exists():
@@ -216,9 +217,9 @@ class Account(Document):
if val != [self.is_group, self.root_type, self.company]:
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old:
frappe.db.set_value("Account", new, "parent_account",
frappe.db.set_value("Account", new, "parent_account",
frappe.db.get_value("Account", old, "parent_account"))
return new_account

View File

@@ -40,6 +40,11 @@ class FiscalYear(Document):
def on_update(self):
check_duplicate_fiscal_year(self)
def on_trash(self):
global_defaults = frappe.get_doc("Global Defaults")
if global_defaults.current_fiscal_year == self.name:
frappe.throw(_("You cannot delete Fiscal Year {0}. Fiscal Year {0} is set as default in Global Settings").format(self.name))
@frappe.whitelist()
def check_duplicate_fiscal_year(doc):

View File

@@ -400,11 +400,11 @@ $.extend(erpnext.journal_entry, {
var row = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, "debit",
flt(flt(row.debit_in_account_currency)*row.exchange_rate), precision("debit", row));
flt(flt(row.debit_in_account_currency)*row.exchange_rate, precision("debit", row)));
frappe.model.set_value(cdt, cdn, "credit",
flt(flt(row.credit_in_account_currency)*row.exchange_rate), precision("credit", row));
flt(flt(row.credit_in_account_currency)*row.exchange_rate, precision("credit", row)));
cur_frm.cscript.update_totals(frm.doc);
},

View File

@@ -353,25 +353,31 @@ class JournalEntry(AccountsController):
self.remark = ("\n").join(r) #User Remarks is not mandatory
def set_print_format_fields(self):
total_amount = 0.0
bank_account_currency = None
pay_to_recd_from = None
bank_amount = party_amount = total_amount = 0.0
currency = bank_account_currency = party_account_currency = pay_to_recd_from= None
for d in self.get('accounts'):
if d.party_type and d.party:
if not pay_to_recd_from:
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
"customer_name" if d.party_type=="Customer" else "supplier_name")
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
party_account_currency = d.account_currency
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
total_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
bank_account_currency = d.account_currency
if pay_to_recd_from:
self.pay_to_recd_from = pay_to_recd_from
else:
total_amount = 0
if bank_amount:
total_amount = bank_amount
currency = bank_account_currency
else:
total_amount = party_amount
currency = party_account_currency
self.set_total_amount(total_amount, bank_account_currency)
self.set_total_amount(total_amount, currency)
def set_total_amount(self, amt, currency):
self.total_amount = amt
@@ -664,7 +670,7 @@ def get_payment_entry(ref_doc, args):
bank_row.cost_center = cost_center
amount = args.get("debit_in_account_currency") or args.get("amount")
if bank_row.account_currency == args.get("party_account_currency"):
bank_row.set(args.get("amount_field_bank"), amount)
else:

View File

@@ -598,13 +598,13 @@
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"in_create": 0,
"in_create": 1,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-02-24 16:49:46.832403",
"modified": "2016-04-12 15:26:22.756129",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",
@@ -675,5 +675,6 @@
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
"sort_order": "DESC",
"track_seen": 0
}

View File

@@ -146,6 +146,10 @@ frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
c.total_amount = d.invoice_amount;
c.outstanding_amount = d.outstanding_amount;
if (in_list(['Sales Invoice', 'Purchase Invoice'], d.voucher_type)){
c.due_date = d.due_date
}
if (frm.doc.set_payment_amount) {
c.payment_amount = d.outstanding_amount;
}
@@ -202,7 +206,7 @@ frappe.ui.form.on("Payment Tool Detail", "against_voucher_no", function(frm, cdt
}
frappe.call({
method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_against_voucher_amount',
method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_against_voucher_details',
args: {
"against_voucher_type": row.against_voucher_type,
"against_voucher_no": row.against_voucher_no,

View File

@@ -20,15 +20,15 @@ class PaymentTool(Document):
jv.company = self.company
jv.cheque_no = self.reference_no
jv.cheque_date = self.reference_date
party_account_currency, party_account_type = frappe.db.get_value("Account", self.party_account,
party_account_currency, party_account_type = frappe.db.get_value("Account", self.party_account,
["account_currency", "account_type"])
bank_account_currency, bank_account_type = None, None
if self.payment_account:
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
["account_currency", "account_type"])
if not self.total_payment_amount:
frappe.throw(_("Please enter Payment Amount in atleast one row"))
@@ -36,11 +36,11 @@ class PaymentTool(Document):
if not frappe.db.get_value(v.against_voucher_type, {"name": v.against_voucher_no}):
frappe.throw(_("Row {0}: {1} is not a valid {2}").format(v.idx, v.against_voucher_no,
v.against_voucher_type))
if v.payment_amount:
exchange_rate = get_exchange_rate(self.party_account, party_account_currency,
self.company, v.against_voucher_type, v.against_voucher_no)
d1 = jv.append("accounts")
d1.account = self.party_account
d1.party_type = self.party_type
@@ -56,7 +56,7 @@ class PaymentTool(Document):
d1.reference_name = v.against_voucher_no
d1.is_advance = 'Yes' \
if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No'
amount = flt(d1.debit_in_account_currency) - flt(d1.credit_in_account_currency)
if bank_account_currency == party_account_currency:
total_payment_amount += amount
@@ -65,27 +65,27 @@ class PaymentTool(Document):
d2 = jv.append("accounts")
if self.payment_account:
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
["account_currency", "account_type"])
d2.account = self.payment_account
d2.account_currency = bank_account_currency
d2.account_type = bank_account_type
d2.exchange_rate = get_exchange_rate(self.payment_account, bank_account_currency, self.company,
debit=(abs(total_payment_amount) if total_payment_amount < 0 else 0),
d2.exchange_rate = get_exchange_rate(self.payment_account, bank_account_currency, self.company,
debit=(abs(total_payment_amount) if total_payment_amount < 0 else 0),
credit=(total_payment_amount if total_payment_amount > 0 else 0))
d2.account_balance = get_balance_on(self.payment_account)
amount_field_bank = 'debit_in_account_currency' if total_payment_amount < 0 \
else 'credit_in_account_currency'
d2.set(amount_field_bank, abs(total_payment_amount))
company_currency = frappe.db.get_value("Company", self.company, "default_currency")
if party_account_currency != company_currency or \
(bank_account_currency and bank_account_currency != company_currency):
jv.multi_currency = 1
jv.set_amounts_in_company_currency()
jv.set_total_debit_credit()
@@ -150,7 +150,7 @@ def get_orders_to_be_billed(party_type, party, party_account_currency, company_c
return order_list
@frappe.whitelist()
def get_against_voucher_amount(against_voucher_type, against_voucher_no, party_account, company):
def get_against_voucher_details(against_voucher_type, against_voucher_no, party_account, company):
party_account_currency = get_account_currency(party_account)
company_currency = frappe.db.get_value("Company", company, "default_currency")
ref_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"

View File

@@ -16,14 +16,16 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_list_view": 0,
"label": "Against Voucher Type",
"length": 0,
"no_copy": 0,
"options": "DocType",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "",
"read_only": 0,
"report_hide": 0,
@@ -41,6 +43,7 @@
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Against Voucher No",
@@ -49,6 +52,7 @@
"options": "against_voucher_type",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -56,6 +60,31 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "due_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Due Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -64,6 +93,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -71,6 +101,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -86,6 +117,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Total Amount",
@@ -94,6 +126,7 @@
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -109,6 +142,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Outstanding Amount",
@@ -117,6 +151,7 @@
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -132,6 +167,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Payment Amount",
@@ -140,6 +176,7 @@
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -150,13 +187,14 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2015-11-16 06:29:51.626386",
"modified": "2016-05-05 06:22:24.736160",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Tool Detail",

View File

@@ -242,6 +242,8 @@ def filter_pricing_rules(args, pricing_rules):
for p in pricing_rules:
if p.item_code and args.variant_of:
p.variant_of = args.variant_of
else:
p.variant_of = None
# find pricing rule with highest priority
if pricing_rules:
@@ -251,7 +253,7 @@ def filter_pricing_rules(args, pricing_rules):
# apply internal priority
all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory",
"supplier", "supplier_type", "campaign", "sales_partner"]
"supplier", "supplier_type", "campaign", "sales_partner", "variant_of"]
if len(pricing_rules) > 1:
for field_set in [["item_code", "variant_of", "item_group", "brand"],

View File

@@ -2692,7 +2692,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-18 13:13:43.694604",
"modified": "2016-03-21 13:13:43.694604",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@@ -3418,7 +3418,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-18 13:12:12.430038",
"modified": "2016-03-21 13:12:12.430038",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@@ -375,7 +375,7 @@ class SalesInvoice(SellingController):
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
if flt(self.paid_amount) + flt(self.write_off_amount) \
- flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
- flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
@@ -471,7 +471,7 @@ class SalesInvoice(SellingController):
frappe.db.set(self,'paid_amount',0)
frappe.db.set(self, 'base_paid_amount',
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
def check_prev_docstatus(self):
for d in self.get('items'):

View File

@@ -3,6 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
@@ -19,6 +20,12 @@ def valdiate_taxes_and_charges_template(doc):
where is_default = 1 and name != %s and company = %s""".format(doc.doctype),
(doc.name, doc.company))
validate_disabled(doc)
for tax in doc.get("taxes"):
validate_taxes_and_charges(tax)
validate_inclusive_tax(tax, doc)
def validate_disabled(doc):
if doc.is_default and doc.disabled:
frappe.throw(_("Disabled template must not be default template"))

View File

@@ -19,19 +19,6 @@ frappe.ui.form.on("Tax Rule", "refresh", function(frm) {
frappe.ui.form.trigger("Tax Rule", "tax_type");
})
frappe.ui.form.on("Tax Rule", "use_for_shopping_cart", function(frm) {
if(!frm.doc.use_for_shopping_cart &&
(frappe.get_list("Tax Rule", {"use_for_shopping_cart":1}).length == 0)) {
frappe.model.get_value("Shopping Cart Settings", "Shopping Cart Settings",
"enabled", function(docfield) {
if(docfield.enabled){
frm.set_value("use_for_shopping_cart", 1);
frappe.throw(__("Shopping Cart is enabled"));
}
});
}
})
frappe.ui.form.on("Tax Rule", "customer", function(frm) {
frappe.call({
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
@@ -64,4 +51,4 @@ frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
}
}
});
});
});

View File

@@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import cstr
from frappe.utils import cstr, cint
class IncorrectCustomerGroup(frappe.ValidationError): pass
class IncorrectSupplierType(frappe.ValidationError): pass
@@ -20,15 +20,16 @@ class TaxRule(Document):
self.validate_tax_template()
self.validate_date()
self.validate_filters()
self.validate_use_for_shopping_cart()
def validate_tax_template(self):
if self.tax_type== "Sales":
self.purchase_tax_template = self.supplier = self.supplier_type= None
self.purchase_tax_template = self.supplier = self.supplier_type = None
if self.customer:
self.customer_group = None
else:
self.sales_tax_template= self.customer = self.customer_group= None
self.sales_tax_template = self.customer = self.customer_group = None
if self.supplier:
self.supplier_type = None
@@ -81,6 +82,15 @@ class TaxRule(Document):
if tax_rule[0].priority == self.priority:
frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule)
def validate_use_for_shopping_cart(self):
'''If shopping cart is enabled and no tax rule exists for shopping cart, enable this one'''
if (not self.use_for_shopping_cart
and cint(frappe.db.get_single_value('Shopping Cart Settings', 'enabled'))
and not frappe.db.get_value('Tax Rule', {'use_for_shopping_cart': 1, 'name': ['!=', self.name]})):
self.use_for_shopping_cart = 1
frappe.msgprint(_("Enabling 'Use for Shopping Cart', as Shopping Cart is enabled and there should be at least one Tax Rule for Shopping Cart"))
@frappe.whitelist()
def get_party_details(party, party_type, args=None):
out = {}
@@ -109,11 +119,11 @@ 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}')
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)]
for key, value in args.iteritems():
if key in "use_for_shopping_cart":
if key=="use_for_shopping_cart":
conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
else:
conditions.append("ifnull({0}, '') in ('', '{1}')".format(key, frappe.db.escape(cstr(value))))
@@ -130,4 +140,11 @@ def get_tax_template(posting_date, args):
if rule.get(key): rule.no_of_keys_matched += 1
rule = sorted(tax_rule, lambda b, a: cmp(a.no_of_keys_matched, b.no_of_keys_matched) or cmp(a.priority, b.priority))[0]
return rule.sales_tax_template or rule.purchase_tax_template
tax_template = rule.sales_tax_template or rule.purchase_tax_template
doctype = "{0} Taxes and Charges Template".format(rule.tax_type)
if frappe.db.get_value(doctype, tax_template, 'disabled')==1:
return None
return tax_template

View File

@@ -299,8 +299,12 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
else:
args.update(get_party_details(party, party_type))
if party_type=="Customer":
if party_type in ("Customer", "Lead"):
args.update({"tax_type": "Sales"})
if party_type=='Lead':
args['customer'] = None
del args['lead']
else:
args.update({"tax_type": "Purchase"})

View File

@@ -37,9 +37,12 @@
<br>{%= data[i][__("Voucher No")] %}</td>
<td>{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Invoiced Amount")]) %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Paid Amount")]) %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Outstanding Amount")]) %}</td>
<td style="text-align: right">
{%= format_currency(data[i][__("Invoiced Amount")], data[i]["currency"]) %}</td>
<td style="text-align: right">
{%= format_currency(data[i][__("Paid Amount")], data[i]["currency"]) %}</td>
<td style="text-align: right">
{%= format_currency(data[i][__("Outstanding Amount")], data[i]["currency"]) %}</td>
{% } else { %}
<td></td>
<td></td>

View File

@@ -58,21 +58,19 @@ class ReceivablePayableReport(object):
"width": 120
})
columns.append({
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 100
})
if args.get("party_type") == "Customer":
columns += [_("Territory") + ":Link/Territory:80"]
if args.get("party_type") == "Supplier":
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]
columns += [
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 100,
"hidden": 1
},
_("Remarks") + "::200"
]
columns.append(_("Remarks") + "::200")
return columns
def get_data(self, party_naming_by, args):
@@ -120,17 +118,17 @@ class ReceivablePayableReport(object):
row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2),
cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
if self.filters.get(scrub(args.get("party_type"))):
row.append(gle.account_currency)
else:
row.append(company_currency)
# customer territory / supplier type
if args.get("party_type") == "Customer":
row += [self.get_territory(gle.party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_type(gle.party)]
if self.filters.get(scrub(args.get("party_type"))):
row.append(gle.account_currency)
else:
row.append(company_currency)
row.append(gle.remarks)
data.append(row)

View File

@@ -18,18 +18,25 @@ class AccountsReceivableSummary(ReceivablePayableReport):
columns += [ args.get("party_type") + " Name::140"]
columns += [
_("Total Invoiced Amt") + ":Currency:140",
_("Total Paid Amt") + ":Currency:140",
_("Total Outstanding Amt") + ":Currency:160",
"0-" + str(self.filters.range1) + ":Currency:100",
str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency:100",
str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency:100",
str(self.filters.range3) + _("-Above") + ":Currency:100"]
_("Total Invoiced Amt") + ":Currency/currency:140",
_("Total Paid Amt") + ":Currency/currency:140",
_("Total Outstanding Amt") + ":Currency/currency:160",
"0-" + str(self.filters.range1) + ":Currency/currency:100",
str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency/currency:100",
str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency/currency:100",
str(self.filters.range3) + _("-Above") + ":Currency/currency:100"]
if args.get("party_type") == "Customer":
columns += [_("Territory") + ":Link/Territory:80"]
if args.get("party_type") == "Supplier":
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]
columns.append({
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 80
})
return columns
@@ -53,6 +60,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
row += [self.get_territory(party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_type(party)]
row.append(party_dict.currency)
data.append(row)
return data
@@ -73,6 +82,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
)
for k in party_total[d.party].keys():
party_total[d.party][k] += d.get(k, 0)
party_total[d.party].currency = d.currency
return party_total
@@ -90,7 +101,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
cols += ["bill_no", "bill_date"]
cols += ["invoiced_amt", "paid_amt",
"outstanding_amt", "age", "range1", "range2", "range3", "range4"]
"outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"]
if args.get("party_type") == "Supplier":
cols += ["supplier_type", "remarks"]

View File

@@ -7,12 +7,12 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2015-11-02 12:32:02.048551",
"modified": "2016-05-17 08:40:18.711626",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Delivered Items To Be Billed",
"owner": "Administrator",
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`base_amount` - ifnull((select sum(base_amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc",
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`base_amount` - `tabDelivery Note Item`.`billed_amt`*ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere \n `tabDelivery Note`.name = `tabDelivery Note Item`.parent \n and `tabDelivery Note`.docstatus = 1 \n and `tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") \n and `tabDelivery Note Item`.amount > 0\n and `tabDelivery Note Item`.billed_amt < `tabDelivery Note Item`.amount\norder by `tabDelivery Note`.`name` desc",
"ref_doctype": "Sales Invoice",
"report_name": "Delivered Items To Be Billed",
"report_type": "Query Report"

View File

@@ -145,11 +145,11 @@ class GrossProfitGenerator(object):
self.data.append(row)
if self.grouped:
self.collapse_group()
self.get_average_rate_based_on_group_by()
else:
self.grouped_data = []
def collapse_group(self):
def get_average_rate_based_on_group_by(self):
# sum buying / selling totals for group
self.grouped_data = []
for key in self.grouped.keys():
@@ -166,6 +166,8 @@ class GrossProfitGenerator(object):
if new_row.base_amount else 0
new_row.buying_rate = (new_row.buying_amount / new_row.qty) \
if new_row.qty else 0
new_row.base_rate = (new_row.base_amount / new_row.qty) \
if new_row.qty else 0
self.grouped_data.append(new_row)

View File

@@ -34,6 +34,12 @@ frappe.query_reports["Item-wise Purchase Register"] = {
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
}
]
}

View File

@@ -14,8 +14,16 @@ def execute(filters=None):
item_list = get_items(filters)
aii_account_map = get_aii_accounts()
if item_list:
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
item_row_tax, tax_accounts = get_tax_accounts(item_list, columns)
columns.append({
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 80
})
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
data = []
for d in item_list:
purchase_receipt = None
@@ -27,14 +35,14 @@ def execute(filters=None):
expense_account = d.expense_account or aii_account_map.get(d.company)
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
d.supplier_name, d.credit_to, d.project, d.company, d.purchase_order,
d.supplier_name, d.credit_to, d.mode_of_payment, d.project, d.company, d.purchase_order,
purchase_receipt, expense_account, d.qty, d.base_net_rate, d.base_net_amount]
for tax in tax_accounts:
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
row.append(item_row_tax.get(d.name, {}).get(tax, 0))
total_tax = sum(row[last_col:])
row += [total_tax, d.base_net_amount + total_tax]
row += [total_tax, d.base_net_amount + total_tax, company_currency]
data.append(row)
@@ -45,10 +53,12 @@ def get_columns():
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120",
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Purchase Invoice:120",
_("Posting Date") + ":Date:80", _("Supplier") + ":Link/Supplier:120",
"Supplier Name::120", "Payable Account:Link/Account:120", _("Project") + ":Link/Project:80",
"Supplier Name::120", "Payable Account:Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
_("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100",
_("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140",
_("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"]
_("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
]
def get_conditions(filters):
conditions = ""
@@ -57,7 +67,8 @@ def get_conditions(filters):
("supplier", " and pi.supplier = %(supplier)s"),
("item_code", " and pi_item.item_code = %(item_code)s"),
("from_date", " and pi.posting_date>=%(from_date)s"),
("to_date", " and pi.posting_date<=%(to_date)s")):
("to_date", " and pi.posting_date<=%(to_date)s"),
("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
if filters.get(opts[0]):
conditions += opts[1]
@@ -67,29 +78,40 @@ def get_items(filters):
conditions = get_conditions(filters)
match_conditions = frappe.build_match_conditions("Purchase Invoice")
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail,
pi_item.expense_account, pi_item.qty, pi_item.base_net_rate, pi_item.base_net_amount, pi.supplier_name
return frappe.db.sql("""
select
pi_item.name, pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name,
pi_item.item_group, pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt,
pi_item.po_detail, pi_item.expense_account, pi_item.qty, pi_item.base_net_rate,
pi_item.base_net_amount, pi.supplier_name, pi.mode_of_payment
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
order by pi.posting_date desc, pi_item.item_code desc""" % (conditions, match_conditions), filters, as_dict=1)
order by pi.posting_date desc, pi_item.item_code desc
""" % (conditions, match_conditions), filters, as_dict=1)
def get_aii_accounts():
return dict(frappe.db.sql("select name, stock_received_but_not_billed from tabCompany"))
def get_tax_accounts(item_list, columns):
import json
item_tax = {}
item_row_tax = {}
tax_accounts = []
invoice_wise_items = {}
invoice_item_row = {}
item_row_map = {}
for d in item_list:
invoice_wise_items.setdefault(d.parent, []).append(d)
invoice_item_row.setdefault(d.parent, []).append(d)
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d)
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, base_tax_amount_after_discount_amount
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
and docstatus = 1 and (account_head is not null and account_head != '') and category in ('Total', 'Valuation and Total')
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
tax_details = frappe.db.sql("""
select
parent, account_head, item_wise_tax_detail, charge_type, base_tax_amount_after_discount_amount
from `tabPurchase Taxes and Charges`
where parenttype = 'Purchase Invoice' and docstatus = 1
and (account_head is not null and account_head != '')
and category in ('Total', 'Valuation and Total')
and parent in (%s)
""" % ', '.join(['%s']*len(invoice_item_row)), tuple(invoice_item_row.keys()))
for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if account_head not in tax_accounts:
@@ -98,19 +120,26 @@ def get_tax_accounts(item_list, columns):
if item_wise_tax_detail:
try:
item_wise_tax_detail = json.loads(item_wise_tax_detail)
for item, tax_amount in item_wise_tax_detail.items():
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
for item_code, tax_amount in item_wise_tax_detail.items():
tax_amount = flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
item_net_amount = sum([flt(d.base_net_amount)
for d in item_row_map.get(parent, {}).get(item_code, [])])
for d in item_row_map.get(parent, {}).get(item_code, []):
item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) if item_net_amount else 0
item_row_tax.setdefault(d.name, {})[account_head] = item_tax_amount
except ValueError:
continue
elif charge_type == "Actual" and tax_amount:
for d in invoice_wise_items.get(parent, []):
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
(tax_amount * d.base_net_amount) / d.base_net_total
for d in invoice_item_row.get(parent, []):
item_row_tax.setdefault(d.name, {})[account_head] = \
flt((tax_amount * d.base_net_amount) / d.base_net_total)
tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts]
columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"]
return item_tax, tax_accounts
return item_row_tax, tax_accounts

View File

@@ -28,6 +28,12 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
}
]
}

View File

@@ -13,8 +13,15 @@ def execute(filters=None):
item_list = get_items(filters)
if item_list:
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
item_row_tax, tax_accounts = get_tax_accounts(item_list, columns)
columns.append({
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 80
})
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
data = []
for d in item_list:
delivery_note = None
@@ -25,14 +32,14 @@ def execute(filters=None):
from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail))
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
d.customer_group, d.debit_to, d.territory, d.project, d.company, d.sales_order,
d.customer_group, d.debit_to, d.mode_of_payment, d.territory, d.project, d.company, d.sales_order,
delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount]
for tax in tax_accounts:
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
row.append(item_row_tax.get(d.name, {}).get(tax, 0))
total_tax = sum(row[last_col:])
row += [total_tax, d.base_net_amount + total_tax]
row += [total_tax, d.base_net_amount + total_tax, company_currency]
data.append(row)
@@ -44,11 +51,12 @@ def get_columns():
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Sales Invoice:120",
_("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120",
_("Receivable Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80",
_("Receivable Account") + ":Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Territory") + ":Link/Territory:80",
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
_("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120",
_("Rate") + ":Currency:120", _("Amount") + ":Currency:120"
_("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
]
def get_conditions(filters):
@@ -58,7 +66,8 @@ def get_conditions(filters):
("customer", " and si.customer = %(customer)s"),
("item_code", " and si_item.item_code = %(item_code)s"),
("from_date", " and si.posting_date>=%(from_date)s"),
("to_date", " and si.posting_date<=%(to_date)s")):
("to_date", " and si.posting_date<=%(to_date)s"),
("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
if filters.get(opts[0]):
conditions += opts[1]
@@ -66,49 +75,66 @@ def get_conditions(filters):
def get_items(filters):
conditions = get_conditions(filters)
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project,
si.customer, si.remarks, si.territory, si.company, si.base_net_total, si_item.item_code, si_item.item_name,
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
si_item.qty, si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
si.customer_group, si_item.so_detail
return frappe.db.sql("""
select
si_item.name, si_item.parent, si.posting_date, si.debit_to, si.project,
si.customer, si.remarks, si.territory, si.company, si.base_net_total,
si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
si_item.delivery_note, si_item.income_account, si_item.qty,
si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
si.customer_group, si_item.so_detail, si.mode_of_payment
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
where si.name = si_item.parent and si.docstatus = 1 %s
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
def get_tax_accounts(item_list, columns):
import json
item_tax = {}
item_row_tax = {}
tax_accounts = []
invoice_wise_items = {}
invoice_item_row = {}
item_row_map = {}
for d in item_list:
invoice_wise_items.setdefault(d.parent, []).append(d)
invoice_item_row.setdefault(d.parent, []).append(d)
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d)
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail,
charge_type, base_tax_amount_after_discount_amount
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
and docstatus = 1 and (account_head is not null and account_head != '')
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
tuple(invoice_wise_items.keys()))
tax_details = frappe.db.sql("""
select
parent, account_head, item_wise_tax_detail,
charge_type, base_tax_amount_after_discount_amount
from `tabSales Taxes and Charges`
where
parenttype = 'Sales Invoice' and docstatus = 1
and (account_head is not null and account_head != '')
and parent in (%s)
""" % ', '.join(['%s']*len(invoice_item_row)), tuple(invoice_item_row.keys()))
for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if account_head not in tax_accounts:
tax_accounts.append(account_head)
if item_wise_tax_detail:
try:
item_wise_tax_detail = json.loads(item_wise_tax_detail)
for item, tax_amount in item_wise_tax_detail.items():
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
for item_code, tax_amount in item_wise_tax_detail.items():
tax_amount = flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
item_net_amount = sum([flt(d.base_net_amount)
for d in item_row_map.get(parent, {}).get(item_code, [])])
for d in item_row_map.get(parent, {}).get(item_code, []):
item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) if item_net_amount else 0
item_row_tax.setdefault(d.name, {})[account_head] = item_tax_amount
except ValueError:
continue
elif charge_type == "Actual" and tax_amount:
for d in invoice_wise_items.get(parent, []):
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
for d in invoice_item_row.get(parent, []):
item_row_tax.setdefault(d.name, {})[account_head] = \
flt((tax_amount * d.base_net_amount) / d.base_net_total)
tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts]
columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"]
return item_tax, tax_accounts
return item_row_tax, tax_accounts

View File

@@ -7,12 +7,12 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2016-02-23 18:48:42.372321",
"modified": "2016-05-17 08:26:50.810208",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Ordered Items To Be Billed",
"owner": "Administrator",
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc",
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (`tabSales Order Item`.base_amount - (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and `tabSales Order Item`.amount > 0\n and `tabSales Order Item`.billed_amt < `tabSales Order Item`.amount\norder by `tabSales Order`.transaction_date asc",
"ref_doctype": "Sales Invoice",
"report_name": "Ordered Items To Be Billed",
"report_type": "Query Report"

View File

@@ -7,12 +7,12 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2016-02-23 18:51:21.968327",
"modified": "2016-05-17 08:28:26.093139",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Order Items To Be Billed",
"owner": "Administrator",
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc",
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc",
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Order Items To Be Billed",
"report_type": "Query Report"

View File

@@ -28,6 +28,12 @@ frappe.query_reports["Purchase Register"] = {
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
}
]
}

View File

@@ -21,6 +21,8 @@ def execute(filters=None):
invoice_expense_map, expense_accounts)
invoice_po_pr_map = get_invoice_po_pr_map(invoice_list)
supplier_details = get_supplier_deatils(invoice_list)
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
data = []
for inv in invoice_list:
@@ -31,8 +33,8 @@ def execute(filters=None):
row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name,
supplier_details.get(inv.supplier),
inv.credit_to, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks,
", ".join(purchase_order), ", ".join(purchase_receipt)]
inv.credit_to, inv.mode_of_payment, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks,
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency]
# map expense values
base_net_total = 0
@@ -62,10 +64,19 @@ def execute(filters=None):
def get_columns(invoice_list):
"""return columns based on filters"""
columns = [
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier Id") + "::120",
_("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
_("Project") + ":Link/Project:80", _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100"
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80",
_("Supplier Id") + "::120", _("Supplier Name") + "::120",
_("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
_("Purchase Order") + ":Link/Purchase Order:100",
_("Purchase Receipt") + ":Link/Purchase Receipt:100",
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 80
}
]
expense_accounts = tax_accounts = expense_columns = tax_columns = []
@@ -84,14 +95,14 @@ def get_columns(invoice_list):
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
expense_columns = [(account + ":Currency:120") for account in expense_accounts]
expense_columns = [(account + ":Currency/currency:120") for account in expense_accounts]
for account in tax_accounts:
if account not in expense_accounts:
tax_columns.append(account + ":Currency:120")
tax_columns.append(account + ":Currency/currency:120")
columns = columns + expense_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \
[_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120",
_("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"]
columns = columns + expense_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \
[_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120",
_("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"]
return columns, expense_accounts, tax_accounts
@@ -103,21 +114,29 @@ def get_conditions(filters):
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
return conditions
def get_invoices(filters):
conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, credit_to, supplier, supplier_name,
bill_no, bill_date, remarks, base_net_total, base_grand_total, outstanding_amount
from `tabPurchase Invoice` where docstatus = 1 %s
return frappe.db.sql("""
select
name, posting_date, credit_to, supplier, supplier_name, bill_no, bill_date, remarks,
base_net_total, base_grand_total, outstanding_amount, mode_of_payment
from `tabPurchase Invoice`
where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
def get_invoice_expense_map(invoice_list):
expense_details = frappe.db.sql("""select parent, expense_account, sum(base_net_amount) as amount
from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_account""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
expense_details = frappe.db.sql("""
select parent, expense_account, sum(base_net_amount) as amount
from `tabPurchase Invoice Item`
where parent in (%s)
group by parent, expense_account
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_expense_map = {}
for d in expense_details:
@@ -127,9 +146,12 @@ def get_invoice_expense_map(invoice_list):
return invoice_expense_map
def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
tax_details = frappe.db.sql("""select parent, account_head, sum(base_tax_amount_after_discount_amount) as tax_amount
from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
tax_details = frappe.db.sql("""
select parent, account_head, sum(base_tax_amount_after_discount_amount) as tax_amount
from `tabPurchase Taxes and Charges`
where parent in (%s) and category in ('Total', 'Valuation and Total')
group by parent, account_head
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_tax_map = {}
for d in tax_details:
@@ -145,10 +167,11 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
return invoice_expense_map, invoice_tax_map
def get_invoice_po_pr_map(invoice_list):
pi_items = frappe.db.sql("""select parent, purchase_order, purchase_receipt, po_detail,
project from `tabPurchase Invoice Item` where parent in (%s)
and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
pi_items = frappe.db.sql("""
select parent, purchase_order, purchase_receipt, po_detail, project
from `tabPurchase Invoice Item`
where parent in (%s) and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_po_pr_map = {}
for d in pi_items:

View File

@@ -7,12 +7,12 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2015-11-02 12:33:11.681513",
"modified": "2016-05-17 08:38:49.654749",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Received Items To Be Billed",
"owner": "Administrator",
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n\t `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`base_amount` - ifnull((select sum(base_amount) \n from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus=1 and \n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc",
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`base_amount` - `tabPurchase Receipt Item`.`billed_amt`*ifnull(`tabPurchase Receipt`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent \n and `tabPurchase Receipt`.docstatus = 1 \n and `tabPurchase Receipt`.status != \"Closed\" \n and `tabPurchase Receipt Item`.amount > 0\n and `tabPurchase Receipt Item`.billed_amt < `tabPurchase Receipt Item`.amount\norder by `tabPurchase Receipt`.`name` desc",
"ref_doctype": "Purchase Invoice",
"report_name": "Received Items To Be Billed",
"report_type": "Query Report"

View File

@@ -28,6 +28,12 @@ frappe.query_reports["Sales Register"] = {
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
}
]
}

View File

@@ -22,6 +22,7 @@ def execute(filters=None):
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
customer_map = get_customer_deatils(invoice_list)
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
data = []
for inv in invoice_list:
@@ -32,7 +33,8 @@ def execute(filters=None):
row = [inv.name, inv.posting_date, inv.customer, inv.customer_name,
customer_map.get(inv.customer, {}).get("customer_group"),
customer_map.get(inv.customer, {}).get("territory"),
inv.debit_to, inv.project, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)]
inv.debit_to, inv.mode_of_payment, inv.project, inv.remarks,
", ".join(sales_order), ", ".join(delivery_note), company_currency]
# map income values
base_net_total = 0
@@ -63,10 +65,18 @@ def execute(filters=None):
def get_columns(invoice_list):
"""return columns based on filters"""
columns = [
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120",
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
_("Receivable Account") + ":Link/Account:120", _("Project") +":Link/Project:80", _("Remarks") + "::150",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100"
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80",
_("Customer Id") + "::120", _("Customer Name") + "::120",
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + ":Link/Mode of Payment:80",
_("Project") +":Link/Project:80", _("Remarks") + "::150",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Data",
"width": 80
}
]
income_accounts = tax_accounts = income_columns = tax_columns = []
@@ -83,14 +93,14 @@ def get_columns(invoice_list):
and parent in (%s) order by account_head""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
income_columns = [(account + ":Currency:120") for account in income_accounts]
income_columns = [(account + ":Currency/currency:120") for account in income_accounts]
for account in tax_accounts:
if account not in income_accounts:
tax_columns.append(account + ":Currency:120")
tax_columns.append(account + ":Currency/currency:120")
columns = columns + income_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \
[_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120",
_("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"]
columns = columns + income_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \
[_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120",
_("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"]
return columns, income_accounts, tax_accounts
@@ -102,13 +112,15 @@ def get_conditions(filters):
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
return conditions
def get_invoices(filters):
conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, debit_to, project, customer,
customer_name, remarks, base_net_total, base_grand_total, base_rounded_total, outstanding_amount
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
base_net_total, base_grand_total, base_rounded_total, outstanding_amount, mode_of_payment
from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1)

View File

@@ -161,6 +161,8 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
def prepare_data(accounts, filters, total_row, parent_children_map):
data = []
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
for d in accounts:
has_value = False
row = {
@@ -169,7 +171,8 @@ def prepare_data(accounts, filters, total_row, parent_children_map):
"parent_account": d.parent_account,
"indent": d.indent,
"from_date": filters.from_date,
"to_date": filters.to_date
"to_date": filters.to_date,
"currency": company_currency
}
prepare_opening_and_closing(d)
@@ -201,37 +204,50 @@ def get_columns():
"fieldname": "opening_debit",
"label": _("Opening (Dr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "opening_credit",
"label": _("Opening (Cr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "debit",
"label": _("Debit"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "credit",
"label": _("Credit"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "closing_debit",
"label": _("Closing (Dr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "closing_credit",
"label": _("Closing (Cr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Link",
"options": "Currency",
"hidden": 1
}
]

View File

@@ -21,7 +21,7 @@ def execute(filters=None):
def get_data(filters, show_party_name):
party_name_field = "customer_name" if filters.get("party_type")=="Customer" else "supplier_name"
parties = frappe.get_all(filters.get("party_type"), fields = ["name", party_name_field], order_by="name")
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
opening_balances = get_opening_balances(filters)
balances_within_period = get_balances_within_period(filters)
@@ -57,6 +57,10 @@ def get_data(filters, show_party_name):
"closing_credit": closing_credit
})
row.update({
"currency": company_currency
})
has_value = False
if (opening_debit or opening_credit or debit or credit or closing_debit or closing_credit):
has_value =True
@@ -69,7 +73,8 @@ def get_data(filters, show_party_name):
data.append({
"party": "'" + _("Totals") + "'",
"debit": total_debit,
"credit": total_credit
"credit": total_credit,
"currency": company_currency
})
return data
@@ -138,37 +143,50 @@ def get_columns(filters, show_party_name):
"fieldname": "opening_debit",
"label": _("Opening (Dr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "opening_credit",
"label": _("Opening (Cr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "debit",
"label": _("Debit"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "credit",
"label": _("Credit"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "closing_debit",
"label": _("Closing (Dr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "closing_credit",
"label": _("Closing (Cr)"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Link",
"options": "Currency",
"hidden": 1
}
]

View File

@@ -473,7 +473,8 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
'posting_date': d.posting_date,
'invoice_amount': flt(d.invoice_amount),
'payment_amount': flt(d.payment_amount),
'outstanding_amount': flt(d.invoice_amount - d.payment_amount, precision)
'outstanding_amount': flt(d.invoice_amount - d.payment_amount, precision),
'due_date': frappe.db.get_value(d.voucher_type, d.voucher_no, "due_date")
})
return outstanding_invoices

View File

@@ -171,18 +171,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
erpnext.buying.get_items_from_product_bundle(me.frm);
}, __("Get items from"));
},
company: function() {
var me = this;
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address")
&& !this.frm.doc.shipping_address) {
erpnext.utils.get_shipping_address(this.frm)
}
},
shipping_address: function(){
var me = this;
this.frm.set_query("shipping_address", function(){
if(me.frm.doc.customer){
return{
@@ -200,8 +192,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}
}
});
erpnext.utils.get_address_display(this.frm, "shipping_address",
erpnext.utils.get_address_display(this.frm, "shipping_address",
"shipping_address_display", is_your_company_address=true)
}
});

View File

@@ -2693,7 +2693,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-03-18 13:13:07.334625",
"modified": "2016-03-21 13:13:07.334625",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",

View File

@@ -7,7 +7,7 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2016-02-22 11:27:39.445257",
"modified": "2016-04-01 08:26:52.361800",
"modified_by": "Administrator",
"module": "Buying",
"name": "Item-wise Purchase History",

View File

@@ -184,8 +184,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
idx desc,
name, item_name
limit %(start)s, %(page_len)s """.format(key=searchfield,
fcond=get_filters_cond(doctype, filters, conditions),
mcond=get_match_cond(doctype)),
fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'),
mcond=get_match_cond(doctype).replace('%', '%%')),
{
"today": nowdate(),
"txt": "%%%s%%" % txt,

View File

@@ -53,17 +53,18 @@ def validate_returned_items(doc):
valid_items = frappe._dict()
select_fields = "item_code, sum(qty) as qty, rate" if doc.doctype=="Purchase Invoice" \
else "item_code, sum(qty) as qty, rate, serial_no, batch_no"
select_fields = "item_code, qty" if doc.doctype=="Purchase Invoice" \
else "item_code, qty, serial_no, batch_no"
for d in frappe.db.sql("""select {0} from `tab{1} Item` where parent = %s
group by item_code""".format(select_fields, doc.doctype), doc.return_against, as_dict=1):
valid_items.setdefault(d.item_code, d)
for d in frappe.db.sql("""select {0} from `tab{1} Item` where parent = %s"""
.format(select_fields, doc.doctype), doc.return_against, as_dict=1):
valid_items = get_ref_item_dict(valid_items, d)
if doc.doctype in ("Delivery Note", "Sales Invoice"):
for d in frappe.db.sql("""select item_code, sum(qty) as qty, serial_no, batch_no from `tabPacked Item`
where parent = %s group by item_code""".format(doc.doctype), doc.return_against, as_dict=1):
valid_items.setdefault(d.item_code, d)
for d in frappe.db.sql("""select item_code, qty, serial_no, batch_no from `tabPacked Item`
where parent = %s""".format(doc.doctype), doc.return_against, as_dict=1):
valid_items = get_ref_item_dict(valid_items, d)
already_returned_items = get_already_returned_items(doc)
@@ -86,7 +87,7 @@ def validate_returned_items(doc):
elif abs(d.qty) > max_return_qty:
frappe.throw(_("Row # {0}: Cannot return more than {1} for Item {2}")
.format(d.idx, ref.qty, d.item_code), StockOverReturnError)
elif ref.batch_no and d.batch_no != ref.batch_no:
elif ref.batch_no and d.batch_no not in ref.batch_no:
frappe.throw(_("Row # {0}: Batch No must be same as {1} {2}")
.format(d.idx, doc.doctype, doc.return_against))
elif ref.serial_no:
@@ -94,9 +95,8 @@ def validate_returned_items(doc):
frappe.throw(_("Row # {0}: Serial No is mandatory").format(d.idx))
else:
serial_nos = get_serial_nos(d.serial_no)
ref_serial_nos = get_serial_nos(ref.serial_no)
for s in serial_nos:
if s not in ref_serial_nos:
if s not in ref.serial_no:
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
.format(d.idx, s, doc.doctype, doc.return_against))
@@ -107,6 +107,25 @@ def validate_returned_items(doc):
if not items_returned:
frappe.throw(_("Atleast one item should be entered with negative quantity in return document"))
def get_ref_item_dict(valid_items, ref_item_row):
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
valid_items.setdefault(ref_item_row.item_code, frappe._dict({
"qty": 0,
"serial_no": [],
"batch_no": []
}))
item_dict = valid_items[ref_item_row.item_code]
item_dict["qty"] += ref_item_row.qty
if ref_item_row.get("serial_no"):
item_dict["serial_no"] += get_serial_nos(ref_item_row.serial_no)
if ref_item_row.get("batch_no"):
item_dict["batch_no"].append(ref_item_row.batch_no)
return valid_items
def get_already_returned_items(doc):
return frappe._dict(frappe.db.sql("""

View File

@@ -51,7 +51,10 @@ class SellingController(StockController):
elif getattr(self, "lead", None):
from erpnext.crm.doctype.lead.lead import get_lead_details
self.update_if_missing(get_lead_details(self.lead))
self.update_if_missing(get_lead_details(
self.lead,
posting_date=self.get('transaction_date') or self.get('posting_date'),
company=self.company))
def set_price_list_and_item_details(self):
self.set_price_list_currency("Selling")

View File

@@ -283,8 +283,8 @@ class calculate_taxes_and_totals(object):
last_tax.tax_amount += diff
last_tax.tax_amount_after_discount_amount += diff
last_tax.total += diff
self._set_in_company_currency(last_tax,
self._set_in_company_currency(last_tax,
["total", "tax_amount", "tax_amount_after_discount_amount"])
def calculate_totals(self):
@@ -319,22 +319,22 @@ class calculate_taxes_and_totals(object):
self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"])
if self.doc.meta.get_field("rounded_total"):
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
self.doc.currency, self.doc.precision("rounded_total"))
if self.doc.meta.get_field("base_rounded_total"):
company_currency = get_company_currency(self.doc.company)
self.doc.base_rounded_total = \
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
company_currency, self.doc.precision("base_rounded_total"))
def _cleanup(self):
for tax in self.doc.get("taxes"):
tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
def set_discount_amount(self):
if not self.doc.discount_amount and self.doc.additional_discount_percentage:
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
* self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount"))
def apply_discount_amount(self):
@@ -397,13 +397,13 @@ class calculate_taxes_and_totals(object):
for adv in self.doc.get("advances")])
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
if self.doc.party_account_currency == self.doc.currency:
invoice_total = self.doc.grand_total
else:
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
self.doc.precision("grand_total"))
if invoice_total > 0 and self.doc.total_advance > invoice_total:
frappe.throw(_("Advance amount cannot be greater than {0} {1}")
.format(self.doc.party_account_currency, invoice_total))
@@ -417,21 +417,23 @@ class calculate_taxes_and_totals(object):
# total_advance is only for non POS Invoice
if self.doc.is_return:
return
self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"])
self._set_in_company_currency(self.doc, ['write_off_amount'])
if self.doc.party_account_currency == self.doc.currency:
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
else:
total_amount_to_pay = flt(flt(self.doc.grand_total *
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
if self.doc.doctype == "Sales Invoice":
self.doc.round_floats_in(self.doc, ["paid_amount"])
paid_amount = self.doc.paid_amount \
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
self.doc.precision("outstanding_amount"))
elif self.doc.doctype == "Purchase Invoice":
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))

View File

@@ -205,7 +205,7 @@
"in_list_view": 0,
"label": "Source",
"length": 0,
"no_copy": 1,
"no_copy": 0,
"oldfieldname": "source",
"oldfieldtype": "Select",
"options": "\nAdvertisement\nBlog Post\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite\nEmail",
@@ -883,7 +883,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-03-03 04:03:54.822184",
"modified": "2016-04-20 11:01:14.179322",
"modified_by": "Administrator",
"module": "CRM",
"name": "Lead",

View File

@@ -10,6 +10,7 @@ from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController
from erpnext.utilities.address_and_contact import load_address_and_contact
from erpnext.accounts.party import set_taxes
sender_field = "email_id"
@@ -58,7 +59,7 @@ class Lead(SellingController):
def check_email_id_is_unique(self):
if self.email_id:
# validate email is unique
duplicate_leads = frappe.db.sql_list("""select name from tabLead
duplicate_leads = frappe.db.sql_list("""select name from tabLead
where email_id=%s and name!=%s""", (self.email_id, self.name))
if duplicate_leads:
@@ -138,7 +139,7 @@ def make_quotation(source_name, target_doc=None):
return target_doc
@frappe.whitelist()
def get_lead_details(lead):
def get_lead_details(lead, posting_date=None, company=None):
if not lead: return {}
from erpnext.accounts.party import set_address_details
@@ -158,4 +159,9 @@ def get_lead_details(lead):
set_address_details(out, lead, "Lead")
taxes_and_charges = set_taxes(None, 'Lead', posting_date, company,
billing_address=out.get('customer_address'), shipping_address=out.get('shipping_address_name'))
if taxes_and_charges:
out['taxes_and_charges'] = taxes_and_charges
return out

View File

@@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple"""
app_icon = "icon-th"
app_color = "#e74c3c"
app_version = "6.27.2"
app_version = "6.27.22"
app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext"

View File

@@ -229,14 +229,13 @@ def get_employees_who_are_born_today():
and status = 'Active'""", {"date": today()}, as_dict=True)
def get_holiday_list_for_employee(employee, raise_exception=True):
employee = frappe.db.get_value("Employee", employee, ["holiday_list", "company"], as_dict=True)
holiday_list = employee.holiday_list
holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"])
if not holiday_list:
holiday_list = frappe.db.get_value("Company", employee.company, "default_holiday_list")
holiday_list = frappe.db.get_value("Company", company, "default_holiday_list")
if not holiday_list and raise_exception:
frappe.throw(_("Please set a Holiday List for either the Employee or the Company"))
frappe.throw(_('Please set a default Holiday List for Employee {0} or Company {0}').format(employee, company))
return holiday_list

View File

@@ -21,4 +21,4 @@ def get_approver_list(name):
user_role.role = "Leave Approver"
and user_role.parent = user.name and
user.name != %s
""", name)
""", name or "")

View File

@@ -77,7 +77,9 @@ class LeaveAllocation(Document):
frappe.throw(_("Total leaves allocated is mandatory"))
def validate_total_leaves_allocated(self):
if date_diff(self.to_date, self.from_date) <= flt(self.total_leaves_allocated):
# Adding a day to include To Date in the difference
date_difference = date_diff(self.to_date, self.from_date) + 1
if date_difference < self.total_leaves_allocated:
frappe.throw(_("Total allocated leaves are more than days in the period"), OverAllocationError)
def validate_against_leave_applications(self):

View File

@@ -335,16 +335,14 @@ def get_leave_allocation_records(date, employee=None):
def get_holidays(employee, from_date, to_date):
tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1
where e1.name = %s and h1.parent = h2.name and e1.holiday_list = h2.name
and h1.holiday_date between %s and %s""", (employee, from_date, to_date))[0][0]
'''get holidays between two dates for the given employee'''
holiday_list = get_holiday_list_for_employee(employee)
if not tot_hol:
tot_hol = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
where h1.parent = h2.name and h1.holiday_date between %s and %s
and h2.is_default = 1""", (from_date, to_date))[0][0]
holidays = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
where h1.parent = h2.name and h1.holiday_date between %s and %s
and h2.name = %s""", (from_date, to_date, holiday_list))[0][0]
return tot_hol
return holidays
def is_lwp(leave_type):
lwp = frappe.db.sql("select is_lwp from `tabLeave Type` where name = %s", leave_type)

View File

@@ -15,11 +15,14 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -33,17 +36,20 @@
"bold": 0,
"collapsible": 0,
"description": "Leave blank if considered for all employee types",
"fieldname": "employee_type",
"fieldname": "employment_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Employee Type",
"label": "Employment Type",
"length": 0,
"no_copy": 0,
"options": "Employment Type",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -60,13 +66,16 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Branch",
"length": 0,
"no_copy": 0,
"options": "Branch",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -83,13 +92,16 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -106,13 +118,16 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Designation",
"length": 0,
"no_copy": 0,
"options": "Designation",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -128,11 +143,14 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -149,13 +167,16 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "From Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -171,13 +192,16 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "To Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -193,13 +217,16 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Leave Type",
"length": 0,
"no_copy": 0,
"options": "Leave Type",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -216,12 +243,15 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Carry Forward",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -237,12 +267,15 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "New Leaves Allocated (In Days)",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -258,13 +291,16 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allocate",
"length": 0,
"no_copy": 0,
"options": "allocate_leave",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -282,7 +318,8 @@
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-10-28 16:23:57.733900",
"max_attachments": 0,
"modified": "2016-05-05 05:45:33.355366",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Control Panel",

View File

@@ -10,27 +10,24 @@ from frappe.model.document import Document
class LeaveControlPanel(Document):
def get_employees(self):
lst1 = [[self.employee_type,"employment_type"],[self.branch,"branch"],[self.designation,"designation"],[self.department, "department"]]
condition = "where "
flag = 0
for l in lst1:
if(l[0]):
if flag == 0:
condition += l[1] + "= '" + l[0] +"'"
else:
condition += " and " + l[1]+ "= '" +l[0] +"'"
flag = 1
emp_query = "select name from `tabEmployee` "
if flag == 1:
emp_query += condition
e = frappe.db.sql(emp_query)
conditions, values = [], []
for field in ["employment_type", "branch", "designation", "department"]:
if self.get(field):
conditions.append("{0}=%s".format(field))
values.append(self.get(field))
condition_str = " and " + " and ".join(conditions) if len(conditions) else ""
e = frappe.db.sql("select name from tabEmployee where status='Active' {condition}"
.format(condition=condition_str), tuple(values))
return e
def validate_values(self):
for f in ["from_date", "to_date", "leave_type", "no_of_days"]:
if not self.get(f):
frappe.throw(_("{0} is required").format(self.meta.get_label(f)))
def to_date_validation(self):
if date_diff(self.to_date, self.from_date) <= 0:
return "Invalid period"

View File

@@ -206,3 +206,5 @@ def get_month_details(year, month):
'month_end_date': med,
'month_days': month_days
})
else:
frappe.throw(_("Fiscal Year {0} not found").format(year))

View File

@@ -4,10 +4,11 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, rounded, date_diff
from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, rounded, date_diff, money_in_words
from frappe.model.naming import make_autoname
from frappe import msgprint, _
from erpnext.accounts.utils import get_fiscal_year
from erpnext.setup.utils import get_company_currency
from erpnext.hr.utils import set_employee_name
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
@@ -18,6 +19,22 @@ class SalarySlip(TransactionBase):
def autoname(self):
self.name = make_autoname('Sal Slip/' +self.employee + '/.#####')
def validate(self):
self.check_existing()
if not (len(self.get("earnings")) or len(self.get("deductions"))):
self.get_emp_and_leave_details()
else:
self.get_leave_details(lwp = self.leave_without_pay)
if not self.net_pay:
self.calculate_net_pay()
company_currency = get_company_currency(self.company)
self.total_in_words = money_in_words(self.rounded_total, company_currency)
set_employee_name(self)
def get_emp_and_leave_details(self):
if self.employee:
joining_date, relieving_date = frappe.db.get_value("Employee", self.employee,
@@ -59,7 +76,9 @@ class SalarySlip(TransactionBase):
def get_leave_details(self, joining_date=None, relieving_date=None, lwp=None):
if not self.fiscal_year:
self.fiscal_year = frappe.db.get_default("fiscal_year")
# if default fiscal year is not set, get from nowdate
self.fiscal_year = get_fiscal_year(nowdate())[0]
if not self.month:
self.month = "%02d" % getdate(nowdate()).month
@@ -150,23 +169,6 @@ class SalarySlip(TransactionBase):
self.employee = ''
frappe.throw(_("Salary Slip of employee {0} already created for this month").format(self.employee))
def validate(self):
from frappe.utils import money_in_words
self.check_existing()
if not (len(self.get("earnings")) or len(self.get("deductions"))):
self.get_emp_and_leave_details()
else:
self.get_leave_details(lwp = self.leave_without_pay)
if not self.net_pay:
self.calculate_net_pay()
company_currency = get_company_currency(self.company)
self.total_in_words = money_in_words(self.rounded_total, company_currency)
set_employee_name(self)
def calculate_earning_total(self):
self.gross_pay = flt(self.arrear_amount) + flt(self.leave_encashment_amount)
for d in self.get("earnings"):

View File

@@ -15,13 +15,21 @@ form_grid_templates = {
class BOM(Document):
def autoname(self):
last_name = frappe.db.sql("""select max(name) from `tabBOM`
where name like "BOM/{0}/%%" and item=%s
""".format(frappe.db.escape(self.item, percent=False)), self.item)
if last_name:
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
names = frappe.db.sql_list("""select name from `tabBOM` where item=%s""", self.item)
if names:
# name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1
# split by item
names = [name.split(self.item)[-1][1:] for name in names]
# split by (-) if cancelled
names = [cint(name.split('-')[-1]) for name in names]
idx = max(names) + 1
else:
idx = 1
self.name = 'BOM/' + self.item + ('/%.3i' % idx)
def validate(self):

View File

@@ -17,6 +17,7 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Items From",
@@ -44,6 +45,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Filters",
@@ -67,6 +69,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Item",
@@ -92,6 +95,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Customer",
@@ -117,6 +121,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Warehouse",
@@ -143,6 +148,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
@@ -167,6 +173,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -190,6 +197,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "From Date",
@@ -213,6 +221,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "To Date",
@@ -237,6 +246,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -261,6 +271,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Sales Orders",
@@ -285,6 +296,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Orders",
@@ -310,6 +322,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -334,6 +347,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Material Request",
@@ -359,6 +373,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Material Requests",
@@ -380,10 +395,12 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"fieldname": "items_for_production",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Select Items",
@@ -408,6 +425,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Items",
@@ -435,6 +453,7 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Use Multi-Level BOM",
@@ -458,6 +477,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Items",
@@ -478,11 +498,12 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"description": "",
"fieldname": "create_production_orders",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Production Orders",
@@ -507,6 +528,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Production Orders",
@@ -532,6 +554,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Material Requirement",
@@ -555,6 +578,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Material Request For Warehouse",
@@ -575,11 +599,37 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty",
"fieldname": "create_material_requests_for_all_required_qty",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Material Requests for All Required Qty",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty, if \"Create Material Requests for All Required Qty\" is unchecked.",
"fieldname": "create_material_requests",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Material Requests",
@@ -605,6 +655,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Download Materials Required",
@@ -631,7 +682,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2016-02-23 02:37:51.260645",
"modified": "2016-05-10 12:55:45.647372",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Planning Tool",

View File

@@ -71,7 +71,7 @@ class ProductionPlanningTool(Document):
pp_so.sales_order_date = cstr(r['transaction_date'])
pp_so.customer = cstr(r['customer'])
pp_so.grand_total = flt(r['base_grand_total'])
def get_pending_material_requests(self):
""" Pull Material Requests that are pending based on criteria selected"""
mr_filter = item_filter = ""
@@ -81,7 +81,7 @@ class ProductionPlanningTool(Document):
mr_filter += " and mr.transaction_date <= %(to_date)s"
if self.warehouse:
mr_filter += " and mr_item.warehouse = %(warehouse)s"
if self.fg_item:
item_filter += " and item.name = %(item)s"
@@ -102,7 +102,7 @@ class ProductionPlanningTool(Document):
}, as_dict=1)
self.add_mr_in_table(pending_mr)
def add_mr_in_table(self, pending_mr):
""" Add Material Requests in the table"""
self.clear_table("material_requests")
@@ -119,7 +119,7 @@ class ProductionPlanningTool(Document):
self.get_so_items()
elif self.get_items_from == "Material Request":
self.get_mr_items()
def get_so_items(self):
so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order]
if not so_list:
@@ -128,7 +128,7 @@ class ProductionPlanningTool(Document):
item_condition = ""
if self.fg_item:
item_condition = ' and so_item.item_code = "' + self.fg_item + '"'
item_condition = ' and so_item.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
items = frappe.db.sql("""select distinct parent, item_code, warehouse,
(qty - delivered_qty) as pending_qty
@@ -139,7 +139,7 @@ class ProductionPlanningTool(Document):
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
if self.fg_item:
item_condition = ' and pi.item_code = "' + self.fg_item + '"'
item_condition = ' and pi.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse,
(((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty)
@@ -153,7 +153,7 @@ class ProductionPlanningTool(Document):
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
self.add_items(items + packed_items)
def get_mr_items(self):
mr_list = [d.material_request for d in self.get('material_requests') if d.material_request]
if not mr_list:
@@ -173,7 +173,7 @@ class ProductionPlanningTool(Document):
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
self.add_items(items)
def add_items(self, items):
self.clear_table("items")
@@ -187,13 +187,13 @@ class ProductionPlanningTool(Document):
pi.bom_no = item_details and item_details.bom_no or ''
pi.planned_qty = flt(p['pending_qty'])
pi.pending_qty = flt(p['pending_qty'])
if self.get_items_from == "Sales Order":
pi.sales_order = p['parent']
elif self.get_items_from == "Material Request":
pi.material_request = p['parent']
pi.material_request_item = p['name']
def validate_data(self):
self.validate_company()
for d in self.get('items'):
@@ -201,7 +201,7 @@ class ProductionPlanningTool(Document):
frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
else:
validate_bom_no(d.item_code, d.bom_no)
if not flt(d.planned_qty):
frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx))
@@ -213,17 +213,17 @@ class ProductionPlanningTool(Document):
validate_uom_is_integer(self, "stock_uom", "planned_qty")
items = self.get_production_items()
pro_list = []
frappe.flags.mute_messages = True
for key in items:
production_order = self.create_production_order(items[key])
if production_order:
pro_list.append(production_order)
frappe.flags.mute_messages = False
if pro_list:
pro_list = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
(p, p) for p in pro_list]
@@ -247,14 +247,14 @@ class ProductionPlanningTool(Document):
"fg_warehouse" : d.warehouse,
"status" : "Draft",
}
""" Club similar BOM and item for processing in case of Sales Orders """
if self.get_items_from == "Material Request":
item_details.update({
"qty": d.planned_qty
})
item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details
else:
item_details.update({
"qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{})
@@ -275,7 +275,7 @@ class ProductionPlanningTool(Document):
pro.wip_warehouse = warehouse.get('wip_warehouse')
if not pro.fg_warehouse:
pro.fg_warehouse = warehouse.get('fg_warehouse')
try:
pro.insert()
return pro.name
@@ -283,7 +283,7 @@ class ProductionPlanningTool(Document):
pass
def get_so_wise_planned_qty(self):
"""
"""
bom_dict {
bom_no: ['sales_order', 'qty']
}
@@ -295,7 +295,7 @@ class ProductionPlanningTool(Document):
else:
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
return bom_dict
def download_raw_materials(self):
""" Create csv data for required raw material to produce finished goods"""
self.validate_data()
@@ -318,14 +318,14 @@ class ProductionPlanningTool(Document):
# Did not use qty_consumed_per_unit in the query, as it leads to rounding loss
for d in frappe.db.sql("""select fb.item_code,
ifnull(sum(fb.qty/ifnull(bom.quantity, 1)), 0) as qty,
fb.description, fb.stock_uom, it.min_order_qty
from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` it
where bom.name = fb.parent and it.name = fb.item_code
and (is_pro_applicable = 0 or ifnull(default_bom, "")="")
and (is_sub_contracted_item = 0 or ifnull(default_bom, "")="")
and is_stock_item = 1
fb.description, fb.stock_uom, item.min_order_qty
from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` item
where bom.name = fb.parent and item.name = fb.item_code
and (item.is_pro_applicable = 0 or ifnull(item.default_bom, "")="")
and (item.is_sub_contracted_item = 0 or ifnull(item.default_bom, "")="")
and item.is_stock_item = 1
and fb.docstatus<2 and bom.name=%s
group by item_code, stock_uom""", bom, as_dict=1):
group by fb.item_code, fb.stock_uom""", bom, as_dict=1):
bom_wise_item_details.setdefault(d.item_code, d)
else:
# Get all raw materials considering SA items as raw materials,
@@ -337,7 +337,7 @@ class ProductionPlanningTool(Document):
where bom.name = bom_item.parent and bom.name = %s and bom_item.docstatus < 2
and bom_item.item_code = item.name
and item.is_stock_item = 1
group by item_code""", bom, as_dict=1):
group by bom_item.item_code""", bom, as_dict=1):
bom_wise_item_details.setdefault(d.item_code, d)
for item, item_details in bom_wise_item_details.items():
for so_qty in so_wise_qty:
@@ -384,19 +384,24 @@ class ProductionPlanningTool(Document):
self.create_material_request()
def get_requested_items(self):
item_projected_qty = self.get_projected_qty()
items_to_be_requested = frappe._dict()
if not self.create_material_requests_for_all_required_qty:
item_projected_qty = self.get_projected_qty()
for item, so_item_qty in self.item_dict.items():
requested_qty = 0
total_qty = sum([flt(d[0]) for d in so_item_qty])
if total_qty > item_projected_qty.get(item, 0):
requested_qty = 0
if self.create_material_requests_for_all_required_qty:
requested_qty = total_qty
elif total_qty > item_projected_qty.get(item, 0):
# shortage
requested_qty = total_qty - flt(item_projected_qty.get(item))
# consider minimum order qty
if requested_qty < flt(so_item_qty[0][3]):
requested_qty = flt(so_item_qty[0][3])
if requested_qty and requested_qty < flt(so_item_qty[0][3]):
requested_qty = flt(so_item_qty[0][3])
# distribute requested qty SO wise
for item_details in so_item_qty:

View File

@@ -169,7 +169,7 @@ erpnext.patches.v5_0.update_item_and_description_again
erpnext.patches.v6_0.multi_currency
erpnext.patches.v5_0.repost_gle_for_jv_with_multiple_party
erpnext.patches.v5_0.portal_fixes
erpnext.patches.v5_0.reset_values_in_tools
erpnext.patches.v5_0.reset_values_in_tools # 02-05-2016
execute:frappe.delete_doc("Page", "users")
erpnext.patches.v5_0.update_material_transferred_for_manufacturing_again
erpnext.patches.v5_0.index_on_account_and_gl_entry
@@ -257,4 +257,5 @@ erpnext.patches.v6_20x.set_compact_print
execute:frappe.delete_doc_if_exists("Web Form", "contact") #2016-03-10
erpnext.patches.v6_20x.remove_fiscal_year_from_holiday_list
erpnext.patches.v6_24.map_customer_address_to_shipping_address_on_po
erpnext.patches.v6_27.fix_recurring_order_status
erpnext.patches.v6_27.fix_recurring_order_status
erpnext.patches.v6_20x.update_product_bundle_description

View File

@@ -6,6 +6,7 @@ import frappe
def execute():
for dt in ["Payment Tool", "Bank Reconciliation", "Payment Reconciliation", "Leave Control Panel",
"Salary Manager", "Upload Attenadance", "Production Planning Tool", "BOM Replace Tool"]:
"Salary Manager", "Upload Attenadance", "Production Planning Tool", "BOM Replace Tool", "Customize Form",
"Employee Attendance Tool", "Rename Tool", "BOM Replace Tool", "Process Payroll", "Naming Series"]:
frappe.db.sql("delete from `tabSingles` where doctype=%s", dt)

View File

@@ -0,0 +1,11 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import sanitize_html
def execute():
for product_bundle in frappe.get_all('Product Bundle'):
doc = frappe.get_doc('Product Bundle', product_bundle.name)
for item in doc.items:
if item.description:
description = sanitize_html(item.description)
item.db_set('description', description, update_modified=False)

View File

@@ -15,6 +15,7 @@ $(document).bind('toolbar_setup', function() {
frappe.urllib.get_base_url()+'/assets/erpnext/images/erp-icon.svg" />');
$('[data-link="docs"]').attr("href", "https://manual.erpnext.com")
$('[data-link="issues"]').attr("href", "https://github.com/frappe/erpnext/issues")
});
// doctypes created via tree

View File

@@ -118,7 +118,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
setup_sms: function() {
var me = this;
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped"], this.frm.doc.status)
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status)
&& this.frm.doctype != "Purchase Invoice") {
this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); });
}
@@ -308,7 +308,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date;
set_party_account(set_pricing);
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){
erpnext.utils.get_shipping_address(this.frm, function(){
set_party_account(set_pricing);
})
}else{
set_party_account(set_pricing);
}
if(this.frm.doc.company) {
erpnext.last_selected_company = this.frm.doc.company;

View File

@@ -28,7 +28,6 @@ function load_erpnext_slides() {
{"label": __("Manufacturing"), "value": "Manufacturing"},
{"label": __("Retail"), "value": "Retail"},
{"label": __("Services"), "value": "Services"},
{"label": __("Education"), "value": "Education"},
{"label": __("Other"), "value": "Other"},
], reqd:1},
{fieldname:'chart_of_accounts', label: __('Chart of Accounts'),

View File

@@ -69,37 +69,57 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field,
if(r.message) {
frm.set_value(display_field, r.message)
}
if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) {
if(!erpnext.utils.validate_mandatory(frm, "Customer/Supplier",
frm.doc.customer || frm.doc.supplier, address_field)) return;
if(!erpnext.utils.validate_mandatory(frm, "Posting/Transaction Date",
frm.doc.posting_date || frm.doc.transaction_date, address_field)) return;
} else return;
frappe.call({
method: "erpnext.accounts.party.set_taxes",
args: {
"party": frm.doc.customer || frm.doc.supplier,
"party_type": (frm.doc.customer ? "Customer" : "Supplier"),
"posting_date": frm.doc.posting_date || frm.doc.transaction_date,
"company": frm.doc.company,
"billing_address": ((frm.doc.customer) ? (frm.doc.customer_address) : (frm.doc.supplier_address)),
"shipping_address": frm.doc.shipping_address_name
},
callback: function(r) {
if(r.message){
frm.set_value("taxes_and_charges", r.message)
}
}
});
erpnext.utils.set_taxes(frm, address_field, display_field, is_your_company_address);
}
})
} else {
frm.set_value(display_field, null);
}
};
erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_company_address) {
if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) {
if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier",
frm.doc.customer || frm.doc.supplier || frm.doc.lead, address_field)) {
return;
}
if(!erpnext.utils.validate_mandatory(frm, "Posting/Transaction Date",
frm.doc.posting_date || frm.doc.transaction_date, address_field)) {
return;
}
} else {
return;
}
var party_type, party;
if (frm.doc.lead) {
party_type = 'Lead';
party = frm.doc.lead;
} else if (frm.doc.customer) {
party_type = 'Customer';
party = frm.doc.customer;
} else if (frm.doc.supplier) {
party_type = 'Supplier';
party = frm.doc.supplier;
}
frappe.call({
method: "erpnext.accounts.party.set_taxes",
args: {
"party": party,
"party_type": party_type,
"posting_date": frm.doc.posting_date || frm.doc.transaction_date,
"company": frm.doc.company,
"billing_address": ((frm.doc.customer || frm.doc.lead) ? (frm.doc.customer_address) : (frm.doc.supplier_address)),
"shipping_address": frm.doc.shipping_address_name
},
callback: function(r) {
if(r.message){
frm.set_value("taxes_and_charges", r.message)
}
}
});
}
erpnext.utils.get_contact_details = function(frm) {
@@ -127,7 +147,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
return true;
}
erpnext.utils.get_shipping_address = function(frm){
erpnext.utils.get_shipping_address = function(frm, callback){
frappe.call({
method: "erpnext.utilities.doctype.address.address.get_shipping_address",
args: {company: frm.doc.company},
@@ -136,6 +156,10 @@ erpnext.utils.get_shipping_address = function(frm){
frm.set_value("shipping_address", r.message[0]) //Address title or name
frm.set_value("shipping_address_display", r.message[1]) //Address to be displayed on the page
}
if(callback){
return callback();
}
}
});
}

View File

@@ -199,7 +199,7 @@ def get_customer_outstanding(customer, company):
select sum(base_grand_total*(100 - per_billed)/100)
from `tabSales Order`
where customer=%s and docstatus = 1 and company=%s
and per_billed < 100 and status != 'Stopped'""", (customer, company))
and per_billed < 100 and status != 'Closed'""", (customer, company))
outstanding_based_on_so = flt(outstanding_based_on_so[0][0]) if outstanding_based_on_so else 0.0
@@ -210,7 +210,7 @@ def get_customer_outstanding(customer, company):
where
dn.name = dn_item.parent
and dn.customer=%s and dn.company=%s
and dn.docstatus = 1 and dn.status != 'Stopped'
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)

View File

@@ -25,7 +25,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
cur_frm.add_custom_button(__('Lost'),
cur_frm.cscript['Declare Order Lost'], __("Status"));
}
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
}
@@ -47,7 +47,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
}
this.toggle_reqd_lead_customer();
},
quotation_to: function() {
@@ -96,7 +96,11 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
var me = this;
frappe.call({
method: "erpnext.crm.doctype.lead.lead.get_lead_details",
args: { "lead": this.frm.doc.lead },
args: {
'lead': this.frm.doc.lead,
'posting_date': this.frm.doc.transaction_date,
'company': this.frm.doc.company,
},
callback: function(r) {
if(r.message) {
me.frm.updating_party_details = true;
@@ -166,6 +170,6 @@ frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt,
frappe.ui.form.on("Quotation Item", "stock_balance", function(frm, cdt, cdn) {
var d = frappe.model.get_doc(cdt, cdn);
frappe.route_options = {"item_code": d.item_code};
frappe.route_options = {"item_code": d.item_code};
frappe.set_route("query-report", "Stock Balance");
})
})

View File

@@ -3018,7 +3018,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-03-18 13:11:32.654873",
"modified": "2016-03-21 13:11:32.654873",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@@ -337,10 +337,6 @@ def make_material_request(source_name, target_doc=None):
def postprocess(source, doc):
doc.material_request_type = "Purchase"
so = frappe.get_doc("Sales Order", source_name)
item_table = "Packed Item" if so.packed_items else "Sales Order Item"
doc = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
"doctype": "Material Request",
@@ -348,12 +344,20 @@ def make_material_request(source_name, target_doc=None):
"docstatus": ["=", 1]
}
},
item_table: {
"Packed Item": {
"doctype": "Material Request Item",
"field_map": {
"parent": "sales_order",
"stock_uom": "uom"
}
},
"Sales Order Item": {
"doctype": "Material Request Item",
"field_map": {
"parent": "sales_order",
"stock_uom": "uom"
},
"condition": lambda doc: not frappe.db.exists('Product Bundle', doc.item_code)
}
}, target_doc, postprocess)

View File

@@ -7,7 +7,7 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2016-01-28 14:59:04.611174",
"modified": "2016-04-01 08:26:55.705992",
"modified_by": "Administrator",
"module": "Selling",
"name": "Item-wise Sales History",
@@ -16,4 +16,4 @@
"ref_doctype": "Sales Order",
"report_name": "Item-wise Sales History",
"report_type": "Query Report"
}
}

View File

@@ -7,12 +7,12 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2015-10-06 12:43:48.259027",
"modified": "2016-04-12 18:45:49.733159",
"modified_by": "Administrator",
"module": "Selling",
"name": "Pending SO Items For Purchase Request",
"owner": "Administrator",
"query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc",
"query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Closed\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc",
"ref_doctype": "Sales Order",
"report_name": "Pending SO Items For Purchase Request",
"report_type": "Query Report"

View File

@@ -103,9 +103,9 @@ class Company(Document):
create_charts(self.chart_of_accounts, self.name)
frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
{"company": self.name, "account_type": "Receivable"}))
{"company": self.name, "account_type": "Receivable", "is_group": 0}))
frappe.db.set(self, "default_payable_account", frappe.db.get_value("Account",
{"company": self.name, "account_type": "Payable"}))
{"company": self.name, "account_type": "Payable", "is_group": 0}))
def set_default_accounts(self):
self._set_default_account("default_cash_account", "Cash")

View File

@@ -21,7 +21,7 @@
<h3>{%= __("Next Steps") %}</h3>
<ul class="list-unstyled">
<li><a class="text-muted" href="#">{%= __("Go to the Desktop and start using ERPNext") %}</a></li>
<li><a class="text-muted" href="#Module/Learn">{%= __("View a list of all the help videos") %}</a></li>
<li><a class="text-muted" href="#modules/Learn">{%= __("View a list of all the help videos") %}</a></li>
<li><a class="text-muted" href="https://manual.erpnext.com" target="_blank">{%= __("Read the ERPNext Manual") %}</a></li>
<li><a class="text-muted" href="https://discuss.erpnext.com" target="_blank">{%= __("Community Forum") %}</a></li>
</ul>

View File

@@ -20,6 +20,7 @@ def setup_complete(args=None):
install_fixtures.install(args.get("country"))
update_setup_wizard_access()
create_fiscal_year_and_company(args)
create_users(args)
set_defaults(args)
@@ -53,6 +54,14 @@ def setup_complete(args=None):
pass
def update_setup_wizard_access():
setup_wizard = frappe.get_doc('Page', 'setup-wizard')
for roles in setup_wizard.roles:
if roles.role == 'System Manager':
roles.role = 'Administrator'
setup_wizard.flags.ignore_permissions = 1
setup_wizard.save()
def create_fiscal_year_and_company(args):
if (args.get('fy_start_date')):
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
@@ -426,7 +435,7 @@ def create_users(args):
# create employee for self
emp = frappe.get_doc({
"doctype": "Employee",
"full_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])),
"employee_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])),
"user_id": frappe.session.user,
"status": "Active",
"company": args.get("company_name")
@@ -470,7 +479,7 @@ def create_users(args):
# create employee
emp = frappe.get_doc({
"doctype": "Employee",
"full_name": fullname,
"employee_name": fullname,
"user_id": email,
"status": "Active",
"company": args.get("company_name")

View File

@@ -463,9 +463,22 @@ class Item(WebsiteGenerator):
clear_cache(self.page_name)
frappe.db.set_value("Item", newdn, "item_code", newdn)
if merge:
self.set_last_purchase_rate(newdn)
self.recalculate_bin_qty(newdn)
for dt in ("Sales Taxes and Charges", "Purchase Taxes and Charges"):
for d in frappe.db.sql("""select name, item_wise_tax_detail from `tab{0}`
where ifnull(item_wise_tax_detail, '') != ''""".format(dt), as_dict=1):
item_wise_tax_detail = json.loads(d.item_wise_tax_detail)
if olddn in item_wise_tax_detail:
item_wise_tax_detail[newdn] = item_wise_tax_detail[olddn]
item_wise_tax_detail.pop(olddn)
frappe.db.set_value(dt, d.name, "item_wise_tax_detail",
json.dumps(item_wise_tax_detail), update_modified=False)
def set_last_purchase_rate(self, newdn):
last_purchase_rate = get_last_purchase_details(newdn).get("base_rate", 0)
@@ -562,7 +575,8 @@ class Item(WebsiteGenerator):
variant = get_variant(self.variant_of, args, self.name)
if variant:
frappe.throw(_("Item variant {0} exists with same attributes")
.format(variant), ItemVariantExistsError)
.format(variant), ItemVariantExistsError)
def validate_end_of_life(item_code, end_of_life=None, disabled=None, verbose=1):
if (not end_of_life) or (disabled is None):

View File

@@ -139,19 +139,24 @@ class PurchaseReceipt(BuyingController):
pr_qty = flt(d.qty) * flt(d.conversion_factor)
if pr_qty:
val_rate_db_precision = 6 if cint(self.precision("valuation_rate", d)) <= 6 else 9
rate = flt(d.valuation_rate, val_rate_db_precision)
sle = self.get_sl_entries(d, {
"actual_qty": flt(pr_qty),
"serial_no": cstr(d.serial_no).strip()
})
if self.is_return:
original_incoming_rate = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Purchase Receipt", "voucher_no": self.return_against,
"item_code": d.item_code}, "incoming_rate")
sle.update({
"outgoing_rate": rate
"outgoing_rate": original_incoming_rate
})
else:
val_rate_db_precision = 6 if cint(self.precision("valuation_rate", d)) <= 6 else 9
incoming_rate = flt(d.valuation_rate, val_rate_db_precision)
sle.update({
"incoming_rate": rate
"incoming_rate": incoming_rate
})
sl_entries.append(sle)
@@ -302,12 +307,9 @@ class PurchaseReceipt(BuyingController):
for d in self.get("items"):
if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty):
if warehouse_account.get(d.warehouse):
val_rate_db_precision = 6 if cint(d.precision("valuation_rate")) <= 6 else 9
# warehouse account
stock_value_diff = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty)
* flt(d.conversion_factor), d.precision("base_net_amount"))
stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Purchase Receipt", "voucher_no": self.name,
"voucher_detail_no": d.name}, "stock_value_difference")
gl_entries.append(self.get_gl_dict({
"account": warehouse_account[d.warehouse]["name"],
@@ -352,16 +354,20 @@ class PurchaseReceipt(BuyingController):
}, warehouse_account[self.supplier_warehouse]["account_currency"]))
# divisional loss adjustment
sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
self.precision("base_net_amount", d))
distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \
valuation_amount_as_per_doc = flt(d.base_net_amount, d.precision("base_net_amount")) + \
flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + flt(d.item_tax_amount)
divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d))
divisional_loss = flt(valuation_amount_as_per_doc - stock_value_diff,
d.precision("base_net_amount"))
if divisional_loss:
if self.is_return or flt(d.item_tax_amount):
loss_account = expenses_included_in_valuation
else:
loss_account = stock_rbnb
gl_entries.append(self.get_gl_dict({
"account": stock_rbnb,
"account": loss_account,
"against": warehouse_account[d.warehouse]["name"],
"cost_center": d.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),

View File

@@ -27,9 +27,8 @@ class StockEntry(StockController):
return _("From {0} to {1}").format(self.from_warehouse, self.to_warehouse)
def onload(self):
if self.docstatus==1:
for item in self.get("items"):
item.update(get_bin_details(item.item_code, item.s_warehouse))
for item in self.get("items"):
item.update(get_bin_details(item.item_code, item.s_warehouse))
def validate(self):
self.pro_doc = None

View File

@@ -1,17 +1,19 @@
{
"apply_user_permissions": 1,
"creation": "2013-08-20 15:08:10",
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2014-06-03 07:18:17.128918",
"modified_by": "Administrator",
"module": "Stock",
"name": "Items To Be Requested",
"owner": "Administrator",
"add_total_row": 0,
"apply_user_permissions": 1,
"creation": "2013-08-20 15:08:10",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2016-04-01 08:27:14.436178",
"modified_by": "Administrator",
"module": "Stock",
"name": "Items To Be Requested",
"owner": "Administrator",
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
"ref_doctype": "Item",
"report_name": "Items To Be Requested",
"ref_doctype": "Item",
"report_name": "Items To Be Requested",
"report_type": "Query Report"
}
}

View File

@@ -7,7 +7,7 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2015-11-04 12:00:40.085130",
"modified": "2016-04-01 08:27:03.318987",
"modified_by": "Administrator",
"module": "Stock",
"name": "Ordered Items To Be Delivered",

View File

@@ -7,7 +7,7 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2015-11-04 12:01:22.108641",
"modified": "2016-04-01 08:26:59.904034",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Order Items To Be Received",

View File

@@ -94,7 +94,11 @@ class MaintenanceSchedule(TransactionBase):
validated = False
employee = frappe.db.get_value("Sales Person", sales_person, "employee")
holiday_list = get_holiday_list_for_employee(employee)
if employee:
holiday_list = get_holiday_list_for_employee(employee)
else:
holiday_list = frappe.db.get_value("Company", self.company, "default_holiday_list")
holidays = frappe.db.sql_list('''select holiday_date from `tabHoliday` where parent=%s''', holiday_list)
if not validated and holidays:

View File

@@ -85,13 +85,18 @@ cur_frm.add_fetch('item_code', 'description', 'description');
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
if(doc.serial_no) {
return{
filters:{ 'serial_no': doc.serial_no}
doctype: "Serial No",
fields: "item_code",
filters:{
name: doc.serial_no
}
}
}
else{
return{
filters:[
['Item', 'docstatus', '!=', 2]
['Item', 'docstatus', '!=', 2],
['Item', 'disabled', '=', 0]
]
}
}

View File

@@ -503,7 +503,7 @@ apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +139,Proposal Writin
apps/erpnext/erpnext/setup/doctype/sales_person/sales_person.py +35,Another Sales Person {0} exists with the same Employee id,شخص آخر مبيعات {0} موجود مع نفس الرقم الوظيفي
apps/erpnext/erpnext/config/accounts.py +70,Masters,الماجستير
apps/erpnext/erpnext/config/accounts.py +127,Update Bank Transaction Dates,تواريخ عملية البنك التحديث
apps/erpnext/erpnext/stock/stock_ledger.py +337,Negative Stock Error ({6}) for Item {0} in Warehouse {1} on {2} {3} in {4} {5},خطأ الأسهم السلبية ( { } 6 ) القطعة ل {0} في {1} في معرض النماذج ثلاثية على {2} {3} {4} في {5}
apps/erpnext/erpnext/stock/stock_ledger.py +337,Negative Stock Error ({6}) for Item {0} in Warehouse {1} on {2} {3} in {4} {5},خطأ الأسهم السلبية ( {6} ) القطعة ل {0} في {1} في معرض النماذج ثلاثية على {2} {3} {4} في {5}
apps/erpnext/erpnext/config/projects.py +30,Time Tracking,تتبع الوقت
DocType: Fiscal Year Company,Fiscal Year Company,الشركة السنة المالية
DocType: Packing Slip Item,DN Detail,DN التفاصيل
1 DocType: Employee Salary Mode وضع الراتب
503 DocType: Time Log Billed توصف
504 DocType: Batch Batch Description دفعة الوصف
505 DocType: Delivery Note Time at which items were delivered from warehouse الوقت الذي تم تسليم العناصر من مستودع
506 DocType: Sales Invoice Sales Taxes and Charges الضرائب على المبيعات والرسوم
507 DocType: Employee Organization Profile الملف الشخصي المنظمة
508 DocType: Employee Reason for Resignation سبب الاستقالة
509 apps/erpnext/erpnext/config/hr.py +151 Template for performance appraisals. نموذج ل تقييم الأداء.

View File

@@ -2066,7 +2066,7 @@ DocType: Delivery Note,Required only for sample item.,ಕೇವಲ ಮಾದ
DocType: Stock Ledger Entry,Actual Qty After Transaction,ವ್ಯವಹಾರದ ನಂತರ ನಿಜವಾದ ಪ್ರಮಾಣ
,Pending SO Items For Purchase Request,ಖರೀದಿ ವಿನಂತಿ ಆದ್ದರಿಂದ ಐಟಂಗಳು ಬಾಕಿ
DocType: Supplier,Billing Currency,ಬಿಲ್ಲಿಂಗ್ ಕರೆನ್ಸಿ
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ದೊಡ್ಡದು
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ಎಕ್ಸ್ಟ್ರಾ ದೊಡ್ಡದು
,Profit and Loss Statement,ಲಾಭ ಮತ್ತು ನಷ್ಟ ಹೇಳಿಕೆ
DocType: Bank Reconciliation Detail,Cheque Number,ಚೆಕ್ ಸಂಖ್ಯೆ
DocType: Payment Tool Detail,Payment Tool Detail,ಪಾವತಿ ಉಪಕರಣ ವಿವರ
@@ -2076,7 +2076,7 @@ apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py +500,Warnin
apps/erpnext/erpnext/setup/setup_wizard/setup_wizard.py +362,Local,ಸ್ಥಳೀಯ
apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +26,Loans and Advances (Assets),ಸಾಲ ಮತ್ತು ಅಡ್ವಾನ್ಸಸ್ ( ಆಸ್ತಿಗಳು )
apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +12,Debtors,ಸಾಲಗಾರರು
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡದು
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡ
DocType: C-Form Invoice Detail,Territory,ಕ್ಷೇತ್ರ
apps/erpnext/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +139,Please mention no of visits required,ನಮೂದಿಸಿ ಅಗತ್ಯವಿದೆ ಭೇಟಿ ಯಾವುದೇ
DocType: Stock Settings,Default Valuation Method,ಡೀಫಾಲ್ಟ್ ಮೌಲ್ಯಮಾಪನ ವಿಧಾನ
Can't render this file because it is too large.

View File

@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
from pip.req import parse_requirements
version = "6.27.2"
version = "6.27.22"
requirements = parse_requirements("requirements.txt", session="")
setup(

8
travis/bench_init.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
cd ~/
curl -I https://github.com/frappe/frappe/tree/$TRAVIS_BRANCH | head -n 1 | cut -d $' ' -f2 | (
read response;
[ $response == '200' ] && branch=$TRAVIS_BRANCH || branch='develop';
bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch $branch
)