diff --git a/addons/account/wizard/account_aged_trial_balance.py b/addons/account/wizard/account_aged_trial_balance.py index 428bf448296..dee5e20e086 100755 --- a/addons/account/wizard/account_aged_trial_balance.py +++ b/addons/account/wizard/account_aged_trial_balance.py @@ -55,11 +55,11 @@ class account_aged_trial_balance(osv.osv_memory): return company_obj.search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'company_id' : _get_company, - 'period_length' : 30, + 'company_id': _get_company, + 'period_length': 30, 'date1' : time.strftime('%Y-%m-%d'), - 'result_selection' : 'all', - 'direction_selection' : 'past', + 'result_selection': 'all', + 'direction_selection': 'past', } def calc_dates(self, cr, uid, ids, context=None): @@ -103,4 +103,5 @@ class account_aged_trial_balance(osv.osv_memory): } account_aged_trial_balance() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index 1a4a53c4c57..cb5886404b3 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -19,13 +19,12 @@ # ############################################################################## import time -import netsvc +import netsvc from osv import osv, fields from tools.translate import _ class account_automatic_reconcile(osv.osv_memory): - _name = 'account.automatic.reconcile' _description = 'Automatic Reconcile' @@ -240,4 +239,5 @@ 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_central_journal.py b/addons/account/wizard/account_central_journal.py index 49c8a43a04d..b1a0f3c2849 100644 --- a/addons/account/wizard/account_central_journal.py +++ b/addons/account/wizard/account_central_journal.py @@ -18,7 +18,6 @@ # along with this program. If not, see . # ############################################################################## - from osv import osv, fields from tools.translate import _ @@ -40,7 +39,7 @@ class account_central_journal(osv.osv_memory): period_id = datas['form']['period_id'] journal_id = datas['form']['journal_id'] - if type(period_id)==type([]): + if isinstance(period_id, list): ids_final = [] for journal in journal_id: for period in period_id: @@ -58,6 +57,4 @@ class account_central_journal(osv.osv_memory): account_central_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_change_currency.py b/addons/account/wizard/account_change_currency.py index 707a182a2aa..1e23b793d27 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -71,4 +71,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 38f47114490..b619565df3f 100644 --- a/addons/account/wizard/account_chart.py +++ b/addons/account/wizard/account_chart.py @@ -38,7 +38,7 @@ class account_chart(osv.osv_memory): ], 'Target Moves', required = True), } - def _get_defaults(self, cr, uid, context={}): + def _get_defaults(self, cr, uid, context=None): """Return default Fiscalyear value""" fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalyear = fiscalyear_obj.find(cr, uid) @@ -64,10 +64,10 @@ class account_chart(osv.osv_memory): result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']],context=context)[0]['code'] return result - _defaults = { 'fiscalyear': _get_defaults, - 'target_move': lambda * a: 'all' + 'target_move': 'all' } account_chart() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_compare_account_balance_report.py b/addons/account/wizard/account_compare_account_balance_report.py index 9e8d7fded2e..af844854271 100755 --- a/addons/account/wizard/account_compare_account_balance_report.py +++ b/addons/account/wizard/account_compare_account_balance_report.py @@ -140,5 +140,4 @@ class account_compare_account_balance_report(osv.osv_memory): } account_compare_account_balance_report() -# 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 eeb202a0c82..f42857eb13c 100644 --- a/addons/account/wizard/account_fiscalyear_close_state.py +++ b/addons/account/wizard/account_fiscalyear_close_state.py @@ -35,7 +35,7 @@ class account_fiscalyear_close_state(osv.osv_memory): 'sure': fields.boolean('Check this box', required=False) } - def data_save(self, cr, uid, ids, context={}): + def data_save(self, cr, uid, ids, context=None): """ This function close account fiscalyear @param cr: the current row, from the database cursor, diff --git a/addons/account/wizard/account_general_journal.py b/addons/account/wizard/account_general_journal.py index 07a08aba3e2..8bd2913ae62 100644 --- a/addons/account/wizard/account_general_journal.py +++ b/addons/account/wizard/account_general_journal.py @@ -30,7 +30,7 @@ class account_general_journal(osv.osv_memory): 'period_id': fields.many2many('account.period', 'account_period_rel', 'account_id', 'period_id', 'Periods', required=True), } - def check_data(self, cr, uid, ids, context={}): + def check_data(self, cr, uid, ids, context=None): obj_jperiod = self.pool.get('account.journal.period') datas = {} datas['ids'] = [] diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 1942fd56e60..f7e9d79b27a 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -34,7 +34,7 @@ class account_invoice_refund(osv.osv_memory): 'description': fields.char('Description', size=150, required=True), } - def compute_refund(self, cr, uid, ids, mode, context={}): + def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -46,7 +46,11 @@ class account_invoice_refund(osv.osv_memory): account_m_line_obj = self.pool.get('account.move.line') mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') - for form in self.read(cr, uid, ids,context=context): + + if context is None: + context = {} + + for form in self.read(cr, uid, ids, context=context): created_inv = [] date = False period = False @@ -171,7 +175,6 @@ class account_invoice_refund(osv.osv_memory): id = mod_obj.read(cr, uid, result, ['res_id'],context=context)['res_id'] result = act_obj.read(cr, uid, id,context=context) result['res_id'] = created_inv - return result def invoice_refund(self, cr, uid, ids, context={}): diff --git a/addons/account/wizard/account_move_bank_reconcile.py b/addons/account/wizard/account_move_bank_reconcile.py index e2329bf09d9..c339ed18831 100644 --- a/addons/account/wizard/account_move_bank_reconcile.py +++ b/addons/account/wizard/account_move_bank_reconcile.py @@ -34,29 +34,29 @@ class account_move_bank_reconcile(osv.osv_memory): } def action_open_window(self, cr, uid, ids, context={}): - """ - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: account move bank reconcile’s ID or list of IDs - @return: dictionary of Open account move line on given journal_id. - """ - for data in self.read(cr, uid, ids,context=context): - cr.execute('select default_credit_account_id \ - from account_journal where id=%s', (data['journal_id'],)) - account_id = cr.fetchone()[0] - if not account_id: - raise osv.except_osv(_('Error'), _('You have to define \ + """ + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: account move bank reconcile’s ID or list of IDs + @return: dictionary of Open account move line on given journal_id. + """ + data = self.read(cr, uid, ids,context=context)[0] + cr.execute('select default_credit_account_id \ + from account_journal where id=%s', (data['journal_id'],)) + account_id = cr.fetchone()[0] + if not account_id: + raise osv.except_osv(_('Error'), _('You have to define \ the bank account\nin the journal definition for reconciliation.')) - return { - 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id), - 'name': _('Standard Encoding'), - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'account.move.line', - 'view_id': False, - 'context': "{'journal_id': %d}" % (data['journal_id'],), - 'type': 'ir.actions.act_window' - } + return { + 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id), + 'name': _('Standard Encoding'), + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'account.move.line', + 'view_id': False, + 'context': "{'journal_id': %d}" % (data['journal_id'],), + 'type': 'ir.actions.act_window' + } account_move_bank_reconcile() diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index df6e41da566..8fc03cddf9a 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -88,7 +88,6 @@ class account_move_journal(osv.osv_memory): 'search_view_id': res['res_id'] } - _defaults = { 'period_id': _get_period } diff --git a/addons/account/wizard/account_move_line_select.py b/addons/account/wizard/account_move_line_select.py index 474018e2fde..8b3388f7f96 100644 --- a/addons/account/wizard/account_move_line_select.py +++ b/addons/account/wizard/account_move_line_select.py @@ -71,5 +71,4 @@ class account_move_line_select(osv.osv_memory): account_move_line_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_line_unreconcile_select.py b/addons/account/wizard/account_move_line_unreconcile_select.py index 1c44e8548bd..35d442001c7 100644 --- a/addons/account/wizard/account_move_line_unreconcile_select.py +++ b/addons/account/wizard/account_move_line_unreconcile_select.py @@ -23,15 +23,12 @@ from osv import fields, osv from tools.translate import _ import tools - class account_move_line_unreconcile_select(osv.osv_memory): - _name = "account.move.line.unreconcile.select" _description = "Unreconciliation" _columns ={ 'account_id': fields.many2one('account.account','Account',required=True), } - def action_open_window(self, cr, uid, ids, context={}): data = self.read(cr, uid, ids, context=context)[0] return { @@ -46,6 +43,4 @@ class account_move_line_unreconcile_select(osv.osv_memory): account_move_line_unreconcile_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_open_closed_fiscalyear.py b/addons/account/wizard/account_open_closed_fiscalyear.py index b4f0f12b4b8..552e630125d 100644 --- a/addons/account/wizard/account_open_closed_fiscalyear.py +++ b/addons/account/wizard/account_open_closed_fiscalyear.py @@ -18,12 +18,10 @@ # along with this program. If not, see . # ############################################################################## - from osv import fields, osv from tools.translate import _ class account_open_closed_fiscalyear(osv.osv_memory): - _name = "account.open.closed.fiscalyear" _description = "Choose Fiscal Year" _columns = { diff --git a/addons/account/wizard/account_partner_balance_report.py b/addons/account/wizard/account_partner_balance_report.py index 476963bf68b..0c330ed6d1e 100644 --- a/addons/account/wizard/account_partner_balance_report.py +++ b/addons/account/wizard/account_partner_balance_report.py @@ -18,7 +18,6 @@ # along with this program. If not, see . # ############################################################################## - import time from tools.translate import _ @@ -58,13 +57,13 @@ class account_partner_balance(osv.osv_memory): return company_obj.search(cr, uid, [('parent_id', '=', False)])[0] _defaults={ - 'state' : 'none', - 'date1' : time.strftime('%Y-01-01'), - 'date2' : time.strftime('%Y-%m-%d'), - 'result_selection' : 'all', - 'soldeinit' : True, - 'company_id' : _get_company, - 'fiscalyear' : False, + 'state' : 'none', + 'date1' : time.strftime('%Y-01-01'), + 'date2' : time.strftime('%Y-%m-%d'), + 'result_selection' : 'all', + 'soldeinit' : True, + 'company_id' : _get_company, + 'fiscalyear' : False, } def check_state(self, cr, uid, ids, context=None): diff --git a/addons/account/wizard/account_period_close.py b/addons/account/wizard/account_period_close.py index 6e71b079dc0..f0f050e953c 100644 --- a/addons/account/wizard/account_period_close.py +++ b/addons/account/wizard/account_period_close.py @@ -32,7 +32,7 @@ class account_period_close(osv.osv_memory): 'sure': fields.boolean('Check this box'), } - def data_save(self, cr, uid, ids, context={}): + def data_save(self, cr, uid, ids, context=None): """ This function close period @param cr: the current row, from the database cursor, @@ -41,7 +41,7 @@ class account_period_close(osv.osv_memory): """ mode = 'done' - for form in self.read(cr, uid, ids,context=context): + for form in self.read(cr, uid, ids, context=context): if form['sure']: for id in context['active_ids']: cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id)) diff --git a/addons/account/wizard/account_print_journal.py b/addons/account/wizard/account_print_journal.py index a7b81db851d..f40efe3eb99 100644 --- a/addons/account/wizard/account_print_journal.py +++ b/addons/account/wizard/account_print_journal.py @@ -34,10 +34,10 @@ class account_print_journal(osv.osv_memory): } _defaults = { - 'sort_selection': lambda *a: 'date', - } + 'sort_selection': lambda *a: 'date', + } - def check_data(self, cr, uid, ids, context={}): + def check_data(self, cr, uid, ids, context=None): obj_jperiod = self.pool.get('account.journal.period') datas = {} datas['ids'] = [] diff --git a/addons/account/wizard/account_vat.py b/addons/account/wizard/account_vat.py index ba07669dc8d..356599b5c80 100755 --- a/addons/account/wizard/account_vat.py +++ b/addons/account/wizard/account_vat.py @@ -43,7 +43,7 @@ class account_vat_declaration(osv.osv_memory): return company_obj.search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'based_on': lambda *a: 'invoices', + 'based_on': 'invoices', 'company_id': _get_company }