[IMP] sale, spreadsheet_dashboard_sale: display amount currency

Amounts in the spredsheet Sales dashboards are displayed without their currency
even though the amounts are all correctly converted to the current
company's currency.

With this commit, amounts are displayed with their currency in the
dashboard, list view and default form view.

The hardcoded number format is removed on the dashboard cells to let
the automatic format do the job

Task 3167343

closes odoo/odoo#111702

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
Lucas Lefèvre
2023-03-10 14:38:43 +01:00
parent 8fc4c6f2d8
commit 2a24e7ae52
3 changed files with 11 additions and 127 deletions
+10 -5
View File
@@ -27,10 +27,10 @@ class SaleReport(models.Model):
partner_id = fields.Many2one('res.partner', 'Customer', readonly=True)
company_id = fields.Many2one('res.company', 'Company', readonly=True)
user_id = fields.Many2one('res.users', 'Salesperson', readonly=True)
price_total = fields.Float('Total', readonly=True)
price_subtotal = fields.Float('Untaxed Total', readonly=True)
untaxed_amount_to_invoice = fields.Float('Untaxed Amount To Invoice', readonly=True)
untaxed_amount_invoiced = fields.Float('Untaxed Amount Invoiced', readonly=True)
price_total = fields.Monetary('Total', readonly=True)
price_subtotal = fields.Monetary('Untaxed Total', readonly=True)
untaxed_amount_to_invoice = fields.Monetary('Untaxed Amount To Invoice', readonly=True)
untaxed_amount_invoiced = fields.Monetary('Untaxed Amount Invoiced', readonly=True)
product_tmpl_id = fields.Many2one('product.template', 'Product', readonly=True)
categ_id = fields.Many2one('product.category', 'Product Category', readonly=True)
nbr = fields.Integer('# of Lines', readonly=True)
@@ -58,13 +58,18 @@ class SaleReport(models.Model):
volume = fields.Float('Volume', readonly=True)
discount = fields.Float('Discount %', readonly=True)
discount_amount = fields.Float('Discount Amount', readonly=True)
discount_amount = fields.Monetary('Discount Amount', readonly=True)
currency_id = fields.Many2one('res.currency', compute='_compute_currency_id')
campaign_id = fields.Many2one('utm.campaign', 'Campaign', readonly=True)
medium_id = fields.Many2one('utm.medium', 'Medium', readonly=True)
source_id = fields.Many2one('utm.source', 'Source', readonly=True)
order_id = fields.Many2one('sale.order', 'Order #', readonly=True)
@api.depends_context('allowed_company_ids')
def _compute_currency_id(self):
self.currency_id = self.env.company.currency_id
def _with_sale(self):
return ""
+1
View File
@@ -39,6 +39,7 @@
<field name="price_total" optional="show" sum="Sum of Total"/>
<field name="state" optional="hide"/>
<field name="invoice_status" optional="hide"/>
<field name="currency_id" invisible="1"/>
</tree>
</field>
</record>
@@ -768,232 +768,171 @@
},
"D34": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",1)"
},
"D35": {
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",2)"
},
"D36": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",3)"
},
"D37": {
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",4)"
},
"D38": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",5)"
},
"D39": {
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",6)"
},
"D40": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",7)"
},
"D41": {
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",8)"
},
"D42": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",9)"
},
"D43": {
"format": 3,
"content": "=ODOO.PIVOT(5,\"price_subtotal\",\"#country_id\",10)"
},
"D44": {
"format": 3
},
"D45": {
"style": 8,
"format": 3,
"border": 1
},
"D46": {
"style": 10,
"format": 3,
"content": "=_t(\"Revenue\")",
"border": 2
},
"D47": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",1)"
},
"D48": {
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",2)"
},
"D49": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",3)"
},
"D50": {
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",4)"
},
"D51": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",5)"
},
"D52": {
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",6)"
},
"D53": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",7)"
},
"D54": {
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",8)"
},
"D55": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",9)"
},
"D56": {
"format": 3,
"content": "=ODOO.PIVOT(4,\"price_subtotal\",\"#partner_id\",10)"
},
"D57": {
"format": 3
},
"D58": {
"style": 8,
"format": 3,
"border": 1
},
"D59": {
"style": 10,
"format": 3,
"content": "=_t(\"Revenue\")",
"border": 2
},
"D60": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",1)"
},
"D61": {
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",2)"
},
"D62": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",3)"
},
"D63": {
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",4)"
},
"D64": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",5)"
},
"D65": {
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",6)"
},
"D66": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",7)"
},
"D67": {
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",8)"
},
"D68": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",9)"
},
"D69": {
"format": 3,
"content": "=ODOO.PIVOT(7,\"price_subtotal\",\"#team_id\",10)"
},
"D70": {
"format": 3
},
"D71": {
"style": 8,
"format": 3,
"border": 1
},
"D72": {
"style": 10,
"format": 3,
"content": "=_t(\"Revenue\")",
"border": 2
},
"D73": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",1)"
},
"D74": {
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",2)"
},
"D75": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",3)"
},
"D76": {
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",4)"
},
"D77": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",5)"
},
"D78": {
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",6)"
},
"D79": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",7)"
},
"D80": {
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",8)"
},
"D81": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",9)"
},
"D82": {
"format": 3,
"content": "=ODOO.PIVOT(9,\"price_subtotal\",\"#source_id\",10)"
},
"D85": {
"format": 3
},
"D86": {
"format": 3
},
"E20": {
"style": 12
},
@@ -1698,232 +1637,171 @@
},
"I34": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",1)"
},
"I35": {
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",2)"
},
"I36": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",3)"
},
"I37": {
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",4)"
},
"I38": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",5)"
},
"I39": {
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",6)"
},
"I40": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",7)"
},
"I41": {
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",8)"
},
"I42": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",9)"
},
"I43": {
"format": 3,
"content": "=ODOO.PIVOT(6,\"price_subtotal\",\"#product_id\",10)"
},
"I44": {
"format": 3
},
"I45": {
"style": 8,
"format": 3,
"border": 1
},
"I46": {
"style": 10,
"format": 3,
"content": "=_t(\"Revenue\")",
"border": 2
},
"I47": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",1)"
},
"I48": {
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",2)"
},
"I49": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",3)"
},
"I50": {
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",4)"
},
"I51": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",5)"
},
"I52": {
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",6)"
},
"I53": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",7)"
},
"I54": {
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",8)"
},
"I55": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",9)"
},
"I56": {
"format": 3,
"content": "=ODOO.PIVOT(3,\"price_subtotal\",\"#categ_id\",10)"
},
"I57": {
"format": 3
},
"I58": {
"style": 8,
"format": 3,
"border": 1
},
"I59": {
"style": 10,
"format": 3,
"content": "=_t(\"Revenue\")",
"border": 2
},
"I60": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",1)"
},
"I61": {
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",2)"
},
"I62": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",3)"
},
"I63": {
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",4)"
},
"I64": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",5)"
},
"I65": {
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",6)"
},
"I66": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",7)"
},
"I67": {
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",8)"
},
"I68": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",9)"
},
"I69": {
"format": 3,
"content": "=ODOO.PIVOT(8,\"price_subtotal\",\"#user_id\",10)"
},
"I70": {
"format": 3
},
"I71": {
"style": 8,
"format": 3,
"border": 1
},
"I72": {
"style": 10,
"format": 3,
"content": "=_t(\"Revenue\")",
"border": 2
},
"I73": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",1)"
},
"I74": {
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",2)"
},
"I75": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",3)"
},
"I76": {
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",4)"
},
"I77": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",5)"
},
"I78": {
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",6)"
},
"I79": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",7)"
},
"I80": {
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",8)"
},
"I81": {
"style": 9,
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",9)"
},
"I82": {
"format": 3,
"content": "=ODOO.PIVOT(10,\"price_subtotal\",\"#medium_id\",10)"
},
"I85": {
"format": 3
},
"I86": {
"format": 3
},
"A8": {
"border": 2
},