mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 15:39:20 +00:00
FEC report corrections (#14741)
* Report corrections to match government requirements * Untranslatable headers * Remove unused onchange logic
This commit is contained in:
committed by
Nabin Hait
parent
dfe897b888
commit
f02bef78f0
@@ -4,35 +4,21 @@
|
|||||||
|
|
||||||
frappe.query_reports["Fichier des Ecritures Comptables [FEC]"] = {
|
frappe.query_reports["Fichier des Ecritures Comptables [FEC]"] = {
|
||||||
"filters": [{
|
"filters": [{
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"label": __("Company"),
|
"label": __("Company"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"default": frappe.defaults.get_user_default("Company"),
|
"default": frappe.defaults.get_user_default("Company"),
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "fiscal_year",
|
"fieldname": "fiscal_year",
|
||||||
"label": __("Fiscal Year"),
|
"label": __("Fiscal Year"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Fiscal Year",
|
"options": "Fiscal Year",
|
||||||
"default": frappe.defaults.get_user_default("fiscal_year"),
|
"default": frappe.defaults.get_user_default("fiscal_year"),
|
||||||
"reqd": 1,
|
"reqd": 1
|
||||||
"on_change": function(query_report) {
|
}],
|
||||||
var fiscal_year = query_report.get_values().fiscal_year;
|
|
||||||
if (!fiscal_year) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
|
||||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
|
||||||
frappe.query_report_filters_by_name.from_date.set_input(fy.year_start_date);
|
|
||||||
frappe.query_report_filters_by_name.to_date.set_input(fy.year_end_date);
|
|
||||||
query_report.trigger_refresh();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
onload: function(query_report) {
|
onload: function(query_report) {
|
||||||
query_report.page.add_inner_button(__("Export"), function() {
|
query_report.page.add_inner_button(__("Export"), function() {
|
||||||
@@ -51,7 +37,7 @@ frappe.query_reports["Fichier des Ecritures Comptables [FEC]"] = {
|
|||||||
callback: function(data) {
|
callback: function(data) {
|
||||||
var company_data = data.message.siren_number;
|
var company_data = data.message.siren_number;
|
||||||
if (company_data === null || company_data === undefined) {
|
if (company_data === null || company_data === undefined) {
|
||||||
msgprint(__("Please register the SIREN number in the company information file"))
|
frappe.msgprint(__("Please register the SIREN number in the company information file"))
|
||||||
} else {
|
} else {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "frappe.client.get_value",
|
method: "frappe.client.get_value",
|
||||||
@@ -83,7 +69,7 @@ frappe.query_reports["Fichier des Ecritures Comptables [FEC]"] = {
|
|||||||
|
|
||||||
var downloadify = function(data, roles, title) {
|
var downloadify = function(data, roles, title) {
|
||||||
if (roles && roles.length && !has_common(roles, roles)) {
|
if (roles && roles.length && !has_common(roles, roles)) {
|
||||||
msgprint(__("Export not allowed. You need {0} role to export.", [frappe.utils.comma_or(roles)]));
|
frappe.msgprint(__("Export not allowed. You need {0} role to export.", [frappe.utils.comma_or(roles)]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,9 +101,6 @@ var downloadify = function(data, roles, title) {
|
|||||||
var to_tab_csv = function(data) {
|
var to_tab_csv = function(data) {
|
||||||
var res = [];
|
var res = [];
|
||||||
$.each(data, function(i, row) {
|
$.each(data, function(i, row) {
|
||||||
row = $.map(row, function(col) {
|
|
||||||
return typeof(col) === "string" ? ('"' + col.replace(/"/g, '""') + '"') : col;
|
|
||||||
});
|
|
||||||
res.push(row.join("\t"));
|
res.push(row.join("\t"));
|
||||||
});
|
});
|
||||||
return res.join("\n");
|
return res.join("\n");
|
||||||
|
|||||||
@@ -40,15 +40,15 @@ def set_account_currency(filters):
|
|||||||
|
|
||||||
def get_columns(filters):
|
def get_columns(filters):
|
||||||
columns = [
|
columns = [
|
||||||
_("JournalCode") + "::90", _("JournalLib") + "::90",
|
"JournalCode" + "::90", "JournalLib" + "::90",
|
||||||
_("EcritureNum") + ":Dynamic Link:90", _("EcritureDate") + "::90",
|
"EcritureNum" + ":Dynamic Link:90", "EcritureDate" + "::90",
|
||||||
_("CompteNum") + ":Link/Account:100", _("CompteLib") + ":Link/Account:200",
|
"CompteNum" + ":Link/Account:100", "CompteLib" + ":Link/Account:200",
|
||||||
_("CompAuxNum") + "::90", _("CompAuxLib") + "::90",
|
"CompAuxNum" + "::90", "CompAuxLib" + "::90",
|
||||||
_("PieceRef") + "::90", _("PieceDate") + "::90",
|
"PieceRef" + "::90", "PieceDate" + "::90",
|
||||||
_("EcritureLib") + "::90", _("Debit") + "::90", _("Credit") + "::90",
|
"EcritureLib" + "::90", "Debit" + "::90", "Credit" + "::90",
|
||||||
_("EcritureLet") + "::90", _("DateLet") +
|
"EcritureLet" + "::90", "DateLet" +
|
||||||
"::90", _("ValidDate") + "::90",
|
"::90", "ValidDate" + "::90",
|
||||||
_("Montantdevise") + "::90", _("Idevise") + "::90"
|
"Montantdevise" + "::90", "Idevise" + "::90"
|
||||||
]
|
]
|
||||||
|
|
||||||
return columns
|
return columns
|
||||||
@@ -69,30 +69,30 @@ def get_gl_entries(filters):
|
|||||||
|
|
||||||
gl_entries = frappe.db.sql("""
|
gl_entries = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
gl.posting_date as GlPostDate, gl.account, gl.transaction_date,
|
gl.posting_date as GlPostDate, gl.name as GlName, gl.account, gl.transaction_date,
|
||||||
sum(gl.debit) as debit, sum(gl.credit) as credit,
|
sum(gl.debit) as debit, sum(gl.credit) as credit,
|
||||||
sum(gl.debit_in_account_currency) as debitCurr, sum(gl.credit_in_account_currency) as creditCurr,
|
sum(gl.debit_in_account_currency) as debitCurr, sum(gl.credit_in_account_currency) as creditCurr,
|
||||||
gl.voucher_type, gl.voucher_no, gl.against_voucher_type,
|
gl.voucher_type, gl.voucher_no, gl.against_voucher_type,
|
||||||
gl.against_voucher, gl.account_currency, gl.against,
|
gl.against_voucher, gl.account_currency, gl.against,
|
||||||
gl.party_type, gl.party, gl.is_opening,
|
gl.party_type, gl.party,
|
||||||
inv.name as InvName, inv.posting_date as InvPostDate,
|
inv.name as InvName, inv.title as InvTitle, inv.posting_date as InvPostDate,
|
||||||
pur.name as PurName, inv.posting_date as PurPostDate,
|
pur.name as PurName, pur.title as PurTitle, pur.posting_date as PurPostDate,
|
||||||
jnl.cheque_no as JnlRef, jnl.posting_date as JnlPostDate,
|
jnl.cheque_no as JnlRef, jnl.posting_date as JnlPostDate, jnl.title as JnlTitle,
|
||||||
pay.name as PayName, pay.posting_date as PayPostDate,
|
pay.name as PayName, pay.posting_date as PayPostDate, pay.title as PayTitle,
|
||||||
cus.customer_name, cus.name as cusName,
|
cus.customer_name, cus.name as cusName,
|
||||||
sup.supplier_name, sup.name as supName
|
sup.supplier_name, sup.name as supName
|
||||||
|
|
||||||
from `tabGL Entry` gl
|
from `tabGL Entry` gl
|
||||||
left join `tabSales Invoice` inv on gl.against_voucher = inv.name
|
left join `tabSales Invoice` inv on gl.voucher_no = inv.name
|
||||||
left join `tabPurchase Invoice` pur on gl.against_voucher = pur.name
|
left join `tabPurchase Invoice` pur on gl.voucher_no = pur.name
|
||||||
left join `tabJournal Entry` jnl on gl.against_voucher = jnl.name
|
left join `tabJournal Entry` jnl on gl.voucher_no = jnl.name
|
||||||
left join `tabPayment Entry` pay on gl.against_voucher = pay.name
|
left join `tabPayment Entry` pay on gl.voucher_no = pay.name
|
||||||
left join `tabCustomer` cus on gl.party = cus.customer_name
|
left join `tabCustomer` cus on gl.party = cus.customer_name
|
||||||
left join `tabSupplier` sup on gl.party = sup.supplier_name
|
left join `tabSupplier` sup on gl.party = sup.supplier_name
|
||||||
where gl.company=%(company)s and gl.fiscal_year=%(fiscal_year)s
|
where gl.company=%(company)s and gl.fiscal_year=%(fiscal_year)s
|
||||||
{group_by_condition}
|
{group_by_condition}
|
||||||
order by GlPostDate, voucher_no"""
|
order by GlPostDate, voucher_no"""\
|
||||||
.format(group_by_condition=group_by_condition), filters, as_dict=1)
|
.format(group_by_condition=group_by_condition), filters, as_dict=1)
|
||||||
|
|
||||||
return gl_entries
|
return gl_entries
|
||||||
|
|
||||||
@@ -131,33 +131,23 @@ def get_result_as_list(data, filters):
|
|||||||
|
|
||||||
ValidDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
ValidDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
||||||
|
|
||||||
|
PieceRef = d.get("voucher_no") if d.get("voucher_no") else "Sans Reference"
|
||||||
|
|
||||||
|
# EcritureLib is the reference title unless it is an opening entry
|
||||||
if d.get("is_opening") == "Yes":
|
if d.get("is_opening") == "Yes":
|
||||||
PieceRef = _("Opening Entry Journal")
|
EcritureLib = _("Opening Entry Journal")
|
||||||
PieceDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
if d.get("voucher_type") == "Sales Invoice":
|
||||||
|
EcritureLib = d.get("InvTitle")
|
||||||
elif d.get("against_voucher_type") == "Sales Invoice":
|
elif d.get("voucher_type") == "Purchase Invoice":
|
||||||
PieceRef = _(d.get("InvName"))
|
EcritureLib = d.get("PurTitle")
|
||||||
PieceDate = format_datetime(d.get("InvPostDate"), "yyyyMMdd")
|
elif d.get("voucher_type") == "Journal Entry":
|
||||||
|
EcritureLib = d.get("JnlTitle")
|
||||||
elif d.get("against_voucher_type") == "Purchase Invoice":
|
elif d.get("voucher_type") == "Payment Entry":
|
||||||
PieceRef = _(d.get("PurName"))
|
EcritureLib = d.get("PayTitle")
|
||||||
PieceDate = format_datetime(d.get("PurPostDate"), "yyyyMMdd")
|
|
||||||
|
|
||||||
elif d.get("against_voucher_type") == "Journal Entry":
|
|
||||||
PieceRef = _(d.get("JnlRef"))
|
|
||||||
PieceDate = format_datetime(d.get("JnlPostDate"), "yyyyMMdd")
|
|
||||||
|
|
||||||
elif d.get("against_voucher_type") == "Payment Entry":
|
|
||||||
PieceRef = _(d.get("PayName"))
|
|
||||||
PieceDate = format_datetime(d.get("PayPostDate"), "yyyyMMdd")
|
|
||||||
|
|
||||||
elif d.get("voucher_type") == "Period Closing Voucher":
|
|
||||||
PieceRef = _("Period Closing Journal")
|
|
||||||
PieceDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
PieceRef = _("No Reference")
|
EcritureLib = d.get("voucher_type")
|
||||||
PieceDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
|
||||||
|
PieceDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
||||||
|
|
||||||
debit = '{:.2f}'.format(d.get("debit")).replace(".", ",")
|
debit = '{:.2f}'.format(d.get("debit")).replace(".", ",")
|
||||||
|
|
||||||
@@ -171,7 +161,7 @@ def get_result_as_list(data, filters):
|
|||||||
Montantdevise = '{:.2f}'.format(d.get("debit")).replace(".", ",") if d.get("debit") != 0 else '{:.2f}'.format(d.get("credit")).replace(".", ",")
|
Montantdevise = '{:.2f}'.format(d.get("debit")).replace(".", ",") if d.get("debit") != 0 else '{:.2f}'.format(d.get("credit")).replace(".", ",")
|
||||||
|
|
||||||
row = [JournalCode, d.get("voucher_type"), EcritureNum, EcritureDate, CompteNum, d.get("account"), CompAuxNum, CompAuxLib,
|
row = [JournalCode, d.get("voucher_type"), EcritureNum, EcritureDate, CompteNum, d.get("account"), CompAuxNum, CompAuxLib,
|
||||||
PieceRef, PieceDate, d.get("voucher_no"), debit, credit, "", "", ValidDate, Montantdevise, Idevise]
|
PieceRef, PieceDate, EcritureLib, debit, credit, "", "", ValidDate, Montantdevise, Idevise]
|
||||||
|
|
||||||
result.append(row)
|
result.append(row)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user