diff --git a/addons/project/models/project.py b/addons/project/models/project.py index dbbd4058a77..ea11bd48c4f 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -728,6 +728,7 @@ class Project(models.Model): 'user': self._get_user_values(), 'milestones': self._get_milestones(), 'buttons': sorted(self._get_stat_buttons(), key=lambda k: k['sequence']), + 'currency_id': self.currency_id.id, } if self._show_profitability(): panel_data['profitability_items'] = self._get_profitability_items() diff --git a/addons/project/static/src/js/right_panel/project_right_panel.js b/addons/project/static/src/js/right_panel/project_right_panel.js index 5d55bd3ca47..2a406e51e29 100644 --- a/addons/project/static/src/js/right_panel/project_right_panel.js +++ b/addons/project/static/src/js/right_panel/project_right_panel.js @@ -1,8 +1,9 @@ /** @odoo-module **/ import { AddMilestone, OpenMilestone } from '@project/js/right_panel/project_utils'; -import { formatFloat } from "@web/fields/formatters"; +import { formatFloat, formatMonetary } from "@web/fields/formatters"; import { LegacyComponent } from "@web/legacy/legacy_component"; +import { session } from "@web/session"; const { onWillStart, onWillUpdateProps, useState } = owl; @@ -32,6 +33,23 @@ export default class ProjectRightPanel extends LegacyComponent { return formatFloat(value, { digits: [false, 1] }); } + formatMonetary(value, options = {}) { + const valueFormatted = formatMonetary(value, { + currencyId: this.state.data.currency_id, + ...options, + 'noSymbol': true, + }); + const currency = session.currencies[this.state.data.currency_id]; + if (!currency) { + return valueFormatted; + } + if (currency.position === "after") { + return `${valueFormatted} ${currency.symbol}`; + } else { + return `${currency.symbol} ${valueFormatted}`; + } + } + async _loadQwebContext() { if (!this.project_id){ // If this is called from notif, multiples updates but no specific project return {}; diff --git a/addons/project/static/src/xml/project_templates.xml b/addons/project/static/src/xml/project_templates.xml index 56c8ba59ee7..43c1fcb1692 100644 --- a/addons/project/static/src/xml/project_templates.xml +++ b/addons/project/static/src/xml/project_templates.xml @@ -101,17 +101,17 @@ - - - + + + Total - - - + + + @@ -133,17 +133,17 @@ - - - + + + Total - - - + + + @@ -159,9 +159,9 @@ Margin - - - + + +