mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
Merge pull request #25384 from deepeshgarg007/psoa_fixes
fix: Updated filters for process statement of accounts
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for row in data %}
|
{% for row in data %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if(row.posting_date) %}
|
{% if(row.posting_date) %}
|
||||||
<td>{{ frappe.format(row.posting_date, 'Date') }}</td>
|
<td>{{ frappe.format(row.posting_date, 'Date') }}</td>
|
||||||
@@ -78,10 +78,10 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ aging.range1 }}</td>
|
<td>{{ frappe.utils.fmt_money(aging.range1, currency=filters.presentation_currency) }}</td>
|
||||||
<td>{{ aging.range2 }}</td>
|
<td>{{ frappe.utils.fmt_money(aging.range2, currency=filters.presentation_currency) }}</td>
|
||||||
<td>{{ aging.range3 }}</td>
|
<td>{{ frappe.utils.fmt_money(aging.range3, currency=filters.presentation_currency) }}</td>
|
||||||
<td>{{ aging.range4 }}</td>
|
<td>{{ frappe.utils.fmt_money(aging.range4, currency=filters.presentation_currency) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from erpnext.accounts.report.general_ledger.general_ledger import execute as get_soa
|
from erpnext.accounts.report.general_ledger.general_ledger import execute as get_soa
|
||||||
from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import execute as get_ageing
|
from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import execute as get_ageing
|
||||||
from frappe.core.doctype.communication.email import make
|
from erpnext import get_company_currency
|
||||||
|
from erpnext.accounts.party import get_party_account_currency
|
||||||
|
|
||||||
from frappe.utils.print_format import report_to_pdf
|
from frappe.utils.print_format import report_to_pdf
|
||||||
from frappe.utils.pdf import get_pdf
|
from frappe.utils.pdf import get_pdf
|
||||||
@@ -29,7 +31,7 @@ class ProcessStatementOfAccounts(Document):
|
|||||||
validate_template(self.body)
|
validate_template(self.body)
|
||||||
|
|
||||||
if not self.customers:
|
if not self.customers:
|
||||||
frappe.throw(frappe._('Customers not selected.'))
|
frappe.throw(_('Customers not selected.'))
|
||||||
|
|
||||||
if self.enable_auto_email:
|
if self.enable_auto_email:
|
||||||
self.to_date = self.start_date
|
self.to_date = self.start_date
|
||||||
@@ -58,22 +60,24 @@ def get_report_pdf(doc, consolidated=True):
|
|||||||
aging[0]['ageing_based_on'] = doc.ageing_based_on
|
aging[0]['ageing_based_on'] = doc.ageing_based_on
|
||||||
|
|
||||||
tax_id = frappe.get_doc('Customer', entry.customer).tax_id
|
tax_id = frappe.get_doc('Customer', entry.customer).tax_id
|
||||||
|
presentation_currency = get_party_account_currency('Customer', entry.customer, doc.company) \
|
||||||
|
or doc.currency or get_company_currency(doc.company)
|
||||||
|
|
||||||
filters= frappe._dict({
|
filters= frappe._dict({
|
||||||
'from_date': doc.from_date,
|
'from_date': doc.from_date,
|
||||||
'to_date': doc.to_date,
|
'to_date': doc.to_date,
|
||||||
'company': doc.company,
|
'company': doc.company,
|
||||||
'finance_book': doc.finance_book if doc.finance_book else None,
|
'finance_book': doc.finance_book if doc.finance_book else None,
|
||||||
"account": doc.account if doc.account else None,
|
'account': doc.account if doc.account else None,
|
||||||
'party_type': 'Customer',
|
'party_type': 'Customer',
|
||||||
'party': [entry.customer],
|
'party': [entry.customer],
|
||||||
|
'presentation_currency': presentation_currency,
|
||||||
'group_by': doc.group_by,
|
'group_by': doc.group_by,
|
||||||
'currency': doc.currency,
|
'currency': doc.currency,
|
||||||
'cost_center': [cc.cost_center_name for cc in doc.cost_center],
|
'cost_center': [cc.cost_center_name for cc in doc.cost_center],
|
||||||
'project': [p.project_name for p in doc.project],
|
'project': [p.project_name for p in doc.project],
|
||||||
'show_opening_entries': 0,
|
'show_opening_entries': 0,
|
||||||
'include_default_book_entries': 0,
|
'include_default_book_entries': 0,
|
||||||
'show_cancelled_entries': 1,
|
|
||||||
'tax_id': tax_id if tax_id else None
|
'tax_id': tax_id if tax_id else None
|
||||||
})
|
})
|
||||||
col, res = get_soa(filters)
|
col, res = get_soa(filters)
|
||||||
@@ -167,7 +171,7 @@ def fetch_customers(customer_collection, collection_name, primary_mandatory):
|
|||||||
if customer_collection == 'Sales Person':
|
if customer_collection == 'Sales Person':
|
||||||
customers = get_customers_based_on_sales_person(collection_name)
|
customers = get_customers_based_on_sales_person(collection_name)
|
||||||
if not bool(customers):
|
if not bool(customers):
|
||||||
frappe.throw('No Customers found with selected options.')
|
frappe.throw(_('No Customers found with selected options.'))
|
||||||
else:
|
else:
|
||||||
if customer_collection == 'Sales Partner':
|
if customer_collection == 'Sales Partner':
|
||||||
customers = frappe.get_list('Customer', fields=['name', 'email_id'], \
|
customers = frappe.get_list('Customer', fields=['name', 'email_id'], \
|
||||||
@@ -199,14 +203,14 @@ def get_customer_emails(customer_name, primary_mandatory, billing_and_primary=Tr
|
|||||||
|
|
||||||
if len(billing_email) == 0 or (billing_email[0][0] is None):
|
if len(billing_email) == 0 or (billing_email[0][0] is None):
|
||||||
if billing_and_primary:
|
if billing_and_primary:
|
||||||
frappe.throw('No billing email found for customer: '+ customer_name)
|
frappe.throw(_("No billing email found for customer: {0}").format(customer_name))
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if billing_and_primary:
|
if billing_and_primary:
|
||||||
primary_email = frappe.get_value('Customer', customer_name, 'email_id')
|
primary_email = frappe.get_value('Customer', customer_name, 'email_id')
|
||||||
if primary_email is None and int(primary_mandatory):
|
if primary_email is None and int(primary_mandatory):
|
||||||
frappe.throw('No primary email found for customer: '+ customer_name)
|
frappe.throw(_("No primary email found for customer: {0}").format(customer_name))
|
||||||
return [primary_email or '', billing_email[0][0]]
|
return [primary_email or '', billing_email[0][0]]
|
||||||
else:
|
else:
|
||||||
return billing_email[0][0] or ''
|
return billing_email[0][0] or ''
|
||||||
|
|||||||
Reference in New Issue
Block a user