Set default integer digits to None

This commit is contained in:
Cédric Krier
2024-11-25 23:47:12 +01:00
parent 6cff740d3c
commit c833195650
19 changed files with 36 additions and 28 deletions
+8 -4
View File
@@ -594,12 +594,14 @@ class TaxTemplate(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
})
start_date = fields.Date('Starting Date')
end_date = fields.Date('Ending Date')
amount = fields.Numeric('Amount', digits=(16, 8),
amount = fields.Numeric(
"Amount", digits=(None, 8),
states={
'required': Eval('type') == 'fixed',
'invisible': Eval('type') != 'fixed',
})
rate = fields.Numeric('Rate', digits=(14, 10),
rate = fields.Numeric(
"Rate", digits=(None, 10),
states={
'required': Eval('type') == 'percentage',
'invisible': Eval('type') != 'percentage',
@@ -762,13 +764,15 @@ class Tax(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
})
start_date = fields.Date('Starting Date', states=_states)
end_date = fields.Date('Ending Date', states=_states)
amount = fields.Numeric('Amount', digits=(16, 8),
amount = fields.Numeric(
"Amount", digits=(None, 8),
states={
'required': Eval('type') == 'fixed',
'invisible': Eval('type') != 'fixed',
'readonly': _states['readonly'],
}, help='In company\'s currency.')
rate = fields.Numeric('Rate', digits=(14, 10),
rate = fields.Numeric(
"Rate", digits=(None, 10),
states={
'required': Eval('type') == 'percentage',
'invisible': Eval('type') != 'percentage',
+1 -1
View File
@@ -33,7 +33,7 @@ class AmountMixin:
'get_amount')
percentage = fields.Function(
fields.Numeric(
"Percentage", digits=(16, 4),
"Percentage", digits=(None, 4),
help="The percentage of booked amount of the budget line."),
'get_amount')
+1 -1
View File
@@ -12,7 +12,7 @@ class Currency(metaclass=PoolMeta):
cash_rounding = fields.Numeric(
"Cash Rounding Factor",
digits=(12, Eval('digits', 6)))
digits=(None, Eval('digits', None)))
def cash_round(self, amount, rounding=ROUND_HALF_EVEN):
return self._round(amount, self.cash_rounding, rounding)
+1 -1
View File
@@ -9,7 +9,7 @@ from trytond.transaction import Transaction
default_credit_limit_amount = fields.Numeric(
"Default Credit Limit Amount",
help="The default credit limit amount for new customers.",
digits=(16, Eval('default_credit_limit_amount_digits', 2)))
digits=(None, Eval('default_credit_limit_amount_digits', None)))
class Configuration(metaclass=PoolMeta):
+2 -1
View File
@@ -23,7 +23,8 @@ class Fee(DeactivableMixin, ModelSQL, ModelView):
('percentage', 'Percentage'),
], 'Compute Method', required=True,
help='Method to compute the fee amount')
percentage = fields.Numeric('Percentage', digits=(16, 8),
percentage = fields.Numeric(
"Percentage", digits=(None, 8),
states={
'invisible': Eval('compute_method') != 'percentage',
'required': Eval('compute_method') == 'percentage',
+1 -1
View File
@@ -2360,7 +2360,7 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin):
},
depends={'invoice'})
taxes_deductible_rate = fields.Numeric(
"Taxes Deductible Rate", digits=(14, 10),
"Taxes Deductible Rate", digits=(None, 10),
domain=[
('taxes_deductible_rate', '>=', 0),
('taxes_deductible_rate', '<=', 1),
+1 -1
View File
@@ -121,7 +121,7 @@ class Category(CompanyMultiValueMixin, metaclass=PoolMeta):
},
help="The taxes to apply when purchasing products of this category.")
supplier_taxes_deductible_rate = fields.Numeric(
"Supplier Taxes Deductible Rate", digits=(14, 10),
"Supplier Taxes Deductible Rate", digits=(None, 10),
domain=[
('supplier_taxes_deductible_rate', '>=', 0),
('supplier_taxes_deductible_rate', '<=', 1),
+3 -3
View File
@@ -271,11 +271,11 @@ class IntrastatDeclarationLine(ModelSQL, ModelView):
country = fields.Many2One('country.country', "Country")
subdivision = fields.Many2One('country.subdivision', "Subdivision")
tariff_code = fields.Many2One('customs.tariff.code', "Tariff Code")
weight = fields.Float("Weight", digits=(16, 3))
value = fields.Numeric("Value", digits=(16, 2))
weight = fields.Float("Weight", digits=(None, 3))
value = fields.Numeric("Value", digits=(None, 2))
transaction = fields.Many2One(
'account.stock.eu.intrastat.transaction', "Transaction")
additional_unit = fields.Float("Additional Unit", digits=(16, 3))
additional_unit = fields.Float("Additional Unit", digits=(None, 3))
country_of_origin = fields.Many2One('country.country', "Country of Origin")
vat = fields.Many2One(
'party.identifier', "VAT",
+2 -2
View File
@@ -52,12 +52,12 @@ class Move(metaclass=PoolMeta):
'customs.tariff.code', "Intrastat Tariff Code",
ondelete='RESTRICT', states=_states)
intrastat_value = fields.Numeric(
"Intrastat Value", digits=(16, 2), readonly=True, states=_states)
"Intrastat Value", digits=(None, 2), readonly=True, states=_states)
intrastat_transaction = fields.Many2One(
'account.stock.eu.intrastat.transaction', "Intrastat Transaction",
ondelete='RESTRICT', states=_states)
intrastat_additional_unit = fields.Float(
"Intrastat Additional Unit", digits=(16, 3),
"Intrastat Additional Unit", digits=(None, 3),
states={
'required': (
_states['required'] & Eval('intrastat_tariff_code_uom')),
+2 -1
View File
@@ -10,7 +10,8 @@ from trytond.transaction import Transaction
class Carrier(metaclass=PoolMeta):
__name__ = 'carrier'
percentage = fields.Numeric('Percentage', digits=(16, 8),
percentage = fields.Numeric(
"Percentage", digits=(None, 8),
states={
'invisible': Eval('carrier_cost_method') != 'percentage',
},
+1 -1
View File
@@ -54,7 +54,7 @@ class Currency(
rates = fields.One2Many('currency.currency.rate', 'currency', 'Rates',
help="Add floating exchange rates for the currency.")
rounding = fields.Numeric('Rounding factor', required=True,
digits=(12, Eval('digits', 6)),
digits=(None, Eval('digits', None)),
domain=[
('rounding', '>', 0),
],
+1 -1
View File
@@ -45,7 +45,7 @@ COST_PRICE_METHODS = [
('average', 'Average'),
]
price_digits = (16, price_decimal)
price_digits = (None, price_decimal)
def round_price(value, rounding=None):
+2 -1
View File
@@ -57,7 +57,8 @@ class Uom(SymbolMixin, DigitsMixin, DeactivableMixin, ModelSQL, ModelView):
help="The coefficient for the formula:\n"
"coefficient (base unit) = 1 (this unit)")
rounding = fields.Float(
"Rounding Precision", digits=(12, Eval('digits', 12)), required=True,
"Rounding Precision",
digits=(None, Eval('digits', None)), required=True,
domain=[
('rounding', '>', 0),
],
+1 -1
View File
@@ -179,7 +179,7 @@ class Work(sequence_ordered(), tree(separator='\\'), ModelSQL, ModelView):
],
help='Estimated progress for this work.')
total_progress = fields.Function(fields.Float('Total Progress',
digits=(16, 4),
digits=(None, 4),
help='Estimated total progress for this work and the sub-works.',
states={
'invisible': (
+2 -1
View File
@@ -10,7 +10,8 @@ class Allocation(ModelSQL, ModelView):
'company.employee', "Employee", required=True, ondelete='CASCADE')
work = fields.Many2One(
'project.work', "Work", required=True, ondelete='CASCADE')
percentage = fields.Float('Percentage', digits=(16, 2), required=True,
percentage = fields.Float(
"Percentage", digits=(None, 2), required=True,
domain=[('percentage', '>', 0.0)])
@staticmethod
+2 -2
View File
@@ -14,14 +14,14 @@ class ProductSupplier(metaclass=PoolMeta):
quantity_minimal = fields.Float(
"Minimal Quantity",
digits=(16, Eval('quantity_digits', 0)),
digits=(None, Eval('quantity_digits', None)),
domain=['OR',
('quantity_minimal', '=', None),
('quantity_minimal', '>', 0),
])
quantity_rounding = fields.Float(
"Rounding Quantity",
digits=(16, Eval('quantity_digits', 0)),
digits=(None, Eval('quantity_digits', None)),
domain=['OR',
('quantity_rounding', '=', None),
('quantity_rounding', '>', 0),
+1 -1
View File
@@ -20,7 +20,7 @@ class Line(metaclass=PoolMeta):
})
discount_rate = fields.Function(fields.Numeric(
"Discount Rate", digits=(16, 4),
"Discount Rate", digits=(None, 4),
states={
'invisible': Eval('type') != 'line',
'readonly': Eval('sale_state') != 'draft',
+2 -2
View File
@@ -13,7 +13,7 @@ class Template(metaclass=PoolMeta):
sale_quantity_minimal = fields.Float(
"Sale Minimal Quantity",
digits=(16, Eval('sale_quantity_digits', 0)),
digits=(None, Eval('sale_quantity_digits', None)),
states={
'invisible': ~Eval('salable', False),
},
@@ -23,7 +23,7 @@ class Template(metaclass=PoolMeta):
])
sale_quantity_rounding = fields.Float(
"Sale Rounding Quantity",
digits=(16, Eval('sale_quantity_digits', 0)),
digits=(None, Eval('sale_quantity_digits', None)),
states={
'invisible': ~Eval('salable', False),
},
+2 -2
View File
@@ -35,7 +35,7 @@ class Abstract(ModelSQL, ModelView):
currency='currency', digits='currency')
margin = fields.Numeric(
lazy_gettext('stock.msg_stock_reporting_margin'),
digits=(14, 4),
digits=(None, 4),
states={
'invisible': ~Eval('margin'),
})
@@ -537,7 +537,7 @@ class CategoryTree(ModelSQL, ModelView):
'get_total')
margin = fields.Function(Monetary(
lazy_gettext('stock.msg_stock_reporting_margin'),
digits=(14, 4)),
digits=(None, 4)),
'get_margin')
currency = fields.Function(fields.Many2One(