[ADD,MOD] account : wizard invoice state converted to the osv memory wizard

bzr revid: vir@tinyerp.com-20100420053142-fon34f3niaswn659
This commit is contained in:
Vir (Open ERP) 2010-04-20 11:01:42 +05:30
parent 0aa38aafa3
commit 666a5203fe
6 changed files with 140 additions and 63 deletions

View File

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

View File

@ -85,9 +85,9 @@
<wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account Balance"/>
<wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
<wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>
<wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>
<!-- <wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>-->
<!-- <wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>-->
<!---->
<!-- account.move validate -->
<!-- <wizard id="wizard_validate_account_moves" menu="False" model="account.move" name="account.move.validate" string="Validate Ledger Postings"/>

View File

@ -42,7 +42,7 @@ import account_vat
import account_open_closed_fiscalyear
import wizard_compare_account_balance_report
import wizard_invoice_state
import account_invoice_state
import wizard_account_duplicate
import account_chart
import wizard_move_line_select

View File

@ -0,0 +1,62 @@
# -*- 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
from tools.translate import _
import netsvc
class account_invoice_confirm(osv.osv_memory):
"""
This wizard will confirm the all the selected draft invoices
"""
_name = "account.invoice.confirm"
_description = "Confirm the selected invoices"
def invoice_confirm(self, cr, uid, ids, context=None):
wf_service = netsvc.LocalService('workflow')
if context is None:
context = {}
for id in context['active_ids']:
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
return {}
account_invoice_confirm()
class account_invoice_cancel(osv.osv_memory):
"""
This wizard will cancel the all the selected invoices.
If in the journal, the option allow cancelling entry is not selected then it will give warning message.
"""
_name = "account.invoice.cancel"
_description = "Cancel the selected invoices"
def invoice_cancel(self, cr, uid, ids, context=None):
wf_service = netsvc.LocalService('workflow')
if context is None:
context = {}
for id in context['active_ids']:
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
return {}
account_invoice_cancel()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,73 @@
<openerp>
<data>
<record id="account_invoice_confirm_view" model="ir.ui.view">
<field name="name">account.invoice.confirm.form</field>
<field name="model">account.invoice.confirm</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Confirm draft invoices">
<separator string="Confirm draft invoices" colspan="4"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-execute" string="Confirm Invoices" name="invoice_confirm" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_invoice_confirm" model="ir.actions.act_window">
<field name="name">Confirm draft invoices</field>
<field name="res_model">account.invoice.confirm</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_invoice_confirm_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_invoice_confirm_values">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Confirm draft invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
<record id="account_invoice_cancel_view" model="ir.ui.view">
<field name="name">account.invoice.cancel.form</field>
<field name="model">account.invoice.cancel</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cancel selected invoices">
<separator string="Cancel selected invoices" colspan="4"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-execute" string="Cancel selected invoices" name="invoice_cancel" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_invoice_cancel" model="ir.actions.act_window">
<field name="name">Cancel selected invoices</field>
<field name="res_model">account.invoice.cancel</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_invoice_cancel_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_invoice_cancel_values">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Cancel selected invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
</data>
</openerp>

View File

@ -1,59 +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 netsvc
def _invoice_confirm(self, cr, uid, data, context):
wf_service = netsvc.LocalService('workflow')
for id in data['ids']:
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
return {}
class wizard_invoice_confirm(wizard.interface):
states = {
'init': {
'actions': [_invoice_confirm],
'result': {'type':'state', 'state':'end'}
}
}
wizard_invoice_confirm('account.invoice.state.confirm')
def _invoice_cancel(self, cr, uid, data, context):
wf_service = netsvc.LocalService('workflow')
for id in data['ids']:
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
return {}
class wizard_invoice_cancel(wizard.interface):
states = {
'init': {
'actions': [_invoice_cancel],
'result': {'type':'state', 'state':'end'}
}
}
wizard_invoice_cancel('account.invoice.state.cancel')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: