← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-bug-technical_usability-avp into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind

 

Naresh(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-technical_usability-avp into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-technical_usability-avp/+merge/59476
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-technical_usability-avp/+merge/59476
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-bug-technical_usability-avp into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind.
=== modified file 'account/account.py'
--- account/account.py	2011-04-19 10:45:57 +0000
+++ account/account.py	2011-04-29 09:12:38 +0000
@@ -926,9 +926,8 @@
 
     def action_draft(self, cr, uid, ids, *args):
         mode = 'draft'
-        for id in ids:
-            cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
-            cr.execute('update account_period set state=%s where id=%s', (mode, id))
+        cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids),))
+        cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids),))
         return True
 
     def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
@@ -2659,8 +2658,6 @@
 
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
         res = super(wizard_multi_charts_accounts, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
-        configured_cmp = []
-        unconfigured_cmp = []
         cmp_select = []
         company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
         #display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts)
@@ -2668,12 +2665,12 @@
         configured_cmp = [r[0] for r in cr.fetchall()]
         unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
         for field in res['fields']:
-           if field == 'company_id':
-               res['fields'][field]['domain'] = unconfigured_cmp
-               res['fields'][field]['selection'] = [('', '')]
-               if unconfigured_cmp:
-                   cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
-                   res['fields'][field]['selection'] = cmp_select
+            if field == 'company_id':
+                res['fields'][field]['domain'] = unconfigured_cmp
+                res['fields'][field]['selection'] = [('', '')]
+                if unconfigured_cmp:
+                    cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
+                    res['fields'][field]['selection'] = cmp_select
         return res
 
     def execute(self, cr, uid, ids, context=None):
@@ -2681,7 +2678,6 @@
         obj_acc = self.pool.get('account.account')
         obj_acc_tax = self.pool.get('account.tax')
         obj_journal = self.pool.get('account.journal')
-        obj_sequence = self.pool.get('ir.sequence')
         obj_acc_template = self.pool.get('account.account.template')
         obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
         obj_fiscal_position = self.pool.get('account.fiscal.position')
@@ -2689,9 +2685,7 @@
         analytic_journal_obj = self.pool.get('account.analytic.journal')
         obj_tax_code = self.pool.get('account.tax.code')
         obj_tax_code_template = self.pool.get('account.tax.code.template')
-        obj_acc_journal_view = self.pool.get('account.journal.view')
         ir_values = self.pool.get('ir.values')
-        obj_product = self.pool.get('product.product')
         # Creating Account
         obj_acc_root = obj_multi.chart_template_id.account_root_id
         tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id
@@ -2946,8 +2940,6 @@
             acc_cash_id  = obj_acc.create(cr,uid,vals)
 
             #create the bank journal
-            analytical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')])
-            analytical_journal_bank = analytical_bank_ids and analytical_bank_ids[0] or False
             vals_journal = {
                 'name': vals['name'],
                 'code': _('BNK') + str(current_num),

=== modified file 'account/installer.py'
--- account/installer.py	2011-03-24 13:11:44 +0000
+++ account/installer.py	2011-04-29 09:12:38 +0000
@@ -90,8 +90,6 @@
 
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
         res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
-        configured_cmp = []
-        unconfigured_cmp = []
         cmp_select = []
         company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
         #display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts)
@@ -99,12 +97,12 @@
         configured_cmp = [r[0] for r in cr.fetchall()]
         unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
         for field in res['fields']:
-           if field == 'company_id':
-               res['fields'][field]['domain'] = unconfigured_cmp
-               res['fields'][field]['selection'] = [('', '')]
-               if unconfigured_cmp:
-                   cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
-                   res['fields'][field]['selection'] = cmp_select
+            if field == 'company_id':
+                res['fields'][field]['domain'] = unconfigured_cmp
+                res['fields'][field]['selection'] = [('', '')]
+                if unconfigured_cmp:
+                    cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
+                    res['fields'][field]['selection'] = cmp_select
         return res
 
     def on_change_tax(self, cr, uid, id, tax):
@@ -126,11 +124,8 @@
         obj_acc_temp = self.pool.get('account.account.template')
         obj_tax_code_temp = self.pool.get('account.tax.code.template')
         obj_tax_temp = self.pool.get('account.tax.template')
-        obj_product = self.pool.get('product.product')
-        ir_values = self.pool.get('ir.values')
         obj_acc_chart_temp = self.pool.get('account.chart.template')
         record = self.browse(cr, uid, ids, context=context)[0]
-        company_id = record.company_id
         for res in self.read(cr, uid, ids, context=context):
             if record.charts == 'configurable':
                 fp = tools.file_open(opj('account', 'configurable_account_chart.xml'))

=== modified file 'account/project/wizard/account_analytic_balance_report.py'
--- account/project/wizard/account_analytic_balance_report.py	2011-01-14 00:11:01 +0000
+++ account/project/wizard/account_analytic_balance_report.py	2011-04-29 09:12:38 +0000
@@ -38,7 +38,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids)[0]

=== modified file 'account/project/wizard/account_analytic_cost_ledger_for_journal_report.py'
--- account/project/wizard/account_analytic_cost_ledger_for_journal_report.py	2011-01-14 00:11:01 +0000
+++ account/project/wizard/account_analytic_cost_ledger_for_journal_report.py	2011-04-29 09:12:38 +0000
@@ -38,7 +38,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids)[0]

=== modified file 'account/project/wizard/account_analytic_cost_ledger_report.py'
--- account/project/wizard/account_analytic_cost_ledger_report.py	2011-01-14 00:11:01 +0000
+++ account/project/wizard/account_analytic_cost_ledger_report.py	2011-04-29 09:12:38 +0000
@@ -37,7 +37,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids)[0]

=== modified file 'account/project/wizard/account_analytic_inverted_balance_report.py'
--- account/project/wizard/account_analytic_inverted_balance_report.py	2011-01-14 00:11:01 +0000
+++ account/project/wizard/account_analytic_inverted_balance_report.py	2011-04-29 09:12:38 +0000
@@ -37,7 +37,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids)[0]

=== modified file 'account/project/wizard/account_analytic_journal_report.py'
--- account/project/wizard/account_analytic_journal_report.py	2011-04-27 11:39:09 +0000
+++ account/project/wizard/account_analytic_journal_report.py	2011-04-29 09:12:38 +0000
@@ -37,7 +37,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids)[0]

=== modified file 'account/project/wizard/project_account_analytic_line.py'
--- account/project/wizard/project_account_analytic_line.py	2011-01-14 00:11:01 +0000
+++ account/project/wizard/project_account_analytic_line.py	2011-04-29 09:12:38 +0000
@@ -22,36 +22,36 @@
 from tools.translate import _
 
 class project_account_analytic_line(osv.osv_memory):
-     _name = "project.account.analytic.line"
-     _description = "Analytic Entries by line"
-     _columns = {
+    _name = "project.account.analytic.line"
+    _description = "Analytic Entries by line"
+    _columns = {
          'from_date': fields.date('From'),
          'to_date': fields.date('To'),
      }
 
-     def action_open_window(self, cr, uid, ids, context=None):
-          mod_obj =self.pool.get('ir.model.data')
-          domain = []
-          data = self.read(cr, uid, ids, [])[0]
-          from_date = data['from_date']
-          to_date = data['to_date']
-          if from_date and to_date:
-                domain = [('date','>=',from_date), ('date','<=',to_date)]
-          elif from_date:
-                domain = [('date','>=',from_date)]
-          elif to_date:
-                domain = [('date','<=',to_date)]
-          result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
-          id = result and result[1] or False
-          return {
-                'name': _('Analytic Entries by line'),
-                'view_type': 'form',
-                "view_mode": 'tree,form',
-                'res_model': 'account.analytic.line',
-                'type': 'ir.actions.act_window',
-                'domain': domain,
-                'search_view_id': id['res_id'],
-                }
+    def action_open_window(self, cr, uid, ids, context=None):
+        mod_obj =self.pool.get('ir.model.data')
+        domain = []
+        data = self.read(cr, uid, ids, [])[0]
+        from_date = data['from_date']
+        to_date = data['to_date']
+        if from_date and to_date:
+            domain = [('date','>=',from_date), ('date','<=',to_date)]
+        elif from_date:
+            domain = [('date','>=',from_date)]
+        elif to_date:
+            domain = [('date','<=',to_date)]
+        result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
+        id = result and result[1] or False
+        return {
+              'name': _('Analytic Entries by line'),
+              'view_type': 'form',
+              "view_mode": 'tree,form',
+              'res_model': 'account.analytic.line',
+              'type': 'ir.actions.act_window',
+              'domain': domain,
+              'search_view_id': id['res_id'],
+              }
 
 project_account_analytic_line()
 

=== modified file 'account/report/account_balance_landscape.py'
--- account/report/account_balance_landscape.py	2011-01-27 06:32:26 +0000
+++ account/report/account_balance_landscape.py	2011-04-29 09:12:38 +0000
@@ -98,7 +98,6 @@
             ref_bal='nothing'
 
 
-        total_for_perc=[]
         self.done_total=1
         self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
         self.done_total=0
@@ -116,9 +115,7 @@
 
 
     def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
-        if self.done_total==1:
-            self.done_total==1
-        else:
+        if not self.done_total==1:
             return [self.result_total]
         accounts=[]
         if not ids:
@@ -127,7 +124,6 @@
             return []
 
         ctx = self.context.copy()
-        result_total_parent=[]
 
         for id in form['fiscalyear']:
             tmp=[]
@@ -142,7 +138,7 @@
                 accounts.append(tmp)
 
         merged_accounts=zip(*accounts)
-         # used to check for the frst record so all sum_credit and sum_debit r set to 0.00
+        # used to check for the frst record so all sum_credit and sum_debit r set to 0.00
         if level==1:
             doneAccount={}
         for entry in merged_accounts:
@@ -345,7 +341,6 @@
 
     def get_lines(self, year_dict, form):
         final_result = []
-        line_l =[]
         res = {}
         line_l = self.lines(form)
         self.cal_total(year_dict)
@@ -357,21 +352,21 @@
                 res['level'] = l['level']
                 for k,v in l.items():
                     if k.startswith('debit'+str(year_dict['last_str'])):
-                     res['debit'] = v
+                        res['debit'] = v
                     if k.startswith('credit'+str(year_dict['last_str'])):
-                     res['credit'] = v
+                        res['credit'] = v
                     if k.startswith('balance'+str(year_dict['last_str'])) and not k.startswith('balance_perc'+str(year_dict['last_str'])):
-                     res['balance'] =v
+                        res['balance'] =v
                     if k.startswith('balance_perc'+str(year_dict['last_str'])) and not k.startswith('balance'+str(year_dict['last_str'])):
-                     res['balance_perc'] = v
+                        res['balance_perc'] = v
                     if form['compare_pattern'] == 'bal_perc':
                         if k.startswith('bal_perc'+str(year_dict['last_str'])):
-                         res['pattern'] = v
+                            res['pattern'] = v
                     elif form['compare_pattern'] == 'bal_cash':
                         if k.startswith('bal_cash'+str(year_dict['last_str'])):
-                         res['pattern'] = v
+                            res['pattern'] = v
                     else:
-                         res['pattern'] = ''
+                        res['pattern'] = ''
                 final_result.append(res)
         return final_result
 

=== modified file 'account/report/account_partner_balance.py'
--- account/report/account_partner_balance.py	2011-01-27 06:32:26 +0000
+++ account/report/account_partner_balance.py	2011-04-29 09:12:38 +0000
@@ -242,7 +242,6 @@
 
         if not self.ids:
             return 0.0
-        temp_res = 0.0
         self.cr.execute(
                 "SELECT sum(debit) " \
                 "FROM account_move_line AS l " \
@@ -261,7 +260,6 @@
 
         if not self.ids:
             return 0.0
-        temp_res = 0.0
         self.cr.execute(
                 "SELECT sum(credit) " \
                 "FROM account_move_line AS l " \
@@ -281,7 +279,6 @@
 
         if not self.ids:
             return 0.0
-        temp_res = 0.0
         self.cr.execute(
                 "SELECT sum(debit-credit) " \
                 "FROM account_move_line AS l " \
@@ -295,7 +292,6 @@
         return temp_res
 
     def _get_partners(self):
-        cr, uid = self.cr, self.uid
 
         if self.result_selection == 'customer':
             return _('Receivable Accounts')

=== modified file 'account/report/account_partner_ledger.py'
--- account/report/account_partner_ledger.py	2011-01-14 00:11:01 +0000
+++ account/report/account_partner_ledger.py	2011-04-29 09:12:38 +0000
@@ -118,7 +118,7 @@
         else:
             amount = str(amount)
         if (amount == '0'):
-             return ' '
+            return ' '
         orig = amount
         new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
         if orig == new:
@@ -402,14 +402,14 @@
             return currency_total
 
     def _display_initial_balance(self, data):
-         if self.initial_balance:
-             return True
-         return False
+        if self.initial_balance:
+            return True
+        return False
 
     def _display_currency(self, data):
-         if self.amount_currency:
-             return True
-         return False
+        if self.amount_currency:
+            return True
+        return False
 
 report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
         'addons/account/report/account_partner_ledger.rml',parser=third_party_ledger,

=== modified file 'account/report/account_report.py'
--- account/report/account_report.py	2011-01-27 07:26:35 +0000
+++ account/report/account_report.py	2011-04-29 09:12:38 +0000
@@ -101,14 +101,14 @@
     def _calc_bal(self, cr, uid, ids, name, args, context=None):
         res = {}
         for period in self.read(cr, uid, ids, ['name'], context=context):
-           date1,date2 = period['name'].split(' to ')
-           cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac  \
+            date1,date2 = period['name'].split(' to ')
+            cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac  \
                         WHERE (line.account_id=ac.id) AND ac.type='receivable' \
                             AND (COALESCE(line.date,date) BETWEEN %s AND  %s) \
                             AND (reconcile_id IS NULL) AND ac.active",(str(date2),str(date1),))
-           amount = cr.fetchone()
-           amount = amount[0] or 0.00
-           res[period['id']] = amount
+            amount = cr.fetchone()
+            amount = amount[0] or 0.00
+            res[period['id']] = amount
 
         return res
 

=== modified file 'account/wizard/account_subscription_generate.py'
--- account/wizard/account_subscription_generate.py	2011-01-14 00:11:01 +0000
+++ account/wizard/account_subscription_generate.py	2011-04-29 09:12:38 +0000
@@ -38,10 +38,10 @@
         act_obj = self.pool.get('ir.actions.act_window')
         moves_created=[]
         for data in  self.read(cr, uid, ids, context=context):
-             cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
-             line_ids = map(lambda x: x[0], cr.fetchall())
-             moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
-             moves_created.extend(moves)
+            cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
+            line_ids = map(lambda x: x[0], cr.fetchall())
+            moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
+            moves_created.extend(moves)
         result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form')
         id = result and result[1] or False
         result = act_obj.read(cr, uid, [id], context=context)[0]

=== modified file 'account/wizard/account_tax_chart.py'
--- account/wizard/account_tax_chart.py	2011-03-14 10:27:42 +0000
+++ account/wizard/account_tax_chart.py	2011-04-29 09:12:38 +0000
@@ -51,7 +51,6 @@
         """
         mod_obj = self.pool.get('ir.model.data')
         act_obj = self.pool.get('ir.actions.act_window')
-        period_obj = self.pool.get('account.period')
         if context is None:
             context = {}
         data = self.browse(cr, uid, ids, context=context)[0]

=== modified file 'account_budget/wizard/account_budget_analytic.py'
--- account_budget/wizard/account_budget_analytic.py	2011-01-14 00:11:01 +0000
+++ account_budget/wizard/account_budget_analytic.py	2011-04-29 09:12:38 +0000
@@ -36,7 +36,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids, context=context)[0]

=== modified file 'account_budget/wizard/account_budget_crossovered_report.py'
--- account_budget/wizard/account_budget_crossovered_report.py	2011-01-14 00:11:01 +0000
+++ account_budget/wizard/account_budget_crossovered_report.py	2011-04-29 09:12:38 +0000
@@ -36,7 +36,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids, context=context)[0]

=== modified file 'account_budget/wizard/account_budget_crossovered_summary_report.py'
--- account_budget/wizard/account_budget_crossovered_summary_report.py	2011-01-14 00:11:01 +0000
+++ account_budget/wizard/account_budget_crossovered_summary_report.py	2011-04-29 09:12:38 +0000
@@ -38,7 +38,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids, context=context)[0]

=== modified file 'account_budget/wizard/account_budget_report.py'
--- account_budget/wizard/account_budget_report.py	2011-01-14 00:11:01 +0000
+++ account_budget/wizard/account_budget_report.py	2011-04-29 09:12:38 +0000
@@ -37,7 +37,6 @@
     }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
         data = self.read(cr, uid, ids, context=context)[0]

=== modified file 'account_invoice_layout/report/report_account_invoice_layout.py'
--- account_invoice_layout/report/report_account_invoice_layout.py	2011-01-14 00:11:01 +0000
+++ account_invoice_layout/report/report_account_invoice_layout.py	2011-04-29 09:12:38 +0000
@@ -38,7 +38,6 @@
         result = []
         sub_total = {}
         info = []
-        invoice_list = []
         res = {}
         list_in_seq = {}
         ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])

=== modified file 'account_invoice_layout/report/special_message_invoice.py'
--- account_invoice_layout/report/special_message_invoice.py	2011-03-14 10:27:42 +0000
+++ account_invoice_layout/report/special_message_invoice.py	2011-04-29 09:12:38 +0000
@@ -46,7 +46,6 @@
         result = []
         sub_total = {}
         info = []
-        invoice_list = []
         res = {}
         list_in_seq = {}
         ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])

=== modified file 'account_invoice_layout/wizard/account_invoice_special_message.py'
--- account_invoice_layout/wizard/account_invoice_special_message.py	2011-01-14 00:11:01 +0000
+++ account_invoice_layout/wizard/account_invoice_special_message.py	2011-04-29 09:12:38 +0000
@@ -30,7 +30,6 @@
         }
 
     def check_report(self, cr, uid, ids, context=None):
-        datas = {}
         if context is None:
             context = {}
 

=== modified file 'analytic_journal_billing_rate/analytic_journal_billing_rate.py'
--- analytic_journal_billing_rate/analytic_journal_billing_rate.py	2011-01-14 00:11:01 +0000
+++ analytic_journal_billing_rate/analytic_journal_billing_rate.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 from osv import fields,osv
-from osv import orm
 
 class analytic_journal_rate_grid(osv.osv):
 
@@ -103,7 +102,6 @@
 
     def _get_analytic_lines(self, cr, uid, id):
         iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id)
-        inv = self.browse(cr, uid, [id])[0]
         for il in iml:
             if il['account_analytic_id'] and il.get('analytic_lines', False):
 

=== modified file 'analytic_user_function/analytic_user_function.py'
--- analytic_user_function/analytic_user_function.py	2011-01-14 00:11:01 +0000
+++ analytic_user_function/analytic_user_function.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 from osv import fields,osv
-from osv import orm
 from tools.translate import _
 
 class analytic_user_funct_grid(osv.osv):

=== modified file 'auction/auction.py'
--- auction/auction.py	2011-01-14 00:11:01 +0000
+++ auction/auction.py	2011-04-29 09:12:38 +0000
@@ -293,13 +293,13 @@
                         result = lot.buyer_price - lot.seller_price - lot.costs
 
                 elif name == "gross_margin":
-                   if ((lot.obj_price==0) and (lot.state=='draft')):
-                     amount = lot.lot_est1
-                   else:
-                     amount = lot.obj_price
-                   if amount > 0:
-                     result = (lot.gross_revenue * 100) / amount
-                     result = round(result,2)
+                    if ((lot.obj_price==0) and (lot.state=='draft')):
+                        amount = lot.lot_est1
+                    else:
+                        amount = lot.obj_price
+                    if amount > 0:
+                        result = (lot.gross_revenue * 100) / amount
+                        result = round(result,2)
 
                 elif name == "net_margin":
                     if ((lot.obj_price==0) and (lot.state=='draft')):

=== modified file 'auction/report/auction_artists.py'
--- auction/report/auction_artists.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_artists.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/auction_bids.py'
--- auction/report/auction_bids.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_bids.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/auction_buyer_result.py'
--- auction/report/auction_buyer_result.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_buyer_result.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/auction_catelog.py'
--- auction/report/auction_catelog.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_catelog.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/auction_objects.py'
--- auction/report/auction_objects.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_objects.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/auction_result.py'
--- auction/report/auction_result.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_result.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/auction_total_rml.py'
--- auction/report/auction_total_rml.py	2011-01-14 00:11:01 +0000
+++ auction/report/auction_total_rml.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/bids_lots.py'
--- auction/report/bids_lots.py	2011-01-14 00:11:01 +0000
+++ auction/report/bids_lots.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/bids_phones_details.py'
--- auction/report/bids_phones_details.py	2011-01-14 00:11:01 +0000
+++ auction/report/bids_phones_details.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/buyer_form_report.py'
--- auction/report/buyer_form_report.py	2011-01-14 00:11:01 +0000
+++ auction/report/buyer_form_report.py	2011-04-29 09:12:38 +0000
@@ -20,10 +20,8 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
-from osv import osv
 
 class buyer_form_report(report_sxw.rml_parse):
     count=0
@@ -51,7 +49,6 @@
     def buyer_info(self):
         objects = [object for object in self.localcontext.get('objects')]
         ret_dict = {}
-        ret_list = []
         for object in objects:
             partner = ret_dict.get(object.ach_uid.id,False)
             if not partner:

=== modified file 'auction/report/buyer_list.py'
--- auction/report/buyer_list.py	2011-01-14 00:11:01 +0000
+++ auction/report/buyer_list.py	2011-04-29 09:12:38 +0000
@@ -19,11 +19,8 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
-from osv import osv
-from tools.translate import _
 
 class buyer_list(report_sxw.rml_parse):
     auc_lot_ids=[]
@@ -66,7 +63,6 @@
         return auct_dat
 
     def lines_lots_auct_lot(self,obj):
-        auc_lot_ids = []
 
         auc_date_ids = self.pool.get('auction.dates').search(self.cr, self.uid, ([('name','like',obj['name'])]))
 

=== modified file 'auction/report/catalog2.py'
--- auction/report/catalog2.py	2011-01-14 00:11:01 +0000
+++ auction/report/catalog2.py	2011-04-29 09:12:38 +0000
@@ -19,22 +19,12 @@
 #
 ##############################################################################
 
-import datetime
-import time
 from report.interface import report_rml
-from report.interface import toxml
 import pooler
-from osv import osv,orm
-from time import strptime
 from xml.dom import minidom
-import sys
-import os
 import re
-import netsvc
 import base64
-import wizard
 import photo_shadow
-from tools import config
 import addons
 
 def _to_unicode(s):
@@ -75,11 +65,6 @@
         catalog=doc.createElement('catalog')
         doc.documentElement.appendChild(catalog)
 
-
-        infodb='info'
-        commdb='comm'
-        tab_avoid = []
-        tab_no_photo=[]
         auction_lot_pool = pooler.get_pool(cr.dbname).get('auction.lots')
         auction_dates_pool = pooler.get_pool(cr.dbname).get('auction.dates')
         for auction in auction_dates_pool.browse(cr, uid, ids, context=context):
@@ -89,7 +74,7 @@
             categ.appendChild(doc.createTextNode(_to_decode(auction.name)))
             catalog.appendChild(categ)
 
-             #Auctuion Date element
+            #Auctuion Date element
             categ = doc.createElement("AuctionDate1")
             categ.appendChild(doc.createTextNode(_to_decode(auction.auction1)))
             catalog.appendChild(categ)
@@ -133,7 +118,6 @@
                         infos.appendChild(lnum)
 
                     if cat.image:
-                        import random
                         import tempfile
                         limg = doc.createElement('photo_small')
 

=== modified file 'auction/report/catelogwithpictures.py'
--- auction/report/catelogwithpictures.py	2011-01-14 00:11:01 +0000
+++ auction/report/catelogwithpictures.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/deposit_seller.py'
--- auction/report/deposit_seller.py	2011-01-14 00:11:01 +0000
+++ auction/report/deposit_seller.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/huissier.py'
--- auction/report/huissier.py	2011-01-14 00:11:01 +0000
+++ auction/report/huissier.py	2011-04-29 09:12:38 +0000
@@ -20,7 +20,6 @@
 ##############################################################################
 
 import pooler
-from osv.osv import osv, orm
 from report.interface import report_rml
 #FIXME: use the one from tools and delete the one from report
 from report.int_to_text import int_to_text

=== modified file 'auction/report/lots_list.py'
--- auction/report/lots_list.py	2011-01-14 00:11:01 +0000
+++ auction/report/lots_list.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/lots_list_inventory.py'
--- auction/report/lots_list_inventory.py	2011-01-14 00:11:01 +0000
+++ auction/report/lots_list_inventory.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/lots_list_landscape.py'
--- auction/report/lots_list_landscape.py	2011-01-14 00:11:01 +0000
+++ auction/report/lots_list_landscape.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/report_lot_bar_code.py'
--- auction/report/report_lot_bar_code.py	2011-01-14 00:11:01 +0000
+++ auction/report/report_lot_bar_code.py	2011-04-29 09:12:38 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import pooler
 import time
 from report import report_sxw
 

=== modified file 'auction/report/seller_form_report.py'
--- auction/report/seller_form_report.py	2011-01-14 00:11:01 +0000
+++ auction/report/seller_form_report.py	2011-04-29 09:12:38 +0000
@@ -20,15 +20,12 @@
 ##############################################################################
 
 
-import pooler
 import time
 from report import report_sxw
-from osv import osv
 
 class seller_form_report(report_sxw.rml_parse):
     def __init__(self, cr, uid, name, context):
         super(seller_form_report, self).__init__(cr, uid, name, context=context)
-        lot=self.pool.get('auction.lots').browse(cr, uid, uid)
 
         self.localcontext.update({
             'time': time,
@@ -52,7 +49,6 @@
     def seller_info(self):
         objects = [object for object in self.localcontext.get('objects')]
         ret_dict = {}
-        ret_list = []
         for object in objects:
 
             partner = ret_dict.get(object.bord_vnd_id.partner_id.id,False)

=== modified file 'auction/report/total.py'
--- auction/report/total.py	2011-01-14 00:11:01 +0000
+++ auction/report/total.py	2011-04-29 09:12:38 +0000
@@ -19,13 +19,9 @@
 #
 ##############################################################################
 
-import os, time, datetime
-
-import netsvc, tools
-
-import report.print_xml
-import report.render
-import report.common
+import time
+import netsvc
+
 from report.interface import report_rml
 
 def toxml(val):
@@ -47,7 +43,6 @@
         unpaid_ids = []
         buyer = {}
         seller = {}
-        debit = 0
 
         for l in lots:
             if l['lot_est2']:

=== modified file 'auction/wizard/auction_aie_send.py'
--- auction/wizard/auction_aie_send.py	2011-01-14 00:11:01 +0000
+++ auction/wizard/auction_aie_send.py	2011-04-29 09:12:38 +0000
@@ -140,7 +140,7 @@
         return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),))
     
     
-    def _photos_send(cr, uid, uname, passwd, did, ids):
+    def _photos_send(self,cr, uid, uname, passwd, did, ids):
         service = netsvc.LocalService("object_proxy")
         for (ref,id) in ids:
             datas = service.execute(cr.db_name, uid, 'auction.lots', 'read', [id], ['name','image'])
@@ -179,7 +179,7 @@
         }
     
     def _send(self, cr, uid, ids, context=None):
-        import pickle, thread, sql_db
+        import pickle, thread
         cr.execute('select name,aie_categ from auction_lot_category')
         vals = dict(cr.fetchall())
         cr.close()

=== modified file 'base_calendar/base_calendar.py'
--- base_calendar/base_calendar.py	2011-04-14 07:27:16 +0000
+++ base_calendar/base_calendar.py	2011-04-29 09:12:38 +0000
@@ -982,10 +982,9 @@
         """
         if context is None:
             context = {}
-        for event_id in ids:
-            cr.execute("select id from %s where recurrent_uid=%%s" % (self._table), (event_id,))
-            r_ids = map(lambda x: x[0], cr.fetchall())
-            self.unlink(cr, uid, r_ids, context=context)
+        cr.execute('select id from %s where recurrent_uid in %s', (self._table, tuple(ids),))
+        r_ids = map(lambda x: x[0], cr.fetchall())
+        self.unlink(cr, uid, r_ids, context=context)
         return True
 
     def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None):
@@ -1208,7 +1207,7 @@
         value = {}
         if edit_all and rrule_type:
             for id in ids:
-              base_calendar_id2real_id(id)
+                base_calendar_id2real_id(id)
         return value              
 
     def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):

=== modified file 'crm/crm_action_rule.py'
--- crm/crm_action_rule.py	2011-01-14 00:11:01 +0000
+++ crm/crm_action_rule.py	2011-04-29 09:12:38 +0000
@@ -19,17 +19,12 @@
 #
 ##############################################################################
 
-import time
 import re
-import os
-import base64
 import tools
 
 from tools.translate import _
 from osv import fields
 from osv import osv
-from osv import orm
-from osv.orm import except_orm
 
 import crm
 

=== modified file 'crm/wizard/crm_lead_to_partner.py'
--- crm/wizard/crm_lead_to_partner.py	2011-04-11 08:51:20 +0000
+++ crm/wizard/crm_lead_to_partner.py	2011-04-29 09:12:38 +0000
@@ -51,7 +51,7 @@
         rec_ids = context and context.get('active_ids', [])
         for lead in lead_obj.browse(cr, uid, rec_ids, context=context):
             if lead.partner_id:
-                     raise osv.except_osv(_('Warning !'),
+                raise osv.except_osv(_('Warning !'),
                         _('A partner is already defined on this lead.'))
 
     def default_get(self, cr, uid, fields, context=None):
@@ -68,7 +68,6 @@
 
         lead_obj = self.pool.get('crm.lead')
         partner_obj = self.pool.get('res.partner')
-        contact_obj = self.pool.get('res.partner.address')
         partner_id = False
 
         data = list(context and context.get('active_ids', []) or [])
@@ -206,9 +205,6 @@
             context = {}
 
         partner_ids = self._create_partner(cr, uid, ids, context=context)
-        mod_obj = self.pool.get('ir.model.data')
-        result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
-        res = mod_obj.read(cr, uid, result, ['res_id'])
         return {'type': 'ir.actions.act_window_close'}
 
 crm_lead2partner()

=== modified file 'crm/wizard/crm_merge_opportunities.py'
--- crm/wizard/crm_merge_opportunities.py	2011-04-11 08:51:20 +0000
+++ crm/wizard/crm_merge_opportunities.py	2011-04-29 09:12:38 +0000
@@ -51,7 +51,6 @@
 
     def get_attachments(self, cr, uid, id, context=None):
         attach_obj = self.pool.get('ir.attachment')
-        result = []
         attach_ids = attach_obj.search(cr, uid, [('res_model' , '=', 'crm.lead'), ('res_id', '=', id)])
         return attach_ids
 

=== modified file 'crm/wizard/crm_partner_to_opportunity.py'
--- crm/wizard/crm_partner_to_opportunity.py	2011-01-14 00:11:01 +0000
+++ crm/wizard/crm_partner_to_opportunity.py	2011-04-29 09:12:38 +0000
@@ -67,8 +67,12 @@
 
         data = context and context.get('active_ids', []) or []
         make_opportunity = self.pool.get('crm.partner2opportunity')
+        data_obj = self.pool.get('ir.model.data')
+        part_obj = self.pool.get('res.partner')
+        categ_obj = self.pool.get('crm.case.categ')
+        case_obj = self.pool.get('crm.lead')
+        
         for make_opportunity_obj in make_opportunity.browse(cr, uid, ids, context=context):
-            data_obj = self.pool.get('ir.model.data')
             result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
             res = data_obj.read(cr, uid, result, ['res_id'])
 
@@ -79,14 +83,9 @@
             if id3:
                 id3 = data_obj.browse(cr, uid, id3, context=context).res_id
 
-            part_obj = self.pool.get('res.partner')
             address = part_obj.address_get(cr, uid, data)
-
-
-            categ_obj = self.pool.get('crm.case.categ')
             categ_ids = categ_obj.search(cr, uid, [('object_id.model','=','crm.lead')])
 
-            case_obj = self.pool.get('crm.lead')
             opp_id = case_obj.create(cr, uid, {
                 'name' : make_opportunity_obj.name,
                 'planned_revenue' : make_opportunity_obj.planned_revenue,

=== modified file 'crm/wizard/wizard_history_event.py'
--- crm/wizard/wizard_history_event.py	2011-01-14 00:11:01 +0000
+++ crm/wizard/wizard_history_event.py	2011-04-29 09:12:38 +0000
@@ -22,7 +22,6 @@
 
 import wizard
 import pooler
-import time
 
 def _open_history_event(self, cr, uid, data, context=None):
     pool = pooler.get_pool(cr.dbname)

=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2011-03-30 09:56:28 +0000
+++ mrp/mrp.py	2011-04-29 09:12:38 +0000
@@ -243,7 +243,6 @@
 
     def _check_product(self, cr, uid, ids, context=None):
         all_prod = []
-        bom_obj = self.pool.get('mrp.bom')
         boms = self.browse(cr, uid, ids, context=context)
         def check_bom(boms):
             res = True
@@ -672,10 +671,10 @@
         res = True
         for production in self.browse(cr, uid, ids):
             if production.move_lines:
-               res = False
+                res = False
 
             if production.move_created_ids:
-               res = False
+                res = False
         return res
 
     def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None):
@@ -748,7 +747,7 @@
                 produced_qty = produced_products.get(produce_product.product_id.id, 0)
                 rest_qty = production.product_qty - produced_qty
                 if rest_qty <= production_qty:
-                   production_qty = rest_qty
+                    production_qty = rest_qty
                 if rest_qty > 0 :
                     stock_mov_obj.action_consume(cr, uid, [produce_product.id], production_qty, context=context)
 

=== modified file 'mrp/procurement.py'
--- mrp/procurement.py	2011-01-14 00:11:01 +0000
+++ mrp/procurement.py	2011-04-29 09:12:38 +0000
@@ -24,9 +24,7 @@
 from osv import fields
 from osv import osv
 from tools.translate import _
-import ir
 import netsvc
-import time
 
 class procurement_order(osv.osv):
     _inherit = 'procurement.order'
@@ -81,7 +79,6 @@
         procurement_obj = self.pool.get('procurement.order')
         for procurement in procurement_obj.browse(cr, uid, ids, context=context):
             res_id = procurement.move_id.id
-            loc_id = procurement.location_id.id
             newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0)
             newdate = newdate - relativedelta(days=company.manufacturing_lead)
             produce_id = production_obj.create(cr, uid, {

=== modified file 'project/project.py'
--- project/project.py	2011-04-25 05:13:25 +0000
+++ project/project.py	2011-04-29 09:12:38 +0000
@@ -82,7 +82,6 @@
 
     def _progress_rate(self, cr, uid, ids, names, arg, context=None):
         res = {}.fromkeys(ids, 0.0)
-        progress = {}
         if not ids:
             return res
         cr.execute('''SELECT
@@ -161,9 +160,9 @@
     # TODO: Why not using a SQL contraints ?
     def _check_dates(self, cr, uid, ids, context=None):
         for leave in self.read(cr, uid, ids, ['date_start', 'date'], context=context):
-             if leave['date_start'] and leave['date']:
-                 if leave['date_start'] > leave['date']:
-                     return False
+            if leave['date_start'] and leave['date']:
+                if leave['date_start'] > leave['date']:
+                    return False
         return True
 
     _constraints = [
@@ -241,7 +240,6 @@
     def duplicate_template(self, cr, uid, ids, context=None):
         if context is None:
             context = {}
-        task_pool = self.pool.get('project.task')
         data_obj = self.pool.get('ir.model.data')
         result = []
         for proj in self.browse(cr, uid, ids, context=context):
@@ -401,8 +399,8 @@
         if not default.get('name', False):
             default['name'] = self.browse(cr, uid, id, context=context).name or ''
             if not context.get('copy',False):
-                 new_name = _("%s (copy)")%default.get('name','')
-                 default.update({'name':new_name})
+                new_name = _("%s (copy)")%default.get('name','')
+                default.update({'name':new_name})
         return super(task, self).copy_data(cr, uid, id, default, context)
 
 
@@ -572,7 +570,7 @@
         project = task.project_id
         res = self.do_close(cr, uid, [project_id], context=context)
         if project.warn_manager or project.warn_customer:
-           return {
+            return {
                 'name': _('Send Email after close task'),
                 'view_type': 'form',
                 'view_mode': 'form',


Follow ups