[ADD,MOD] account : wizard account move line select converted to osv memory wizard
bzr revid: vir@tinyerp.com-20100423084957-skicsige368lwrf3
This commit is contained in:
parent
b33b1bb317
commit
c5278a0078
|
@ -74,6 +74,7 @@ module named account_voucherss
|
|||
'wizard/account_use_model_view.xml',
|
||||
'wizard/account_partner_balance_report_view.xml',
|
||||
'wizard/account_balance_report_view.xml',
|
||||
'wizard/account_move_line_select_view.xml',
|
||||
'wizard/account_aged_trial_balance_view.xml',
|
||||
'project/wizard/project_account_analytic_line_view.xml',
|
||||
'account_view.xml',
|
||||
|
|
|
@ -1382,14 +1382,14 @@
|
|||
<field name="domain">[('account_id','child_of', [active_id]),('state','<>','draft')]</field>
|
||||
<field name="context">{'account_id':active_id}</field>
|
||||
</record>
|
||||
<wizard id="wizard_move_line_select" menu="False" model="account.move.line" name="account.move.line.select" string="Move line select"/>
|
||||
<record id="ir_open_account_account" model="ir.values">
|
||||
<field eval="'tree_but_open'" name="key2"/>
|
||||
<field eval="'account.account'" name="model"/>
|
||||
<field name="name">Account Entries</field>
|
||||
<field eval="'ir.actions.wizard,%d'%wizard_move_line_select" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
<!-- <wizard id="wizard_move_line_select" menu="False" model="account.move.line" name="account.move.line.select" string="Move line select"/>-->
|
||||
<!-- <record id="ir_open_account_account" model="ir.values">-->
|
||||
<!-- <field eval="'tree_but_open'" name="key2"/>-->
|
||||
<!-- <field eval="'account.account'" name="model"/>-->
|
||||
<!-- <field name="name">Account Entries</field>-->
|
||||
<!-- <field eval="'ir.actions.wizard,%d'%wizard_move_line_select" name="value"/>-->
|
||||
<!-- <field eval="True" name="object"/>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
<record id="view_move_line_tax_tree" model="ir.ui.view">
|
||||
|
|
|
@ -45,7 +45,7 @@ import wizard_compare_account_balance_report
|
|||
import account_invoice_state
|
||||
import wizard_account_duplicate
|
||||
import account_chart
|
||||
import wizard_move_line_select
|
||||
import account_move_line_select
|
||||
|
||||
import account_validate_account_move
|
||||
import account_use_model
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,54 +15,61 @@
|
|||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class wizard_move_line_select(wizard.interface):
|
||||
def _open_window(self, cr, uid, data, context):
|
||||
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
|
||||
act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
|
||||
account_obj = pooler.get_pool(cr.dbname).get('account.account')
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
class account_move_line_select(osv.osv_memory):
|
||||
"""
|
||||
Account move line select
|
||||
"""
|
||||
_name = "account.move.line.select"
|
||||
_description = "Account move line select"
|
||||
|
||||
if not context.get('fiscalyear', False):
|
||||
def open_window(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
account_obj = self.pool.get('account.account')
|
||||
fiscalyear_obj = self.pool.get('account.fiscalyear')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if 'fiscalyear' not in context:
|
||||
fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
|
||||
else:
|
||||
fiscalyear_ids = [context['fiscalyear']]
|
||||
|
||||
fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
|
||||
fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids)
|
||||
|
||||
period_ids = []
|
||||
for fiscalyear in fiscalyears:
|
||||
for period in fiscalyear.period_ids:
|
||||
period_ids.append(period.id)
|
||||
domain = str(('period_id', 'in', period_ids))
|
||||
if fiscalyears :
|
||||
for fiscalyear in fiscalyears:
|
||||
for period in fiscalyear.period_ids:
|
||||
period_ids.append(period.id)
|
||||
domain = str(('period_id', 'in', period_ids))
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_tree1')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id])[0]
|
||||
result['context'] = {
|
||||
'fiscalyear': context.get('fiscalyear', False),
|
||||
'account_id': data['id']
|
||||
'fiscalyear': False ,
|
||||
'account_id': context['active_id'],
|
||||
'active_id': context['active_id'],
|
||||
}
|
||||
if data['id']:
|
||||
acc_data = account_obj.browse(cr, uid, data['id']).child_consol_ids
|
||||
|
||||
if context['active_id']:
|
||||
acc_data = account_obj.browse(cr, uid, context['active_id']).child_consol_ids
|
||||
if acc_data:
|
||||
result['context'].update({'consolidate_childs': True})
|
||||
result['domain']=result['domain'][0:-1]+','+domain+result['domain'][-1]
|
||||
return result
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _open_window, 'state': 'end'}
|
||||
}
|
||||
}
|
||||
wizard_move_line_select('account.move.line.select')
|
||||
|
||||
account_move_line_select()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_move_line_select_button_view" model="ir.ui.view">
|
||||
<field name="name">Open Move Line Button</field>
|
||||
<field name="model">account.move.line.select</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Account Select">
|
||||
<label string="Are you sure you want to open Account move line entries!" colspan="4"/>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-open" string="Open Entries" name="open_window" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_move_line_select_button" model="ir.actions.act_window">
|
||||
<field name="name">Open Account</field>
|
||||
<field name="res_model">account.move.line.select</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_move_line_select_button_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="ir_account_move_line_select" model="ir.values">
|
||||
<field name="key2">tree_but_open</field>
|
||||
<field name="model">account.account</field>
|
||||
<field name="name">Open Account</field>
|
||||
<field eval="'ir.actions.act_window,%d'%action_account_move_line_select_button" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue