2
0
account-financial-tools/account_fiscal_month/models/date_range_type.py

20 lines
612 B
Python
Raw Normal View History

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