[add] new module account_move_batch_validate: initial work, unfinished

This commit is contained in:
Leonardo Pistone
2014-01-10 15:05:48 +01:00
parent 3faac10fee
commit 7b28343e8c
7 changed files with 304 additions and 0 deletions

View File

@@ -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 <http://www.gnu.org/licenses/>. #
# #
###############################################################################
"""Account Move Batch Validate."""
import account # noqa
import wizard # noqa

View File

@@ -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 <http://www.gnu.org/licenses/>. #
# #
###############################################################################
{
'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',
}

View File

@@ -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 <http://www.gnu.org/licenses/>. #
# #
###############################################################################
"""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'
),
}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_move_to_post_tree" model="ir.ui.view">
<field name="name">view.move.to_post.tree</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_tree"/>
<field name="arch" type="xml">
<field name="to_check" position="after">
<field name="to_post"/>
</field>
</field>
</record>
<record id="view_move_to_post_form" model="ir.ui.view">
<field name="name">view.move.to_post.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<field name="to_check" position="after">
<field name="to_post"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@@ -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 <http://www.gnu.org/licenses/>. #
# #
###############################################################################
"""Wizard to mark account moves for batch posting."""
import move_marker # noqa

View File

@@ -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 <http://www.gnu.org/licenses/>. #
# #
###############################################################################
"""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()

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_move_marker" model="ir.ui.view">
<field name="name">Mark Jornal Items for Batch Posting</field>
<field name="model">account.move.marker</field>
<field name="arch" type="xml">
<form string="Report Options" version="7.0">
<label string=""/> <!-- binding for inherited views -->
<group col="4">
<field name="chart_account_id" widget='selection' on_change="onchange_chart_id(chart_account_id, context)"/>
<field name="company_id" invisible="1"/>
<field name="fiscalyear_id" domain="[('company_id','=',company_id)]"/>
<field name="action"/>
</group>
<notebook tabpos="up" colspan="4">
<page string="Filters" name="filters">
<group>
<field name="filter" on_change="onchange_filter(filter, fiscalyear_id)"/>
</group>
<group string="Dates" attrs="{'invisible':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}">
<field name="date_from" />
<field name="date_to" />
</group>
<group string="Periods" attrs="{'invisible':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}">
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>
</group>
</page>
<page string="Journals" name="journal_ids">
<field name="journal_ids"/>
</page>
</notebook>
<footer>
<button name="button_mark" string="Mark" type="object" default_focus="1" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_account_move_marker" model="ir.actions.act_window">
<field name="name">Mark Jornal Items for Batch Posting</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.move.marker</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name="Mark Jornal Items for Batch Posting"
parent="account.periodical_processing_journal_entries_validation"
action="action_account_move_marker"
id="menu_account_move_marker"
icon="STOCK_PRINT"/>
</data>
</openerp>