feat: voucher subtype for general ledger (#38822)
* feat: add voucher subtype column to gle * feat: add logic to set voucher subtypes * feat: fetch voucher subtype in ledger report * fix: order of conditions
This commit is contained in:
parent
161ae1edd1
commit
47f7b65058
@ -23,6 +23,7 @@
|
|||||||
"against_voucher_type",
|
"against_voucher_type",
|
||||||
"against_voucher",
|
"against_voucher",
|
||||||
"voucher_type",
|
"voucher_type",
|
||||||
|
"voucher_subtype",
|
||||||
"voucher_no",
|
"voucher_no",
|
||||||
"voucher_detail_no",
|
"voucher_detail_no",
|
||||||
"project",
|
"project",
|
||||||
@ -138,19 +139,19 @@
|
|||||||
"options": "DocType"
|
"options": "DocType"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "against",
|
"fieldname": "against",
|
||||||
"fieldtype": "Text",
|
"fieldtype": "Text",
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
"label": "Against",
|
"label": "Against",
|
||||||
"oldfieldname": "against",
|
"oldfieldname": "against",
|
||||||
"oldfieldtype": "Text"
|
"oldfieldtype": "Text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "against_link",
|
"fieldname": "against_link",
|
||||||
"fieldtype": "Dynamic Link",
|
"fieldtype": "Dynamic Link",
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
"label": "Against",
|
"label": "Against",
|
||||||
"options": "against_type"
|
"options": "against_type"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "against_voucher_type",
|
"fieldname": "against_voucher_type",
|
||||||
@ -294,13 +295,18 @@
|
|||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Credit Amount in Transaction Currency",
|
"label": "Credit Amount in Transaction Currency",
|
||||||
"options": "transaction_currency"
|
"options": "transaction_currency"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "voucher_subtype",
|
||||||
|
"fieldtype": "Small Text",
|
||||||
|
"label": "Voucher Subtype"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-list",
|
"icon": "fa fa-list",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-11-08 12:20:23.031733",
|
"modified": "2023-12-18 15:38:14.006208",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "GL Entry",
|
"name": "GL Entry",
|
||||||
|
|||||||
@ -39,6 +39,8 @@ class GLEntry(Document):
|
|||||||
account: DF.Link | None
|
account: DF.Link | None
|
||||||
account_currency: DF.Link | None
|
account_currency: DF.Link | None
|
||||||
against: DF.Text | None
|
against: DF.Text | None
|
||||||
|
against_link: DF.DynamicLink | None
|
||||||
|
against_type: DF.Link | None
|
||||||
against_voucher: DF.DynamicLink | None
|
against_voucher: DF.DynamicLink | None
|
||||||
against_voucher_type: DF.Link | None
|
against_voucher_type: DF.Link | None
|
||||||
company: DF.Link | None
|
company: DF.Link | None
|
||||||
@ -66,6 +68,7 @@ class GLEntry(Document):
|
|||||||
transaction_exchange_rate: DF.Float
|
transaction_exchange_rate: DF.Float
|
||||||
voucher_detail_no: DF.Data | None
|
voucher_detail_no: DF.Data | None
|
||||||
voucher_no: DF.DynamicLink | None
|
voucher_no: DF.DynamicLink | None
|
||||||
|
voucher_subtype: DF.SmallText | None
|
||||||
voucher_type: DF.Link | None
|
voucher_type: DF.Link | None
|
||||||
# end: auto-generated types
|
# end: auto-generated types
|
||||||
|
|
||||||
|
|||||||
@ -200,7 +200,7 @@ def get_gl_entries(filters, accounting_dimensions):
|
|||||||
"""
|
"""
|
||||||
select
|
select
|
||||||
name as gl_entry, posting_date, account, party_type, party,
|
name as gl_entry, posting_date, account, party_type, party,
|
||||||
voucher_type, voucher_no, {dimension_fields}
|
voucher_type, voucher_subtype, voucher_no, {dimension_fields}
|
||||||
cost_center, project, {transaction_currency_fields}
|
cost_center, project, {transaction_currency_fields}
|
||||||
against_voucher_type, against_voucher, account_currency,
|
against_voucher_type, against_voucher, account_currency,
|
||||||
against_link, against, is_opening, creation {select_fields}
|
against_link, against, is_opening, creation {select_fields}
|
||||||
@ -609,6 +609,12 @@ def get_columns(filters):
|
|||||||
|
|
||||||
columns += [
|
columns += [
|
||||||
{"label": _("Voucher Type"), "fieldname": "voucher_type", "width": 120},
|
{"label": _("Voucher Type"), "fieldname": "voucher_type", "width": 120},
|
||||||
|
{
|
||||||
|
"label": _("Voucher Subtype"),
|
||||||
|
"fieldname": "voucher_subtype",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"width": 180,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": _("Voucher No"),
|
"label": _("Voucher No"),
|
||||||
"fieldname": "voucher_no",
|
"fieldname": "voucher_no",
|
||||||
|
|||||||
@ -874,6 +874,7 @@ class AccountsController(TransactionBase):
|
|||||||
"project": self.get("project"),
|
"project": self.get("project"),
|
||||||
"post_net_value": args.get("post_net_value"),
|
"post_net_value": args.get("post_net_value"),
|
||||||
"voucher_detail_no": args.get("voucher_detail_no"),
|
"voucher_detail_no": args.get("voucher_detail_no"),
|
||||||
|
"voucher_subtype": self.get_voucher_subtype(),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -929,6 +930,25 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
return gl_dict
|
return gl_dict
|
||||||
|
|
||||||
|
def get_voucher_subtype(self):
|
||||||
|
voucher_subtypes = {
|
||||||
|
"Journal Entry": "voucher_type",
|
||||||
|
"Payment Entry": "payment_type",
|
||||||
|
"Stock Entry": "stock_entry_type",
|
||||||
|
"Asset Capitalization": "entry_type",
|
||||||
|
}
|
||||||
|
if self.doctype in voucher_subtypes:
|
||||||
|
return self.get(voucher_subtypes[self.doctype])
|
||||||
|
elif self.doctype == "Purchase Receipt" and self.is_return:
|
||||||
|
return "Purchase Return"
|
||||||
|
elif self.doctype == "Delivery Note" and self.is_return:
|
||||||
|
return "Sales Return"
|
||||||
|
elif (self.doctype == "Sales Invoice" and self.is_return) or self.doctype == "Purchase Invoice":
|
||||||
|
return "Credit Note"
|
||||||
|
elif (self.doctype == "Purchase Invoice" and self.is_return) or self.doctype == "Sales Invoice":
|
||||||
|
return "Debit Note"
|
||||||
|
return self.doctype
|
||||||
|
|
||||||
def get_value_in_transaction_currency(self, account_currency, args, field):
|
def get_value_in_transaction_currency(self, account_currency, args, field):
|
||||||
if account_currency == self.get("currency"):
|
if account_currency == self.get("currency"):
|
||||||
return args.get(field + "_in_account_currency")
|
return args.get(field + "_in_account_currency")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user