mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #56 from akretion/8.0
[MIG] Port account_journal_always_check_date to v8 and new API
This commit is contained in:
@@ -14,4 +14,4 @@ It provides addons to:
|
||||
- Force draft accounting by default
|
||||
- Enforce partners on account moves
|
||||
|
||||
And munch more.
|
||||
And much more.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Account Journal Always Check Date module for OpenERP
|
||||
# Copyright (C) 2013 Akretion (http://www.akretion.com)
|
||||
# Copyright (C) 2013-2014 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -2,7 +2,7 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Account Journal Always Check Date module for OpenERP
|
||||
# Copyright (C) 2013 Akretion (http://www.akretion.com)
|
||||
# Copyright (C) 2013-2014 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -49,7 +49,6 @@ for any help or question about this module.
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['account'],
|
||||
'data': [],
|
||||
'images': ['images/always_check_date_constraint.jpg'],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Account Journal Always Check Date module for OpenERP
|
||||
# Copyright (C) 2013 Akretion (http://www.akretion.com)
|
||||
# Copyright (C) 2013-2014 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -20,13 +20,13 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import orm
|
||||
from openerp.tools.translate import _
|
||||
from openerp import models, fields, api, _
|
||||
|
||||
|
||||
class account_journal(orm.Model):
|
||||
class account_journal(models.Model):
|
||||
_inherit = 'account.journal'
|
||||
|
||||
@api.v7
|
||||
def init(self, cr):
|
||||
'''Activate 'Check Date in Period' on all existing journals'''
|
||||
cr.execute(
|
||||
@@ -34,21 +34,12 @@ class account_journal(orm.Model):
|
||||
"WHERE allow_date <> true")
|
||||
return True
|
||||
|
||||
_defaults = {
|
||||
'allow_date': True,
|
||||
}
|
||||
allow_date = fields.Boolean(default=True)
|
||||
|
||||
def _allow_date_always_active(self, cr, uid, ids):
|
||||
for journal in self.browse(cr, uid, ids):
|
||||
if not journal.allow_date:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("The option 'Check Date in Period' must be active "
|
||||
"on journal '%s'.")
|
||||
% journal.name
|
||||
)
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_allow_date_always_active, "Error msg in raise", ['allow_date']),
|
||||
]
|
||||
@api.one
|
||||
@api.constrains('allow_date')
|
||||
def _allow_date_always_active(self):
|
||||
if not self.allow_date:
|
||||
raise Warning(
|
||||
_("The option 'Check Date in Period' must be active "
|
||||
"on journal '%s'.") % self.name)
|
||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Reference in New Issue
Block a user