Merge branch 'version-13-hotfix' of https://github.com/frappe/erpnext into issue-summary-report-fix
This commit is contained in:
commit
f3f87886a9
@ -166,6 +166,11 @@ frappe.query_reports["General Ledger"] = {
|
||||
"fieldname": "show_cancelled_entries",
|
||||
"label": __("Show Cancelled Entries"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
{
|
||||
"fieldname": "show_net_values_in_party_account",
|
||||
"label": __("Show Net Values in Party Account"),
|
||||
"fieldtype": "Check"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -344,6 +344,9 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map):
|
||||
consolidated_gle = OrderedDict()
|
||||
group_by = group_by_field(filters.get('group_by'))
|
||||
|
||||
if filters.get('show_net_values_in_party_account'):
|
||||
account_type_map = get_account_type_map(filters.get('company'))
|
||||
|
||||
def update_value_in_dict(data, key, gle):
|
||||
data[key].debit += flt(gle.debit)
|
||||
data[key].credit += flt(gle.credit)
|
||||
@ -351,6 +354,24 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map):
|
||||
data[key].debit_in_account_currency += flt(gle.debit_in_account_currency)
|
||||
data[key].credit_in_account_currency += flt(gle.credit_in_account_currency)
|
||||
|
||||
if filters.get('show_net_values_in_party_account') and \
|
||||
account_type_map.get(data[key].account) in ('Receivable', 'Payable'):
|
||||
net_value = flt(data[key].debit) - flt(data[key].credit)
|
||||
net_value_in_account_currency = flt(data[key].debit_in_account_currency) \
|
||||
- flt(data[key].credit_in_account_currency)
|
||||
|
||||
if net_value < 0:
|
||||
dr_or_cr = 'credit'
|
||||
rev_dr_or_cr = 'debit'
|
||||
else:
|
||||
dr_or_cr = 'debit'
|
||||
rev_dr_or_cr = 'credit'
|
||||
|
||||
data[key][dr_or_cr] = abs(net_value)
|
||||
data[key][dr_or_cr+'_in_account_currency'] = abs(net_value_in_account_currency)
|
||||
data[key][rev_dr_or_cr] = 0
|
||||
data[key][rev_dr_or_cr+'_in_account_currency'] = 0
|
||||
|
||||
if data[key].against_voucher and gle.against_voucher:
|
||||
data[key].against_voucher += ', ' + gle.against_voucher
|
||||
|
||||
@ -388,6 +409,12 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map):
|
||||
|
||||
return totals, entries
|
||||
|
||||
def get_account_type_map(company):
|
||||
account_type_map = frappe._dict(frappe.get_all('Account', fields=['name', 'account_type'],
|
||||
filters={'company': company}, as_list=1))
|
||||
|
||||
return account_type_map
|
||||
|
||||
def get_result_as_list(data, filters):
|
||||
balance, balance_in_account_currency = 0, 0
|
||||
inv_details = get_supplier_invoice_details()
|
||||
|
@ -81,8 +81,7 @@ def convert_to_presentation_currency(gl_entries, currency_info, company):
|
||||
presentation_currency = currency_info['presentation_currency']
|
||||
company_currency = currency_info['company_currency']
|
||||
|
||||
pl_accounts = [d.name for d in frappe.get_list('Account',
|
||||
filters={'report_type': 'Profit and Loss', 'company': company})]
|
||||
account_currencies = list(set(entry['account_currency'] for entry in gl_entries))
|
||||
|
||||
for entry in gl_entries:
|
||||
account = entry['account']
|
||||
@ -92,10 +91,15 @@ def convert_to_presentation_currency(gl_entries, currency_info, company):
|
||||
credit_in_account_currency = flt(entry['credit_in_account_currency'])
|
||||
account_currency = entry['account_currency']
|
||||
|
||||
if account_currency != presentation_currency:
|
||||
value = debit or credit
|
||||
if len(account_currencies) == 1 and account_currency == presentation_currency:
|
||||
if entry.get('debit'):
|
||||
entry['debit'] = debit_in_account_currency
|
||||
|
||||
date = entry['posting_date'] if account in pl_accounts else currency_info['report_date']
|
||||
if entry.get('credit'):
|
||||
entry['credit'] = credit_in_account_currency
|
||||
else:
|
||||
value = debit or credit
|
||||
date = currency_info['report_date']
|
||||
converted_value = convert(value, presentation_currency, company_currency, date)
|
||||
|
||||
if entry.get('debit'):
|
||||
@ -104,13 +108,6 @@ def convert_to_presentation_currency(gl_entries, currency_info, company):
|
||||
if entry.get('credit'):
|
||||
entry['credit'] = converted_value
|
||||
|
||||
elif account_currency == presentation_currency:
|
||||
if entry.get('debit'):
|
||||
entry['debit'] = debit_in_account_currency
|
||||
|
||||
if entry.get('credit'):
|
||||
entry['credit'] = credit_in_account_currency
|
||||
|
||||
converted_gl_list.append(entry)
|
||||
|
||||
return converted_gl_list
|
||||
|
@ -76,12 +76,12 @@ status_map = {
|
||||
["Stopped", "eval:self.status == 'Stopped'"],
|
||||
["Cancelled", "eval:self.docstatus == 2"],
|
||||
["Pending", "eval:self.status != 'Stopped' and self.per_ordered == 0 and self.docstatus == 1"],
|
||||
["Partially Ordered", "eval:self.status != 'Stopped' and self.per_ordered < 100 and self.per_ordered > 0 and self.docstatus == 1"],
|
||||
["Ordered", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||
["Transferred", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Transfer'"],
|
||||
["Issued", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Issue'"],
|
||||
["Received", "eval:self.status != 'Stopped' and self.per_received == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||
["Partially Received", "eval:self.status != 'Stopped' and self.per_received > 0 and self.per_received < 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||
["Partially Ordered", "eval:self.status != 'Stopped' and self.per_ordered < 100 and self.per_ordered > 0 and self.docstatus == 1"],
|
||||
["Manufactured", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Manufacture'"]
|
||||
],
|
||||
"Bank Transaction": [
|
||||
|
@ -183,11 +183,11 @@ def new_bank_transaction(transaction):
|
||||
bank_account = frappe.db.get_value("Bank Account", dict(integration_id=transaction["account_id"]))
|
||||
|
||||
if float(transaction["amount"]) >= 0:
|
||||
debit = float(transaction["amount"])
|
||||
credit = 0
|
||||
else:
|
||||
debit = 0
|
||||
credit = abs(float(transaction["amount"]))
|
||||
credit = float(transaction["amount"])
|
||||
else:
|
||||
debit = abs(float(transaction["amount"]))
|
||||
credit = 0
|
||||
|
||||
status = "Pending" if transaction["pending"] == "True" else "Settled"
|
||||
|
||||
|
@ -241,7 +241,7 @@ erpnext.PointOfSale.PastOrderSummary = class {
|
||||
|
||||
send_email() {
|
||||
const frm = this.events.get_frm();
|
||||
const recipients = this.email_dialog.get_values().recipients;
|
||||
const recipients = this.email_dialog.get_values().email_id;
|
||||
const doc = this.doc || frm.doc;
|
||||
const print_format = frm.pos_print_format;
|
||||
|
||||
|
@ -90,12 +90,6 @@ frappe.ui.form.on("Company", {
|
||||
frm.toggle_enable("default_currency", (frm.doc.__onload &&
|
||||
!frm.doc.__onload.transactions_exist));
|
||||
|
||||
if (frm.has_perm('write')) {
|
||||
frm.add_custom_button(__('Create Tax Template'), function() {
|
||||
frm.trigger("make_default_tax_template");
|
||||
});
|
||||
}
|
||||
|
||||
if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
|
||||
frm.add_custom_button(__('Cost Centers'), function() {
|
||||
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
|
||||
@ -121,17 +115,21 @@ frappe.ui.form.on("Company", {
|
||||
}
|
||||
|
||||
if (frm.has_perm('write')) {
|
||||
frm.add_custom_button(__('Default Tax Template'), function() {
|
||||
frm.add_custom_button(__('Create Tax Template'), function() {
|
||||
frm.trigger("make_default_tax_template");
|
||||
}, __('Create'));
|
||||
}, __('Manage'));
|
||||
}
|
||||
|
||||
if (frappe.user.has_role('System Manager')) {
|
||||
if (frm.has_perm('write')) {
|
||||
frm.add_custom_button(__('Delete Transactions'), function() {
|
||||
frm.trigger("delete_company_transactions");
|
||||
}, __('Manage'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
||||
|
||||
if (!frappe.user.has_role('System Manager')) {
|
||||
frm.get_field("delete_company_transactions").hide();
|
||||
}
|
||||
},
|
||||
|
||||
make_default_tax_template: function(frm) {
|
||||
@ -145,11 +143,6 @@ frappe.ui.form.on("Company", {
|
||||
})
|
||||
},
|
||||
|
||||
onload_post_render: function(frm) {
|
||||
if(frm.get_field("delete_company_transactions").$input)
|
||||
frm.get_field("delete_company_transactions").$input.addClass("btn-danger");
|
||||
},
|
||||
|
||||
country: function(frm) {
|
||||
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
||||
},
|
||||
|
@ -99,7 +99,6 @@
|
||||
"company_description",
|
||||
"registration_info",
|
||||
"registration_details",
|
||||
"delete_company_transactions",
|
||||
"lft",
|
||||
"rgt",
|
||||
"old_parent"
|
||||
@ -666,11 +665,6 @@
|
||||
"oldfieldname": "registration_details",
|
||||
"oldfieldtype": "Code"
|
||||
},
|
||||
{
|
||||
"fieldname": "delete_company_transactions",
|
||||
"fieldtype": "Button",
|
||||
"label": "Delete Company Transactions"
|
||||
},
|
||||
{
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
@ -747,7 +741,7 @@
|
||||
"image_field": "company_logo",
|
||||
"is_tree": 1,
|
||||
"links": [],
|
||||
"modified": "2021-02-16 15:53:37.167589",
|
||||
"modified": "2021-05-07 03:11:28.189740",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Company",
|
||||
|
Loading…
x
Reference in New Issue
Block a user