[FIX] Account: posted/unposted entries filter

lp bug: https://launchpad.net/bugs/678441 fixed

bzr revid: mra@mra-laptop-20101210103112-kitohyv96eux3ud6
This commit is contained in:
Mustufa Rangwala 2010-12-10 16:01:12 +05:30
parent 74cd546e26
commit 1339b69375
5 changed files with 33 additions and 14 deletions

View File

@ -1170,7 +1170,7 @@
<filter icon="terp-document-new" string="Unbalanced" domain="[('state','=','draft')]" help="Unbalanced Journal Items"/>
<separator orientation="vertical"/>
<filter icon="terp-document-new" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Journal Items"/>
<filter icon="terp-camera_test" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
<filter name="posted" icon="terp-camera_test" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
<separator orientation="vertical"/>
<filter
icon="terp-dolar_ok!"
@ -1216,6 +1216,7 @@
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_posted': 1}</field>
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="help">This view is used by accountants in order to record entries massively in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account, OpenERP will propose to you automatically the Tax related to this account and the counter-part "Account Payable".</field>
</record>

View File

@ -33,8 +33,9 @@ class account_chart(osv.osv_memory):
help = 'Keep empty for all open fiscal years'),
'period_from': fields.many2one('account.period', 'Start period'),
'period_to': fields.many2one('account.period', 'End period'),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required = True),
'target_move': fields.selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], 'Target Moves', required = True),
}
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
@ -92,7 +93,7 @@ class account_chart(osv.osv_memory):
return result
_defaults = {
'target_move': 'all'
'target_move': 'posted'
}
account_chart()

View File

@ -21,7 +21,7 @@
from lxml import etree
from osv import osv
from osv import osv, fields
from tools.translate import _
import tools
@ -29,6 +29,15 @@ class account_move_journal(osv.osv_memory):
_name = "account.move.journal"
_description = "Move journal"
_columns = {
'target_move': fields.selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], 'Target Moves', required=True),
}
_defaults = {
'target_move': 'posted'
}
def _get_period(self, cr, uid, context={}):
"""
Return default account period value
@ -93,6 +102,8 @@ class account_move_journal(osv.osv_memory):
view = """<?xml version="1.0" encoding="utf-8"?>
<form string="Standard entries">
<separator string="Open Journal Items !" colspan="4"/>
<field name="target_move" />
<newline/>
<group colspan="4" >
<label width="300" string="Journal: %s"/>
<newline/>
@ -132,6 +143,7 @@ class account_move_journal(osv.osv_memory):
journal_id = self._get_journal(cr, uid, context)
period_id = self._get_period(cr, uid, context)
target_move = self.read(cr, uid, ids, [])[0]['target_move']
name = _("Journal Items")
if journal_id:
@ -156,23 +168,26 @@ class account_move_journal(osv.osv_memory):
}
period_pool.create(cr, uid, res,context=context)
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context)
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context)
period = period_pool.browse(cr, uid, ids[0], context=context)
name = (period.journal_id.code or '') + ':' + (period.period_id.code or '')
result = data_pool.get_object_reference(cr, uid, 'account', 'view_account_move_line_filter')
res_id = result and result[1] or False
move = 0
if target_move == 'posted':
move = 1
return {
'name': name,
'view_type': 'form',
'view_mode': 'tree,graph,form',
'res_model': 'account.move.line',
'view_id': False,
'context': "{'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (journal_id, journal_id, period_id),
'context': "{'search_default_posted': %d, 'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (move, journal_id, journal_id, period_id),
'type': 'ir.actions.act_window',
'search_view_id': res_id
}
account_move_journal()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -38,8 +38,9 @@ class account_common_report(osv.osv_memory):
'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
'date_from': fields.date("Start Date"),
'date_to': fields.date("End Date"),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
'target_move': fields.selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], 'Target Moves', required=True),
}
@ -101,7 +102,7 @@ class account_common_report(osv.osv_memory):
'journal_ids': _get_all_journal,
'filter': 'filter_no',
'chart_account_id': _get_account,
'target_move': 'all',
'target_move': 'posted',
}
def _build_contexts(self, cr, uid, ids, data, context=None):

View File

@ -31,8 +31,9 @@ class account_tax_chart(osv.osv_memory):
'period_id': fields.many2one('account.period', \
'Period', \
),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
'target_move': fields.selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], 'Target Moves', required=True),
}
def _get_period(self, cr, uid, context=None):
@ -72,7 +73,7 @@ class account_tax_chart(osv.osv_memory):
_defaults = {
'period_id': _get_period,
'target_move': 'all'
'target_move': 'posted'
}
account_tax_chart()