mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[IMP] report_xlsx: Method for getting cell format for a currency
TT38722
This commit is contained in:
@@ -91,6 +91,13 @@ class ReportXlsxAbstract(models.AbstractModel):
|
||||
ids = self.env.context.get("active_ids", [])
|
||||
return self.env[self.env.context.get("active_model")].browse(ids)
|
||||
|
||||
def _report_xlsx_currency_format(self, currency):
|
||||
"""Get the format to be used in cells (symbol included).
|
||||
Used in account_financial_report addon"""
|
||||
s_before = currency.symbol if currency.position == "before" else ""
|
||||
s_after = " %s" % currency.symbol if currency.position == "after" else ""
|
||||
return f"{f'{s_before}'}#,##0.{'0' * currency.decimal_places}{f'{s_after}'}"
|
||||
|
||||
def create_xlsx_report(self, docids, data):
|
||||
objs = self._get_objs_for_report(docids, data)
|
||||
file_data = BytesIO()
|
||||
|
||||
Reference in New Issue
Block a user