[Add] account: convert account_unreconcile wizard to osv_memory

bzr revid: psi@tinyerp.co.in-20100419062823-zlbgmvk0agczi2fm
This commit is contained in:
psi (Open ERP) 2010-04-19 11:58:23 +05:30
parent 3ad297a8fc
commit 4738eeb564
7 changed files with 143 additions and 80 deletions

View File

@ -68,6 +68,7 @@ module named account_voucherss
'wizard/account_validate_move_view.xml',
'wizard/account_statement_from_invoice_view.xml',
'wizard/account_pay_invoice_view.xml',
'wizard/account_unreconcile_view.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_view.xml',
'account_end_fy.xml',

View File

@ -49,7 +49,7 @@
<!-- manual reconcile -->
<wizard id="wizard_reconcile" model="account.move.line" name="account.move.line.reconcile" string="Reconcile Entries"/>
<wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>
<!-- <wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>-->
<!-- <wizard id="wizard_reconcile_select" menu="False" model="account.move.line" name="account.move.line.reconcile.select" string="Reconcile entries"/>
@ -57,7 +57,7 @@
-->
<!-- unreconcile -->
<wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>
<!-- <wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>-->
<!-- unreconcile

View File

@ -23,7 +23,7 @@ import wizard_automatic_reconcile
import account_move_line_reconcile_select
import account_move_line_unreconcile_select
import wizard_reconcile
import wizard_unreconcile
import account_unreconcile
import account_invoice_refund
import account_pay_invoice
import account_move_journal

View File

@ -0,0 +1,55 @@
# -*- 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 osv import fields, osv
class account_unreconcile(osv.osv_memory):
_name = "account.unreconcile"
_description = "Account Unreconcile"
def trans_unrec(self, cr, uid, ids, context=None):
obj_move_line = self.pool.get('account.move.line')
obj_move_reconcile = self.pool.get('account.move.reconcile')
if context is None:
context = {}
recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id',])
recs = filter(lambda x: x['reconcile_id'], recs)
rec_ids = [rec['reconcile_id'][0] for rec in recs]
if len(rec_ids):
obj_move_reconcile.unlink(cr, uid, rec_ids)
return {}
account_unreconcile()
class account_unreconcile_reconcile(osv.osv_memory):
_name = "account.unreconcile.reconcile"
_description = "Account Unreconcile Reconcile"
def trans_unrec_reconcile(self, cr, uid, ids, context=None):
obj_move_reconcile = self.pool.get('account.move.reconcile')
if context is None:
context = {}
if len(rec_ids):
obj_move_reconcile.unlink(cr, uid, context['active_ids'])
return {}
account_unreconcile_reconcile()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_unreconcile_view" model="ir.ui.view">
<field name="name">Unreconcile Entries</field>
<field name="model">account.unreconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Unreconciliation">
<separator string="Unreconciliation transactions" colspan="4"/>
<image name="gtk-dialog-info"/>
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_unreconcile" model="ir.actions.act_window">
<field name="name">Unreconcile Entries</field>
<field name="res_model">account.unreconcile</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_unreconcile_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_unreconcile_values">
<field name="model_id" ref="account.model_account_move_line" />
<field name="object" eval="1" />
<field name="name">Unreconcile Entries</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_unreconcile'))" />
<field name="key">action</field>
<field name="model">account.move.line</field>
</record>
<record id="account_unreconcile_reconcile_view" model="ir.ui.view">
<field name="name">Unreconcile Entries</field>
<field name="model">account.unreconcile.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Unreconciliation">
<separator string="Unreconciliation transactions" colspan="4"/>
<image name="gtk-dialog-info"/>
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec_reconcile" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_unreconcile_reconcile" model="ir.actions.act_window">
<field name="name">Unreconcile Entries</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.unreconcile.reconcile</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_unreconcile_reconcile_view"/>
<field name="context">{'record_id' : active_id}</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_unreconcile_reconcile_values">
<field name="model_id" ref="account.model_account_move_reconcile" />
<field name="object" eval="1" />
<field name="name">Unreconcile Entries</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_unreconcile_reconcile'))" />
<field name="key">action</field>
<field name="model">account.move.reconcile</field>
</record>
</data>
</openerp>

View File

@ -64,7 +64,7 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="event_registration_values">
<record model="ir.values" id="validate_account_move_line_values">
<field name="model_id" ref="account.model_account_move_line" />
<field name="object" eval="1" />
<field name="name">Validate Ledger Postings</field>

View File

@ -1,76 +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/>.
#
##############################################################################
import wizard
import pooler
_info_form = '''<?xml version="1.0"?>
<form string="Unreconciliation">
<separator string="Unreconciliation transactions" colspan="4"/>
<image name="gtk-dialog-info" colspan="2"/>
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
</form>'''
def _trans_unrec(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id',])
recs = filter(lambda x: x['reconcile_id'], recs)
rec_ids = [rec['reconcile_id'][0] for rec in recs]
if len(rec_ids):
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
return {}
class wiz_unreconcile(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
},
'unrec': {
'actions': [_trans_unrec],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_unreconcile('account.move.line.unreconcile')
def _trans_unrec_reconcile(self, cr, uid, data, context):
rec_ids = data['ids']
if len(rec_ids):
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
return {}
class wiz_unreconcile_reconcile(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
},
'unrec': {
'actions': [_trans_unrec_reconcile],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_unreconcile_reconcile('account.reconcile.unreconcile')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: