mirror of
https://gitlab.com/flectra-community/account-closing.git
synced 2024-11-24 22:52:03 +00:00
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
# Copyright 2016 Tecnativa - Antonio Espinosa
|
|
# Copyright 2017 Tecnativa - Pedro M. Baeza
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from flectra import _, fields, models
|
|
|
|
|
|
class AccountMove(models.Model):
|
|
_inherit = "account.move"
|
|
|
|
def _selection_closing_type(self):
|
|
"""Use selection values from move_type field in closing config
|
|
(making a copy for preventing side effects), plus an extra value for
|
|
non-closing moves."""
|
|
res = list(
|
|
self.env["account.fiscalyear.closing.config"].fields_get(
|
|
allfields=["move_type"]
|
|
)["move_type"]["selection"]
|
|
)
|
|
res.append(("none", _("None")))
|
|
return res
|
|
|
|
fyc_id = fields.Many2one(
|
|
comodel_name="account.fiscalyear.closing",
|
|
ondelete="cascade",
|
|
string="Fiscal year closing",
|
|
readonly=True,
|
|
)
|
|
closing_type = fields.Selection(
|
|
selection=_selection_closing_type,
|
|
default="none",
|
|
states={"posted": [("readonly", True)]},
|
|
)
|