[IMP] *: remove digits attribute from Monetary fields
* account, hr_contract, hr_expense, point_of_sale, sale_margin, website_sale_delivery, website_sale_wishlist digits only works on Float fields, on Monetary fields it has no effect: - The column_type of a monetary field is always numeric - It is not applied in `convert_to_column()` or `convert_to_cache()` - It is not part of `description_attrs`, so it will not be included in the output of `fields_get()` closes odoo/odoo#35336 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
committed by
Martin Trigaux
parent
914a722f81
commit
0fe2b4530f
@@ -338,7 +338,7 @@ class AccountBankStatementLine(models.Model):
|
||||
|
||||
name = fields.Char(string='Label', required=True)
|
||||
date = fields.Date(required=True, default=lambda self: self._context.get('date', fields.Date.context_today(self)))
|
||||
amount = fields.Monetary(digits=0, currency_field='journal_currency_id')
|
||||
amount = fields.Monetary(currency_field='journal_currency_id')
|
||||
journal_currency_id = fields.Many2one('res.currency', string="Journal's Currency", related='statement_id.currency_id',
|
||||
help='Utility field to express amount currency', readonly=True)
|
||||
partner_id = fields.Many2one('res.partner', string='Partner')
|
||||
|
||||
@@ -28,7 +28,7 @@ class Contract(models.Model):
|
||||
resource_calendar_id = fields.Many2one(
|
||||
'resource.calendar', 'Working Schedule',
|
||||
default=lambda self: self.env.company.resource_calendar_id.id)
|
||||
wage = fields.Monetary('Wage', digits=(16, 2), required=True, tracking=True, help="Employee's monthly gross wage.")
|
||||
wage = fields.Monetary('Wage', required=True, tracking=True, help="Employee's monthly gross wage.")
|
||||
advantages = fields.Text('Advantages')
|
||||
notes = fields.Text('Notes')
|
||||
state = fields.Selection([
|
||||
|
||||
@@ -53,9 +53,9 @@ class HrExpense(models.Model):
|
||||
quantity = fields.Float(required=True, readonly=True, states={'draft': [('readonly', False)], 'reported': [('readonly', False)], 'refused': [('readonly', False)]}, digits='Product Unit of Measure', default=1)
|
||||
tax_ids = fields.Many2many('account.tax', 'expense_tax', 'expense_id', 'tax_id', string='Taxes')
|
||||
untaxed_amount = fields.Float("Subtotal", store=True, compute='_compute_amount', digits='Account')
|
||||
total_amount = fields.Monetary("Total", compute='_compute_amount', store=True, currency_field='currency_id', digits='Account')
|
||||
total_amount = fields.Monetary("Total", compute='_compute_amount', store=True, currency_field='currency_id')
|
||||
company_currency_id = fields.Many2one('res.currency', string="Report Company Currency", related='sheet_id.currency_id', store=True, readonly=False)
|
||||
total_amount_company = fields.Monetary("Total (Company Currency)", compute='_compute_total_amount_company', store=True, currency_field='company_currency_id', digits='Account')
|
||||
total_amount_company = fields.Monetary("Total (Company Currency)", compute='_compute_total_amount_company', store=True, currency_field='company_currency_id')
|
||||
company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.company.currency_id)
|
||||
analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', oldname='analytic_account')
|
||||
@@ -618,7 +618,7 @@ class HrExpenseSheet(models.Model):
|
||||
address_id = fields.Many2one('res.partner', string="Employee Home Address")
|
||||
payment_mode = fields.Selection(related='expense_line_ids.payment_mode', default='own_account', readonly=True, string="Paid By")
|
||||
user_id = fields.Many2one('res.users', 'Manager', readonly=True, copy=False, states={'draft': [('readonly', False)]}, tracking=True, oldname='responsible_id')
|
||||
total_amount = fields.Monetary('Total Amount', currency_field='currency_id', compute='_compute_amount', store=True, digits='Account')
|
||||
total_amount = fields.Monetary('Total Amount', currency_field='currency_id', compute='_compute_amount', store=True)
|
||||
company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)]}, default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, states={'draft': [('readonly', False)]}, default=lambda self: self.env.company.currency_id)
|
||||
attachment_number = fields.Integer(compute='_compute_attachment_number', string='Number of Attachments')
|
||||
|
||||
@@ -89,7 +89,6 @@ class PosSession(models.Model):
|
||||
help="Total of all paid sales orders")
|
||||
cash_register_balance_end = fields.Monetary(
|
||||
related='cash_register_id.balance_end',
|
||||
digits=0,
|
||||
string="Theoretical Closing Balance",
|
||||
help="Sum of opening balance and transactions.",
|
||||
readonly=True)
|
||||
|
||||
@@ -66,7 +66,7 @@ class SaleOrderLine(models.Model):
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
margin = fields.Monetary(compute='_product_margin', help="It gives profitability by calculating the difference between the Unit Price and the cost.", currency_field='currency_id', digits='Product Price', store=True)
|
||||
margin = fields.Monetary(compute='_product_margin', help="It gives profitability by calculating the difference between the Unit Price and the cost.", currency_field='currency_id', store=True)
|
||||
|
||||
@api.depends('order_line.margin')
|
||||
def _product_margin(self):
|
||||
|
||||
@@ -11,7 +11,7 @@ class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
amount_delivery = fields.Monetary(
|
||||
compute='_compute_amount_delivery', digits=0,
|
||||
compute='_compute_amount_delivery',
|
||||
string='Delivery Amount',
|
||||
help="The amount without tax.", store=True, tracking=True)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class ProductWishlist(models.Model):
|
||||
product_id = fields.Many2one('product.product', string='Product', required=True)
|
||||
currency_id = fields.Many2one('res.currency', related='pricelist_id.currency_id', readonly=True)
|
||||
pricelist_id = fields.Many2one('product.pricelist', string='Pricelist', help='Pricelist when added')
|
||||
price = fields.Monetary(digits=0, currency_field='currency_id', string='Price', help='Price of the product when it has been added in the wishlist')
|
||||
price = fields.Monetary(currency_field='currency_id', string='Price', help='Price of the product when it has been added in the wishlist')
|
||||
website_id = fields.Many2one('website', required=True)
|
||||
active = fields.Boolean(default=True, required=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user