Skip to content

Commit

Permalink
V14 party lookup (#68)
Browse files Browse the repository at this point in the history
* fix: remove check_digit argument in ACH generation

* feat: look up party on PE submission to avoid renaming problems
  • Loading branch information
agritheory authored Mar 1, 2023
1 parent 8476235 commit 7f940f3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
17 changes: 14 additions & 3 deletions check_run/check_run/doctype/check_run/check_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def validate_transactions(self):
for t in selected:
if not t['mode_of_payment']:
frappe.throw(frappe._(f"Mode of Payment Required: {t['party_name']} {t['ref_number']}"))
if frappe.get_value(t['doctype'], filters=t['name'], fieldname='docstatus') != 1:
filters = {'name': t['name'] if t['doctype'] != 'Journal Entry' else t['ref_number']}
if frappe.get_value(t['doctype'], filters, 'docstatus') != 1:
wrong_status.append({'party_name': t['party_name'], 'ref_number': t['ref_number'] or '', 'name': t['name']})
if len(wrong_status) < 1:
return
Expand Down Expand Up @@ -208,6 +209,12 @@ def create_payment_entries(self, transactions):
continue
for group in groups:
_references = []
if group[0].doctype == 'Purchase Invoice':
party = frappe.db.get_value('Purchase Invoice', group[0].name, 'supplier')
elif group[0].doctype == 'Expense Claim':
party = frappe.db.get_value('Expense Claim', group[0].name, 'employee')
elif group[0].doctype == 'Journal Entry':
party = frappe.db.get_value('Journal Entry Account', group[0].name, 'party')
pe = frappe.new_doc("Payment Entry")
pe.payment_type = "Pay"
pe.posting_date = nowdate()
Expand Down Expand Up @@ -236,9 +243,13 @@ def create_payment_entries(self, transactions):
if settings.automatically_release_on_hold_invoices and reference.doctype == 'Purchase Invoice':
if frappe.get_value(reference.doctype, reference.name, 'on_hold'):
frappe.db.set_value(reference.doctype, reference.name, 'on_hold', 0)
if reference.doctype == 'Journal Entry':
reference_name = reference.ref_number
else:
reference_name = reference.name or reference.ref_number
pe.append('references', {
"reference_doctype": reference.doctype,
"reference_name": reference.name or reference.ref_number,
"reference_name": reference_name,
"due_date": reference.get("due_date"),
"outstanding_amount": flt(reference.amount),
"allocated_amount": flt(reference.amount),
Expand Down Expand Up @@ -445,7 +456,7 @@ def get_entries(doc):
.select(
ConstantColumn('Journal Entry').as_('doctype'),
je_accounts.party_type,
journal_entries.name,
je_accounts.name,
(journal_entries.name).as_('ref_number'),
je_accounts.party,
(je_accounts.party).as_('party_name'),
Expand Down
12 changes: 9 additions & 3 deletions check_run/public/js/check_run/CheckRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,15 @@ export default {
},
methods: {
transactionUrl: transaction => {
return encodeURI(
`${frappe.urllib.get_base_url()}/app/${transaction.doctype.toLowerCase().replace(' ', '-')}/${transaction.name}`
)
if(transaction.doctype !== 'Journal Entry'){
return encodeURI(
`${frappe.urllib.get_base_url()}/app/${transaction.doctype.toLowerCase().replace(' ', '-')}/${transaction.name}`
)
} else {
return encodeURI(
`${frappe.urllib.get_base_url()}/app/${transaction.doctype.toLowerCase().replace(' ', '-')}/${transaction.ref_number}`
)
}
},
paymentEntryUrl: transaction => {
if (!transaction.payment_entry) {
Expand Down
2 changes: 2 additions & 0 deletions docs/exampledata.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ With `bench start` running in the background, run the following command to insta

```shell
bench execute 'check_run.test_setup.before_test'
# to reinstall from scratch and setup test data
bench reinstall --yes --admin-password admin --mariadb-root-password admin && bench execute 'check_run.test_setup.before_test'
```

Refer to the [installation guide](./installationguide.md) for detailed instructions for how to set up a bench, a new site, and installing ERPNext and the Check Run application.

0 comments on commit 7f940f3

Please sign in to comment.