Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
ab4a96d
fix: Multiple fixes in Gross Profit report
deepeshgarg007 Feb 10, 2022
b0a9ff0
fix: Update columns in new format
deepeshgarg007 Feb 11, 2022
9a0b830
fix: Remove unused param
deepeshgarg007 Feb 12, 2022
a63373c
fix: Gross profit for credit notes
deepeshgarg007 Feb 14, 2022
93033fb
feat: Bank Reconciliation for loan documents
deepeshgarg007 Feb 17, 2022
c2129b7
fix: Add patch for account fields
deepeshgarg007 Feb 21, 2022
e998521
fix: Update queries in Bank Reconciliation Tool
deepeshgarg007 Feb 21, 2022
247325e
fix: Update bank reconciliation statement
deepeshgarg007 Feb 21, 2022
259a091
fix: Remove print statements
deepeshgarg007 Feb 21, 2022
d1049b0
fix: Resolve conflicts
deepeshgarg007 Feb 23, 2022
c040d7d
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Feb 23, 2022
c9da4e1
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Feb 28, 2022
a8ae86e
fix: wrong payment days in salary slip for employees joining/leaving …
mergify[bot] Mar 7, 2022
fd3adbb
fix: Item discounts for quotation
deepeshgarg007 Feb 22, 2022
dfbd0eb
fix: apply margin on duplicated doc too
ankush Mar 1, 2022
9af14ec
fix: Test cases with discount
deepeshgarg007 Mar 1, 2022
456ebc3
fix: translate error message titles
TurkerTunali Mar 8, 2022
ba4d496
fix: Resolve conflicts
deepeshgarg007 Mar 8, 2022
31f20cf
fix(pos): multiple pos round off cases
nextchamp-saqib Mar 7, 2022
f7f1147
Merge pull request #30106 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 8, 2022
07db36b
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 8, 2022
7de6f0a
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 8, 2022
dc8fd6d
Merge pull request #30104 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 8, 2022
e5c82d0
fix: Get MRs that are yet to be received but fully ordered in Report …
mergify[bot] Mar 8, 2022
ac7f182
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 8, 2022
6a4c023
Merge pull request #29918 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 8, 2022
e8f17e5
test: Fix flaky tests (backport #30107) (#30119)
mergify[bot] Mar 8, 2022
07b8dd0
fix: leave allocation records query (backport #30118) (#30120)
mergify[bot] Mar 8, 2022
3aace2f
fix: Reload doctypes
deepeshgarg007 Mar 9, 2022
b9ccbd5
fix: Ambigous column in picklist query
deepeshgarg007 Mar 7, 2022
95792d8
fix: Remove unintentional changes
deepeshgarg007 Mar 8, 2022
8fc105a
fix: Item-wise sales history report
deepeshgarg007 Mar 6, 2022
b3fd665
Merge pull request #30122 from frappe/mergify/bp/version-13-hotfix/pr…
ankush Mar 9, 2022
ba21e2e
Merge pull request #30123 from frappe/mergify/bp/version-13-hotfix/pr…
ankush Mar 9, 2022
3d8eaa5
fix: add filters in default_discount_account (#30095)
Mohamed-D-Ouf Mar 9, 2022
ab6cdbd
Merge pull request #29949 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 9, 2022
4a5ea55
fix(ux): Improve label for better understanding
deepeshgarg007 Mar 7, 2022
58f4172
fix: dont fetch entire barcode table in get_item_details (#30131) (#3…
mergify[bot] Mar 9, 2022
a12a3bd
fix: dont fetch entire barcode table in get_item_details (#30131) (#3…
mergify[bot] Mar 9, 2022
5c7b2e2
Merge pull request #30133 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 9, 2022
76376d7
chore: bump version
ankush Mar 9, 2022
856534c
fix: Remove tax invoice no field
deepeshgarg007 Mar 9, 2022
8d74181
fix: Update timestamp
deepeshgarg007 Mar 9, 2022
b503b83
Merge pull request #30137 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 9, 2022
7f234c7
feat: Include child item group products in Item Group Page & cleanup
marination Mar 7, 2022
c8026eb
test: Test include_descendants in Item Group Product Listing
marination Mar 9, 2022
ca41263
fix: Linter
marination Mar 9, 2022
51f7ca8
revert: BU Schlüssel (a21f76f) (#30142)
mergify[bot] Mar 9, 2022
f721a29
fix(translation) - correction for translation
HarryPaulo Feb 25, 2022
4b4b104
fix: Merge conflicts
marination Mar 9, 2022
d68cf18
test: Added test for monthly attendance report (backport #29989) (#30…
mergify[bot] Mar 9, 2022
db38c36
Merge pull request #30144 from frappe/mergify/bp/version-13-hotfix/pr…
marination Mar 9, 2022
6241f9b
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr…
marination Mar 9, 2022
458f264
fix: Remove extra line
marination Mar 9, 2022
63e7d8c
perf(asset): fetch only distinct depreciable assets (#30138)
mergify[bot] Mar 9, 2022
eb90d50
fix: ignore non-unique swift numbers while migrating (#30139)
mergify[bot] Mar 9, 2022
e3387a0
fix: customer credit limit validation on update (#30126)
mergify[bot] Mar 9, 2022
c9d0692
Merge pull request #30141 from frappe/mergify/bp/version-13-hotfix/pr…
marination Mar 9, 2022
31ba09b
fix: program enrollment button labels (backport #30148) (#30149)
mergify[bot] Mar 10, 2022
cef8820
fix(psoa): add company filter to account
nextchamp-saqib Mar 9, 2022
903e5d0
Merge pull request #30151 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 10, 2022
92a59fa
chore: imports (#30157)
nextchamp-saqib Mar 10, 2022
6c21642
fix(psoa): no such element: dict object['account'] (#30156)
mergify[bot] Mar 10, 2022
5081438
fix: do not reset asset_category (#29696)
hrwX Mar 10, 2022
5e6879a
Merge pull request #30159 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 10, 2022
bb0be16
fix: Ignore missing customer group while fetching price list
ChillarAnand Mar 7, 2022
3f0a4d9
fix: Ignore missing customer group while fetching price list
nextchamp-saqib Mar 10, 2022
4febcd8
fix: flaky tests (backport #30154) (#30161)
mergify[bot] Mar 10, 2022
62b50b6
fix: 'save_quotations_as_draft' checkbox not honoured
marination Mar 10, 2022
aec1916
fix: Merge Conflicts in test_shopping_cart imports
marination Mar 10, 2022
b529b5c
fix: Remove extra empty line after frappe imports
marination Mar 10, 2022
584f069
Merge pull request #30163 from frappe/mergify/bp/version-13-hotfix/pr…
marination Mar 10, 2022
e89c181
Merge pull request #30162 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 10, 2022
a5b25db
fix: dont reset UOM in MR on every get_item_detail call (#30164) (#30…
mergify[bot] Mar 10, 2022
de55008
test: refactor item merge test and disable commits
ankush Mar 10, 2022
33ddbb4
fix: handle duplicate bins during item merge renames
ankush Mar 10, 2022
f065542
fix: fetch new fields from routing to bom (backport #30169) (#30171)
mergify[bot] Mar 10, 2022
e428c36
fix: only update valuation rate if not None
ankush Mar 10, 2022
b13389b
test: flaky MR report test
ankush Mar 10, 2022
a04c7fc
test: submit PR directly
ankush Mar 10, 2022
44fd94f
fix: Shipping rule application fixes
deepeshgarg007 Mar 10, 2022
d47b351
Merge pull request #30188 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 13, 2022
5eeb09c
fix: Sales and Purchase retrun optimization
deepeshgarg007 Mar 10, 2022
f31a7bd
fix: Update party type
deepeshgarg007 Mar 10, 2022
abc2dd9
fix: Update modified timestamp
deepeshgarg007 Mar 10, 2022
d71a888
Merge pull request #30205 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 13, 2022
625034a
test: standalone SI creates and attaches serial nos
ankush Mar 11, 2022
2a00380
fix: attach sr no si standalone credit note
ankush Mar 11, 2022
39d6ceb
fix: Nil and Exempted values in GSTR-3B Report
deepeshgarg007 Mar 1, 2022
8a567b8
fix: Multi-currency bank reconciliation fixes
deepeshgarg007 Feb 24, 2022
f7b06a6
refactor: Employee Leave Balance Report
ruchamahabal Jan 31, 2022
d7a75a6
fix: expired leaves not calculated properly because of newly created …
ruchamahabal Feb 3, 2022
60eb38c
refactor: Leaves Taken calculation
ruchamahabal Feb 3, 2022
4632d13
refactor: balance in Balance Summary report near allocation expiry date
ruchamahabal Feb 4, 2022
420cb82
fix: sort imports, sider issues
ruchamahabal Feb 4, 2022
e96b661
fix: show actual balance instead of consumption balance in opening ba…
ruchamahabal Feb 4, 2022
6af8e97
test: employee leave balance report
ruchamahabal Feb 28, 2022
49434e4
chore: remove unused imports, sort imports, fix sider
ruchamahabal Feb 28, 2022
73b104a
test: Employee Leave Balance Summary
ruchamahabal Feb 28, 2022
b1d3d82
fix: leave application dashboard
ruchamahabal Feb 28, 2022
d9ec973
fix: earned leave policy assignment test
ruchamahabal Feb 28, 2022
758e095
test: fix test `test_leave_balance_near_allocaton_expiry`
ruchamahabal Feb 28, 2022
4cd89c3
test: get leave details for leave application dashboard
ruchamahabal Feb 28, 2022
51b17cf
fix: add type hints for employee leave balance report
ruchamahabal Mar 8, 2022
a30ec8b
feat: split ledger entries for applications created across allocations
ruchamahabal Mar 9, 2022
bfedac4
fix: clearer validation/warning messages for insufficient balance in …
ruchamahabal Mar 9, 2022
b63cedc
test: leave application validations
ruchamahabal Mar 9, 2022
7583324
fix: boundary determination for separate ledger entries
ruchamahabal Mar 9, 2022
fab0153
test: separate leave ledger entries for leave applications across all…
ruchamahabal Mar 9, 2022
d430167
chore: linter issue
ruchamahabal Mar 9, 2022
c66a66e
fix: conflicts
ruchamahabal Mar 10, 2022
9449d11
fix: simplify insufficient leave balance message
ruchamahabal Mar 11, 2022
70febe4
fix: add more type hints
ruchamahabal Mar 13, 2022
d50dbca
fix: flaky tests
ruchamahabal Mar 13, 2022
465c117
fix: conflicts
ruchamahabal Mar 13, 2022
164d28a
Merge pull request #30212 from frappe/mergify/bp/version-13-hotfix/pr…
ruchamahabal Mar 13, 2022
404a821
fix: if an item code is too long, truncate before setting BOM name
Feb 15, 2022
25df914
test: bom for item_code that is >VARCHAR_LEN
ankush Feb 16, 2022
6a031a8
fix: improve bom autoname logic
Feb 16, 2022
1a2a03e
refactor: split versioning code for testability
ankush Feb 26, 2022
c8ca92e
fix: cancelled document check
Mar 2, 2022
fc257fa
test: actual bom naming test
ankush Mar 11, 2022
d198c48
fix: max_qty validation condition
s-aga-r Mar 14, 2022
1cee08f
fix: cannot create purchase order from sales order
nextchamp-saqib Mar 14, 2022
1120a0f
Merge pull request #30219 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 14, 2022
aadc2a8
test: negative fifo test
ankush Mar 13, 2022
7aca949
fix(ux): skip items without batch series
ankush Mar 13, 2022
5c285bc
Merge pull request #30211 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 14, 2022
2e10e9e
Merge pull request #30210 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 14, 2022
a1c9d1c
fix: pos return payment mode issue (#26872)
nemesis189 Aug 23, 2021
75061ca
Merge pull request #30220 from nextchamp-saqib/backport-#26872
nextchamp-saqib Mar 14, 2022
98a6796
fix: Search query of payroll entry reference in Journal Entry (#30225)
nabinhait Mar 14, 2022
468964a
ci: Revert fail on merge conflict label
ankush Mar 14, 2022
2e79c4f
fix(ux): remove get item buttons from submitted production plan (#30224)
mergify[bot] Mar 14, 2022
1fd96f3
test(refactor): use FrappeTestCase
ankush Feb 28, 2022
b22bdc5
test: add test for planned_qty
s-aga-r Mar 14, 2022
017624c
fix: Add missing currency option in Supplier Quotation's `rounded_tot…
marination Mar 14, 2022
d5b142e
chore: Re-arrange fields for consistency with base currency LHS
marination Mar 14, 2022
aab677c
Merge pull request #30216 from s-aga-r/fix/production-plan/validation…
ankush Mar 14, 2022
18d7c77
fix: max_qty validation condition
s-aga-r Mar 14, 2022
46f9503
test: add test for planned_qty
s-aga-r Mar 14, 2022
fab8e16
Merge pull request #30235 from frappe/mergify/bp/version-13-pre-relea…
ankush Mar 14, 2022
4768f4f
fix(ux): negative stock warning
ankush Mar 14, 2022
f238107
fix: Do not consider cancelled entries
deepeshgarg007 Mar 13, 2022
2d8bbf1
Merge pull request #30237 from frappe/mergify/bp/version-13-hotfix/pr…
ankush Mar 14, 2022
9b2cb23
Merge pull request #30232 from frappe/mergify/bp/version-13-hotfix/pr…
marination Mar 14, 2022
34d6031
fix(pos): do not reset mode of payments in case of consolidation (bac…
mergify[bot] Mar 14, 2022
767a02c
fix: cannot create multicurrency sales order with product bundles (#3…
mergify[bot] Mar 14, 2022
d8de8ca
fix: BOM - clear Quality Inspection Template according to Inspection …
FHenry Mar 14, 2022
1dbb654
test: refactor BOM quality template test
ankush Mar 14, 2022
fa32fc3
fix: show status in job card list view in Draft mode
akurungadam Mar 13, 2022
7b87234
fix: job card - sub operations table status misbehaviour on pause / r…
akurungadam Mar 14, 2022
b0e178a
fix: Do not update ignore prcing rule check implicitly
deepeshgarg007 Mar 13, 2022
8b07710
fix: KSA E-Invoice QR Code showing wrong VAT amount
deepeshgarg007 Mar 14, 2022
fc29877
fix: Linting Issue
deepeshgarg007 Mar 14, 2022
c5de903
fix: Itemised tax rate updation
deepeshgarg007 Mar 14, 2022
ec92551
Update erpnext/regional/saudi_arabia/utils.py
deepeshgarg007 Mar 14, 2022
5e4ab34
Merge pull request #30245 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 15, 2022
f48caf4
Merge pull request #30246 from frappe/mergify/bp/version-13-hotfix/pr…
deepeshgarg007 Mar 15, 2022
0133b2a
fix: salary slip amount rounding errors (backport #30248) (#30251)
mergify[bot] Mar 15, 2022
6ef0854
fix: Leave Policy Assignment creation patch (backport #30215) (#30252)
mergify[bot] Mar 15, 2022
5d458d6
Merge pull request #30243 from akurungadam/jc-fix
rohitwaghchaure Mar 15, 2022
2c5e76d
fix(pos): loyalty points in case of returned pos invoice (#30257)
mergify[bot] Mar 15, 2022
a56fd20
fix: Sub-Categpry Routing in Item Group Page Listing pills
marination Mar 15, 2022
69bf64e
Merge pull request #30259 from frappe/mergify/bp/version-13-hotfix/pr…
marination Mar 15, 2022
8663a77
fix: incorrect debit credit amount in presentation currency
nextchamp-saqib Mar 14, 2022
510668f
test: foreign_account_balance_after_exchange_rate_revaluation
nextchamp-saqib Mar 15, 2022
29fa902
feat: add German translations
scdanieli Mar 15, 2022
3bcef50
Merge pull request #30262 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 16, 2022
f27fd60
fix: Do not update ignore prcing rule check implicitly
deepeshgarg007 Mar 16, 2022
461506a
Merge pull request #30267 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 16, 2022
b8fc06f
Merge pull request #30270 from frappe/mergify/bp/version-13-hotfix/pr…
nextchamp-saqib Mar 16, 2022
cde3c68
revert: "fix: updated packed_items getting fetched on Sales Return / …
ankush Mar 15, 2022
f3af5dd
test: packed item return scenarios
ankush Mar 16, 2022
64b6460
refactor: removed unrequired code and test for standalone delivery no…
mergify[bot] Mar 16, 2022
0becc1e
refactor: call repost directly during tests (#30277) (#30279)
mergify[bot] Mar 16, 2022
15413cf
fix: Non Profit fixes (#30280)
ruchamahabal Mar 17, 2022
3b1033c
test: fix holiday list creation causing flaky tests (backport #30260)…
mergify[bot] Mar 17, 2022
d8b7693
Merge pull request #30291 from ankush/13_23_pre_release
ankush Mar 17, 2022
eac0723
fix: Clean and fixes in Dimension-wise Accounts Balance Report
deepeshgarg007 Mar 17, 2022
fe88cfb
fix: Remove comments
deepeshgarg007 Mar 17, 2022
9e8b830
fix: Error in bank reco statement
deepeshgarg007 Mar 15, 2022
c20fc51
Merge pull request #30294 from frappe/mergify/bp/version-13-pre-relea…
deepeshgarg007 Mar 17, 2022
c018328
fix: Validate income/expense account in sales and purchase invoice
deepeshgarg007 Mar 16, 2022
0269bc9
fix: Test case
deepeshgarg007 Mar 17, 2022
6c23b30
Merge pull request #30297 from frappe/mergify/bp/version-13-pre-relea…
deepeshgarg007 Mar 17, 2022
ec79e13
fix: respect db multi_tenancy while fetching precision (#30301) (#30303)
mergify[bot] Mar 18, 2022
1c36b1a
Merge pull request #30293 from frappe/mergify/bp/version-13-pre-relea…
deepeshgarg007 Mar 18, 2022
230d171
chore: add change log for v13.23.0
ankush Mar 20, 2022
84c5f98
Merge branch 'version-13-pre-release' into version-13
ankush Mar 21, 2022
5ab6e3f
chore: bump version
ankush Mar 21, 2022
388fe5e
Merge remote-tracking branch 'upstream/version-13' into merge-v13
Mar 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
paths-ignore:
- '**.js'
- '**.md'
types: [opened, unlabeled, synchronize, reopened]
workflow_dispatch:


Expand All @@ -30,11 +29,6 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Check for merge conficts label
if: ${{ contains(github.event.pull_request.labels.*.name, 'conflicts') }}
run: |
echo "Remove merge conflicts and remove conflict label to run CI"
exit 1
- name: Clone
uses: actions/checkout@v2

Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/server-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
paths-ignore:
- '**.js'
- '**.md'
types: [opened, unlabeled, synchronize, reopened]
workflow_dispatch:
push:
branches: [ develop ]
Expand Down Expand Up @@ -40,12 +39,6 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Check for merge conficts label
if: ${{ contains(github.event.pull_request.labels.*.name, 'conflicts') }}
run: |
echo "Remove merge conflicts and remove conflict label to run CI"
exit 1

- name: Clone
uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion erpnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from erpnext.hooks import regional_overrides

__version__ = '13.22.0'
__version__ = '13.23.0'

def get_default_company(user=None):
'''Get default company for user'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.query_builder.custom import ConstantColumn
from frappe.utils import flt

from erpnext import get_company_currency
Expand Down Expand Up @@ -231,7 +232,7 @@ def reconcile_vouchers(bank_transaction_name, vouchers):
}), transaction.currency, company_account)

if total_amount > transaction.unallocated_amount:
frappe.throw(_("The Sum Total of Amounts of All Selected Vouchers Should be Less than the Unallocated Amount of the Bank Transaction"))
frappe.throw(_("The sum total of amounts of all selected vouchers should be less than the unallocated amount of the bank transaction"))
account = frappe.db.get_value("Bank Account", transaction.bank_account, "account")

for voucher in vouchers:
Expand Down Expand Up @@ -275,6 +276,10 @@ def check_matching(bank_account, company, transaction, document_types):
}

matching_vouchers = []

matching_vouchers.extend(get_loan_vouchers(bank_account, transaction,
document_types, filters))

for query in subquery:
matching_vouchers.extend(
frappe.db.sql(query, filters,)
Expand Down Expand Up @@ -311,6 +316,114 @@ def get_queries(bank_account, company, transaction, document_types):

return queries

def get_loan_vouchers(bank_account, transaction, document_types, filters):
vouchers = []
amount_condition = True if "exact_match" in document_types else False

if transaction.withdrawal > 0 and "loan_disbursement" in document_types:
vouchers.extend(get_ld_matching_query(bank_account, amount_condition, filters))

if transaction.deposit > 0 and "loan_repayment" in document_types:
vouchers.extend(get_lr_matching_query(bank_account, amount_condition, filters))

return vouchers

def get_ld_matching_query(bank_account, amount_condition, filters):
loan_disbursement = frappe.qb.DocType("Loan Disbursement")
matching_reference = loan_disbursement.reference_number == filters.get("reference_number")
matching_party = loan_disbursement.applicant_type == filters.get("party_type") and \
loan_disbursement.applicant == filters.get("party")

rank = (
frappe.qb.terms.Case()
.when(matching_reference, 1)
.else_(0)
)

rank1 = (
frappe.qb.terms.Case()
.when(matching_party, 1)
.else_(0)
)

query = frappe.qb.from_(loan_disbursement).select(
rank + rank1 + 1,
ConstantColumn("Loan Disbursement").as_("doctype"),
loan_disbursement.name,
loan_disbursement.disbursed_amount,
loan_disbursement.reference_number,
loan_disbursement.reference_date,
loan_disbursement.applicant_type,
loan_disbursement.disbursement_date
).where(
loan_disbursement.docstatus == 1
).where(
loan_disbursement.clearance_date.isnull()
).where(
loan_disbursement.disbursement_account == bank_account
)

if amount_condition:
query.where(
loan_disbursement.disbursed_amount == filters.get('amount')
)
else:
query.where(
loan_disbursement.disbursed_amount <= filters.get('amount')
)

vouchers = query.run(as_list=True)

return vouchers

def get_lr_matching_query(bank_account, amount_condition, filters):
loan_repayment = frappe.qb.DocType("Loan Repayment")
matching_reference = loan_repayment.reference_number == filters.get("reference_number")
matching_party = loan_repayment.applicant_type == filters.get("party_type") and \
loan_repayment.applicant == filters.get("party")

rank = (
frappe.qb.terms.Case()
.when(matching_reference, 1)
.else_(0)
)

rank1 = (
frappe.qb.terms.Case()
.when(matching_party, 1)
.else_(0)
)

query = frappe.qb.from_(loan_repayment).select(
rank + rank1 + 1,
ConstantColumn("Loan Repayment").as_("doctype"),
loan_repayment.name,
loan_repayment.amount_paid,
loan_repayment.reference_number,
loan_repayment.reference_date,
loan_repayment.applicant_type,
loan_repayment.posting_date
).where(
loan_repayment.docstatus == 1
).where(
loan_repayment.clearance_date.isnull()
).where(
loan_repayment.payment_account == bank_account
)

if amount_condition:
query.where(
loan_repayment.amount_paid == filters.get('amount')
)
else:
query.where(
loan_repayment.amount_paid <= filters.get('amount')
)

vouchers = query.run()

return vouchers

def get_pe_matching_query(amount_condition, account_from_to, transaction):
# get matching payment entries query
if transaction.deposit > 0:
Expand Down Expand Up @@ -348,7 +461,6 @@ def get_je_matching_query(amount_condition, transaction):
# We have mapping at the bank level
# So one bank could have both types of bank accounts like asset and liability
# So cr_or_dr should be judged only on basis of withdrawal and deposit and not account type
company_account = frappe.get_value("Bank Account", transaction.bank_account, "account")
cr_or_dr = "credit" if transaction.withdrawal > 0 else "debit"

return f"""
Expand Down
21 changes: 17 additions & 4 deletions erpnext/accounts/doctype/bank_transaction/bank_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def update_allocations(self):

def clear_linked_payment_entries(self, for_cancel=False):
for payment_entry in self.payment_entries:
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim", "Loan Repayment",
"Loan Disbursement"]:
self.clear_simple_entry(payment_entry, for_cancel=for_cancel)

elif payment_entry.payment_document == "Sales Invoice":
Expand Down Expand Up @@ -108,18 +109,30 @@ def get_paid_amount(payment_entry, currency, bank_account):
paid_amount_field = "paid_amount"
if payment_entry.payment_document == 'Payment Entry':
doc = frappe.get_doc("Payment Entry", payment_entry.payment_entry)
paid_amount_field = ("base_paid_amount"
if doc.paid_to_account_currency == currency else "paid_amount")

if doc.payment_type == 'Receive':
paid_amount_field = ("received_amount"
if doc.paid_to_account_currency == currency else "base_received_amount")
elif doc.payment_type == 'Pay':
paid_amount_field = ("paid_amount"
if doc.paid_to_account_currency == currency else "base_paid_amount")

return frappe.db.get_value(payment_entry.payment_document,
payment_entry.payment_entry, paid_amount_field)

elif payment_entry.payment_document == "Journal Entry":
return frappe.db.get_value('Journal Entry Account', {'parent': payment_entry.payment_entry, 'account': bank_account}, "sum(credit_in_account_currency)")
return frappe.db.get_value('Journal Entry Account', {'parent': payment_entry.payment_entry, 'account': bank_account},
"sum(credit_in_account_currency)")

elif payment_entry.payment_document == "Expense Claim":
return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "total_amount_reimbursed")

elif payment_entry.payment_document == "Loan Disbursement":
return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "disbursed_amount")

elif payment_entry.payment_document == "Loan Repayment":
return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "amount_paid")

else:
frappe.throw("Please reconcile {0}: {1} manually".format(payment_entry.payment_document, payment_entry.payment_entry))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# See license.txt

import frappe
from frappe.tests.utils import FrappeTestCase

from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
create_dimension,
Expand All @@ -10,11 +11,10 @@
from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import (
get_temporary_opening_account,
)
from erpnext.tests.utils import ERPNextTestCase

test_dependencies = ["Customer", "Supplier", "Accounting Dimension"]

class TestOpeningInvoiceCreationTool(ERPNextTestCase):
class TestOpeningInvoiceCreationTool(FrappeTestCase):
@classmethod
def setUpClass(self):
if not frappe.db.exists("Company", "_Test Opening Invoice Company"):
Expand Down
4 changes: 2 additions & 2 deletions erpnext/accounts/doctype/pos_invoice/pos_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def validate(self):

def on_submit(self):
# create the loyalty point ledger entry if the customer is enrolled in any loyalty program
if self.loyalty_program:
if not self.is_return and self.loyalty_program:
self.make_loyalty_point_entry()
elif self.is_return and self.return_against and self.loyalty_program:
against_psi_doc = frappe.get_doc("POS Invoice", self.return_against)
Expand Down Expand Up @@ -88,7 +88,7 @@ def before_cancel(self):
def on_cancel(self):
# run on cancel method of selling controller
super(SalesInvoice, self).on_cancel()
if self.loyalty_program:
if not self.is_return and self.loyalty_program:
self.delete_loyalty_point_entry()
elif self.is_return and self.return_against and self.loyalty_program:
against_psi_doc = frappe.get_doc("POS Invoice", self.return_against)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def test_consolidated_credit_note_creation(self):
pos_inv_cn = make_sales_return(pos_inv.name)
pos_inv_cn.set("payments", [])
pos_inv_cn.append('payments', {
'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': -300
'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': -100
})
pos_inv_cn.append('payments', {
'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': -200
})
pos_inv_cn.paid_amount = -300
pos_inv_cn.submit()
Expand All @@ -98,7 +101,12 @@ def test_consolidated_credit_note_creation(self):

pos_inv_cn.load_from_db()
self.assertTrue(frappe.db.exists("Sales Invoice", pos_inv_cn.consolidated_invoice))
self.assertTrue(frappe.db.get_value("Sales Invoice", pos_inv_cn.consolidated_invoice, "is_return"))
consolidated_credit_note = frappe.get_doc("Sales Invoice", pos_inv_cn.consolidated_invoice)
self.assertEqual(consolidated_credit_note.is_return, 1)
self.assertEqual(consolidated_credit_note.payments[0].mode_of_payment, 'Cash')
self.assertEqual(consolidated_credit_note.payments[0].amount, -100)
self.assertEqual(consolidated_credit_note.payments[1].mode_of_payment, 'Bank Draft')
self.assertEqual(consolidated_credit_note.payments[1].amount, -200)

finally:
frappe.set_user("Administrator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ <h5 style="float: right;">
<td></td>
<td><b>{{ frappe.format(row.account, {fieldtype: "Link"}) or "&nbsp;" }}</b></td>
<td style="text-align: right">
{{ row.account and frappe.utils.fmt_money(row.debit, currency=filters.presentation_currency) }}
{{ row.get('account', '') and frappe.utils.fmt_money(row.debit, currency=filters.presentation_currency) }}
</td>
<td style="text-align: right">
{{ row.account and frappe.utils.fmt_money(row.credit, currency=filters.presentation_currency) }}
{{ row.get('account', '') and frappe.utils.fmt_money(row.credit, currency=filters.presentation_currency) }}
</td>
{% endif %}
<td style="text-align: right">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ frappe.ui.form.on('Process Statement Of Accounts', {
}
}
});
frm.set_query("account", function() {
return {
filters: {
'company': frm.doc.company
}
};
});
if(frm.doc.__islocal){
frm.set_value('from_date', frappe.datetime.add_months(frappe.datetime.get_today(), -1));
frm.set_value('to_date', frappe.datetime.get_today());
Expand Down
6 changes: 6 additions & 0 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_enabled
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
from erpnext.buying.utils import check_on_hold_or_closed_status
from erpnext.controllers.accounts_controller import validate_account_head
from erpnext.controllers.buying_controller import BuyingController
from erpnext.stock import get_warehouse_account_map
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
Expand Down Expand Up @@ -105,6 +106,7 @@ def validate(self):
self.validate_uom_is_integer("uom", "qty")
self.validate_uom_is_integer("stock_uom", "stock_qty")
self.set_expense_account(for_validate=True)
self.validate_expense_account()
self.set_against_expense_account()
self.validate_write_off_account()
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items")
Expand Down Expand Up @@ -309,6 +311,10 @@ def set_expense_account(self, for_validate=False):
elif not item.expense_account and for_validate:
throw(_("Expense account is mandatory for item {0}").format(item.item_code or item.item_name))

def validate_expense_account(self):
for item in self.get('items'):
validate_account_head(item.idx, item.expense_account, self.company, 'Expense')

def set_against_expense_account(self):
against_accounts = []
for item in self.get("items"):
Expand Down
Loading