diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py
index 5939437ce1d..c512eb63701 100644
--- a/addons/account/wizard/account_automatic_reconcile.py
+++ b/addons/account/wizard/account_automatic_reconcile.py
@@ -248,4 +248,4 @@ class account_automatic_reconcile(osv.osv_memory):
account_automatic_reconcile()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py
index ebc11e1dabf..5b03710659e 100644
--- a/addons/account/wizard/account_change_currency.py
+++ b/addons/account/wizard/account_change_currency.py
@@ -19,6 +19,7 @@
# along with this program. If not, see .
#
##############################################################################
+
from osv import osv, fields
from tools.translate import _
@@ -77,4 +78,4 @@ class account_change_currency(osv.osv_memory):
account_change_currency()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py
index b8e18659327..22dd7505f74 100644
--- a/addons/account/wizard/account_chart.py
+++ b/addons/account/wizard/account_chart.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
import time
from osv import fields, osv
from tools.translate import _
@@ -40,8 +41,9 @@ class account_chart(osv.osv_memory):
def _get_fiscalyear(self, cr, uid, context=None):
"""Return default Fiscalyear value"""
+ fy_obj = self.pool.get('account.fiscalyear')
now = time.strftime('%Y-%m-%d')
- fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now)], limit=1 )
+ fiscalyears = fy_obj.search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now)], limit=1 )
return fiscalyears and fiscalyears[0] or False
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
@@ -81,19 +83,21 @@ class account_chart(osv.osv_memory):
"""
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
+ period_obj = self.pool.get('account.period')
+ fy_obj = self.pool.get('account.fiscalyear')
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
result = act_obj.read(cr, uid, [id], context=context)[0]
- result['periods'] = []
+ result['periods'] = []
if data['period_from'] and data['period_to']:
- result['periods'] = self.pool.get('account.period').build_ctx_periods(cr, uid, data['period_from'], data['period_to'])
+ result['periods'] = period_obj.build_ctx_periods(cr, uid, data['period_from'], data['period_to'])
result['context'] = str({'fiscalyear': data['fiscalyear'], 'periods': result['periods'], \
'state': data['target_move']})
if data['fiscalyear']:
- result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']], context=context)[0]['code']
+ result['name'] += ':' + fy_obj.read(cr, uid, [data['fiscalyear']], context=context)[0]['code']
return result
_defaults = {
@@ -103,4 +107,4 @@ class account_chart(osv.osv_memory):
account_chart()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index d58ef42cf6f..2f793b77d67 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
from osv import fields, osv
from tools.translate import _
@@ -220,4 +221,4 @@ class account_fiscalyear_close(osv.osv_memory):
account_fiscalyear_close()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_fiscalyear_close_state.py b/addons/account/wizard/account_fiscalyear_close_state.py
index 4c0a29d6896..9a559d039da 100644
--- a/addons/account/wizard/account_fiscalyear_close_state.py
+++ b/addons/account/wizard/account_fiscalyear_close_state.py
@@ -61,4 +61,4 @@ class account_fiscalyear_close_state(osv.osv_memory):
account_fiscalyear_close_state()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
index 29d67859ca5..0c866853594 100644
--- a/addons/account/wizard/account_invoice_refund.py
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -84,7 +84,7 @@ class account_invoice_refund(osv.osv_memory):
wf_service = netsvc.LocalService('workflow')
inv_tax_obj = self.pool.get('account.invoice.tax')
inv_line_obj = self.pool.get('account.invoice.line')
-
+ res_users_obj = self.pool.get('res.users')
if context is None:
context = {}
@@ -93,7 +93,7 @@ class account_invoice_refund(osv.osv_memory):
date = False
period = False
description = False
- company = self.pool.get('res.users').browse(cr, uid, uid).company_id
+ company = res_users_obj.browse(cr, uid, uid).company_id
journal_id = form.get('journal_id', False)
for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
if inv.state in ['draft', 'proforma2', 'cancel']:
diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py
index 3b63ed843d1..fb2e488ac2f 100644
--- a/addons/account/wizard/account_invoice_state.py
+++ b/addons/account/wizard/account_invoice_state.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
from osv import fields, osv
from tools.translate import _
import netsvc
diff --git a/addons/account/wizard/account_journal_select.py b/addons/account/wizard/account_journal_select.py
index e11660a42af..ab59c252917 100644
--- a/addons/account/wizard/account_journal_select.py
+++ b/addons/account/wizard/account_journal_select.py
@@ -45,8 +45,6 @@ class account_journal_select(osv.osv_memory):
result['context'] = str({'journal_id': journal_id, 'period_id': period_id})
return result
-
account_journal_select()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_move_bank_reconcile.py b/addons/account/wizard/account_move_bank_reconcile.py
index fd1d56011ec..2935aa5358d 100644
--- a/addons/account/wizard/account_move_bank_reconcile.py
+++ b/addons/account/wizard/account_move_bank_reconcile.py
@@ -18,11 +18,11 @@
# along with this program. If not, see .
#
##############################################################################
+
import tools
from osv import fields, osv
from tools.translate import _
-
class account_move_bank_reconcile(osv.osv_memory):
"""
Bank Reconciliation
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
index 02cd614ee5d..9564fdb37e7 100644
--- a/addons/account/wizard/account_move_journal.py
+++ b/addons/account/wizard/account_move_journal.py
@@ -31,7 +31,8 @@ class account_move_journal(osv.osv_memory):
"""
Return default account period value
"""
- ids = self.pool.get('account.period').find(cr, uid, context=context)
+ account_period_obj = self.pool.get('account.period')
+ ids = account_period_obj.find(cr, uid, context=context)
period_id = False
if ids:
period_id = ids[0]
@@ -119,6 +120,7 @@ class account_move_journal(osv.osv_memory):
period_pool = self.pool.get('account.journal.period')
data_pool = self.pool.get('ir.model.data')
journal_pool = self.pool.get('account.journal')
+ account_period_obj = self.pool.get('account.period')
if context is None:
context = {}
@@ -132,7 +134,7 @@ class account_move_journal(osv.osv_memory):
if not ids:
journal = journal_pool.browse(cr, uid, journal_id)
- period = self.pool.get('account.period').browse(cr, uid, period_id)
+ period = account_period_obj.browse(cr, uid, period_id)
name = journal.name
state = period.state
@@ -169,4 +171,4 @@ class account_move_journal(osv.osv_memory):
account_move_journal()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_move_line_reconcile_select.py b/addons/account/wizard/account_move_line_reconcile_select.py
index 8538270c723..d51b78f8db4 100644
--- a/addons/account/wizard/account_move_line_reconcile_select.py
+++ b/addons/account/wizard/account_move_line_reconcile_select.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
from osv import fields, osv
from tools.translate import _
diff --git a/addons/account/wizard/account_open_closed_fiscalyear.py b/addons/account/wizard/account_open_closed_fiscalyear.py
index 229a0d5d06d..3b7dc0743fc 100644
--- a/addons/account/wizard/account_open_closed_fiscalyear.py
+++ b/addons/account/wizard/account_open_closed_fiscalyear.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
from osv import fields, osv
from tools.translate import _
@@ -30,15 +31,19 @@ class account_open_closed_fiscalyear(osv.osv_memory):
}
def remove_entries(self, cr, uid, ids, context={}):
+ fy_obj = self.pool.get('account.fiscalyear')
+ move_obj = self.pool.get('account.move')
+
data = self.read(cr, uid, ids, [])[0]
- data_fyear = self.pool.get('account.fiscalyear').browse(cr, uid, data['fyear_id'])
+ data_fyear = fy_obj.browse(cr, uid, data['fyear_id'])
if not data_fyear.end_journal_period_id:
raise osv.except_osv(_('Error'), _('No journal for ending writing has been defined for the fiscal year'))
period_journal = data_fyear.end_journal_period_id
- ids_move = self.pool.get('account.move').search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
+ ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
if ids_move:
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))
return {}
account_open_closed_fiscalyear()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_period_close.py b/addons/account/wizard/account_period_close.py
index 5342f4b8334..1bc34c39b80 100644
--- a/addons/account/wizard/account_period_close.py
+++ b/addons/account/wizard/account_period_close.py
@@ -39,6 +39,7 @@ class account_period_close(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param ids: account period close’s ID or list of IDs
"""
+ period_pool = self.pool.get('account.period')
mode = 'done'
for form in self.read(cr, uid, ids, context=context):
@@ -48,7 +49,6 @@ class account_period_close(osv.osv_memory):
cr.execute('update account_period set state=%s where id=%s', (mode, id))
# Log message for Period
- period_pool = self.pool.get('account.period')
for period_id, name in period_pool.name_get(cr, uid, [id]):
period_pool.log(cr, uid, period_id, "Period '%s' is closed, no more modification allowed for this period." % (name))
return {}
diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py
index 13fea538532..1b13064a208 100644
--- a/addons/account/wizard/account_reconcile.py
+++ b/addons/account/wizard/account_reconcile.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
import time
from osv import fields, osv
@@ -72,6 +73,7 @@ class account_move_line_reconcile(osv.osv_memory):
def trans_rec_reconcile_full(self, cr, uid, ids, context=None):
account_move_line_obj = self.pool.get('account.move.line')
+ period_obj = self.pool.get('account.period')
date = False
period_id = False
journal_id= False
@@ -82,7 +84,7 @@ class account_move_line_reconcile(osv.osv_memory):
data = self.read(cr, uid, ids, context=context)
date = time.strftime('%Y-%m-%d')
- ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context)
+ ids = period_obj.find(cr, uid, dt=date, context=context)
if ids:
period_id = ids[0]
#stop the reconciliation process by partner (manual reconciliation) only if there is nothing more to reconcile for this partner
@@ -148,6 +150,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
def trans_rec_reconcile(self, cr, uid, ids, context=None):
account_move_line_obj = self.pool.get('account.move.line')
+ period_obj = self.pool.get('account.period')
if context is None:
context = {}
data = self.read(cr, uid, ids,context=context)[0]
@@ -160,7 +163,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
if context['date_p']:
date = context['date_p']
- ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context)
+ ids = period_obj.find(cr, uid, dt=date, context=context)
if ids:
period_id = ids[0]
@@ -171,4 +174,4 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
account_move_line_reconcile_writeoff()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_reconcile_partner_process.py b/addons/account/wizard/account_reconcile_partner_process.py
index 6b915dfe3c9..2bc920b1993 100644
--- a/addons/account/wizard/account_reconcile_partner_process.py
+++ b/addons/account/wizard/account_reconcile_partner_process.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
import time
from osv import osv, fields
@@ -29,15 +30,15 @@ class account_partner_reconcile_process(osv.osv_memory):
def _get_to_reconcile(self, cr, uid, context=None):
cr.execute("""
- SELECT p_id FROM (SELECT l.partner_id as p_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
- FROM account_move_line AS l LEFT JOIN account_account a ON (l.account_id = a.id)
- LEFT JOIN res_partner p ON (p.id = l.partner_id)
- WHERE a.reconcile = 't'
- AND l.reconcile_id IS NULL
- AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') OR p.last_reconciliation_date IS NULL )
- AND l.state <> 'draft'
- GROUP BY l.partner_id) AS tmp
- WHERE debit > 0
+ SELECT p_id FROM (SELECT l.partner_id as p_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
+ FROM account_move_line AS l LEFT JOIN account_account a ON (l.account_id = a.id)
+ LEFT JOIN res_partner p ON (p.id = l.partner_id)
+ WHERE a.reconcile = 't'
+ AND l.reconcile_id IS NULL
+ AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') OR p.last_reconciliation_date IS NULL )
+ AND l.state <> 'draft'
+ GROUP BY l.partner_id) AS tmp
+ WHERE debit > 0
AND credit > 0
""",(time.strftime('%Y-%m-%d'),)
)
@@ -55,7 +56,9 @@ class account_partner_reconcile_process(osv.osv_memory):
return len(map(lambda x: x[0], cr.fetchall())) + 1
def _get_partner(self, cr, uid, context=None):
- partner = self.pool.get('account.move.line').get_next_partner_only(cr, uid, offset=1, context=context)
+ move_line_obj = self.pool.get('account.move.line')
+
+ partner = move_line_obj.get_next_partner_only(cr, uid, offset=1, context=context)
if not partner:
return False
return partner[0]
@@ -71,9 +74,12 @@ class account_partner_reconcile_process(osv.osv_memory):
return res
def next_partner(self, cr, uid, ids, context=None):
- partner_id = self.pool.get('account.move.line').read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
+ move_line_obj = self.pool.get('account.move.line')
+ res_partner_obj = self.pool.get('res.partner')
+
+ partner_id = move_line_obj.read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
if partner_id:
- self.pool.get('res.partner').write(cr, uid, partner_id[0], {'last_reconciliation_date': time.strftime('%Y-%m-%d')}, context)
+ res_partner_obj.write(cr, uid, partner_id[0], {'last_reconciliation_date': time.strftime('%Y-%m-%d')}, context)
#TODO: we have to find a way to update the context of the current tab (we could open a new tab with the context but it's not really handy)
#TODO: remove that comments when the client side dev is done
return {}
@@ -93,4 +99,4 @@ class account_partner_reconcile_process(osv.osv_memory):
account_partner_reconcile_process()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file