feat: item(row) wise tax amount rounding
This commit is contained in:
parent
611c2bf775
commit
3ead28906c
@ -32,6 +32,7 @@
|
|||||||
"column_break_19",
|
"column_break_19",
|
||||||
"add_taxes_from_item_tax_template",
|
"add_taxes_from_item_tax_template",
|
||||||
"book_tax_discount_loss",
|
"book_tax_discount_loss",
|
||||||
|
"round_row_wise_tax",
|
||||||
"print_settings",
|
"print_settings",
|
||||||
"show_inclusive_tax_in_print",
|
"show_inclusive_tax_in_print",
|
||||||
"show_taxes_as_table_in_print",
|
"show_taxes_as_table_in_print",
|
||||||
@ -58,7 +59,6 @@
|
|||||||
"closing_settings_tab",
|
"closing_settings_tab",
|
||||||
"period_closing_settings_section",
|
"period_closing_settings_section",
|
||||||
"acc_frozen_upto",
|
"acc_frozen_upto",
|
||||||
"ignore_account_closing_balance",
|
|
||||||
"column_break_25",
|
"column_break_25",
|
||||||
"frozen_accounts_modifier",
|
"frozen_accounts_modifier",
|
||||||
"tab_break_dpet",
|
"tab_break_dpet",
|
||||||
@ -410,10 +410,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"description": "Financial reports will be generated using GL Entry doctypes (should be enabled if Period Closing Voucher is not posted for all years sequentially or missing) ",
|
"description": "Tax Amount will be rounded on a row(items) level",
|
||||||
"fieldname": "ignore_account_closing_balance",
|
"fieldname": "round_row_wise_tax",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Ignore Account Closing Balance"
|
"label": "Round Tax Amount Row-wise"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@ -421,7 +421,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-07-27 15:05:34.000264",
|
"modified": "2023-08-22 20:11:00.042840",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Accounts Settings",
|
"name": "Accounts Settings",
|
||||||
|
|||||||
@ -1387,6 +1387,9 @@ class PaymentEntry(AccountsController):
|
|||||||
def calculate_taxes(self):
|
def calculate_taxes(self):
|
||||||
self.total_taxes_and_charges = 0.0
|
self.total_taxes_and_charges = 0.0
|
||||||
self.base_total_taxes_and_charges = 0.0
|
self.base_total_taxes_and_charges = 0.0
|
||||||
|
frappe.flags.round_row_wise_tax = (
|
||||||
|
frappe.db.get_single_value("Accounts Settings", "round_row_wise_tax")
|
||||||
|
)
|
||||||
|
|
||||||
actual_tax_dict = dict(
|
actual_tax_dict = dict(
|
||||||
[
|
[
|
||||||
@ -1398,6 +1401,8 @@ class PaymentEntry(AccountsController):
|
|||||||
|
|
||||||
for i, tax in enumerate(self.get("taxes")):
|
for i, tax in enumerate(self.get("taxes")):
|
||||||
current_tax_amount = self.get_current_tax_amount(tax)
|
current_tax_amount = self.get_current_tax_amount(tax)
|
||||||
|
if frappe.flags.round_row_wise_tax:
|
||||||
|
current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount"))
|
||||||
|
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
actual_tax_dict[tax.idx] -= current_tax_amount
|
actual_tax_dict[tax.idx] -= current_tax_amount
|
||||||
|
|||||||
@ -25,6 +25,9 @@ class calculate_taxes_and_totals(object):
|
|||||||
def __init__(self, doc: Document):
|
def __init__(self, doc: Document):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
frappe.flags.round_off_applicable_accounts = []
|
frappe.flags.round_off_applicable_accounts = []
|
||||||
|
frappe.flags.round_row_wise_tax = (
|
||||||
|
frappe.db.get_single_value("Accounts Settings", "round_row_wise_tax")
|
||||||
|
)
|
||||||
|
|
||||||
self._items = self.filter_rows() if self.doc.doctype == "Quotation" else self.doc.get("items")
|
self._items = self.filter_rows() if self.doc.doctype == "Quotation" else self.doc.get("items")
|
||||||
|
|
||||||
@ -368,6 +371,8 @@ class calculate_taxes_and_totals(object):
|
|||||||
for i, tax in enumerate(self.doc.get("taxes")):
|
for i, tax in enumerate(self.doc.get("taxes")):
|
||||||
# tax_amount represents the amount of tax for the current step
|
# tax_amount represents the amount of tax for the current step
|
||||||
current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
|
current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
|
||||||
|
if frappe.flags.round_row_wise_tax:
|
||||||
|
current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount"))
|
||||||
|
|
||||||
# Adjust divisional loss to the last item
|
# Adjust divisional loss to the last item
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user