[IMP] Add Unreconciled Entries as fourth selection ooption in Filter
bzr revid: psi@tinyerp.co.in-20110506062758-6nd4styq6xqojrok
This commit is contained in:
parent
ee0f98590e
commit
887afe3384
|
@ -81,7 +81,8 @@ class account_move_line(osv.osv):
|
|||
period_ids = fiscalperiod_obj.search(cr, uid, [('id', 'in', context['periods'])], order='date_start', limit=1)
|
||||
if period_ids and period_ids[0]:
|
||||
first_period = fiscalperiod_obj.browse(cr, uid, period_ids[0], context=context)
|
||||
query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND date_start <= '%s' AND id NOT IN %s) %s %s" % (fiscalyear_clause, first_period.date_start, tuple(context['periods']), where_move_state, where_move_lines_by_date)
|
||||
ids = ','.join([str(x) for x in context['periods']])
|
||||
query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND date_start <= '%s' AND id NOT IN (%s)) %s %s" % (fiscalyear_clause, first_period.date_start, ids, where_move_state, where_move_lines_by_date)
|
||||
else:
|
||||
ids = ','.join([str(x) for x in context['periods']])
|
||||
query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND id IN (%s)) %s %s" % (fiscalyear_clause, ids, where_move_state, where_move_lines_by_date)
|
||||
|
@ -93,6 +94,7 @@ class account_move_line(osv.osv):
|
|||
#so we have to invalidate this query
|
||||
raise osv.except_osv(_('Warning !'),_("You haven't supplied enough argument to compute the initial balance"))
|
||||
|
||||
|
||||
if context.get('journal_ids', False):
|
||||
query += ' AND '+obj+'.journal_id IN (%s)' % ','.join(map(str, context['journal_ids']))
|
||||
|
||||
|
|
|
@ -62,7 +62,9 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
|||
if self.initial_balance:
|
||||
ctx2.update({'initial_bal': True})
|
||||
self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2)
|
||||
self.reconcil = data['form'].get('reconcil', True)
|
||||
self.reconcil = True
|
||||
if data['form']['filter'] == 'unreconciled':
|
||||
self.reconcil = False
|
||||
self.result_selection = data['form'].get('result_selection', 'customer')
|
||||
self.amount_currency = data['form'].get('amount_currency', False)
|
||||
self.target_move = data['form'].get('target_move', 'all')
|
||||
|
@ -170,7 +172,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
|||
RECONCILE_TAG = " "
|
||||
else:
|
||||
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
|
||||
|
||||
self.cr.execute(
|
||||
"SELECT COALESCE(SUM(l.debit),0.0), COALESCE(SUM(l.credit),0.0), COALESCE(sum(debit-credit), 0.0) " \
|
||||
"FROM account_move_line AS l, " \
|
||||
|
|
|
@ -56,7 +56,7 @@ class account_common_report(osv.osv_memory):
|
|||
return res
|
||||
|
||||
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None):
|
||||
res = {}
|
||||
res = {'value': {}}
|
||||
if filter == 'filter_no':
|
||||
res['value'] = {'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False}
|
||||
if filter == 'filter_date':
|
||||
|
|
|
@ -32,35 +32,27 @@ class account_partner_ledger(osv.osv_memory):
|
|||
_columns = {
|
||||
'initial_balance': fields.boolean('Include initial balances',
|
||||
help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
|
||||
'reconcil': fields.boolean('Include Reconciled Entries', help='Consider reconciled entries'),
|
||||
'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods'), ('unreconciled', 'Unreconciled Entries')], "Filter by", required=True),
|
||||
'page_split': fields.boolean('One Partner Per Page', help='Display Ledger Report with One partner per page'),
|
||||
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
|
||||
|
||||
}
|
||||
_defaults = {
|
||||
'reconcil': True,
|
||||
'initial_balance': False,
|
||||
'page_split': False,
|
||||
}
|
||||
def onchange_initial_balance(self, cr, uid, ids, initial_balance=False, reconcil=False, context=None):
|
||||
res = {'value': {}}
|
||||
if initial_balance:
|
||||
res['value'] = {
|
||||
'reconcil': False
|
||||
}
|
||||
return res
|
||||
|
||||
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None):
|
||||
res = super(account_partner_ledger, self).onchange_filter(cr, uid, ids, filter=filter, fiscalyear_id=fiscalyear_id, context=context)
|
||||
if filter == 'filter_no':
|
||||
res['value'].update({'initial_balance': False})
|
||||
if filter in ['filter_no', 'unreconciled']:
|
||||
res['value'].update({'initial_balance': False, 'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False})
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'filter', 'page_split', 'amount_currency'])[0])
|
||||
if data['form']['page_split']:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
</xpath>
|
||||
<xpath expr="//field[@name='target_move']" position="after">
|
||||
<field name="result_selection"/>
|
||||
<field name="initial_balance" attrs="{'readonly':[('filter', '=', 'filter_no')]}" on_change="onchange_initial_balance(initial_balance, reconcil)"/>
|
||||
<field name="reconcil" attrs="{'readonly':[('initial_balance', '=', True)]}" on_change="onchange_initial_balance(initial_balance, reconcil)"/>
|
||||
<field name="initial_balance" attrs="{'readonly':[('filter', 'in', ('filter_no', 'unreconciled'))]}" />
|
||||
<field name="amount_currency"/>
|
||||
<field name="page_split"/>
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue