[ADD] account: convert account_state_open wizard to osv_memory wizard
bzr revid: psi@tinyerp.co.in-20100409132837-du0sczu7efqfno5j
This commit is contained in:
parent
fa3e8b8a0a
commit
6b96f35c55
|
@ -62,6 +62,7 @@ module named account_voucherss
|
|||
'wizard/account_central_journal_view.xml',
|
||||
'wizard/account_subscription_generate_view.xml',
|
||||
'wizard/account_fiscalyear_close_view.xml',
|
||||
'wizard/account_state_open_view.xml',
|
||||
'project/wizard/project_account_analytic_line_view.xml',
|
||||
'account_view.xml',
|
||||
'account_end_fy.xml',
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-apply"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||
<button name='%(wizard_paid_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
|
||||
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
@ -290,7 +290,7 @@
|
|||
<button name="invoice_open" states="draft,proforma2" string="Create" icon="gtk-execute"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||
<button name='%(wizard_paid_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
|
||||
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<wizard string="Create Entries From Models" model="account.move.line" name="account_use_models" menu="True" id="wizard_line_account_use_model"/>
|
||||
|
||||
<!-- account.invoice -->
|
||||
<wizard string="Open State" model="account.invoice" name="account.wizard_paid_open" menu="False" id="wizard_paid_open" groups="base.group_user"/>
|
||||
<!-- <wizard string="Open State" model="account.invoice" name="account.wizard_paid_open" menu="False" id="wizard_paid_open" groups="base.group_user"/> -->
|
||||
|
||||
<!-- generic report wizard -->
|
||||
<wizard id="wizard_account_balance_report" menu="False" model="account.account" name="account.account.balance.report" string="Account Balance"/>
|
||||
|
|
|
@ -50,7 +50,7 @@ import wizard_move_line_select
|
|||
import wizard_validate_account_move
|
||||
import wizard_use_model
|
||||
|
||||
import wizard_state_open
|
||||
import account_state_open
|
||||
|
||||
import wizard_statement_from_invoice
|
||||
import account_print_journal
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
# -*- 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 osv, fields
|
||||
|
||||
import netsvc
|
||||
from tools.translate import _
|
||||
|
||||
class account_state_open(osv.osv_memory):
|
||||
_name = 'account.state.open'
|
||||
_description = 'Account State Open'
|
||||
|
||||
def change_inv_state(self, cr, uid, ids, context=None):
|
||||
obj_invoice = self.pool.get('account.invoice')
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'active_ids' in context:
|
||||
data_inv = obj_invoice.browse(cr, uid, context['active_ids'][0], context=context)
|
||||
if data_inv.reconciled:
|
||||
raise osv.except_osv(_('Warning'), _('Invoice is already reconciled'))
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
res = wf_service.trg_validate(uid, 'account.invoice', context['active_ids'][0], 'open_test', cr)
|
||||
return {}
|
||||
|
||||
account_state_open()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_state_open" model="ir.ui.view">
|
||||
<field name="name">Account State Open</field>
|
||||
<field name="model">account.state.open</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Invoice">
|
||||
<label string="Are you sure you want to open this invoice ?"/>
|
||||
<newline/>
|
||||
<label string="(Invoice should be unreconciled if you want to open it)"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="2" col="4">
|
||||
<button special="cancel" string="No" icon="gtk-no"/>
|
||||
<button name="change_inv_state" string="Yes" type="object" icon="gtk-yes"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_state_open" model="ir.actions.act_window">
|
||||
<field name="name">Account State Open</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.state.open</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_account_state_open"/>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,58 +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
|
||||
import netsvc
|
||||
from tools.translate import _
|
||||
|
||||
form = '''<?xml version="1.0"?>
|
||||
<form string="Open Invoice">
|
||||
<label string="Are you sure you want to open this invoice ?"/>
|
||||
<newline/>
|
||||
<label string="(Invoice should be unreconciled if you want to open it)"/>
|
||||
</form>'''
|
||||
|
||||
fields = {
|
||||
}
|
||||
|
||||
def _change_inv_state(self, cr, uid, data, context):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
data_inv = pool_obj.get('account.invoice').browse(cr, uid, data['ids'][0])
|
||||
if data_inv.reconciled:
|
||||
raise wizard.except_wizard(_('Warning'), _('Invoice is already reconciled'))
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
res = wf_service.trg_validate(uid, 'account.invoice', data['ids'][0], 'open_test', cr)
|
||||
return {}
|
||||
|
||||
class wiz_state_open(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','No','gtk-no'),('yes','Yes','gtk-yes')]}
|
||||
},
|
||||
'yes': {
|
||||
'actions': [_change_inv_state],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_state_open('account.wizard_paid_open')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
Loading…
Reference in New Issue