diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
| commit | 1ca3b3df3421961caec3b747a364071c80f5c7da (patch) | |
| tree | 6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /v14_indoteknik/models/account_move.py | |
| parent | b57188be371d36d96caac4b8d65a40745c0e972c (diff) | |
initial commit
Diffstat (limited to 'v14_indoteknik/models/account_move.py')
| -rw-r--r-- | v14_indoteknik/models/account_move.py | 19 |
1 files changed, 19 insertions, 0 deletions
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')) |
