[FIX] takes all current fy for taxes amount
bzr revid: fp@tinyerp.com-20111125174908-287t7g8ao6w7wu3q
This commit is contained in:
parent
8df3c70127
commit
9a1e776b18
|
@ -859,7 +859,7 @@ class account_fiscalyear(osv.osv):
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||||
}
|
}
|
||||||
_order = "date_start"
|
_order = "date_start, id"
|
||||||
|
|
||||||
|
|
||||||
def _check_duration(self, cr, uid, ids, context=None):
|
def _check_duration(self, cr, uid, ids, context=None):
|
||||||
|
@ -904,6 +904,10 @@ class account_fiscalyear(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def find(self, cr, uid, dt=None, exception=True, context=None):
|
def find(self, cr, uid, dt=None, exception=True, context=None):
|
||||||
|
res = self.finds(cr, uid, dt, exception, context=context)
|
||||||
|
return res and res[0] or False
|
||||||
|
|
||||||
|
def finds(self, cr, uid, dt=None, exception=True, context=None):
|
||||||
if context is None: context = {}
|
if context is None: context = {}
|
||||||
if not dt:
|
if not dt:
|
||||||
dt = time.strftime('%Y-%m-%d')
|
dt = time.strftime('%Y-%m-%d')
|
||||||
|
@ -918,8 +922,8 @@ class account_fiscalyear(osv.osv):
|
||||||
if exception:
|
if exception:
|
||||||
raise osv.except_osv(_('Error !'), _('No fiscal year defined for this date !\nPlease create one.'))
|
raise osv.except_osv(_('Error !'), _('No fiscal year defined for this date !\nPlease create one.'))
|
||||||
else:
|
else:
|
||||||
return False
|
return []
|
||||||
return ids[0]
|
return ids
|
||||||
|
|
||||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
||||||
if args is None:
|
if args is None:
|
||||||
|
@ -1682,13 +1686,15 @@ class account_tax_code(osv.osv):
|
||||||
if context.get('state', 'all') == 'all':
|
if context.get('state', 'all') == 'all':
|
||||||
move_state = ('draft', 'posted', )
|
move_state = ('draft', 'posted', )
|
||||||
if context.get('fiscalyear_id', False):
|
if context.get('fiscalyear_id', False):
|
||||||
fiscalyear_id = context['fiscalyear_id']
|
fiscalyear_id = [context['fiscalyear_id']]
|
||||||
else:
|
else:
|
||||||
fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid, exception=False)
|
fiscalyear_id = self.pool.get('account.fiscalyear').finds(cr, uid, exception=False)
|
||||||
where = ''
|
where = ''
|
||||||
where_params = ()
|
where_params = ()
|
||||||
if fiscalyear_id:
|
if fiscalyear_id:
|
||||||
pids = map(lambda x: str(x.id), self.pool.get('account.fiscalyear').browse(cr, uid, fiscalyear_id).period_ids)
|
pids = []
|
||||||
|
for fy in fiscalyear_id:
|
||||||
|
pids += map(lambda x: str(x.id), self.pool.get('account.fiscalyear').browse(cr, uid, fy).period_ids)
|
||||||
if pids:
|
if pids:
|
||||||
where = ' AND line.period_id IN %s AND move.state IN %s '
|
where = ' AND line.period_id IN %s AND move.state IN %s '
|
||||||
where_params = (tuple(pids), move_state)
|
where_params = (tuple(pids), move_state)
|
||||||
|
|
Loading…
Reference in New Issue