From 9cb99db2b39e947e72cef1c4a2cc80916bf581ca Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 26 Feb 2016 11:18:09 +0100 Subject: [PATCH] FIX one precision Add help message to inform about the unit of measure of the field --- account_invoice_margin/account_invoice.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/account_invoice_margin/account_invoice.py b/account_invoice_margin/account_invoice.py index e0094a5..4cac02d 100644 --- a/account_invoice_margin/account_invoice.py +++ b/account_invoice_margin/account_invoice.py @@ -29,11 +29,16 @@ class AccountInvoiceLine(models.Model): standard_price_company_currency = fields.Float( string='Cost Price in Company Currency', readonly=True, - digits=dp.get_precision('Product Price')) + digits=dp.get_precision('Product Price'), + help="Cost price in company currency in the unit of measure " + "of the invoice line (which may be different from the unit " + "of measure of the product).") standard_price_invoice_currency = fields.Float( string='Cost Price in Invoice Currency', readonly=True, compute='_compute_margin', store=True, - digits=dp.get_precision('Account')) + digits=dp.get_precision('Product Price'), + help="Cost price in invoice currency in the unit of measure " + "of the invoice line") margin_invoice_currency = fields.Float( string='Margin in Invoice Currency', readonly=True, store=True, compute='_compute_margin', @@ -62,6 +67,7 @@ class AccountInvoiceLine(models.Model): self.invoice_id.type in ('out_invoice', 'out_refund')): # it works in _get_current_rate # even if we set date = False in context + # standard_price_inv_cur is in the UoM of the invoice line standard_price_inv_cur =\ self.invoice_id.company_id.currency_id.with_context( date=self.invoice_id.date_invoice).compute(