diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index 136731fbac6..3d3905ed249 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -31,7 +31,7 @@ Taxes management Budgets """, - "website" : "http://tinyerp.com/module_account.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [ ], diff --git a/addons/account/account.py b/addons/account/account.py index 30a18ac6efe..5908fa737e0 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -448,7 +448,7 @@ class account_journal(osv.osv): 'account_control_ids': fields.many2many('account.account', 'account_account_type_rel', 'journal_id','account_id', 'Account', domain=[('type','<>','view'), ('type', '<>', 'closed')]), 'active': fields.boolean('Active'), - 'view_id': fields.many2one('account.journal.view', 'View', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tell Tiny ERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), + 'view_id': fields.many2one('account.journal.view', 'View', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tell Open ERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account'), 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account'), 'centralisation': fields.boolean('Centralised counterpart', help="Check this box if you want that each entry doesn't create a counterpart but share the same counterpart for each entry of this journal."), @@ -606,8 +606,8 @@ class account_period(osv.osv): if role.name=='Period': mode = 'draft' for id in ids: - cr.execute('update account_journal_period set state=%s where period_id=%d', (mode, id)) - cr.execute('update account_period set state=%s where id=%d', (mode, id)) + 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)) return True account_period() @@ -637,7 +637,7 @@ class account_journal_period(osv.osv): def _check(self, cr, uid, ids, context={}): for obj in self.browse(cr, uid, ids, context): - cr.execute('select * from account_move_line where journal_id=%d and period_id=%d limit 1', (obj.journal_id.id, obj.period_id.id)) + cr.execute('select * from account_move_line where journal_id=%s and period_id=%s limit 1', (obj.journal_id.id, obj.period_id.id)) res = cr.fetchall() if res: raise osv.except_osv(_('Error !'), _('You can not modify/delete a journal with entries for this period !')) @@ -882,7 +882,7 @@ class account_move(osv.osv): # find the first line of this move with the current mode # or create it if it doesn't exist - cr.execute('select id from account_move_line where move_id=%d and centralisation=%s limit 1', (move.id, mode)) + cr.execute('select id from account_move_line where move_id=%s and centralisation=%s limit 1', (move.id, mode)) res = cr.fetchone() if res: line_id = res[0] @@ -901,16 +901,16 @@ class account_move(osv.osv): # find the first line of this move with the other mode # so that we can exclude it from our calculation - cr.execute('select id from account_move_line where move_id=%d and centralisation=%s limit 1', (move.id, mode2)) + cr.execute('select id from account_move_line where move_id=%s and centralisation=%s limit 1', (move.id, mode2)) res = cr.fetchone() if res: line_id2 = res[0] else: line_id2 = 0 - cr.execute('select sum('+mode+') from account_move_line where move_id=%d and id<>%d', (move.id, line_id2)) + cr.execute('select sum('+mode+') from account_move_line where move_id=%s and id<>%s', (move.id, line_id2)) result = cr.fetchone()[0] or 0.0 - cr.execute('update account_move_line set '+mode2+'=%f where id=%d', (result, line_id)) + cr.execute('update account_move_line set '+mode2+'=%s where id=%s', (result, line_id)) return True # @@ -1625,7 +1625,7 @@ class account_config_wizard(osv.osv_memory): mod_obj.write(cr , uid, [id] ,{'state' : 'to install'}) mod_obj.download(cr, uid, [id], context=context) cr.commit() - cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,)) + cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%s and m.state='uninstalled'",(id,)) ret = cr.fetchall() if len(ret): for r in ret: diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 7981bac255e..603b77bc36b 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -82,7 +82,7 @@ class account_analytic_line(osv.osv): def view_header_get(self, cr, user, view_id, view_type, context): if context.get('account_id', False): - cr.execute('select name from account_analytic_account where id=%d', (context['account_id'],)) + cr.execute('select name from account_analytic_account where id=%s', (context['account_id'],)) res = cr.fetchone() res = _('Entries: ')+ (res[0] or '') return res diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index a1d47dd027d..69afa0987fe 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -37,7 +37,7 @@ class account_bank_statement(osv.osv): return False def _default_balance_start(self, cr, uid, context={}): - cr.execute('select id from account_bank_statement where journal_id=%d order by date desc limit 1', (1,)) + cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,)) res = cr.fetchone() if res: return self.browse(cr, uid, [res[0]], context)[0].balance_end @@ -313,7 +313,7 @@ class account_bank_statement(osv.osv): cursor.execute('SELECT balance_end_real \ FROM account_bank_statement \ - WHERE journal_id = %d \ + WHERE journal_id = %s \ ORDER BY date DESC,id DESC LIMIT 1', (journal_id,)) res = cursor.fetchone() balance_start = res and res[0] or 0.0 @@ -513,8 +513,8 @@ class account_bank_statement_line(osv.osv): cursor.execute('SELECT sum(debit-credit) \ FROM account_move_line \ WHERE (reconcile_id is null) \ - AND partner_id = %d \ - AND account_id=%d', (partner_id, account_id)) + AND partner_id = %s \ + AND account_id=%s', (partner_id, account_id)) res = cursor.fetchone() balance = res and res[0] or 0.0 diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 453ec9e9067..d32e2c7b003 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -133,7 +133,7 @@ class account_move_line(osv.osv): from \ account_move_line \ where \ - journal_id=%d and period_id=%d and create_uid=%d and state=%s \ + journal_id=%s and period_id=%s and create_uid=%s and state=%s \ order by id desc limit 1', (context['journal_id'], context['period_id'], uid, 'draft')) res = cr.fetchone() @@ -148,7 +148,7 @@ class account_move_line(osv.osv): from \ account_move_line \ where \ - journal_id=%d and period_id=%d and create_uid=%d \ + journal_id=%s and period_id=%s and create_uid=%s \ order by id desc', (context['journal_id'], context['period_id'], uid)) res = cr.fetchone() @@ -191,10 +191,7 @@ class account_move_line(osv.osv): account = move.journal_id.default_debit_account_id data['account_id'] = account.id - if account and account.tax_ids: - for tax in self.pool.get('account.tax').compute_inv(cr,uid,[account.tax_ids[0]],total,1.00): - total -= tax['amount'] - data['account_tax_id'] = account.tax_ids[0].id + s = -total data['debit'] = s>0 and s or 0.0 data['credit'] = s<0 and -s or 0.0 @@ -219,9 +216,9 @@ class account_move_line(osv.osv): res={} # TODO group the foreach in sql for id in ids: - cr.execute('SELECT date,account_id FROM account_move_line WHERE id=%d', (id,)) + cr.execute('SELECT date,account_id FROM account_move_line WHERE id=%s', (id,)) dt, acc = cr.fetchone() - cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE account_id=%d AND (date<%s OR (date=%s AND id<=%d))', (acc,dt,dt,id)) + cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE account_id=%s AND (date<%s OR (date=%s AND id<=%s))', (acc,dt,dt,id)) res[id] = cr.fetchone()[0] return res @@ -284,11 +281,11 @@ class account_move_line(osv.osv): elif (x[2] is False) and (x[1] == '<>' or x[1] == '!='): qu1.append('(i.id IS NOT NULL)') else: - qu1.append('(i.id %s %s)' % (x[1], '%d')) + qu1.append('(i.id %s %s)' % (x[1], '%s')) qu2.append(x[2]) elif x[1] == 'in': if len(x[2]) > 0: - qu1.append('(i.id in (%s))' % (','.join(['%d'] * len(x[2])))) + qu1.append('(i.id in (%s))' % (','.join(['%s'] * len(x[2])))) qu2 += x[2] else: qu1.append(' (False)') @@ -350,7 +347,7 @@ class account_move_line(osv.osv): dt = time.strftime('%Y-%m-%d') if ('journal_id' in context) and ('period_id' in context): cr.execute('select date from account_move_line ' \ - 'where journal_id=%d and period_id=%d ' \ + 'where journal_id=%s and period_id=%s ' \ 'order by id desc limit 1', (context['journal_id'], context['period_id'])) res = cr.fetchone() @@ -436,13 +433,11 @@ class account_move_line(osv.osv): date = now().strftime('%Y-%m-%d') part = self.pool.get('res.partner').browse(cr, uid, partner_id) - if part.property_payment_term and part.property_payment_term.line_ids:# Compute Maturity Date in val ! - line = part.property_payment_term.line_ids[0] - next_date = mx.DateTime.strptime(date, '%Y-%m-%d') + RelativeDateTime(days=line.days) - if line.condition == 'end of month': - next_date += RelativeDateTime(day=-1) - next_date = next_date.strftime('%Y-%m-%d') - val['date_maturity'] = next_date + if part.property_payment_term and part.property_payment_term.line_ids: + payterm = part.property_payment_term.line_ids[0] + res = self.pool.get('account.payment.term').compute(cr, uid, payterm.id, 100, date) + if res: + val['date_maturity'] = res[0][0] if not account_id: id1 = part.property_account_payable.id id2 = part.property_account_receivable.id @@ -452,6 +447,16 @@ class account_move_line(osv.osv): val['account_id'] = id2 elif jt=='purchase': val['account_id'] = id1 + if val['account_id']: + d = self.onchange_account_id(cr, uid, ids, val['account_id']) + val.update(d['value']) + return {'value':val} + + def onchange_account_id(self, cr, uid, ids, account_id=False): + val = {} + if account_id: + tax_ids = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids + val['account_tax_id'] = tax_ids and tax_ids[0].id or False return {'value':val} # @@ -610,15 +615,15 @@ class account_move_line(osv.osv): def view_header_get(self, cr, user, view_id, view_type, context): if context.get('account_id', False): - cr.execute('select code from account_account where id=%d', (context['account_id'],)) + cr.execute('select code from account_account where id=%s', (context['account_id'],)) res = cr.fetchone() res = _('Entries: ')+ (res[0] or '') return res if (not context.get('journal_id', False)) or (not context.get('period_id', False)): return False - cr.execute('select code from account_journal where id=%d', (context['journal_id'],)) + cr.execute('select code from account_journal where id=%s', (context['journal_id'],)) j = cr.fetchone()[0] or '' - cr.execute('select code from account_period where id=%d', (context['period_id'],)) + cr.execute('select code from account_period where id=%s', (context['period_id'],)) p = cr.fetchone()[0] or '' if j or p: return j+(p and (':'+p) or '') @@ -658,7 +663,7 @@ class account_move_line(osv.osv): elif field.field=='account_tax_id': attrs.append('domain="[(\'parent_id\',\'=\',False)]"') elif field.field=='account_id' and journal.id: - attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'<>\',\'view\'), (\'type\',\'<>\',\'closed\')]"') + attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'<>\',\'view\'), (\'type\',\'<>\',\'closed\')]" on_change="onchange_account_id(account_id)"') if field.readonly: attrs.append('readonly="1"') if field.required: @@ -668,7 +673,7 @@ class account_move_line(osv.osv): if field.field in ('amount_currency','currency_id'): attrs.append('on_change="onchange_currency(account_id,amount_currency,currency_id,date,((\'journal_id\' in context) and context[\'journal_id\']) or {})"') if field.field == 'partner_id': - attrs.append('on_change="onchange_partner_id(move_id,partner_id,account_id,debit,credit,((\'journal_id\' in context) and context[\'journal_id\']) or {})"') + attrs.append('on_change="onchange_partner_id(move_id,partner_id,account_id,debit,credit,date,((\'journal_id\' in context) and context[\'journal_id\']) or {})"') if field.field in widths: attrs.append('width="'+str(widths[field.field])+'"') xml += '''\n''' % (field.field,' '.join(attrs)) @@ -711,7 +716,7 @@ class account_move_line(osv.osv): return result def _update_journal_check(self, cr, uid, journal_id, period_id, context={}): - cr.execute('select state from account_journal_period where journal_id=%d and period_id=%d', (journal_id, period_id)) + cr.execute('select state from account_journal_period where journal_id=%s and period_id=%s', (journal_id, period_id)) result = cr.fetchall() for (state,) in result: if state=='done': @@ -762,7 +767,7 @@ class account_move_line(osv.osv): if not move_id: if journal.centralisation: # use the first move ever created for this journal and period - cr.execute('select id, state, name from account_move where journal_id=%d and period_id=%d order by id limit 1', (context['journal_id'],context['period_id'])) + cr.execute('select id, state, name from account_move where journal_id=%s and period_id=%s order by id limit 1', (context['journal_id'],context['period_id'])) res = cr.fetchone() if res: if res[1] != 'draft': diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index c73b829f14b..85a2d50f84b 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -134,7 +134,7 @@ - /> + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index c57626d5720..96da3233651 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -33,7 +33,6 @@ from tools.translate import _ class account_invoice(osv.osv): def _amount_all(self, cr, uid, ids, name, args, context={}): res = {} - print ids for invoice in self.browse(cr,uid,ids, context=context): res[invoice.id] = { 'amount_untaxed': 0.0, @@ -117,9 +116,7 @@ class account_invoice(osv.osv): def _get_invoice_line(self, cr, uid, ids, context={}): result = {} for line in self.pool.get('account.invoice.line').browse(cr, uid, ids, context=context): - print '\t', line.invoice_id result[line.invoice_id.id] = True - print result return result.keys() def _get_invoice_tax(self, cr, uid, ids, context={}): @@ -371,14 +368,14 @@ class account_invoice(osv.osv): return False ok = True for id in res: - cr.execute('select reconcile_id from account_move_line where id=%d', (id,)) + cr.execute('select reconcile_id from account_move_line where id=%s', (id,)) ok = ok and bool(cr.fetchone()[0]) return ok def button_reset_taxes(self, cr, uid, ids, context={}): ait_obj = self.pool.get('account.invoice.tax') for id in ids: - cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%d", (id,)) + cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) for taxe in ait_obj.compute(cr, uid, id).values(): ait_obj.create(cr, uid, taxe) return True @@ -664,13 +661,13 @@ class account_invoice(osv.osv): else: ref = self._convert_ref(cr, uid, number) cr.execute('UPDATE account_invoice SET number=%s ' \ - 'WHERE id=%d', (number, id)) + 'WHERE id=%s', (number, id)) cr.execute('UPDATE account_move_line SET ref=%s ' \ - 'WHERE move_id=%d AND (ref is null OR ref = \'\')', + 'WHERE move_id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_analytic_line SET ref=%s ' \ 'FROM account_move_line ' \ - 'WHERE account_move_line.move_id = %d ' \ + 'WHERE account_move_line.move_id = %s ' \ 'AND account_analytic_line.move_id = account_move_line.id', (ref, move_id)) return True @@ -705,7 +702,7 @@ class account_invoice(osv.osv): for inv in invs: part=inv['partner_id'] and inv['partner_id'][0] pc = pr = 0.0 - cr.execute('select sum(quantity*price_unit) from account_invoice_line where invoice_id=%d', (inv['id'],)) + cr.execute('select sum(quantity*price_unit) from account_invoice_line where invoice_id=%s', (inv['id'],)) total = inv['amount_untaxed'] if inv['type'] in ('in_invoice','in_refund'): partnertype='supplier' @@ -1115,7 +1112,7 @@ class account_invoice_tax(osv.osv): def move_line_get(self, cr, uid, invoice_id): res = [] - cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%d', (invoice_id,)) + cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ diff --git a/addons/account/project/project.py b/addons/account/project/project.py index 65433812843..338d243e2e7 100644 --- a/addons/account/project/project.py +++ b/addons/account/project/project.py @@ -222,7 +222,7 @@ class account_analytic_journal(osv.osv): 'name' : fields.char('Journal name', size=64, required=True), 'code' : fields.char('Journal code', size=8), 'active' : fields.boolean('Active'), - 'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When a document (eg: an invoice) needs to create analytic entries, Tiny ERP will look for a matching journal of the same type."), + 'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When a document (eg: an invoice) needs to create analytic entries, Open ERP will look for a matching journal of the same type."), 'line_ids' : fields.one2many('account.analytic.line', 'journal_id', 'Lines'), } _defaults = { diff --git a/addons/account/project/report/account_journal.py b/addons/account/project/report/account_journal.py index 77530e1a06b..d305547aa91 100644 --- a/addons/account/project/report/account_journal.py +++ b/addons/account/project/report/account_journal.py @@ -29,12 +29,12 @@ from report import report_sxw # class journal_print(report_sxw.rml_parse): def lines(self, journal_id, *args): - self.cr.execute('select id from account_analytic_line where journal_id=%d order by date,id', (journal_id,)) + self.cr.execute('select id from account_analytic_line where journal_id=%s order by date,id', (journal_id,)) ids = map(lambda x: x[0], self.cr.fetchall()) res = self.pool.get('account.analytic.line').browse(self.cr, self.uid, ids) return res def _sum_lines(self, journal_id): - self.cr.execute('select sum(amount) from account_analytic_line where journal_id=%d', (journal_id,)) + self.cr.execute('select sum(amount) from account_analytic_line where journal_id=%s', (journal_id,)) return self.cr.fetchone()[0] or 0.0 def __init__(self, cr, uid, name, context): super(journal_print, self).__init__(cr, uid, name, context) diff --git a/addons/account/project/report/analytic_check.py b/addons/account/project/report/analytic_check.py index 73df2b693cc..0c8a3b43cd3 100644 --- a/addons/account/project/report/analytic_check.py +++ b/addons/account/project/report/analytic_check.py @@ -49,19 +49,19 @@ class account_analytic_analytic_check(report_sxw.rml_parse): for a in acc_obj.read(self.cr, self.uid, self.ids, ['name', 'code']): self.cr.execute("SELECT sum(debit), sum(credit) \ FROM account_move_line \ - WHERE date>=%s AND date<=%s AND state<>'draft' AND account_id = %d", (date1, date2, a['id'])) + WHERE date>=%s AND date<=%s AND state<>'draft' AND account_id = %s", (date1, date2, a['id'])) (gd, gc) = self.cr.fetchone() gd = gd or 0.0 gc = gc or 0.0 self.cr.execute("SELECT abs(sum(amount)) AS balance \ FROM account_analytic_line \ - WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %d", (date1, date2, a['id'])) + WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id'])) (ad,) = self.cr.fetchone() ad = ad or 0.0 self.cr.execute("SELECT abs(sum(amount)) AS balance \ FROM account_analytic_line \ - WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %d", (date1, date2, a['id'])) + WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id'])) (ac,) = self.cr.fetchone() ac = ac or 0.0 @@ -85,19 +85,19 @@ class account_analytic_analytic_check(report_sxw.rml_parse): # for a in acc_obj.read(self.cr, self.uid, self.ids, ['name', 'code','sign']): # self.cr.execute("SELECT sum(debit), sum(credit) \ # FROM account_move_line \ -# WHERE date>=%s AND date<=%s AND state<>'draft' AND account_id = %d", (date1, date2, a['id'])) +# WHERE date>=%s AND date<=%s AND state<>'draft' AND account_id = %s", (date1, date2, a['id'])) # (gd, gc) = self.cr.fetchone() # gd = gd or 0.0 # gc = gc or 0.0 # # self.cr.execute("SELECT abs(sum(amount)) AS balance \ # FROM account_analytic_line \ -# WHERE date>=%s AND date<=%s AND amount*%d>0 AND general_account_id = %d", (date1, date2, a['sign'], a['id'])) +# WHERE date>=%s AND date<=%s AND amount*%s>0 AND general_account_id = %s", (date1, date2, a['sign'], a['id'])) # (ad,) = self.cr.fetchone() # ad = ad or 0.0 # self.cr.execute("SELECT abs(sum(amount)) AS balance \ # FROM account_analytic_line \ -# WHERE date>=%s AND date<=%s AND amount*%d<0 AND general_account_id = %d", (date1, date2, a['sign'], a['id'])) +# WHERE date>=%s AND date<=%s AND amount*%s<0 AND general_account_id = %s", (date1, date2, a['sign'], a['id'])) # (ac,) = self.cr.fetchone() # ac = ac or 0.0 # diff --git a/addons/account/project/report/analytic_journal.py b/addons/account/project/report/analytic_journal.py index 4f2a116c10a..659852d3c2b 100644 --- a/addons/account/project/report/analytic_journal.py +++ b/addons/account/project/report/analytic_journal.py @@ -38,7 +38,7 @@ class account_analytic_journal(report_sxw.rml_parse): }) def _lines(self, journal_id, date1, date2): - self.cr.execute('SELECT DISTINCT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%d) AND (move_id is not null)', (date1, date2, journal_id,)) + self.cr.execute('SELECT DISTINCT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%s) AND (move_id is not null)', (date1, date2, journal_id,)) ids = map(lambda x: x[0], self.cr.fetchall()) return self.pool.get('account.move.line').browse(self.cr, self.uid, ids) @@ -49,11 +49,11 @@ class account_analytic_journal(report_sxw.rml_parse): return self.pool.get('account.analytic.line').browse(self.cr, self.uid, ids) def _sum_general(self, journal_id, date1, date2): - self.cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE id IN (SELECT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%d) AND (move_id is not null))', (date1, date2, journal_id,)) + self.cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE id IN (SELECT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%s) AND (move_id is not null))', (date1, date2, journal_id,)) return self.cr.fetchall()[0][0] or 0 def _sum_analytic(self, journal_id, date1, date2): - self.cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE date>=%s AND date<=%s AND journal_id=%d", (date1, date2, journal_id)) + self.cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE date>=%s AND date<=%s AND journal_id=%s", (date1, date2, journal_id)) res = self.cr.dictfetchone() return res['sum'] or 0 diff --git a/addons/account/project/report/cost_ledger.py b/addons/account/project/report/cost_ledger.py index 63acbc36e91..5cf7b89564c 100644 --- a/addons/account/project/report/cost_ledger.py +++ b/addons/account/project/report/cost_ledger.py @@ -42,7 +42,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse): def _lines_g(self, account_id, date1, date2): self.cr.execute("SELECT sum(aal.amount) AS balance, aa.code AS code, aa.name AS name, aa.id AS id \ FROM account_account AS aa, account_analytic_line AS aal \ - WHERE (aal.account_id=%d) AND (aal.date>=%s) AND (aal.date<=%s) AND (aal.general_account_id=aa.id) AND aa.active \ + WHERE (aal.account_id=%s) AND (aal.date>=%s) AND (aal.date<=%s) AND (aal.general_account_id=aa.id) AND aa.active \ GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code", (account_id, date1, date2)) res = self.cr.dictfetchall() @@ -60,7 +60,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse): def _lines_a(self, general_account_id, account_id, date1, date2): self.cr.execute("SELECT aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj FROM account_analytic_line AS aal, account_analytic_journal AS aaj \ - WHERE (aal.general_account_id=%d) AND (aal.account_id=%d) AND (aal.date>=%s) AND (aal.date<=%s) \ + WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) AND (aal.date>=%s) AND (aal.date<=%s) \ AND (aal.journal_id=aaj.id) \ ORDER BY aal.date, aaj.code, aal.code", (general_account_id, account_id, date1, date2)) res = self.cr.dictfetchall() @@ -78,11 +78,11 @@ class account_analytic_cost_ledger(report_sxw.rml_parse): return res def _account_sum_debit(self, account_id, date1, date2): - self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id=%d AND date>=%s AND date<=%s AND amount>0", (account_id, date1, date2)) + self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s AND amount>0", (account_id, date1, date2)) return self.cr.fetchone()[0] or 0.0 def _account_sum_credit(self, account_id, date1, date2): - self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id=%d AND date>=%s AND date<=%s AND amount<0", (account_id, date1, date2)) + self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s AND amount<0", (account_id, date1, date2)) return self.cr.fetchone()[0] or 0.0 def _account_sum_balance(self, account_id, date1, date2): diff --git a/addons/account/project/report/inverted_analytic_balance.py b/addons/account/project/report/inverted_analytic_balance.py index 22b2a37e81a..834c38232ff 100644 --- a/addons/account/project/report/inverted_analytic_balance.py +++ b/addons/account/project/report/inverted_analytic_balance.py @@ -61,7 +61,7 @@ class account_inverted_analytic_balance(report_sxw.rml_parse): ids = map(lambda x: x.id, accounts) self.cr.execute("SELECT sum(aal.amount) AS balance, sum(aal.unit_amount) AS quantity, aaa.code AS code, aaa.name AS name, account_id \ FROM account_analytic_line AS aal, account_analytic_account AS aaa \ - WHERE aal.account_id=aaa.id AND aal.account_id IN ("+','.join(map(str, ids))+") AND aal.general_account_id=%d AND aal.date>=%s AND aal.date<=%s \ + WHERE aal.account_id=aaa.id AND aal.account_id IN ("+','.join(map(str, ids))+") AND aal.general_account_id=%s AND aal.date>=%s AND aal.date<=%s \ GROUP BY aal.account_id, general_account_id, aaa.code, aaa.name ORDER BY aal.account_id", (general_account_id, date1, date2)) res = self.cr.dictfetchall() diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py index a97d30040fe..0d6241fa30f 100644 --- a/addons/account/project/report/quantity_cost_ledger.py +++ b/addons/account/project/report/quantity_cost_ledger.py @@ -41,7 +41,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \ aa.code AS code, aa.name AS name, aa.id AS id \ FROM account_account AS aa, account_analytic_line AS aal \ - WHERE (aal.account_id=%d) AND (aal.date>=%s) \ + WHERE (aal.account_id=%s) AND (aal.date>=%s) \ AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \ AND aa.active \ GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code", @@ -51,7 +51,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \ aa.code AS code, aa.name AS name, aa.id AS id \ FROM account_account AS aa, account_analytic_line AS aal \ - WHERE (aal.account_id=%d) AND (aal.date>=%s) \ + WHERE (aal.account_id=%s) AND (aal.date>=%s) \ AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \ AND aa.active \ AND (aal.journal_id IN (" + @@ -68,7 +68,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): aaj.code AS cj \ FROM account_analytic_line AS aal, \ account_analytic_journal AS aaj \ - WHERE (aal.general_account_id=%d) AND (aal.account_id=%d) \ + WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) \ AND (aal.date>=%s) AND (aal.date<=%s) \ AND (aal.journal_id=aaj.id) \ ORDER BY aal.date, aaj.code, aal.code", @@ -80,7 +80,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): aaj.code AS cj \ FROM account_analytic_line AS aal, \ account_analytic_journal AS aaj \ - WHERE (aal.general_account_id=%d) AND (aal.account_id=%d) \ + WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) \ AND (aal.date>=%s) AND (aal.date<=%s) \ AND (aal.journal_id=aaj.id) AND (aaj.id IN (" + ','.join(map(str, journal_ids)) + ")) \ @@ -93,13 +93,13 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): if not journals or not journals[0][2]: self.cr.execute("SELECT sum(unit_amount) \ FROM account_analytic_line \ - WHERE account_id=%d AND date>=%s AND date<=%s", + WHERE account_id=%s AND date>=%s AND date<=%s", (account_id, date1, date2)) else: journal_ids = journals[0][2] self.cr.execute("SELECT sum(unit_amount) \ FROM account_analytic_line \ - WHERE account_id = %d AND date >= %s AND date <= %s \ + WHERE account_id = %s AND date >= %s AND date <= %s \ AND journal_id IN (" + ','.join(map(str, journal_ids)) + ")", (account_id, date1, date2)) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index a0aef896250..85596741a3c 100755 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -52,7 +52,7 @@ class account_balance(report_sxw.rml_parse): fisc_id = form['fiscalyear'] if not (fisc_id): return '' - self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id))) + self.cr.execute("select name from account_fiscalyear where id = %s" , (int(fisc_id),)) res=self.cr.fetchone() return res and res[0] or '' @@ -226,4 +226,4 @@ class account_balance(report_sxw.rml_parse): def _sum_debit(self): return self.sum_debit -report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False) \ No newline at end of file +report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 38e410ca70d..06898020f08 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -44,9 +44,9 @@ class journal_print(report_sxw.rml_parse): for period in period_id: ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)]) if ids_journal_period: - self.cr.execute('update account_journal_period set state=%s where journal_id=%d and period_id=%d and state=%s', ('printed',journal,period,'draft')) + self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal,period,'draft')) self.cr.commit() - self.cr.execute('select id from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\' order by ('+ sort_selection +'),id', (period, journal)) + self.cr.execute('select id from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\' order by ('+ sort_selection +'),id', (period, journal)) ids = map(lambda x: x[0], self.cr.fetchall()) ids_final.append(ids) line_ids = [] @@ -54,18 +54,18 @@ class journal_print(report_sxw.rml_parse): a = self.pool.get('account.move.line').browse(self.cr, self.uid, line_id ) line_ids.append(a) return line_ids - self.cr.execute('update account_journal_period set state=%s where journal_id=%d and period_id=%d and state=%s', ('printed',journal_id,period_id,'draft')) + self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal_id,period_id,'draft')) self.cr.commit() - self.cr.execute('select id from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\' order by date,id', (period_id, journal_id)) + self.cr.execute('select id from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\' order by date,id', (period_id, journal_id)) ids = map(lambda x: x[0], self.cr.fetchall()) return self.pool.get('account.move.line').browse(self.cr, self.uid, ids ) def _sum_debit(self, period_id, journal_id): - self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) + self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 def _sum_credit(self, period_id, journal_id): - self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) + self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print,header=False) report_sxw.report_sxw('report.account.journal.period.print.wiz', 'account.journal.period', 'addons/account/report/wizard_account_journal.rml', parser=journal_print,header=False) diff --git a/addons/account/report/aged_trial_balance.py b/addons/account/report/aged_trial_balance.py index 8ffdb1b566b..0688c2a2274 100755 --- a/addons/account/report/aged_trial_balance.py +++ b/addons/account/report/aged_trial_balance.py @@ -66,7 +66,7 @@ class aged_trial_report(rml_parse.rml_parse): "AND ((reconcile_id IS NULL) " \ "OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \ "AND (line.partner_id=res_partner.id) " \ - "AND (account_account.company_id = %d) " \ + "AND (account_account.company_id = %s) " \ "ORDER BY res_partner.name", (form['date1'],form['company_id'])) partners = self.cr.dictfetchall() ## mise a 0 du total @@ -82,10 +82,10 @@ class aged_trial_report(rml_parse.rml_parse): "FROM account_move_line AS line, account_account " \ "WHERE (line.account_id=account_account.id) " \ "AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \ - "AND (COALESCE(date_maturity,date) < %s) AND (partner_id=%d) " \ + "AND (COALESCE(date_maturity,date) < %s) AND (partner_id=%s) " \ "AND ((reconcile_id IS NULL) " \ "OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \ - "AND (account_account.company_id = %d) " \ + "AND (account_account.company_id = %s) " \ "AND account_account.active", (form['date1'], partner['id'],form['date1'], form['company_id'])) before = self.cr.fetchone() @@ -98,10 +98,10 @@ class aged_trial_report(rml_parse.rml_parse): "FROM account_move_line AS line, account_account " \ "WHERE (line.account_id=account_account.id) " \ "AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \ - "AND (COALESCE(date_maturity,date) > %s) AND (partner_id=%d) " \ + "AND (COALESCE(date_maturity,date) > %s) AND (partner_id=%s) " \ "AND ((reconcile_id IS NULL) " \ "OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \ - "AND (account_account.company_id = %d) " \ + "AND (account_account.company_id = %s) " \ "AND account_account.active", (form['date1'], partner['id'],form['date1'], form['company_id'])) after = self.cr.fetchone() @@ -113,10 +113,10 @@ class aged_trial_report(rml_parse.rml_parse): "WHERE (line.account_id=account_account.id) " \ "AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \ "AND (COALESCE(date_maturity,date) BETWEEN %s AND %s) " \ - "AND (partner_id = %d) " \ + "AND (partner_id = %s) " \ "AND ((reconcile_id IS NULL) " \ "OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \ - "AND (account_account.company_id = %d) " \ + "AND (account_account.company_id = %s) " \ "AND account_account.active", (form[str(i)]['start'], form[str(i)]['stop'],partner['id'],form['date1'] ,form['company_id'])) during = self.cr.fetchone() @@ -127,10 +127,10 @@ class aged_trial_report(rml_parse.rml_parse): "FROM account_move_line AS line, account_account " \ "WHERE (line.account_id = account_account.id) " \ "AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \ - "AND (partner_id = %d) " \ + "AND (partner_id = %s) " \ "AND ((reconcile_id IS NULL) " \ "OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \ - "AND (account_account.company_id = %d) " \ + "AND (account_account.company_id = %s) " \ "AND account_account.active", (partner['id'],form['date1'],form['company_id'])) total = self.cr.fetchone() diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py index 8b8932782b6..5ce24cef8be 100644 --- a/addons/account/report/central_journal.py +++ b/addons/account/report/central_journal.py @@ -43,22 +43,22 @@ class journal_print(report_sxw.rml_parse): for period in period_id: ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)]) if ids_journal_period: - self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%d and l.journal_id=%d and l.state<>\'draft\' group by a.id, a.code, a.name, l.journal_id, l.period_id', (period, journal)) + self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%s and l.journal_id=%s and l.state<>\'draft\' group by a.id, a.code, a.name, l.journal_id, l.period_id', (period, journal)) res = self.cr.dictfetchall() a = {'journal':self.pool.get('account.journal').browse(self.cr, self.uid, journal),'period':self.pool.get('account.period').browse(self.cr, self.uid, period)} res[0].update(a) ids_final.append(res) return ids_final - self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%d and l.journal_id=%d and l.state<>\'draft\' group by a.id, a.code, a.name', (period_id, journal_id)) + self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%s and l.journal_id=%s and l.state<>\'draft\' group by a.id, a.code, a.name', (period_id, journal_id)) res = self.cr.dictfetchall() return res def _sum_debit(self, period_id, journal_id): - self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) + self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 def _sum_credit(self, period_id, journal_id): - self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) + self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/central_journal.rml',parser=journal_print, header=False) report_sxw.report_sxw('report.account.central.journal.wiz', 'account.journal.period', 'addons/account/report/wizard_central_journal.rml',parser=journal_print, header=False) diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py index 6894ccdc81c..0499fc064fb 100644 --- a/addons/account/report/general_journal.py +++ b/addons/account/report/general_journal.py @@ -75,7 +75,7 @@ class journal_print(report_sxw.rml_parse): periods.append(data.period_id.id) for period in periods: period_data = self.pool.get('account.period').browse(self.cr, self.uid, period) - self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%d and journal_id in (' + ','.join(map(str, journal_id)) + ') and l.state<>\'draft\' group by j.id, j.code, j.name', (period,)) + self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%s and journal_id in (' + ','.join(map(str, journal_id)) + ') and l.state<>\'draft\' group by j.id, j.code, j.name', (period,)) res = self.cr.dictfetchall() res[0].update({'period_name':period_data.name}) res[0].update({'pid':period}) @@ -83,27 +83,27 @@ class journal_print(report_sxw.rml_parse): return lines_data if not self.journal_ids: return [] - self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%d and journal_id in (' + self.journal_ids + ') and l.state<>\'draft\' group by j.id, j.code, j.name', (period_id,)) + self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%s and journal_id in (' + self.journal_ids + ') and l.state<>\'draft\' group by j.id, j.code, j.name', (period_id,)) res = self.cr.dictfetchall() return res def _sum_debit_period(self, period_id,journal_id=None): if type(journal_id)==type([]): - self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'', (period_id,)) + self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'', (period_id,)) return self.cr.fetchone()[0] or 0.0 if not self.journal_ids: return 0.0 - self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id in (' + self.journal_ids + ') and state<>\'draft\'', (period_id,)) + self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id in (' + self.journal_ids + ') and state<>\'draft\'', (period_id,)) return self.cr.fetchone()[0] or 0.0 def _sum_credit_period(self, period_id,journal_id=None): if type(journal_id)==type([]): - self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'', (period_id,)) + self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'', (period_id,)) return self.cr.fetchone()[0] or 0.0 if not self.journal_ids: return 0.0 - self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id in (' + self.journal_ids + ') and state<>\'draft\'', (period_id,)) + self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id in (' + self.journal_ids + ') and state<>\'draft\'', (period_id,)) return self.cr.fetchone()[0] or 0.0 def _sum_debit(self,period_id=None,journal_id=None): diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index aef67140939..64ee26229f8 100755 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -289,13 +289,13 @@ class general_ledger(rml_parse.rml_parse): FROM account_move_line as l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id) - AND account_id = %d + AND account_id = %%s AND %s - WHERE l.date<='%s' - AND l.date>='%s' - ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag) + WHERE l.date<=%%s + AND l.date>=%%s + ORDER by %s""" % (self.query, sorttag) - self.cr.execute(sql) + self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date'],)) res = self.cr.dictfetchall() @@ -415,7 +415,7 @@ class general_ledger(rml_parse.rml_parse): def _sum_currency_amount_account(self, account, form): self._set_get_account_currency_code(account.id) - self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %d "%account.id) + self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() if self.account_currency: diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index 6fd2eafae76..4dc1060ab1e 100755 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -273,13 +273,13 @@ class general_ledger_landscape(rml_parse.rml_parse): FROM account_move_line as l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id) - AND account_id = %d + AND account_id = %%s AND %s - WHERE l.date<='%s' - AND l.date>='%s' - ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag) + WHERE l.date<=%%s + AND l.date>=%%s + ORDER by %s""" % (self.query, sorttag) - self.cr.execute(sql) + self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date'],)) res = self.cr.dictfetchall() sum = 0.0 @@ -395,7 +395,7 @@ class general_ledger_landscape(rml_parse.rml_parse): def _sum_currency_amount_account(self, account, form): self._set_get_account_currency_code(account.id) - self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %d "%account.id) + self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() if self.account_currency: diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index 0e286d61805..29e8b791a0e 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -191,7 +191,7 @@ class partner_balance(report_sxw.rml_parse): "FROM account_account a " \ "LEFT JOIN account_account_type t " \ "ON (a.type = t.code) " \ - "WHERE a.company_id = %d " \ + "WHERE a.company_id = %s " \ "AND a.type IN " + self.ACCOUNT_TYPE + " " \ "AND a.active", (data['form']['company_id'],)) self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()]) @@ -264,7 +264,6 @@ class partner_balance(report_sxw.rml_parse): "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \ "ORDER BY l.account_id,p.name") res = self.cr.dictfetchall() - print "============ res",res for r in res: full_account.append(r) @@ -368,8 +367,6 @@ class partner_balance(report_sxw.rml_parse): # r['balance'] = float(r['sdebit']) - float(r['scredit']) - # - print "=========r",r completearray.append(r) if cleanarray[i]['account_id'] == cleanarray[i-1]['account_id']: diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py index 50d85247351..e5ed33d84b8 100755 --- a/addons/account/report/tax_report.py +++ b/addons/account/report/tax_report.py @@ -111,9 +111,9 @@ class tax_report(rml_parse.rml_parse): LEFT JOIN account_invoice invoice ON \ (invoice.move_id = move.id) \ WHERE line.state<>%s \ - AND line.tax_code_id = %d \ + AND line.tax_code_id = %s \ AND line.account_id = account.id \ - AND account.company_id = %d \ + AND account.company_id = %s \ AND move.id = line.move_id \ AND ((invoice.state = %s) \ OR (invoice.id IS NULL)) \ @@ -131,9 +131,9 @@ class tax_report(rml_parse.rml_parse): FROM account_move_line AS line, \ account_account AS account \ WHERE line.state <> %s \ - AND line.tax_code_id = %d \ + AND line.tax_code_id = %s \ AND line.account_id = account.id \ - AND account.company_id = %d \ + AND account.company_id = %s \ AND account.active \ GROUP BY account.id,account.name,account.code', ('draft',tax_code_id, company_id)) diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py index 5c8132082d9..7fb908e2053 100755 --- a/addons/account/report/third_party_ledger.py +++ b/addons/account/report/third_party_ledger.py @@ -175,7 +175,7 @@ class third_party_ledger(rml_parse.rml_parse): "FROM account_account a " \ "LEFT JOIN account_account_type t " \ "ON (a.type=t.code) " \ - "WHERE a.company_id = %d " \ + "WHERE a.company_id = %s " \ 'AND a.type IN ' + self.ACCOUNT_TYPE + " " \ "AND a.active", (data['form']['company_id'],)) self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()]) @@ -195,7 +195,7 @@ class third_party_ledger(rml_parse.rml_parse): "AND line.reconcile_id IS NULL " \ "AND line.account_id IN (" + self.account_ids + ") " \ " " + PARTNER_REQUEST + " " \ - "AND account.company_id = %d " \ + "AND account.company_id = %s " \ "AND account.active " , (self.date_lst[0],self.date_lst[len(self.date_lst)-1],data['form']['company_id'])) # else: @@ -208,7 +208,7 @@ class third_party_ledger(rml_parse.rml_parse): # "AND line.date IN (" + self.date_lst_string + ") " \ # "AND line.account_id IN (" + self.account_ids + ") " \ # " " + PARTNER_REQUEST + " " \ -# "AND account.company_id = %d " \ +# "AND account.company_id = %s " \ # "AND account.active " , # (data['form']['company_id'])) @@ -236,7 +236,7 @@ class third_party_ledger(rml_parse.rml_parse): # "FROM account_move_line l " \ # "LEFT JOIN account_journal j " \ # "ON (l.journal_id = j.id) " \ -# "WHERE l.partner_id = %d " \ +# "WHERE l.partner_id = %s " \ # "AND l.account_id IN (" + self.account_ids + ") " \ # "AND l.date <= %s " \ # "AND l.reconcile_id IS NULL " @@ -255,7 +255,7 @@ class third_party_ledger(rml_parse.rml_parse): "FROM account_move_line l " \ "LEFT JOIN account_journal j " \ "ON (l.journal_id = j.id) " \ - "WHERE l.partner_id = %d " \ + "WHERE l.partner_id = %s " \ "AND l.account_id IN (" + self.account_ids + ") " \ "AND l.date IN (" + self.date_lst_string + ") " \ " " + RECONCILE_TAG + " "\ @@ -283,7 +283,7 @@ class third_party_ledger(rml_parse.rml_parse): self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line " \ - "WHERE partner_id = %d " \ + "WHERE partner_id = %s " \ "AND account_id IN (" + self.account_ids + ") " \ "AND reconcile_id IS NULL " \ "AND date < %s " , @@ -298,7 +298,7 @@ class third_party_ledger(rml_parse.rml_parse): self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line " \ - "WHERE partner_id = %d " \ + "WHERE partner_id = %s " \ "AND account_id IN (" + self.account_ids + ") " \ " " + RECONCILE_TAG + " " \ "AND date IN (" + self.date_lst_string + ") " , @@ -322,7 +322,7 @@ class third_party_ledger(rml_parse.rml_parse): self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line " \ - "WHERE partner_id=%d " \ + "WHERE partner_id=%s " \ "AND account_id IN (" + self.account_ids + ") " \ "AND reconcile_id IS NULL " \ "AND date < %s " , @@ -336,7 +336,7 @@ class third_party_ledger(rml_parse.rml_parse): self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line " \ - "WHERE partner_id=%d " \ + "WHERE partner_id=%s " \ "AND account_id IN (" + self.account_ids + ") " \ " " + RECONCILE_TAG + " " \ "AND date IN (" + self.date_lst_string + ") " , diff --git a/addons/account/wizard/wizard_automatic_reconcile.py b/addons/account/wizard/wizard_automatic_reconcile.py index df191fb91b2..7c04c963552 100644 --- a/addons/account/wizard/wizard_automatic_reconcile.py +++ b/addons/account/wizard/wizard_automatic_reconcile.py @@ -226,11 +226,11 @@ def _reconcile(self, cr, uid, data, context): cr.execute( "SELECT partner_id " \ "FROM account_move_line " \ - "WHERE account_id=%d " \ + "WHERE account_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ "GROUP BY partner_id " \ - "HAVING ABS(SUM(debit-credit)) < %f AND count(*)>0", + "HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0", (account_id, max_amount)) partner_ids = [id for (id,) in cr.fetchall()] @@ -238,8 +238,8 @@ def _reconcile(self, cr, uid, data, context): cr.execute( "SELECT id " \ "FROM account_move_line " \ - "WHERE account_id=%d " \ - "AND partner_id=%d " \ + "WHERE account_id=%s " \ + "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) @@ -253,7 +253,7 @@ def _reconcile(self, cr, uid, data, context): cr.execute( "SELECT partner_id " \ "FROM account_move_line " \ - "WHERE account_id=%d " \ + "WHERE account_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ "AND partner_id IS NOT NULL " \ @@ -267,8 +267,8 @@ def _reconcile(self, cr, uid, data, context): cr.execute( "SELECT id, debit " \ "FROM account_move_line " \ - "WHERE account_id=%d " \ - "AND partner_id=%d " \ + "WHERE account_id=%s " \ + "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ "AND debit > 0", @@ -279,8 +279,8 @@ def _reconcile(self, cr, uid, data, context): cr.execute( "SELECT id, credit " \ "FROM account_move_line " \ - "WHERE account_id=%d " \ - "AND partner_id=%d " \ + "WHERE account_id=%s " \ + "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ "AND credit > 0", @@ -297,7 +297,7 @@ def _reconcile(self, cr, uid, data, context): cr.execute( "SELECT count(*) " \ "FROM account_move_line " \ - "WHERE account_id=%d " \ + "WHERE account_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " + partner_filter, (account_id,)) diff --git a/addons/account/wizard/wizard_bank_reconcile.py b/addons/account/wizard/wizard_bank_reconcile.py index 0c80ed5a7fb..2fc1bd63c61 100644 --- a/addons/account/wizard/wizard_bank_reconcile.py +++ b/addons/account/wizard/wizard_bank_reconcile.py @@ -34,7 +34,7 @@ _journal_fields = { def _action_open_window(self, cr, uid, data, context): form = data['form'] - cr.execute('select default_credit_account_id from account_journal where id=%d', (form['journal_id'],)) + cr.execute('select default_credit_account_id from account_journal where id=%s', (form['journal_id'],)) account_id = cr.fetchone()[0] if not account_id: raise Exception, _('You have to define the bank account\nin the journal definition for reconciliation.') diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py index 250f2363d3b..f6f47a1d1ae 100644 --- a/addons/account/wizard/wizard_fiscalyear_close.py +++ b/addons/account/wizard/wizard_fiscalyear_close.py @@ -106,11 +106,11 @@ def _data_save(self, cr, uid, data, context): 'amount_currency, currency_id, blocked, partner_id, ' \ 'date_maturity, date_created ' \ 'FROM account_move_line ' \ - 'WHERE account_id = %d ' \ + 'WHERE account_id = %s ' \ 'AND ' + query_line + ' ' \ 'AND reconcile_id is NULL ' \ 'ORDER BY id ' \ - 'LIMIT %d OFFSET %d', (account.id, limit, offset)) + 'LIMIT %s OFFSET %s', (account.id, limit, offset)) result = cr.dictfetchall() if not result: break @@ -136,10 +136,10 @@ def _data_save(self, cr, uid, data, context): 'amount_currency, currency_id, blocked, partner_id, ' \ 'date_maturity, date_created ' \ 'FROM account_move_line ' \ - 'WHERE account_id = %d ' \ + 'WHERE account_id = %s ' \ 'AND ' + query_line + ' ' \ 'ORDER BY id ' \ - 'LIMIT %d OFFSET %d', (account.id,fy_id, limit, offset)) + 'LIMIT %s OFFSET %s', (account.id,fy_id, limit, offset)) result = cr.dictfetchall() if not result: break @@ -157,13 +157,13 @@ def _data_save(self, cr, uid, data, context): cr.execute('UPDATE account_journal_period ' \ 'SET state = %s ' \ - 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %d)', + 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %s)', ('done',fy_id)) cr.execute('UPDATE account_period SET state = %s ' \ - 'WHERE fiscalyear_id = %d', ('done',fy_id)) + 'WHERE fiscalyear_id = %s', ('done',fy_id)) cr.execute('UPDATE account_fiscalyear ' \ - 'SET state = %s, end_journal_period_id = %d' \ - 'WHERE id = %d', ('done',start_jp,fy_id)) + 'SET state = %s, end_journal_period_id = %s' \ + 'WHERE id = %s', ('done',start_jp,fy_id)) return {} class wiz_journal_close(wizard.interface): diff --git a/addons/account/wizard/wizard_journal_select.py b/addons/account/wizard/wizard_journal_select.py index 0bc9b7dc5ad..74f4a597a1e 100644 --- a/addons/account/wizard/wizard_journal_select.py +++ b/addons/account/wizard/wizard_journal_select.py @@ -31,7 +31,7 @@ def _action_open_window(self, cr, uid, data, context): id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] result = act_obj.read(cr, uid, [id])[0] - cr.execute('select journal_id,period_id from account_journal_period where id=%d', (data['id'],)) + cr.execute('select journal_id,period_id from account_journal_period where id=%s', (data['id'],)) journal_id,period_id = cr.fetchone() result['domain'] = str([('journal_id', '=', journal_id), ('period_id', '=', period_id)]) diff --git a/addons/account/wizard/wizard_open_closed_fiscalyear.py b/addons/account/wizard/wizard_open_closed_fiscalyear.py index 5f284b3a7ba..ca484cf03ba 100644 --- a/addons/account/wizard/wizard_open_closed_fiscalyear.py +++ b/addons/account/wizard/wizard_open_closed_fiscalyear.py @@ -47,13 +47,13 @@ def _remove_entries(self, cr, uid, data, context): pool.get('account.move').unlink(cr,uid,ids_move) cr.execute('UPDATE account_journal_period ' \ 'SET state = %s ' \ - 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %d)', + 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %s)', ('draft',data_fyear)) cr.execute('UPDATE account_period SET state = %s ' \ - 'WHERE fiscalyear_id = %d', ('draft',data_fyear)) + 'WHERE fiscalyear_id = %s', ('draft',data_fyear)) cr.execute('UPDATE account_fiscalyear ' \ 'SET state = %s, end_journal_period_id = null '\ - 'WHERE id = %d', ('draft',data_fyear)) + 'WHERE id = %s', ('draft',data_fyear)) return {} class open_closed_fiscal(wizard.interface): diff --git a/addons/account/wizard/wizard_period_close.py b/addons/account/wizard/wizard_period_close.py index 589043a8821..297b271e423 100644 --- a/addons/account/wizard/wizard_period_close.py +++ b/addons/account/wizard/wizard_period_close.py @@ -36,8 +36,8 @@ def _data_save(self, cr, uid, data, context): mode = 'done' if data['form']['sure']: for id in data['ids']: - cr.execute('update account_journal_period set state=%s where period_id=%d', (mode, id)) - cr.execute('update account_period set state=%s where id=%d', (mode, id)) + 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)) return {} class wiz_journal_close(wizard.interface): diff --git a/addons/account_analytic_default/__terp__.py b/addons/account_analytic_default/__terp__.py index e2944cabec0..10199286f44 100644 --- a/addons/account_analytic_default/__terp__.py +++ b/addons/account_analytic_default/__terp__.py @@ -23,7 +23,7 @@ "name" : "Account Analytic Default", "version" : "1.0", "author" : "Tiny", - "website" : "http://tinyerp.com", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "description": """ Allows to automatically select analytic accounts based on criterions: diff --git a/addons/account_analytic_plans/__terp__.py b/addons/account_analytic_plans/__terp__.py index b859645cd0a..3ae2d3ed252 100644 --- a/addons/account_analytic_plans/__terp__.py +++ b/addons/account_analytic_plans/__terp__.py @@ -52,7 +52,7 @@ Plan2: So when this line of invoice will be confirmed, it will generate 3 analytic lines, for one account entry. """, - "website" : "http://tinyerp.com/module_account.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [ ], diff --git a/addons/account_balance/__terp__.py b/addons/account_balance/__terp__.py index 563c03b462f..c9d39375feb 100644 --- a/addons/account_balance/__terp__.py +++ b/addons/account_balance/__terp__.py @@ -38,7 +38,7 @@ 5. You have an option to print the desired report in Landscape format. """, - "website" : "http://tinyerp.com/account_balance.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [ ], diff --git a/addons/account_budget/__terp__.py b/addons/account_budget/__terp__.py index 5f946b91fa5..88a66c88e79 100644 --- a/addons/account_budget/__terp__.py +++ b/addons/account_budget/__terp__.py @@ -23,7 +23,7 @@ "name" : "Budget Management", "version" : "1.0", "author" : "Tiny", - "website" : "http://tinyerp.com/module_crossovered_budget.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "description": """This module allow accountants to manage analytic and crossovered budgets. diff --git a/addons/account_budget/crossovered_budget.py b/addons/account_budget/crossovered_budget.py index 60ca40411ea..c8ebaccf49b 100644 --- a/addons/account_budget/crossovered_budget.py +++ b/addons/account_budget/crossovered_budget.py @@ -168,7 +168,7 @@ class crossovered_budget_lines(osv.osv): date_from = context['wizard_date_from'] if context.has_key('wizard_date_to'): date_to = context['wizard_date_to'] - cr.execute("select sum(amount) from account_analytic_line where account_id=%d and (date between to_date('%s','yyyy-mm-dd') and to_date('%s','yyyy-mm-dd')) and general_account_id in (%s)"%(line.analytic_account_id.id,date_from,date_to,acc_ids)) + cr.execute("select sum(amount) from account_analytic_line where account_id=%s and (date between to_date('%s','yyyy-mm-dd') and to_date('%s','yyyy-mm-dd')) and general_account_id in (%s)", (line.analytic_account_id.id,date_from,date_to,acc_ids)) result=cr.fetchone()[0] if result==None: result=0.00 diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py index 8728ce449e2..da9d3776676 100644 --- a/addons/account_budget/report/budget_report.py +++ b/addons/account_budget/report/budget_report.py @@ -61,7 +61,7 @@ class budget_report(report_sxw.rml_parse): def lines(self, post_obj, date1, date2): res = [] for a in post_obj.account_ids: - self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%d AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2)) + self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%s AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2)) achievements = float(self.cr.fetchone()[0]) res.append({'name': a.name, 'code': a.code, 'achievements': achievements}) return res diff --git a/addons/account_chart/__terp__.py b/addons/account_chart/__terp__.py index 0a57e69d969..f9bb8cd7cef 100644 --- a/addons/account_chart/__terp__.py +++ b/addons/account_chart/__terp__.py @@ -25,7 +25,7 @@ "depends" : ["account"], "author" : "Tiny", "description": """Remove minimal account chart""", - "website" : "http://tinyerp.com/module_account.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [ ], diff --git a/addons/account_date_check/__terp__.py b/addons/account_date_check/__terp__.py index dab5404d331..798beef64ee 100644 --- a/addons/account_date_check/__terp__.py +++ b/addons/account_date_check/__terp__.py @@ -23,7 +23,7 @@ "name" : "Account Date check", "version" : "1.0", "author" : "Tiny", - "website" : "http://tinyerp.com/module_sale.html", + "website" : "http://www.openerp.com", "depends" : ["account"], "category" : "Generic Modules/Accounting", "init_xml" : [], diff --git a/addons/account_followup/__terp__.py b/addons/account_followup/__terp__.py index 0d4a144e7bc..2d86403b13b 100644 --- a/addons/account_followup/__terp__.py +++ b/addons/account_followup/__terp__.py @@ -37,7 +37,7 @@ It will generate a PDF with all the letters according the the different levels of recall defined. You can define different policies for different companies.""", - "website" : "http://tinyerp.com/module_account.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [], "demo_xml" : ["followup_demo.xml"], diff --git a/addons/account_followup/wizard/wizard_followup_print.py b/addons/account_followup/wizard/wizard_followup_print.py index cf3e2cdb409..d1ee95a00b4 100644 --- a/addons/account_followup/wizard/wizard_followup_print.py +++ b/addons/account_followup/wizard/wizard_followup_print.py @@ -129,8 +129,8 @@ class followup_all_print(wizard.interface): for id in to_update.keys(): cr.execute( "UPDATE account_move_line "\ - "SET followup_line_id=%d, followup_date=%s "\ - "WHERE id=%d", + "SET followup_line_id=%s, followup_date=%s "\ + "WHERE id=%s", (to_update[id], data['form']['date'], int(id),)) return {} @@ -230,7 +230,7 @@ class followup_all_print(wizard.interface): cr.execute( "SELECT * "\ "FROM account_followup_followup_line "\ - "WHERE followup_id=%d "\ + "WHERE followup_id=%s "\ "ORDER BY sequence", (fup_id,)) for result in cr.dictfetchall(): delay = datetime.timedelta(days=result['delay']) diff --git a/addons/account_invoice_layout/__terp__.py b/addons/account_invoice_layout/__terp__.py index 0fccef7fa1c..4dd31cc1d07 100644 --- a/addons/account_invoice_layout/__terp__.py +++ b/addons/account_invoice_layout/__terp__.py @@ -35,7 +35,7 @@ Moreover, there is one option which allow you to print all the selected invoices with a given special message at the bottom of it. This feature can be very useful for printing your invoices with end-of-year wishes, special punctual conditions... """, - "website" : "http://tinyerp.com/", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Projects & Services", "init_xml" : [], "demo_xml" : [], diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.py b/addons/account_invoice_layout/report/report_account_invoice_layout.py index f1f745d0579..1909d1de6a0 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.py +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.py @@ -118,7 +118,7 @@ class account_invoice_1(report_sxw.rml_parse): res={} if entry.state=='article': - self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%d'%(entry.id)) + self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%s', (entry.id,)) tax_ids=self.cr.fetchall() if tax_ids==[]: @@ -126,7 +126,7 @@ class account_invoice_1(report_sxw.rml_parse): else: tax_names_dict={} for item in range(0,len(tax_ids)) : - self.cr.execute('select name from account_tax where id=%d'%(tax_ids[item][0])) + self.cr.execute('select name from account_tax where id=%s', (tax_ids[item][0],)) type=self.cr.fetchone() tax_names_dict[item] =type[0] tax_names = ','.join([tax_names_dict[x] for x in range(0,len(tax_names_dict))]) diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py index f9129d412e8..e7aa4cdb727 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.py +++ b/addons/account_invoice_layout/report/special_message_invoice.py @@ -124,7 +124,7 @@ class account_invoice_with_message(report_sxw.rml_parse): res={} if entry.state=='article': - self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%d'%(entry.id)) + self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%s', (entry.id,)) tax_ids=self.cr.fetchall() if tax_ids==[]: @@ -132,7 +132,7 @@ class account_invoice_with_message(report_sxw.rml_parse): else: tax_names_dict={} for item in range(0,len(tax_ids)) : - self.cr.execute('select name from account_tax where id=%d'%(tax_ids[item][0])) + self.cr.execute('select name from account_tax where id=%s', (tax_ids[item][0],)) type=self.cr.fetchone() tax_names_dict[item] =type[0] tax_names = ','.join([tax_names_dict[x] for x in range(0,len(tax_names_dict))]) diff --git a/addons/account_report/__terp__.py b/addons/account_report/__terp__.py index db2688eb269..5425d518b6f 100644 --- a/addons/account_report/__terp__.py +++ b/addons/account_report/__terp__.py @@ -25,7 +25,7 @@ "depends" : ["account"], "author" : "Tiny", "description": """Financial and accounting reporting""", - "website" : "http://tinyerp.com/module_account.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [ ], "demo_xml" : [ ], diff --git a/addons/account_tax_include/__terp__.py b/addons/account_tax_include/__terp__.py index 96fbcf50a1b..5863caafd23 100644 --- a/addons/account_tax_include/__terp__.py +++ b/addons/account_tax_include/__terp__.py @@ -29,7 +29,7 @@ Especially useful for b2c businesses. This module implement the modification on the invoice form. """, - "website" : "http://tinyerp.com/module_account.html", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Accounting", "init_xml" : [ ], "demo_xml" : [ ], diff --git a/addons/account_voucher/__terp__.py b/addons/account_voucher/__terp__.py index 9696cc5c65c..867711e5fe4 100755 --- a/addons/account_voucher/__terp__.py +++ b/addons/account_voucher/__terp__.py @@ -34,7 +34,7 @@ Basic Accounting, plus new things which available are: * Accounting Periods """, "category" : "Generic Modules/Accounting", - "website" : "http://tinyerp.com", + "website" : "http://www.openerp.com", "depends" : ["base", "account"], "init_xml" : [ ], diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 10b3862f3c8..9c584d49c11 100755 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -299,7 +299,7 @@ class account_voucher(osv.osv): self.write(cr, uid, [inv.id], {'move_id': move_id}) obj=self.pool.get('account.move').browse(cr,uid,move_id) for line in obj.line_id : - cr.execute('insert into voucher_id (account_id,rel_account_move) values (%d, %d)',(int(ids[0]),int(line.id))) + cr.execute('insert into voucher_id (account_id,rel_account_move) values (%s, %s)',(int(ids[0]),int(line.id))) return True @@ -337,13 +337,13 @@ class account_voucher(osv.osv): else: ref = self._convert_ref(cr, uid, number) cr.execute('UPDATE account_voucher SET number=%s ' \ - 'WHERE id=%d', (number, id)) + 'WHERE id=%s', (number, id)) cr.execute('UPDATE account_move_line SET ref=%s ' \ - 'WHERE move_id=%d AND (ref is null OR ref = \'\')', + 'WHERE move_id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_analytic_line SET ref=%s ' \ 'FROM account_move_line ' \ - 'WHERE account_move_line.move_id = %d ' \ + 'WHERE account_move_line.move_id = %s ' \ 'AND account_analytic_line.move_id = account_move_line.id', (ref, move_id)) return True diff --git a/addons/analytic_journal_billing_rate/__terp__.py b/addons/analytic_journal_billing_rate/__terp__.py index 83d0bf1d0a3..91d31892b7f 100644 --- a/addons/analytic_journal_billing_rate/__terp__.py +++ b/addons/analytic_journal_billing_rate/__terp__.py @@ -31,7 +31,7 @@ Obviously if no data has been recorded for the current account, the default value is given as usual by the account data so that this module is perfectly compatible with older configurations. """, - "website" : "http://tinyerp.com/", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Others", "init_xml" : [], "demo_xml" : [], diff --git a/addons/analytic_user_function/__terp__.py b/addons/analytic_user_function/__terp__.py index f68543b29a5..9c57b7dc8d2 100644 --- a/addons/analytic_user_function/__terp__.py +++ b/addons/analytic_user_function/__terp__.py @@ -31,7 +31,7 @@ Obviously if no data has been recorded for the current account, the default value is given as usual by the employee data so that this module is perfectly compatible with older configurations. """, - "website" : "http://tinyerp.com/", + "website" : "http://www.openerp.com", "category" : "Generic Modules/Others", "init_xml" : [], "demo_xml" : [], diff --git a/addons/auction/auction.py b/addons/auction/auction.py index 535830c09fd..bcf781f9e83 100644 --- a/addons/auction/auction.py +++ b/addons/auction/auction.py @@ -49,7 +49,7 @@ class auction_dates(osv.osv): tmp={} for id in ids: tmp[id]=0.0 - cr.execute("select sum(obj_price) from auction_lots where auction_id=%d", (id,)) + cr.execute("select sum(obj_price) from auction_lots where auction_id=%s", (id,)) sum = cr.fetchone() if sum: tmp[id]=sum[0] @@ -346,7 +346,7 @@ class auction_lots(osv.osv): res[lot.id] = 0.0 continue auct_id=lot.auction_id.id - cr.execute('select count(*) from auction_lots where auction_id=%d', (auct_id,)) + cr.execute('select count(*) from auction_lots where auction_id=%s', (auct_id,)) nb = cr.fetchone()[0] account_analytic_line_obj = self.pool.get('account.analytic.line') line_ids = account_analytic_line_obj.search(cr, uid, [('account_id', '=', lot.auction_id.account_analytic_id.id),('journal_id', '<>', lot.auction_id.journal_id.id),('journal_id', '<>', lot.auction_id.journal_seller_id.id)]) @@ -806,16 +806,16 @@ class auction_lots(osv.osv): def numerotate(self, cr, uid, ids): - cr.execute('select auction_id from auction_lots where id=%d', (ids[0],)) + cr.execute('select auction_id from auction_lots where id=%s', (ids[0],)) auc_id = cr.fetchone()[0] - cr.execute('select max(obj_num) from auction_lots where auction_id=%d', (auc_id,)) + cr.execute('select max(obj_num) from auction_lots where auction_id=%s', (auc_id,)) try: max = cr.fetchone()[0] except: max = 0 for id in ids: max+=1 - cr.execute('update auction_lots set obj_num=%d where id=%d', (max, id)) + cr.execute('update auction_lots set obj_num=%s where id=%s', (max, id)) return [] auction_lots() diff --git a/addons/auction/report/artists.xsl b/addons/auction/report/artists.xsl index 98e3bde4b01..3349fc2d0bc 100644 --- a/addons/auction/report/artists.xsl +++ b/addons/auction/report/artists.xsl @@ -10,7 +10,7 @@ -