Merge pull request #62 from expsa/fix_bug_fiscalyears_periods
[FIX] fix bug fiscalyears periods
This commit is contained in:
commit
79a9e1a5e1
|
|
@ -2,7 +2,7 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError, Warning
|
||||
from odoo.exceptions import ValidationError, Warning
|
||||
|
||||
|
||||
class CrossoveredBudget(models.Model):
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.osv import expression
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ class AccountFiscalYear(models.Model):
|
|||
"""
|
||||
for rec in self:
|
||||
if rec.state != 'draft':
|
||||
raise UserError(
|
||||
raise ValidationError(
|
||||
_('You cannot delete a fiscal year not in draft state.'))
|
||||
rec.periods_ids.unlink()
|
||||
return super().unlink()
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ class fiscalyears_periods(models.Model):
|
|||
"""
|
||||
for rec in self:
|
||||
if rec.state != 'draft':
|
||||
raise UserError(
|
||||
raise ValidationError(
|
||||
_('You cannot delete a period not in draft state.'))
|
||||
|
||||
self.env['ir.translation'].search([('name', '=', "fiscalyears.periods,name"),
|
||||
|
|
@ -127,7 +127,7 @@ class fiscalyears_periods(models.Model):
|
|||
"""
|
||||
for rec in self:
|
||||
if rec.fiscalyear_id.state not in ['open']:
|
||||
raise UserError(
|
||||
raise ValidationError(
|
||||
_('''You cannot open a period where the fiscalyear not in open state.'''))
|
||||
rec.state = 'open'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue