blob: 5bacec676105308382e6e2414d7c503b7d4ae6fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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'))
|