Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor : Setting Float Precision for Columns that Representing Monetary DataFields instead of Float with System Settings or Currency #39035

Closed
wants to merge 2 commits into from

Conversation

Sendipad
Copy link
Contributor

Representing Monetary data field as currency in many script report columns would take a lot of space and be annoyaing sometimes, meanwhile using Float as fieldtype would be annoyaing when you set float Precision to 5 in System Settings.

Thus after apply such field many report would get some update for example General Ledger Report: def get_float_precison():
fp = frappe.db.get_single_value(
"Accounts Settings", "monetary_columns_float_precison"
)
if fp !="":
return fp
else :
return frappe.db.get_single_value(
"System Settings", "float_precision"
)

def get_columns(filters):
....

float_precision = get_float_precison()

columns = [

{
"label": _("Debit"),
"fieldname": "debit_in_account_currency",
"fieldtype": "Float",
"precision": float_precision,
"width": 130,
},

	{
		"label": _("Credit"),
		"fieldname": "credit_in_account_currency",
		"fieldtype": "Float",
		"precision": float_precision,
		"width": 130,
	},
	{
		"label": _("Balance"),
		"fieldname": "balance",
		"fieldtype": "Float",
		"precision": float_precision,
		"width": 130,
	},

Please provide enough information so that others can review your pull request:

Explain the details for making this change. What existing problem does the pull request solve?

Screenshots/GIFs

… without symbol ) Columns in Report

Representing Monetary data field as currency in many script report columns would take a lot of space and be annoyaing sometimes, meanwhile using Float as fieldtype would be annoyaing when you set float Precision to 5 in System Settings.

Thus after apply such field many report would get some update for example General Ledger Report:
def get_float_precison():
	fp = frappe.db.get_single_value(
			"Accounts Settings", "monetary_columns_float_precison"
		)
	if fp !="":
		return fp
	else :
		return frappe.db.get_single_value(
			"System Settings", "float_precision"
		) 

def get_columns(filters):
	....

	float_precision = get_float_precison()

	columns = [

{
			"label": _("Debit"),
			"fieldname": "debit_in_account_currency",
 			"fieldtype": "Float",
  			"precision": float_precision,
			"width": 130,
		},

		{
			"label": _("Credit"),
			"fieldname": "credit_in_account_currency",
			"fieldtype": "Float",
  			"precision": float_precision,
			"width": 130,
		},
		{
			"label": _("Balance"),
			"fieldname": "balance",
			"fieldtype": "Float",
  			"precision": float_precision,
			"width": 130,
		},
@Sendipad Sendipad marked this pull request as draft December 29, 2023 18:52
Copy link

stale bot commented Jan 13, 2024

This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@stale stale bot added the inactive label Jan 13, 2024
@stale stale bot closed this Jan 18, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant