diff --git a/account_move_batch_validate/__init__.py b/account_move_batch_validate/__init__.py new file mode 100644 index 000000000..5858ff462 --- /dev/null +++ b/account_move_batch_validate/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Leonardo Pistone +# Copyright 2014 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 . # +# # +############################################################################### +"""Account Move Batch Validate.""" + +import account # noqa +import wizard # noqa diff --git a/account_move_batch_validate/__openerp__.py b/account_move_batch_validate/__openerp__.py new file mode 100644 index 000000000..ebde87356 --- /dev/null +++ b/account_move_batch_validate/__openerp__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Leonardo Pistone +# Copyright 2014 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 . # +# # +############################################################################### +{ + 'name': "Account Move Batch Validate", + 'version': '0.1', + 'author': 'Camptocamp', + 'maintainer': 'Camptocamp', + 'category': 'Finance', + 'complexity': 'normal', + 'depends': [ + 'account', + 'account_default_draft_move', + 'connector', + ], + 'description': """ + Account Move Batch Validate + + This module provides a wizard to post many Journal Entries in batch. it + uses the queue system introduces by the OpenERP Connector to handle a + big quantity of moves in batch. + """, + 'website': 'http://www.camptocamp.com', + 'init_xml': [], + 'update_xml': [ + 'account_view.xml', + 'wizard/move_marker_view.xml', + ], + 'demo_xml': [], + 'test': [], + 'installable': True, + 'images': [], + 'license': 'AGPL-3', +} diff --git a/account_move_batch_validate/account.py b/account_move_batch_validate/account.py new file mode 100644 index 000000000..012f3bfed --- /dev/null +++ b/account_move_batch_validate/account.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Leonardo Pistone +# Copyright 2014 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 . # +# # +############################################################################### +"""Accounting customisation for delayed posting.""" + +from openerp.osv import fields, orm + + +class account_move(orm.Model): + + """We add a field to mark a move for delayed posting.""" + + _name = 'account.move' + _inherit = 'account.move' + + _columns = { + 'to_post': fields.boolean( + 'To Post', + help='Check this box to mark the move for batch posting' + ), + } diff --git a/account_move_batch_validate/account_view.xml b/account_move_batch_validate/account_view.xml new file mode 100644 index 000000000..7fb8d1156 --- /dev/null +++ b/account_move_batch_validate/account_view.xml @@ -0,0 +1,31 @@ + + + + + + view.move.to_post.tree + account.move + + + + + + + + + + + + + view.move.to_post.form + account.move + + + + + + + + + + diff --git a/account_move_batch_validate/wizard/__init__.py b/account_move_batch_validate/wizard/__init__.py new file mode 100644 index 000000000..fd305e63c --- /dev/null +++ b/account_move_batch_validate/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Leonardo Pistone +# Copyright 2014 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 . # +# # +############################################################################### +"""Wizard to mark account moves for batch posting.""" +import move_marker # noqa diff --git a/account_move_batch_validate/wizard/move_marker.py b/account_move_batch_validate/wizard/move_marker.py new file mode 100644 index 000000000..a6cb6ca90 --- /dev/null +++ b/account_move_batch_validate/wizard/move_marker.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Leonardo Pistone +# Copyright 2014 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 . # +# # +############################################################################### +"""Wizards for batch posting.""" + +from openerp.osv import fields, orm + + +class AccountMoveMarker(orm.TransientModel): + + """Wizard to mark account moves for batch posting.""" + + _name = "account.move.marker" + _inherit = "account.common.report" + _description = "Mark Journal Items for batch posting" + + _columns = { + 'action': fields.selection([ + ('mark', 'Mark for posting'), + ('unmark', 'Unmark for posting'), + ], "Action", required=True), + + } + + _defaults = { + 'action': 'mark', + } + + def button_mark(self, cr, uid, ids, context=None): + """Mark/unmark lines and update the queue. Return action.""" + + for wiz in self.browse(cr, uid, ids, context=context): + + move_obj = self.pool['account.move'] + + if wiz.action == 'mark': + import pdb;pdb.set_trace() + elif wiz.action == 'unmark': + # TODO + raise NotImplementedError( + 'The Unmark action is not implemented yet' + ) + if wiz.filter != 'filter_no': + # TODO + raise NotImplementedError( + 'Date and period filter are not implemented yet' + ) + + domain = [] + if wiz.journal_ids: + domain.append(( + 'journal_id', + 'in', + [journal.id for journal in wiz.journal_ids] + )) + + move_ids = move_obj.search(cr, uid, domain, context=context) + move_obj.write + for move in move_ids: + import pdb;pdb.set_trace() \ No newline at end of file diff --git a/account_move_batch_validate/wizard/move_marker_view.xml b/account_move_batch_validate/wizard/move_marker_view.xml new file mode 100644 index 000000000..1387dc7e9 --- /dev/null +++ b/account_move_batch_validate/wizard/move_marker_view.xml @@ -0,0 +1,61 @@ + + + + + + Mark Jornal Items for Batch Posting + account.move.marker + +
+
+
+ + + Mark Jornal Items for Batch Posting + ir.actions.act_window + account.move.marker + form + form + new + + + + +
+