From 1ca3b3df3421961caec3b747a364071c80f5c7da Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 17:14:58 +0700 Subject: initial commit --- v14_indoteknik/models/account_move.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 v14_indoteknik/models/account_move.py (limited to 'v14_indoteknik/models/account_move.py') diff --git a/v14_indoteknik/models/account_move.py b/v14_indoteknik/models/account_move.py new file mode 100644 index 0000000..5bacec6 --- /dev/null +++ b/v14_indoteknik/models/account_move.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError, RedirectWarning, ValidationError, except_orm, Warning +from datetime import datetime + + +class AccountMove(models.Model): + _inherit = "account.move" + + period_start_date = fields.Date(string="Period") + period_end_date = fields.Date(string="Period") + period_id = fields.Many2one(string="Period") + + def action_post(self): + if self.period_id and self.period_id.state == "Open": + super(AccountMove, self).action_post() + else: + raise ValidationError(_('Period of this Journal has been closed')) -- cgit v1.2.3