diff --git a/account_move_locking/__openerp__.py b/account_move_locking/__openerp__.py index cfa0974b0..ef79ab44f 100644 --- a/account_move_locking/__openerp__.py +++ b/account_move_locking/__openerp__.py @@ -19,13 +19,13 @@ ############################################################################## { "name": "Move locked to prevent modification", - "version": "8.0.1.0.0", + "version": "9.0.1.0.0", "depends": ["base", "account"], "author": "Camptocamp,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'http://www.camptocamp.com', 'data': ['account_view.xml', 'wizard/account_lock_move_view.xml'], - 'installable': False, + 'installable': True, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_move_locking/account_view.xml b/account_move_locking/account_view.xml index cbcebb132..4d4828c21 100644 --- a/account_move_locking/account_view.xml +++ b/account_move_locking/account_view.xml @@ -6,7 +6,7 @@ account.move - + diff --git a/account_move_locking/wizard/account_lock_account_move.py b/account_move_locking/wizard/account_lock_account_move.py index 6a2e554fd..d1b229abd 100644 --- a/account_move_locking/wizard/account_lock_account_move.py +++ b/account_move_locking/wizard/account_lock_account_move.py @@ -29,11 +29,10 @@ class lock_account_move(models.TransientModel): rel='wizard_lock_account_move_journal', string='Journal', required=True) - period_ids = fields.Many2many('account.period', - rel='wizard_lock_account_move_period', - string='Period', - required=True, - domain=[('state', '<>', 'done')]) + date_start = fields.Datetime(string='Date start', + required=True) + date_end = fields.Datetime(string='Date end', + required=True) @api.multi def lock_move(self, data): @@ -42,8 +41,10 @@ class lock_account_move(models.TransientModel): ('journal_id', 'in', self.journal_ids.ids), - ('period_id', 'in', - self.period_ids.ids)], + ('date', '>=', + self.date_start), + ('date', '<=', + self.date_end)], order='date') if draft_move: raise exceptions.Warning(_('Warning!'), @@ -53,7 +54,8 @@ class lock_account_move(models.TransientModel): move = obj_move.search([('state', '=', 'posted'), ('locked', '=', False), ('journal_id', 'in', self.journal_ids.ids), - ('period_id', 'in', self.period_ids.ids)], + ('date', '>=', self.date_start), + ('date', '<=', self.date_end)], order='date') if not move: raise exceptions.Warning(_('Warning!'), diff --git a/account_move_locking/wizard/account_lock_move_view.xml b/account_move_locking/wizard/account_lock_move_view.xml index 823072932..ebcf94a82 100644 --- a/account_move_locking/wizard/account_lock_move_view.xml +++ b/account_move_locking/wizard/account_lock_move_view.xml @@ -10,7 +10,8 @@
- + +