mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #86 from acsone/8.0-del-account_move_validation_improvement-sbi
[DEL] account_move_validation_improvement is now in official 8.0
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author Matthieu Dietrich. Copyright 2012 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import wizard
|
||||
@@ -1,35 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author Vincent Renaville/Joel Grand-Guillaume.
|
||||
# Copyright 2012 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
##############################################################################
|
||||
{
|
||||
"name": "Wizard to validate multiple moves",
|
||||
"version": "1.0",
|
||||
"depends": ["base", "account", "account_constraints"],
|
||||
"author": "Camptocamp",
|
||||
'license': 'AGPL-3',
|
||||
"description": """
|
||||
Re-defining a base wizard (validate all moves in a period for a journal),
|
||||
but extending it to multiple periods and multiple journals.
|
||||
It replaces the base one defined in addons/account/wizard.
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'data': ['wizard/account_validate_move_view.xml'],
|
||||
'installable': False,
|
||||
'active': False,
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author Matthieu Dietrich. Copyright 2012 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import account_validate_move
|
||||
@@ -1,61 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.osv import fields, orm, osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
|
||||
class ValidateAccountMove(orm.TransientModel):
|
||||
_name = "validate.account.move"
|
||||
_inherit = "validate.account.move"
|
||||
|
||||
_columns = {
|
||||
'journal_ids': fields.many2many('account.journal', string='Journals',
|
||||
required=True),
|
||||
'period_ids': fields.many2many('account.period', string='Periods',
|
||||
required=True,
|
||||
domain=[('state', '<>', 'done')]),
|
||||
# re-define existing fields as non-mandatory
|
||||
'journal_id': fields.many2one('account.journal', 'Journal',
|
||||
required=False),
|
||||
'period_id': fields.many2one('account.period', 'Period',
|
||||
required=False),
|
||||
}
|
||||
|
||||
def validate_move(self, cr, uid, ids, context=None):
|
||||
obj_move = self.pool.get('account.move')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
journal_ids = [journal.id for journal in data.journal_ids]
|
||||
period_ids = [period.id for period in data.period_ids]
|
||||
ids_move = obj_move.search(cr, uid, [('state', '=', 'draft'),
|
||||
('journal_id', 'in', journal_ids),
|
||||
('period_id', '=', period_ids)],
|
||||
order='date',
|
||||
context=context)
|
||||
if not ids_move:
|
||||
raise osv.except_osv(
|
||||
_('Warning!'),
|
||||
_('Specified journal does not have any account move entries '
|
||||
'in draft state for this period.')
|
||||
)
|
||||
obj_move.button_validate(cr, uid, ids_move, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--Account Moves-->
|
||||
<record id="account.validate_account_move_view" model="ir.ui.view">
|
||||
<field name="name">Post Journal Entries</field>
|
||||
<field name="model">validate.account.move</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Post Journal Entries" version="7.0">
|
||||
<group>
|
||||
<field name="journal_ids"/>
|
||||
<field name="period_ids"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Approve" name="validate_move" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user