2017-07-06 09:40:15 +02:00
|
|
|
# Copyright 2017 ACSONE SA/NV
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
|
2020-11-17 00:09:33 +01:00
|
|
|
from odoo import _, fields, models
|
2017-07-06 09:40:15 +02:00
|
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
|
|
|
|
|
|
class DateRangeType(models.Model):
|
2020-11-17 00:00:36 +01:00
|
|
|
_inherit = "date.range.type"
|
2017-07-06 09:40:15 +02:00
|
|
|
|
|
|
|
fiscal_month = fields.Boolean(string="Is fiscal month?", readonly=True)
|
|
|
|
|
|
|
|
def unlink(self):
|
|
|
|
date_range_type_fm = self.env.ref(
|
2020-11-17 00:00:36 +01:00
|
|
|
"account_fiscal_month.date_range_fiscal_month"
|
|
|
|
)
|
2017-07-06 09:40:15 +02:00
|
|
|
if date_range_type_fm.id in self.ids:
|
2020-11-17 00:00:36 +01:00
|
|
|
raise UserError(_("You can't delete date range type: " "Fiscal month"))
|
2021-09-27 17:26:48 +02:00
|
|
|
return super().unlink()
|