mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: Add misssing dimensions in GL entries (#21691)
* fix: Add misssing dimensions in GL entries * fix: expnese_taxes_and_charges.json * fix: Add project filter in trial balance report * fix: Use current dimensions instead of dimensions from asset
This commit is contained in:
@@ -159,7 +159,7 @@ def book_deferred_income_or_expense(doc, posting_date=None):
|
|||||||
total_days, total_booking_days, account_currency)
|
total_days, total_booking_days, account_currency)
|
||||||
|
|
||||||
make_gl_entries(doc, credit_account, debit_account, against,
|
make_gl_entries(doc, credit_account, debit_account, against,
|
||||||
amount, base_amount, end_date, project, account_currency, item.cost_center, item.name)
|
amount, base_amount, end_date, project, account_currency, item.cost_center, item)
|
||||||
|
|
||||||
if getdate(end_date) < getdate(posting_date) and not last_gl_entry:
|
if getdate(end_date) < getdate(posting_date) and not last_gl_entry:
|
||||||
_book_deferred_revenue_or_expense(item)
|
_book_deferred_revenue_or_expense(item)
|
||||||
@@ -170,7 +170,7 @@ def book_deferred_income_or_expense(doc, posting_date=None):
|
|||||||
_book_deferred_revenue_or_expense(item)
|
_book_deferred_revenue_or_expense(item)
|
||||||
|
|
||||||
def make_gl_entries(doc, credit_account, debit_account, against,
|
def make_gl_entries(doc, credit_account, debit_account, against,
|
||||||
amount, base_amount, posting_date, project, account_currency, cost_center, voucher_detail_no):
|
amount, base_amount, posting_date, project, account_currency, cost_center, item):
|
||||||
# GL Entry for crediting the amount in the deferred expense
|
# GL Entry for crediting the amount in the deferred expense
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
|
|
||||||
@@ -184,10 +184,10 @@ def make_gl_entries(doc, credit_account, debit_account, against,
|
|||||||
"credit": base_amount,
|
"credit": base_amount,
|
||||||
"credit_in_account_currency": amount,
|
"credit_in_account_currency": amount,
|
||||||
"cost_center": cost_center,
|
"cost_center": cost_center,
|
||||||
"voucher_detail_no": voucher_detail_no,
|
"voucher_detail_no": item.name,
|
||||||
'posting_date': posting_date,
|
'posting_date': posting_date,
|
||||||
'project': project
|
'project': project
|
||||||
}, account_currency)
|
}, account_currency, item=item)
|
||||||
)
|
)
|
||||||
# GL Entry to debit the amount from the expense
|
# GL Entry to debit the amount from the expense
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
@@ -197,10 +197,10 @@ def make_gl_entries(doc, credit_account, debit_account, against,
|
|||||||
"debit": base_amount,
|
"debit": base_amount,
|
||||||
"debit_in_account_currency": amount,
|
"debit_in_account_currency": amount,
|
||||||
"cost_center": cost_center,
|
"cost_center": cost_center,
|
||||||
"voucher_detail_no": voucher_detail_no,
|
"voucher_detail_no": item.name,
|
||||||
'posting_date': posting_date,
|
'posting_date': posting_date,
|
||||||
'project': project
|
'project': project
|
||||||
}, account_currency)
|
}, account_currency, item=item)
|
||||||
)
|
)
|
||||||
|
|
||||||
if gl_entries:
|
if gl_entries:
|
||||||
|
|||||||
@@ -162,9 +162,9 @@ def toggle_disabling(doc):
|
|||||||
|
|
||||||
def get_doctypes_with_dimensions():
|
def get_doctypes_with_dimensions():
|
||||||
doclist = ["GL Entry", "Sales Invoice", "Purchase Invoice", "Payment Entry", "Asset",
|
doclist = ["GL Entry", "Sales Invoice", "Purchase Invoice", "Payment Entry", "Asset",
|
||||||
"Expense Claim", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note", "Sales Invoice Item", "Purchase Invoice Item",
|
"Expense Claim", "Expense Claim Detail", "Expense Taxes and Charges", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note",
|
||||||
"Purchase Order Item", "Journal Entry Account", "Material Request Item", "Delivery Note Item", "Purchase Receipt Item",
|
"Sales Invoice Item", "Purchase Invoice Item", "Purchase Order Item", "Journal Entry Account", "Material Request Item", "Delivery Note Item",
|
||||||
"Stock Entry Detail", "Payment Entry Deduction", "Sales Taxes and Charges", "Purchase Taxes and Charges", "Shipping Rule",
|
"Purchase Receipt Item", "Stock Entry Detail", "Payment Entry Deduction", "Sales Taxes and Charges", "Purchase Taxes and Charges", "Shipping Rule",
|
||||||
"Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation",
|
"Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation",
|
||||||
"Travel Request", "Fees", "POS Profile", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item", "Subscription",
|
"Travel Request", "Fees", "POS Profile", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item", "Subscription",
|
||||||
"Subscription Plan"]
|
"Subscription Plan"]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from frappe import _
|
|||||||
from frappe.utils import flt, getdate, nowdate, add_days
|
from frappe.utils import flt, getdate, nowdate, add_days
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||||
|
|
||||||
class InvoiceDiscounting(AccountsController):
|
class InvoiceDiscounting(AccountsController):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@@ -81,10 +82,15 @@ class InvoiceDiscounting(AccountsController):
|
|||||||
def make_gl_entries(self):
|
def make_gl_entries(self):
|
||||||
company_currency = frappe.get_cached_value('Company', self.company, "default_currency")
|
company_currency = frappe.get_cached_value('Company', self.company, "default_currency")
|
||||||
|
|
||||||
|
|
||||||
gl_entries = []
|
gl_entries = []
|
||||||
|
invoice_fields = ["debit_to", "party_account_currency", "conversion_rate", "cost_center"]
|
||||||
|
accounting_dimensions = get_accounting_dimensions()
|
||||||
|
|
||||||
|
invoice_fields.extend(accounting_dimensions)
|
||||||
|
|
||||||
for d in self.invoices:
|
for d in self.invoices:
|
||||||
inv = frappe.db.get_value("Sales Invoice", d.sales_invoice,
|
inv = frappe.db.get_value("Sales Invoice", d.sales_invoice, invoice_fields, as_dict=1)
|
||||||
["debit_to", "party_account_currency", "conversion_rate", "cost_center"], as_dict=1)
|
|
||||||
|
|
||||||
if d.outstanding_amount:
|
if d.outstanding_amount:
|
||||||
outstanding_in_company_currency = flt(d.outstanding_amount * inv.conversion_rate,
|
outstanding_in_company_currency = flt(d.outstanding_amount * inv.conversion_rate,
|
||||||
@@ -102,7 +108,7 @@ class InvoiceDiscounting(AccountsController):
|
|||||||
"cost_center": inv.cost_center,
|
"cost_center": inv.cost_center,
|
||||||
"against_voucher": d.sales_invoice,
|
"against_voucher": d.sales_invoice,
|
||||||
"against_voucher_type": "Sales Invoice"
|
"against_voucher_type": "Sales Invoice"
|
||||||
}, inv.party_account_currency))
|
}, inv.party_account_currency, item=inv))
|
||||||
|
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": self.accounts_receivable_credit,
|
"account": self.accounts_receivable_credit,
|
||||||
@@ -115,7 +121,7 @@ class InvoiceDiscounting(AccountsController):
|
|||||||
"cost_center": inv.cost_center,
|
"cost_center": inv.cost_center,
|
||||||
"against_voucher": d.sales_invoice,
|
"against_voucher": d.sales_invoice,
|
||||||
"against_voucher_type": "Sales Invoice"
|
"against_voucher_type": "Sales Invoice"
|
||||||
}, ar_credit_account_currency))
|
}, ar_credit_account_currency, item=inv))
|
||||||
|
|
||||||
make_gl_entries(gl_entries, cancel=(self.docstatus == 2), update_outstanding='No')
|
make_gl_entries(gl_entries, cancel=(self.docstatus == 2), update_outstanding='No')
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class PaymentEntry(AccountsController):
|
|||||||
self.update_payment_schedule(cancel=1)
|
self.update_payment_schedule(cancel=1)
|
||||||
self.set_payment_req_status()
|
self.set_payment_req_status()
|
||||||
self.set_status()
|
self.set_status()
|
||||||
|
|
||||||
def set_payment_req_status(self):
|
def set_payment_req_status(self):
|
||||||
from erpnext.accounts.doctype.payment_request.payment_request import update_payment_req_status
|
from erpnext.accounts.doctype.payment_request.payment_request import update_payment_req_status
|
||||||
update_payment_req_status(self, None)
|
update_payment_req_status(self, None)
|
||||||
@@ -503,7 +503,7 @@ class PaymentEntry(AccountsController):
|
|||||||
"against": against_account,
|
"against": against_account,
|
||||||
"account_currency": self.party_account_currency,
|
"account_currency": self.party_account_currency,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
})
|
}, item=self)
|
||||||
|
|
||||||
dr_or_cr = "credit" if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit"
|
dr_or_cr = "credit" if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit"
|
||||||
|
|
||||||
@@ -547,7 +547,7 @@ class PaymentEntry(AccountsController):
|
|||||||
"credit_in_account_currency": self.paid_amount,
|
"credit_in_account_currency": self.paid_amount,
|
||||||
"credit": self.base_paid_amount,
|
"credit": self.base_paid_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
if self.payment_type in ("Receive", "Internal Transfer"):
|
if self.payment_type in ("Receive", "Internal Transfer"):
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
@@ -558,7 +558,7 @@ class PaymentEntry(AccountsController):
|
|||||||
"debit_in_account_currency": self.received_amount,
|
"debit_in_account_currency": self.received_amount,
|
||||||
"debit": self.base_received_amount,
|
"debit": self.base_received_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_deductions_gl_entries(self, gl_entries):
|
def add_deductions_gl_entries(self, gl_entries):
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_item_gl_entries(self, gl_entries):
|
def make_item_gl_entries(self, gl_entries):
|
||||||
@@ -802,7 +802,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
@@ -813,7 +813,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"credit_in_account_currency": self.base_paid_amount \
|
"credit_in_account_currency": self.base_paid_amount \
|
||||||
if bank_account_currency==self.company_currency else self.paid_amount,
|
if bank_account_currency==self.company_currency else self.paid_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, bank_account_currency)
|
}, bank_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_write_off_gl_entry(self, gl_entries):
|
def make_write_off_gl_entry(self, gl_entries):
|
||||||
@@ -834,7 +834,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@@ -844,7 +844,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"credit_in_account_currency": self.base_write_off_amount \
|
"credit_in_account_currency": self.base_write_off_amount \
|
||||||
if write_off_account_currency==self.company_currency else self.write_off_amount,
|
if write_off_account_currency==self.company_currency else self.write_off_amount,
|
||||||
"cost_center": self.cost_center or self.write_off_cost_center
|
"cost_center": self.cost_center or self.write_off_cost_center
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_gle_for_rounding_adjustment(self, gl_entries):
|
def make_gle_for_rounding_adjustment(self, gl_entries):
|
||||||
@@ -863,8 +863,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"debit_in_account_currency": self.rounding_adjustment,
|
"debit_in_account_currency": self.rounding_adjustment,
|
||||||
"debit": self.base_rounding_adjustment,
|
"debit": self.base_rounding_adjustment,
|
||||||
"cost_center": self.cost_center or round_off_cost_center,
|
"cost_center": self.cost_center or round_off_cost_center,
|
||||||
}
|
}, item=self))
|
||||||
))
|
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
super(PurchaseInvoice, self).on_cancel()
|
super(PurchaseInvoice, self).on_cancel()
|
||||||
|
|||||||
@@ -785,7 +785,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_tax_gl_entries(self, gl_entries):
|
def make_tax_gl_entries(self, gl_entries):
|
||||||
@@ -802,7 +802,7 @@ class SalesInvoice(SellingController):
|
|||||||
tax.precision("base_tax_amount_after_discount_amount")) if account_currency==self.company_currency else
|
tax.precision("base_tax_amount_after_discount_amount")) if account_currency==self.company_currency else
|
||||||
flt(tax.tax_amount_after_discount_amount, tax.precision("tax_amount_after_discount_amount"))),
|
flt(tax.tax_amount_after_discount_amount, tax.precision("tax_amount_after_discount_amount"))),
|
||||||
"cost_center": tax.cost_center
|
"cost_center": tax.cost_center
|
||||||
}, account_currency)
|
}, account_currency, item=tax)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_item_gl_entries(self, gl_entries):
|
def make_item_gl_entries(self, gl_entries):
|
||||||
@@ -822,7 +822,7 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
for gle in fixed_asset_gl_entries:
|
for gle in fixed_asset_gl_entries:
|
||||||
gle["against"] = self.customer
|
gle["against"] = self.customer
|
||||||
gl_entries.append(self.get_gl_dict(gle))
|
gl_entries.append(self.get_gl_dict(gle, item=item))
|
||||||
|
|
||||||
asset.db_set("disposal_date", self.posting_date)
|
asset.db_set("disposal_date", self.posting_date)
|
||||||
asset.set_status("Sold" if self.docstatus==1 else None)
|
asset.set_status("Sold" if self.docstatus==1 else None)
|
||||||
@@ -860,7 +860,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@@ -869,7 +869,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"debit": self.loyalty_amount,
|
"debit": self.loyalty_amount,
|
||||||
"remark": "Loyalty Points redeemed by the customer"
|
"remark": "Loyalty Points redeemed by the customer"
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_pos_gl_entries(self, gl_entries):
|
def make_pos_gl_entries(self, gl_entries):
|
||||||
@@ -890,7 +890,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
payment_mode_account_currency = get_account_currency(payment_mode.account)
|
payment_mode_account_currency = get_account_currency(payment_mode.account)
|
||||||
@@ -903,7 +903,7 @@ class SalesInvoice(SellingController):
|
|||||||
if payment_mode_account_currency==self.company_currency \
|
if payment_mode_account_currency==self.company_currency \
|
||||||
else payment_mode.amount,
|
else payment_mode.amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, payment_mode_account_currency)
|
}, payment_mode_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_gle_for_change_amount(self, gl_entries):
|
def make_gle_for_change_amount(self, gl_entries):
|
||||||
@@ -921,7 +921,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
@@ -930,7 +930,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"credit": self.base_change_amount,
|
"credit": self.base_change_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Select change amount account"), title="Mandatory Field")
|
frappe.throw(_("Select change amount account"), title="Mandatory Field")
|
||||||
@@ -954,7 +954,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}, self.party_account_currency)
|
}, self.party_account_currency, item=self)
|
||||||
)
|
)
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@@ -965,7 +965,7 @@ class SalesInvoice(SellingController):
|
|||||||
self.precision("base_write_off_amount")) if write_off_account_currency==self.company_currency
|
self.precision("base_write_off_amount")) if write_off_account_currency==self.company_currency
|
||||||
else flt(self.write_off_amount, self.precision("write_off_amount"))),
|
else flt(self.write_off_amount, self.precision("write_off_amount"))),
|
||||||
"cost_center": self.cost_center or self.write_off_cost_center or default_cost_center
|
"cost_center": self.cost_center or self.write_off_cost_center or default_cost_center
|
||||||
}, write_off_account_currency)
|
}, write_off_account_currency, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_gle_for_rounding_adjustment(self, gl_entries):
|
def make_gle_for_rounding_adjustment(self, gl_entries):
|
||||||
@@ -982,8 +982,7 @@ class SalesInvoice(SellingController):
|
|||||||
"credit": flt(self.base_rounding_adjustment,
|
"credit": flt(self.base_rounding_adjustment,
|
||||||
self.precision("base_rounding_adjustment")),
|
self.precision("base_rounding_adjustment")),
|
||||||
"cost_center": self.cost_center or round_off_cost_center,
|
"cost_center": self.cost_center or round_off_cost_center,
|
||||||
}
|
}, item=self))
|
||||||
))
|
|
||||||
|
|
||||||
def update_billing_status_in_dn(self, update_modified=True):
|
def update_billing_status_in_dn(self, update_modified=True):
|
||||||
updated_delivery_notes = []
|
updated_delivery_notes = []
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"cost_center",
|
"fieldname": "cost_center",
|
||||||
"label": __("Cost Center"),
|
"label": __("Cost Center"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Cost Center",
|
"options": "Cost Center",
|
||||||
@@ -61,7 +61,13 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"finance_book",
|
"fieldname": "project",
|
||||||
|
"label": __("Project"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Project"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "finance_book",
|
||||||
"label": __("Finance Book"),
|
"label": __("Finance Book"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Finance Book",
|
"options": "Finance Book",
|
||||||
@@ -97,7 +103,7 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
erpnext.dimension_filters.forEach((dimension) => {
|
erpnext.dimension_filters.forEach((dimension) => {
|
||||||
frappe.query_reports["Trial Balance"].filters.splice(5, 0 ,{
|
frappe.query_reports["Trial Balance"].filters.splice(6, 0 ,{
|
||||||
"fieldname": dimension["fieldname"],
|
"fieldname": dimension["fieldname"],
|
||||||
"label": __(dimension["label"]),
|
"label": __(dimension["label"]),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ def get_data(filters):
|
|||||||
gl_entries_by_account = {}
|
gl_entries_by_account = {}
|
||||||
|
|
||||||
opening_balances = get_opening_balances(filters)
|
opening_balances = get_opening_balances(filters)
|
||||||
|
|
||||||
|
#add filter inside list so that the query in financial_statements.py doesn't break
|
||||||
|
filters.project = [filters.project]
|
||||||
|
|
||||||
set_gl_entries_by_account(filters.company, filters.from_date,
|
set_gl_entries_by_account(filters.company, filters.from_date,
|
||||||
filters.to_date, min_lft, max_rgt, filters, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry))
|
filters.to_date, min_lft, max_rgt, filters, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry))
|
||||||
|
|
||||||
@@ -102,6 +106,9 @@ def get_rootwise_opening_balances(filters, report_type):
|
|||||||
additional_conditions += """ and cost_center in (select name from `tabCost Center`
|
additional_conditions += """ and cost_center in (select name from `tabCost Center`
|
||||||
where lft >= %s and rgt <= %s)""" % (lft, rgt)
|
where lft >= %s and rgt <= %s)""" % (lft, rgt)
|
||||||
|
|
||||||
|
if filters.project:
|
||||||
|
additional_conditions += " and project = %(project)s"
|
||||||
|
|
||||||
if filters.finance_book:
|
if filters.finance_book:
|
||||||
fb_conditions = " AND finance_book = %(finance_book)s"
|
fb_conditions = " AND finance_book = %(finance_book)s"
|
||||||
if filters.include_default_book_entries:
|
if filters.include_default_book_entries:
|
||||||
@@ -116,6 +123,7 @@ def get_rootwise_opening_balances(filters, report_type):
|
|||||||
"from_date": filters.from_date,
|
"from_date": filters.from_date,
|
||||||
"report_type": report_type,
|
"report_type": report_type,
|
||||||
"year_start_date": filters.year_start_date,
|
"year_start_date": filters.year_start_date,
|
||||||
|
"project": filters.project,
|
||||||
"finance_book": filters.finance_book,
|
"finance_book": filters.finance_book,
|
||||||
"company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book')
|
"company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ class Asset(AccountsController):
|
|||||||
"credit": self.purchase_receipt_amount,
|
"credit": self.purchase_receipt_amount,
|
||||||
"credit_in_account_currency": self.purchase_receipt_amount,
|
"credit_in_account_currency": self.purchase_receipt_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}))
|
}, item=self))
|
||||||
|
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": fixed_asset_account,
|
"account": fixed_asset_account,
|
||||||
@@ -522,7 +522,7 @@ class Asset(AccountsController):
|
|||||||
"debit": self.purchase_receipt_amount,
|
"debit": self.purchase_receipt_amount,
|
||||||
"debit_in_account_currency": self.purchase_receipt_amount,
|
"debit_in_account_currency": self.purchase_receipt_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
}))
|
}, item=self))
|
||||||
|
|
||||||
if gl_entries:
|
if gl_entries:
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
@@ -655,7 +655,7 @@ def get_asset_account(account_name, asset=None, asset_category=None, company=Non
|
|||||||
if asset:
|
if asset:
|
||||||
account = get_asset_category_account(account_name, asset=asset,
|
account = get_asset_category_account(account_name, asset=asset,
|
||||||
asset_category = asset_category, company = company)
|
asset_category = asset_category, company = company)
|
||||||
|
|
||||||
if not asset and not account:
|
if not asset and not account:
|
||||||
account = get_asset_category_account(account_name, asset_category = asset_category, company = company)
|
account = get_asset_category_account(account_name, asset_category = asset_category, company = company)
|
||||||
|
|
||||||
|
|||||||
@@ -97,14 +97,16 @@ class Fees(AccountsController):
|
|||||||
"debit_in_account_currency": self.grand_total,
|
"debit_in_account_currency": self.grand_total,
|
||||||
"against_voucher": self.name,
|
"against_voucher": self.name,
|
||||||
"against_voucher_type": self.doctype
|
"against_voucher_type": self.doctype
|
||||||
})
|
}, item=self)
|
||||||
|
|
||||||
fee_gl_entry = self.get_gl_dict({
|
fee_gl_entry = self.get_gl_dict({
|
||||||
"account": self.income_account,
|
"account": self.income_account,
|
||||||
"against": self.student,
|
"against": self.student,
|
||||||
"credit": self.grand_total,
|
"credit": self.grand_total,
|
||||||
"credit_in_account_currency": self.grand_total,
|
"credit_in_account_currency": self.grand_total,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center
|
||||||
})
|
}, item=self)
|
||||||
|
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
make_gl_entries([student_gl_entries, fee_gl_entry], cancel=(self.docstatus == 2),
|
make_gl_entries([student_gl_entries, fee_gl_entry], cancel=(self.docstatus == 2),
|
||||||
update_outstanding="Yes", merge_entries=False)
|
update_outstanding="Yes", merge_entries=False)
|
||||||
|
|||||||
@@ -115,8 +115,9 @@ class ExpenseClaim(AccountsController):
|
|||||||
"party_type": "Employee",
|
"party_type": "Employee",
|
||||||
"party": self.employee,
|
"party": self.employee,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"against_voucher": self.name
|
"against_voucher": self.name,
|
||||||
})
|
"cost_center": self.cost_center
|
||||||
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
# expense entries
|
# expense entries
|
||||||
@@ -127,8 +128,8 @@ class ExpenseClaim(AccountsController):
|
|||||||
"debit": data.sanctioned_amount,
|
"debit": data.sanctioned_amount,
|
||||||
"debit_in_account_currency": data.sanctioned_amount,
|
"debit_in_account_currency": data.sanctioned_amount,
|
||||||
"against": self.employee,
|
"against": self.employee,
|
||||||
"cost_center": self.cost_center
|
"cost_center": data.cost_center
|
||||||
})
|
}, item=data)
|
||||||
)
|
)
|
||||||
|
|
||||||
for data in self.advances:
|
for data in self.advances:
|
||||||
@@ -156,7 +157,7 @@ class ExpenseClaim(AccountsController):
|
|||||||
"credit": self.grand_total,
|
"credit": self.grand_total,
|
||||||
"credit_in_account_currency": self.grand_total,
|
"credit_in_account_currency": self.grand_total,
|
||||||
"against": self.employee
|
"against": self.employee
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
gl_entry.append(
|
gl_entry.append(
|
||||||
@@ -169,7 +170,7 @@ class ExpenseClaim(AccountsController):
|
|||||||
"debit_in_account_currency": self.grand_total,
|
"debit_in_account_currency": self.grand_total,
|
||||||
"against_voucher": self.name,
|
"against_voucher": self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
})
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
return gl_entry
|
return gl_entry
|
||||||
@@ -186,7 +187,7 @@ class ExpenseClaim(AccountsController):
|
|||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"against_voucher": self.name
|
"against_voucher": self.name
|
||||||
})
|
}, item=tax)
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate_account_details(self):
|
def validate_account_details(self):
|
||||||
|
|||||||
@@ -10,6 +10,22 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"expense_date",
|
||||||
|
"column_break_2",
|
||||||
|
"expense_type",
|
||||||
|
"default_account",
|
||||||
|
"section_break_4",
|
||||||
|
"description",
|
||||||
|
"section_break_6",
|
||||||
|
"amount",
|
||||||
|
"column_break_8",
|
||||||
|
"sanctioned_amount",
|
||||||
|
"accounting_dimensions_section",
|
||||||
|
"cost_center",
|
||||||
|
"dimension_col_break"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
@@ -348,6 +364,21 @@
|
|||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
"unique": 0,
|
"unique": 0,
|
||||||
"width": "150px"
|
"width": "150px"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "cost_center",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Cost Center",
|
||||||
|
"options": "Cost Center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "accounting_dimensions_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Accounting Dimensions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "dimension_col_break",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"has_web_view": 0,
|
||||||
@@ -359,12 +390,12 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"links": [],
|
||||||
"modified": "2019-06-10 08:41:36.122565",
|
"modified": "2020-05-11 18:54:35.601592",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Claim Detail",
|
"name": "Expense Claim Detail",
|
||||||
"owner": "harshada@webnotestech.com",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"quick_entry": 0,
|
"quick_entry": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
|
|||||||
@@ -7,14 +7,16 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"account_head",
|
"account_head",
|
||||||
"cost_center",
|
|
||||||
"col_break1",
|
"col_break1",
|
||||||
"rate",
|
"rate",
|
||||||
"description",
|
"description",
|
||||||
"section_break_6",
|
"section_break_6",
|
||||||
"tax_amount",
|
"tax_amount",
|
||||||
"column_break_8",
|
"column_break_8",
|
||||||
"total"
|
"total",
|
||||||
|
"accounting_dimensions_section",
|
||||||
|
"cost_center",
|
||||||
|
"dimension_col_break"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -90,10 +92,20 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break_8",
|
"fieldname": "column_break_8",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "accounting_dimensions_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Accounting Dimensions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "dimension_col_break",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-06-20 12:01:33.919555",
|
"links": [],
|
||||||
|
"modified": "2020-05-11 19:01:26.611758",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Taxes and Charges",
|
"name": "Expense Taxes and Charges",
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ erpnext.patches.v11_1.update_default_supplier_in_item_defaults
|
|||||||
erpnext.patches.v12_0.update_due_date_in_gle
|
erpnext.patches.v12_0.update_due_date_in_gle
|
||||||
erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
|
erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
|
||||||
erpnext.patches.v12_0.update_ewaybill_field_position
|
erpnext.patches.v12_0.update_ewaybill_field_position
|
||||||
erpnext.patches.v12_0.create_accounting_dimensions_in_missing_doctypes
|
erpnext.patches.v12_0.create_accounting_dimensions_in_missing_doctypes #2020-05-11
|
||||||
erpnext.patches.v11_1.set_status_for_material_request_type_manufacture
|
erpnext.patches.v11_1.set_status_for_material_request_type_manufacture
|
||||||
erpnext.patches.v12_0.move_plaid_settings_to_doctype
|
erpnext.patches.v12_0.move_plaid_settings_to_doctype
|
||||||
execute:frappe.reload_doc('desk', 'doctype', 'dashboard_chart_link')
|
execute:frappe.reload_doc('desk', 'doctype', 'dashboard_chart_link')
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ def execute():
|
|||||||
else:
|
else:
|
||||||
insert_after_field = 'accounting_dimensions_section'
|
insert_after_field = 'accounting_dimensions_section'
|
||||||
|
|
||||||
for doctype in ["Subscription Plan", "Subscription", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item"]:
|
for doctype in ["Subscription Plan", "Subscription", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item",
|
||||||
|
"Expense Claim Detail", "Expense Taxes and Charges"]:
|
||||||
|
|
||||||
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname})
|
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user