diff --git a/addons/account/account.py b/addons/account/account.py index a9a1a9bdf9e..9176a2eec64 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -343,7 +343,7 @@ class account_account(osv.osv): accounts = self.browse(cr, uid, ids) for account in accounts: level = 0 - if account.parent_id : + if account.parent_id: obj = self.browse(cr, uid, account.parent_id.id) level = obj.level + 1 res[account.id] = level @@ -463,7 +463,7 @@ class account_account(osv.osv): return self.name_get(cr, user, ids, context=context) def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] reads = self.read(cr, uid, ids, ['name', 'code'], context=context) res = [] @@ -661,13 +661,13 @@ class account_journal(osv.osv): def create(self, cr, uid, vals, context=None): if not 'sequence_id' in vals or not vals['sequence_id']: - vals.update({'sequence_id' : self.create_sequence(cr, uid, vals, context)}) + vals.update({'sequence_id': self.create_sequence(cr, uid, vals, context)}) return super(account_journal, self).create(cr, uid, vals, context) def name_get(self, cr, user, ids, context=None): """ Returns a list of tupples containing id, name. - result format : {[(id, name), (id, name), ...]} + result format: {[(id, name), (id, name), ...]} @param cr: A database cursor @param user: ID of the user currently logged in @@ -1014,7 +1014,7 @@ class account_move(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): """ Returns a list of tupples containing id, name, as internally it is called {def name_get} - result format : {[(id, name), (id, name), ...]} + result format: {[(id, name), (id, name), ...]} @param cr: A database cursor @param user: ID of the user currently logged in @@ -1046,7 +1046,7 @@ class account_move(osv.osv): def name_get(self, cursor, user, ids, context=None): if isinstance(ids, (int, long)): ids = [ids] - if not len(ids): + if not ids: return [] res = [] data_move = self.pool.get('account.move').browse(cursor,user,ids) @@ -1088,7 +1088,7 @@ class account_move(osv.osv): if cond[1] in ['=like', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of']: continue - cr.execute("select move_id from account_move_line group by move_id having sum(debit) %s %%s" % (cond[1]) ,(amount,)) + cr.execute("select move_id from account_move_line group by move_id having sum(debit) %s %%s" % (cond[1]),(amount,)) res_ids = set(id[0] for id in cr.fetchall()) ids = ids and (ids & res_ids) or res_ids if ids: @@ -1199,7 +1199,7 @@ class account_move(osv.osv): for line in self.browse(cr, uid, ids, context): if not line.journal_id.update_posted: raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.')) - if len(ids): + if ids: cr.execute('UPDATE account_move '\ 'SET state=%s '\ 'WHERE id IN %s', ('draft', tuple(ids),)) @@ -1387,7 +1387,7 @@ class account_move(osv.osv): # Check whether the move lines are confirmed - if not len(line_draft_ids): + if not line_draft_ids: continue # Update the move lines (set them as valid) @@ -1473,7 +1473,7 @@ class account_move_reconcile(osv.osv): return True def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] result = [] for r in self.browse(cr, uid, ids, context): @@ -1564,7 +1564,7 @@ class account_tax_code(osv.osv): period_id = context['period_id'] else: period_id = self.pool.get('account.period').find(cr, uid) - if not len(period_id): + if not period_id: return dict.fromkeys(ids, 0.0) period_id = period_id[0] return self._sum(cr, uid, ids, name, args, context, @@ -1600,7 +1600,7 @@ class account_tax_code(osv.osv): def name_get(self, cr, uid, ids, context=None): if isinstance(ids, (int, long)): ids = [ids] - if not len(ids): + if not ids: return [] if isinstance(ids, (int, long)): ids = [ids] @@ -1691,7 +1691,7 @@ class account_tax(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): """ Returns a list of tupples containing id, name, as internally it is called {def name_get} - result format : {[(id, name), (id, name), ...]} + result format: {[(id, name), (id, name), ...]} @param cr: A database cursor @param user: ID of the user currently logged in @@ -1733,7 +1733,7 @@ class account_tax(osv.osv): return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count) def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] res = [] for record in self.read(cr, uid, ids, ['description','name'], context=context): @@ -1748,8 +1748,8 @@ class account_tax(osv.osv): return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'python_compute': '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or None\n# partner : res.partner object or None\n\nresult = price_unit * 0.10''', - 'python_compute_inv': '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''', + 'python_compute': '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''', + 'python_compute_inv': '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''', 'applicable_type': 'true', 'type': 'percent', 'amount': 0, @@ -1822,7 +1822,7 @@ class account_tax(osv.osv): data['balance'] = cur_price_unit amount2 = data.get('amount', 0.0) - if len(tax.child_ids): + if tax.child_ids: if tax.child_depend: latest = res.pop() amount = amount2 @@ -1963,7 +1963,7 @@ class account_tax(osv.osv): 'tax_code_id': tax.tax_code_id.id, 'ref_tax_code_id': tax.ref_tax_code_id.id, }) - if len(tax.child_ids): + if tax.child_ids: if tax.child_depend: del res[-1] amount = price_unit @@ -2015,7 +2015,7 @@ class account_model(osv.osv): 'journal_id': fields.many2one('account.journal', 'Journal', required=True), 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), 'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'), - 'legend' :fields.text('Legend', readonly=True, size=100), + 'legend': fields.text('Legend', readonly=True, size=100), } _defaults = { @@ -2159,7 +2159,7 @@ class account_subscription(osv.osv): break if ok: todone.append(sub.id) - if len(todone): + if todone: self.write(cr, uid, todone, {'state':'done'}) return False @@ -2169,7 +2169,7 @@ class account_subscription(osv.osv): for line in sub.lines_id: if not line.move_id.id: toremove.append(line.id) - if len(toremove): + if toremove: self.pool.get('account.subscription.line').unlink(cr, uid, toremove) self.write(cr, uid, ids, {'state':'draft'}) return False @@ -2263,7 +2263,7 @@ class account_account_template(osv.osv): _defaults = { 'reconcile': False, - 'type' : 'view', + 'type': 'view', 'nocreate': False, } @@ -2274,7 +2274,7 @@ class account_account_template(osv.osv): def name_get(self, cr, uid, ids, context={}): - if not len(ids): + if not ids: return [] reads = self.read(cr, uid, ids, ['name','code'], context) res = [] @@ -2362,7 +2362,7 @@ class account_tax_code_template(osv.osv): } def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] if isinstance(ids, (int, long)): ids = [ids] @@ -2394,7 +2394,7 @@ class account_chart_template(osv.osv): 'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'), 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'), 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'), - 'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')] , help='This Account is used for transferring Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profilt & Loss Report'), + 'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profilt & Loss Report'), } account_chart_template() @@ -2440,7 +2440,7 @@ class account_tax_template(osv.osv): } def name_get(self, cr, uid, ids, context={}): - if not len(ids): + if not ids: return [] res = [] for record in self.read(cr, uid, ids, ['description','name'], context): @@ -2455,8 +2455,8 @@ class account_tax_template(osv.osv): return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'python_compute': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or None\n# partner : res.partner object or None\n\nresult = price_unit * 0.10''', - 'python_compute_inv': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''', + 'python_compute': lambda *a: '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''', + 'python_compute_inv': lambda *a: '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''', 'applicable_type': 'true', 'type': 'percent', 'amount': 0, @@ -2822,24 +2822,24 @@ class wizard_multi_charts_accounts(osv.osv_memory): for position in obj_fiscal_position_template.browse(cr, uid, fp_ids): vals_fp = { - 'company_id' : company_id, - 'name' : position.name, + 'company_id': company_id, + 'name': position.name, } new_fp = obj_fiscal_position.create(cr, uid, vals_fp) for tax in position.tax_ids: vals_tax = { - 'tax_src_id' : tax_template_ref[tax.tax_src_id.id], - 'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False, - 'position_id' : new_fp, + 'tax_src_id': tax_template_ref[tax.tax_src_id.id], + 'tax_dest_id': tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False, + 'position_id': new_fp, } obj_tax_fp.create(cr, uid, vals_tax) for acc in position.account_ids: vals_acc = { - 'account_src_id' : acc_template_ref[acc.account_src_id.id], - 'account_dest_id' : acc_template_ref[acc.account_dest_id.id], - 'position_id' : new_fp, + 'account_src_id': acc_template_ref[acc.account_src_id.id], + 'account_dest_id': acc_template_ref[acc.account_dest_id.id], + 'position_id': new_fp, } obj_ac_fp.create(cr, uid, vals_acc) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index fcd4aa95c09..a7b6b66d2c1 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -284,7 +284,7 @@ class account_bank_statement(osv.osv): account=acc_cur) val['amount_currency'] = amount_cur - move_line_id = account_move_line_obj.create(cr, uid, val , context=context) + move_line_id = account_move_line_obj.create(cr, uid, val, context=context) torec.append(move_line_id) # Fill the secondary amount/currency diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 48624253bc6..3cf67c9eb91 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -519,7 +519,6 @@ res_model="account.move.line" src_model="account.invoice"/> - =%s AND date<=%s AND amount<0",query_params) - elif option == "debit" : + elif option == "debit": self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ WHERE account_id IN %s\ AND date>=%s AND date<=%s AND amount>0",query_params) - elif option == "quantity" : + elif option == "quantity": self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ WHERE account_id IN %s\ AND date>=%s AND date<=%s",query_params) @@ -120,7 +120,7 @@ class account_analytic_balance(report_sxw.rml_parse): def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) - if not len(ids): + if not ids: return 0.0 if not self.acc_sum_list: @@ -129,15 +129,15 @@ class account_analytic_balance(report_sxw.rml_parse): self.acc_sum_list = ids2 else: ids2 = self.acc_sum_list - + query_params = (tuple(ids2), date1, date2) - if option == "debit" : + if option == "debit": self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params) - elif option == "credit" : + elif option == "credit": self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params) - elif option == "quantity" : + elif option == "quantity": self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ WHERE account_id IN %s AND date>=%s AND date<=%s",query_params) return self.cr.fetchone()[0] or 0.0 diff --git a/addons/account/project/wizard/account_analytic_chart.py b/addons/account/project/wizard/account_analytic_chart.py index 89155810fc0..22ec9d8a957 100644 --- a/addons/account/project/wizard/account_analytic_chart.py +++ b/addons/account/project/wizard/account_analytic_chart.py @@ -40,9 +40,9 @@ class account_analytic_chart(osv.osv_memory): result = act_obj.read(cr, uid, [id], context=context)[0] data = self.read(cr, uid, ids, [])[0] if data['from_date']: - result_context.update({'from_date' : data['from_date']}) + result_context.update({'from_date': data['from_date']}) if data['to_date']: - result_context.update({'to_date' : data['to_date']}) + result_context.update({'to_date': data['to_date']}) result['context'] = str(result_context) return result diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index 876d23901f4..e04527f16a8 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -38,12 +38,12 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): self.result_temp = [] self.localcontext.update({ 'time': time, - 'get_lines' : self.get_lines, - 'get_lines_another' : self.get_lines_another, + 'get_lines': self.get_lines, + 'get_lines_another': self.get_lines_another, 'get_company': self._get_company, 'get_currency': self._get_currency, - 'sum_dr' : self.sum_dr, - 'sum_cr' : self.sum_cr, + 'sum_dr': self.sum_dr, + 'sum_cr': self.sum_cr, 'get_data':self.get_data, 'get_pl_balance':self.get_pl_balance, 'get_fiscalyear': self._get_fiscalyear, @@ -92,7 +92,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): ctx = self.context.copy() ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) - if data['form']['filter'] == 'filter_period' : + if data['form']['filter'] == 'filter_period': ctx['periods'] = data['form'].get('periods', False) elif data['form']['filter'] == 'filter_date': ctx['date_from'] = data['form'].get('date_from', False) @@ -110,8 +110,8 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): else: self.res_bl['type'] = 'Net Loss' pl_dict = { - 'code' : False, - 'name' : self.res_bl['type'], + 'code': False, + 'name': self.res_bl['type'], 'level': False, 'balance':self.res_bl['balance'], } @@ -120,9 +120,9 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): for account in accounts: if (account.user_type.report_type) and (account.user_type.report_type == typ): account_dict = { - 'id' : account.id, - 'code' : account.code, - 'name' : account.name, + 'id': account.id, + 'code': account.code, + 'name': account.name, 'level': account.level, 'balance':account.balance, } @@ -131,7 +131,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_cr += account.balance if data['form']['display_account'] == 'bal_movement': - if account.credit > 0 or account.debit > 0 or account.balance > 0 : + if account.credit > 0 or account.debit > 0 or account.balance > 0: accounts_temp.append(account_dict) elif data['form']['display_account'] == 'bal_solde': if account.balance != 0: @@ -150,12 +150,12 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))): if i < len(cal_list['liability']) and i < len(cal_list['asset']): temp={ - 'code' : cal_list['liability'][i]['code'], - 'name' : cal_list['liability'][i]['name'], + 'code': cal_list['liability'][i]['code'], + 'name': cal_list['liability'][i]['name'], 'level': cal_list['liability'][i]['level'], 'balance':cal_list['liability'][i]['balance'], - 'code1' : cal_list['asset'][i]['code'], - 'name1' : cal_list['asset'][i]['name'], + 'code1': cal_list['asset'][i]['code'], + 'name1': cal_list['asset'][i]['name'], 'level1': cal_list['asset'][i]['level'], 'balance1':cal_list['asset'][i]['balance'], } @@ -163,24 +163,24 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): else: if i < len(cal_list['asset']): temp={ - 'code' : '', - 'name' : '', + 'code': '', + 'name': '', 'level': False, 'balance':False, - 'code1' : cal_list['asset'][i]['code'], - 'name1' : cal_list['asset'][i]['name'], + 'code1': cal_list['asset'][i]['code'], + 'name1': cal_list['asset'][i]['name'], 'level1': cal_list['asset'][i]['level'], 'balance1':cal_list['asset'][i]['balance'], } self.result_temp.append(temp) if i < len(cal_list['liability']): temp={ - 'code' : cal_list['liability'][i]['code'], - 'name' : cal_list['liability'][i]['name'], + 'code': cal_list['liability'][i]['code'], + 'name': cal_list['liability'][i]['name'], 'level': cal_list['liability'][i]['level'], 'balance':cal_list['liability'][i]['balance'], - 'code1' : '', - 'name1' : '', + 'code1': '', + 'name1': '', 'level1': False, 'balance1':False, } diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 5df50566b0d..0038eb1278f 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -38,7 +38,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): # 'sum_debit': self._sum_debit, # 'sum_credit': self._sum_credit, 'get_currency': self._get_currency, - 'comma_me' : self.comma_me, + 'comma_me': self.comma_me, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_account': self._get_account, @@ -103,7 +103,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): "AND " + self.query +" " \ "AND l.account_id IN %s " \ " " + PARTNER_REQUEST + " " \ - "AND account.active " , + "AND account.active ", (tuple(move_state), tuple(self.account_ids),)) res = self.cr.dictfetchall() @@ -115,9 +115,9 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): return super(third_party_ledger, self).set_context(objects, data, new_ids, report_type) def comma_me(self, amount): - if type(amount) is float : + if type(amount) is float: amount = str('%.2f'%amount) - else : + else: amount = str(amount) if (amount == '0'): return ' ' @@ -186,7 +186,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): result_tmp = 0.0 result_init = 0.0 - if self.reconcil : + if self.reconcil: RECONCILE_TAG = " " else: RECONCILE_TAG = "AND reconcile_id IS NULL" @@ -217,7 +217,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): "AND m.state IN %s " "AND account_id IN %s" \ " " + RECONCILE_TAG + " " \ - "AND " + self.query + " " , + "AND " + self.query + " ", (partner.id, tuple(move_state), tuple(self.account_ids),)) contemp = self.cr.fetchone() @@ -235,7 +235,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): result_tmp = 0.0 result_init = 0.0 - if self.reconcil : + if self.reconcil: RECONCILE_TAG = " " else: RECONCILE_TAG = "AND reconcile_id IS NULL" @@ -266,7 +266,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): "AND m.state IN %s " "AND account_id IN %s" \ " " + RECONCILE_TAG + " " \ - "AND " + self.query + " " , + "AND " + self.query + " ", (partner.id, tuple(move_state), tuple(self.account_ids),)) contemp = self.cr.fetchone() @@ -401,7 +401,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): return False def _display_currency(self, data): - if self.amount_currency : + if self.amount_currency: return True return False diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 84a7a4f8dbf..792b88053a1 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -36,13 +36,13 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): self.result_temp = [] self.localcontext.update( { 'time': time, - 'get_lines' : self.get_lines, - 'get_lines_another' : self.get_lines_another, + 'get_lines': self.get_lines, + 'get_lines_another': self.get_lines_another, 'get_currency': self._get_currency, 'get_data': self.get_data, - 'sum_dr' : self.sum_dr, - 'sum_cr' : self.sum_cr, - 'final_result' : self.final_result, + 'sum_dr': self.sum_dr, + 'sum_cr': self.sum_cr, + 'final_result': self.final_result, 'get_fiscalyear': self._get_fiscalyear, 'get_account': self._get_account, 'get_start_period': self.get_start_period, @@ -86,7 +86,7 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): ctx = self.context.copy() ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) - if data['form']['filter'] == 'filter_period' : + if data['form']['filter'] == 'filter_period': ctx['periods'] = data['form'].get('periods', False) elif data['form']['filter'] == 'filter_date': ctx['date_from'] = data['form'].get('date_from', False) @@ -106,7 +106,7 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_cr += abs(account.debit - account.credit) if data['form']['display_account'] == 'bal_movement': - if account.credit > 0 or account.debit > 0 or account.balance > 0 : + if account.credit > 0 or account.debit > 0 or account.balance > 0: accounts_temp.append(account) elif data['form']['display_account'] == 'bal_solde': if account.balance != 0: @@ -126,12 +126,12 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): for i in range(0,max(len(cal_list['expense']),len(cal_list['income']))): if i < len(cal_list['expense']) and i < len(cal_list['income']): temp={ - 'code' : cal_list['expense'][i].code, - 'name' : cal_list['expense'][i].name, + 'code': cal_list['expense'][i].code, + 'name': cal_list['expense'][i].name, 'level': cal_list['expense'][i].level, 'balance':cal_list['expense'][i].balance, - 'code1' : cal_list['income'][i].code, - 'name1' : cal_list['income'][i].name, + 'code1': cal_list['income'][i].code, + 'name1': cal_list['income'][i].name, 'level1': cal_list['income'][i].level, 'balance1':cal_list['income'][i].balance, } @@ -139,24 +139,24 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): else: if i < len(cal_list['income']): temp={ - 'code' : '', - 'name' : '', + 'code': '', + 'name': '', 'level': False, 'balance':False, - 'code1' : cal_list['income'][i].code, - 'name1' : cal_list['income'][i].name, + 'code1': cal_list['income'][i].code, + 'name1': cal_list['income'][i].name, 'level1': cal_list['income'][i].level, 'balance1':cal_list['income'][i].balance, } self.result_temp.append(temp) if i < len(cal_list['expense']): temp={ - 'code' : cal_list['expense'][i].code, - 'name' : cal_list['expense'][i].name, + 'code': cal_list['expense'][i].code, + 'name': cal_list['expense'][i].name, 'level': cal_list['expense'][i].level, 'balance':cal_list['expense'][i].balance, - 'code1' : '', - 'name1' : '', + 'code1': '', + 'name1': '', 'level1': False, 'balance1':False, } diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py index ff90235c5c6..d9bcabf0ce4 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/account_tax_report.py @@ -36,7 +36,7 @@ class tax_report(rml_parse.rml_parse): 'get_general': self._get_general, 'get_company': self._get_company, 'get_currency': self._get_currency, - 'get_lines' : self._get_lines, + 'get_lines': self._get_lines, }) @@ -45,12 +45,12 @@ class tax_report(rml_parse.rml_parse): if period_list: res = self._add_codes(based_on, res, period_list, context=context) - else : + else: self.cr.execute ("select id from account_fiscalyear") fy = self.cr.fetchall() self.cr.execute ("select id from account_period where fiscalyear_id = %s",(fy[0][0],)) periods = self.cr.fetchall() - for p in periods : + for p in periods: period_list.append(p[0]) res = self._add_codes(based_on, res, period_list, context=context) @@ -58,20 +58,20 @@ class tax_report(rml_parse.rml_parse): top_result = [] while i < len(res): - res_dict = { 'code' : res[i][1].code, - 'name' : res[i][1].name, - 'debit' : 0, - 'credit' : 0, - 'tax_amount' : res[i][1].sum_period, - 'type' : 1, - 'level' : res[i][0], - 'pos' : 0 + res_dict = { 'code': res[i][1].code, + 'name': res[i][1].name, + 'debit': 0, + 'credit': 0, + 'tax_amount': res[i][1].sum_period, + 'type': 1, + 'level': res[i][0], + 'pos': 0 } top_result.append(res_dict) res_general = self._get_general(res[i][1].id, period_list, company_id, based_on, context=context) ind_general = 0 - while ind_general < len(res_general) : + while ind_general < len(res_general): res_general[ind_general]['type'] = 2 res_general[ind_general]['pos'] = 0 res_general[ind_general]['level'] = res_dict['level'] @@ -84,7 +84,7 @@ class tax_report(rml_parse.rml_parse): def _get_period(self, period_id, context={}): return self.pool.get('account.period').browse(self.cr, self.uid, period_id, context=context).name - def _get_general(self, tax_code_id, period_list ,company_id, based_on, context={}): + def _get_general(self, tax_code_id, period_list,company_id, based_on, context={}): res=[] obj_account = self.pool.get('account.account') periods_ids = tuple(period_list) @@ -112,7 +112,7 @@ class tax_report(rml_parse.rml_parse): GROUP BY account.id,account.name,account.code', ('draft', tax_code_id, company_id, periods_ids, 'paid',)) - else : + else: self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \ SUM(line.debit) AS debit, \ SUM(line.credit) AS credit, \ @@ -191,14 +191,14 @@ class tax_report(rml_parse.rml_parse): while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ): tot_elem = copy.copy(accounts[bcl_rup_ind], context=context) - res_tot = { 'code' : accounts[bcl_rup_ind]['code'], - 'name' : '', - 'debit' : 0, - 'credit' : 0, - 'tax_amount' : accounts[bcl_rup_ind]['tax_amount'], - 'type' : accounts[bcl_rup_ind]['type'], - 'level' : 0, - 'pos' : 0 + res_tot = { 'code': accounts[bcl_rup_ind]['code'], + 'name': '', + 'debit': 0, + 'credit': 0, + 'tax_amount': accounts[bcl_rup_ind]['tax_amount'], + 'type': accounts[bcl_rup_ind]['type'], + 'level': 0, + 'pos': 0 } if res_tot['type'] == 1: diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 8422ece3fcb..c03176a0536 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -43,7 +43,7 @@ class account_move_journal(osv.osv_memory): """ journal_id = False - + journal_pool = self.pool.get('account.journal') if context.get('journal_type', False): jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))]) @@ -52,7 +52,7 @@ class account_move_journal(osv.osv_memory): journal_id = jids[0] return journal_id - + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @@ -62,7 +62,7 @@ class account_move_journal(osv.osv_memory): @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model - + @return: Returns a dict that contains definition for fields, views, and toolbars """ @@ -115,47 +115,47 @@ class account_move_journal(osv.osv_memory): @param ids: account move journal’s ID or list of IDs @return: dictionary of Open action move line window on given period and Journal/Payment Mode """ - + period_pool = self.pool.get('account.journal.period') data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') - + if context is None: context = {} - + journal_id = self._get_journal(cr, uid, context) period_id = self._get_period(cr, uid, context) name = _("Journal Items") if journal_id: ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context) - - if not len(ids): + + if not ids: journal = journal_pool.browse(cr, uid, journal_id) period = self.pool.get('account.period').browse(cr, uid, period_id) - + name = journal.name state = period.state - + if state == 'done': raise osv.except_osv(_('UserError'), _('This period is already closed !')) - + company = period.company_id.id res = { - 'name': name, - 'period_id': period_id, - 'journal_id': journal_id, + 'name': name, + 'period_id': period_id, + 'journal_id': journal_id, 'company_id': company } period_pool.create(cr, uid, res,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_id(cr, uid, 'account', 'view_account_move_line_filter') res_id = data_pool.browse(cr, uid, result, context=context).res_id - + return { 'name': name, 'view_type': 'form', @@ -166,7 +166,7 @@ class account_move_journal(osv.osv_memory): 'type': 'ir.actions.act_window', 'search_view_id': res_id } - + account_move_journal() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_report_aged_partner_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py index f421f3735fa..f13214cb6da 100644 --- a/addons/account/wizard/account_report_aged_partner_balance.py +++ b/addons/account/wizard/account_report_aged_partner_balance.py @@ -40,7 +40,7 @@ class account_aged_trial_balance(osv.osv_memory): } _defaults = { 'period_length': 30, - 'date_from' : time.strftime('%Y-%m-%d'), + 'date_from': time.strftime('%Y-%m-%d'), 'direction_selection': 'past', } @@ -84,7 +84,7 @@ class account_aged_trial_balance(osv.osv_memory): for i in range(5): stop = start + relativedelta(days=period_length) res[str(5-(i+1))] = { - 'name' : (i!=4 and str((i) * period_length)+'-' + str((i+1) * period_length) or ('+'+str(4 * period_length))), + 'name': (i!=4 and str((i) * period_length)+'-' + str((i+1) * period_length) or ('+'+str(4 * period_length))), 'start': start.strftime('%Y-%m-%d'), 'stop': (i!=4 and stop.strftime('%Y-%m-%d') or False), }