mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] account_asset_management: include 'number' method_time
This commit is contained in:
@@ -211,7 +211,9 @@ class AccountAsset(models.Model):
|
||||
help="Choose the method to use to compute the dates and "
|
||||
"number of depreciation lines.\n"
|
||||
" * Number of Years: Specify the number of years "
|
||||
"for the depreciation.\n",
|
||||
"for the depreciation.\n"
|
||||
" * Number of Depreciations: Fix the number of "
|
||||
"depreciation lines and the time between 2 depreciations.\n",
|
||||
)
|
||||
days_calc = fields.Boolean(
|
||||
string="Calculate by days",
|
||||
@@ -395,10 +397,12 @@ class AccountAsset(models.Model):
|
||||
_("Degressive-Linear is only supported for Time Method = Year.")
|
||||
)
|
||||
|
||||
@api.constrains("date_start", "method_end", "method_time")
|
||||
@api.constrains("date_start", "method_end", "method_number", "method_time")
|
||||
def _check_dates(self):
|
||||
if self.filtered(
|
||||
lambda a: a.method_time == "end" and a.method_end <= a.date_start
|
||||
lambda a: a.method_time == "year"
|
||||
and not a.method_number
|
||||
and a.method_end <= a.date_start
|
||||
):
|
||||
raise UserError(_("The Start Date must precede the Ending Date."))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user