mirror of
https://gitlab.com/flectra-community/account-closing.git
synced 2024-11-22 13:42:06 +00:00
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
# Copyright 2019-2021 Akretion France (https://akretion.com/)
|
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from flectra import _, models
|
|
from flectra.exceptions import UserError
|
|
|
|
|
|
class AccountMove(models.Model):
|
|
_inherit = "account.move"
|
|
|
|
def _post(self, soft=True):
|
|
for move in self:
|
|
for line in move.line_ids:
|
|
if (
|
|
line.product_id
|
|
and line.product_id.must_have_dates
|
|
and (not line.start_date or not line.end_date)
|
|
):
|
|
raise UserError(
|
|
_(
|
|
"Missing Start Date and End Date for invoice "
|
|
"line with Product '%s' which has the "
|
|
"property 'Must Have Start/End Dates'."
|
|
)
|
|
% (line.product_id.display_name)
|
|
)
|
|
return super()._post(soft=soft)
|