bzr revid: fp@tinyerp.com-20081211121432-svcnmyzzf2dgbqiw
This commit is contained in:
Fabien Pinckaers 2008-12-11 13:14:32 +01:00
commit cc6278ea80
189 changed files with 472 additions and 520 deletions

View File

@ -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" : [
],

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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\',\'&lt;&gt;\',\'view\'), (\'type\',\'&lt;&gt;\',\'closed\')]"')
attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'&lt;&gt;\',\'view\'), (\'type\',\'&lt;&gt;\',\'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 += '''<field name="%s" %s/>\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':

View File

@ -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'] \

View File

@ -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 = {

View File

@ -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)

View File

@ -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
#

View File

@ -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

View File

@ -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):

View File

@ -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()

View File

@ -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))

View File

@ -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)
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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):

View File

@ -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:

View File

@ -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:

View File

@ -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']:

View File

@ -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))

View File

@ -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 + ") " ,

View File

@ -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,))

View File

@ -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.')

View File

@ -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):

View File

@ -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)])

View File

@ -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):

View File

@ -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):

View File

@ -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:

View File

@ -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" : [
],

View File

@ -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" : [
],

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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" : [
],

View File

@ -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" : [],

View File

@ -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"],

View File

@ -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'])

View File

@ -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" : [],

View File

@ -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))])

View File

@ -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))])

View File

@ -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" : [ ],

View File

@ -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" : [ ],

View File

@ -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" : [
],

View File

@ -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

View File

@ -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" : [],

View File

@ -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" : [],

View File

@ -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()

View File

@ -10,7 +10,7 @@
<xsl:template match="artists">
<document>
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Bids report" author="Generated by Tiny ERP, Fabien Pinckaers">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Bids report" author="Generated by Open ERP, Fabien Pinckaers">
<pageTemplate id="all">

View File

@ -65,84 +65,84 @@ class auction_total_rml(report_sxw.rml_parse):
def sum_taxes(self,auction_id):
self.cr.execute("select count(1) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d group by auction_id "%(auction_id))
self.cr.execute("select count(1) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s group by auction_id ", (auction_id,))
res = self.cr.fetchone()
return res[0]
def sold_item(self, object_id):
self.cr.execute("select count(1) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and state in ('unsold') "%(object_id,))
self.cr.execute("select count(1) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and state in ('unsold') ", (object_id,))
res = self.cr.fetchone()
return str(res[0])
def sum_buyer(self, auction_id):
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and (ach_uid is not null or ach_login is not null) "%(auction_id))
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and (ach_uid is not null or ach_login is not null) ", (auction_id,))
res = self.cr.fetchone()
return str(res[0])
def sum_seller(self, auction_id):
self.cr.execute("select count(distinct bord_vnd_id) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d AND bord_vnd_id is not null "%(auction_id))
self.cr.execute("select count(distinct bord_vnd_id) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s AND bord_vnd_id is not null ", (auction_id,))
res = self.cr.fetchone()
return res[0]
def sum_adj(self, auction_id):
self.cr.execute("select sum(obj_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d "%(auction_id))
self.cr.execute("select sum(obj_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s ", (auction_id,))
res = self.cr.fetchone()
return str(res[0])
def count_take(self, auction_id):
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and ach_emp='True' "%(auction_id))
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and ach_emp='True' ", (auction_id,))
res = self.cr.fetchone()
return str(res[0])
def chek_paid(self, auction_id):
self.cr.execute("select count(1) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and ((paid_ach='T') or (is_ok='T')) "%(auction_id))
self.cr.execute("select count(1) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and ((paid_ach='T') or (is_ok='T')) ", (auction_id,))
res = self.cr.fetchone()
return str(res[0])
def check_paid_seller(self,auction_id):
self.cr.execute("select sum(seller_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and paid_vnd != 'T' "%(auction_id))
self.cr.execute("select sum(seller_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and paid_vnd != 'T' ", (auction_id,))
res = self.cr.fetchone()
return str(res[0]) or 0.0
def sum_credit(self,auction_id):
self.cr.execute("select sum(buyer_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d "%(auction_id))
self.cr.execute("select sum(buyer_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s", (auction_id,))
res = self.cr.fetchone()
return str(res[0])
def sum_debit_buyer(self,auction_id):
self.cr.execute("select sum(buyer_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d "%(auction_id))
self.cr.execute("select sum(buyer_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s", (auction_id,))
res = self.cr.fetchone()
return str(res[0] or 0)
def sum_debit(self,object_id):
self.cr.execute("select sum(seller_price) from auction_lots where auction_id=%d "%(object_id,))
self.cr.execute("select sum(seller_price) from auction_lots where auction_id=%s", (object_id,))
res = self.cr.fetchone()
return str(res[0] or 0)
def sum_credit_seller(self, object_id):
self.cr.execute("select sum(seller_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d "%(object_id))
self.cr.execute("select sum(seller_price) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s", (object_id,))
res = self.cr.fetchone()
return str(res[0] or 0)
def sum_minadj(self, auction_id):
self.cr.execute('select sum(lot_est1) from auction_lots where id in ('+','.join(map(str,self.total_obj))+') and auction_id=%d '%(auction_id))
self.cr.execute('select sum(lot_est1) from auction_lots where id in ('+','.join(map(str,self.total_obj))+') and auction_id=%s', (auction_id,))
res = self.cr.fetchone()
return str(res[0]) or 0
def sum_maxadj(self, auction_id):
self.cr.execute('select sum(lot_est2) from auction_lots where id in ('+','.join(map(str,self.total_obj))+') and auction_id=%d '%(auction_id))
self.cr.execute('select sum(lot_est2) from auction_lots where id in ('+','.join(map(str,self.total_obj))+') and auction_id=%s', (auction_id,))
res = self.cr.fetchone()
return str(res[0]) or 0
def sum_buyer_paid(self, auction_id):
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and state = 'paid' "%(auction_id))
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and state = 'paid' ", (auction_id,))
res = self.cr.fetchone()
return str(res[0])
def count_comm(self, auction_id):
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%d and obj_comm is not null "%(auction_id))
self.cr.execute("select count(*) from auction_lots where id in ("+",".join(map(str,self.total_obj))+") and auction_id=%s and obj_comm is not null ", (auction_id,))
res = self.cr.fetchone()
return str(res[0])

View File

@ -55,7 +55,7 @@ class buyer_list(report_sxw.rml_parse):
auct_dat=[]
for ad_id in auc_date_ids:
auc_dates_fields = self.pool.get('auction.dates').read(self.cr,self.uid,ad_id[0],['name'])
self.cr.execute('select * from auction_buyer_taxes_rel abr,auction_dates ad where ad.id=abr.auction_id and ad.id=%d'%(ad_id[0],))
self.cr.execute('select * from auction_buyer_taxes_rel abr,auction_dates ad where ad.id=abr.auction_id and ad.id=%s', (ad_id[0],))
res=self.cr.fetchall()
total=0
for r in res:
@ -70,8 +70,8 @@ class buyer_list(report_sxw.rml_parse):
auc_date_ids = self.pool.get('auction.dates').search(self.cr,self.uid,([('name','like',obj['name'])]))
# self.cr.execute('select ach_uid,count(1) as no_lot, sum(obj_price) as adj_price, sum(buyer_price)-sum(obj_price) as buyer_cost ,sum(buyer_price) as to_pay from auction_lots where id in ('+','.join(map(str,self.auc_lot_ids))+') and auction_id=%d and ach_uid is not null group by ach_uid '%(auc_date_ids[0]))
self.cr.execute('select ach_login as ach_uid,count(1) as no_lot, sum(obj_price) as adj_price, sum(buyer_price)-sum(obj_price) as buyer_cost ,sum(buyer_price) as to_pay from auction_lots where id in ('+','.join(map(str,self.auc_lot_ids))+') and auction_id=%d and ach_login is not null group by ach_login order by ach_login'%(auc_date_ids[0]))
# self.cr.execute('select ach_uid,count(1) as no_lot, sum(obj_price) as adj_price, sum(buyer_price)-sum(obj_price) as buyer_cost ,sum(buyer_price) as to_pay from auction_lots where id in ('+','.join(map(str,self.auc_lot_ids))+') and auction_id=%s and ach_uid is not null group by ach_uid ', (auc_date_ids[0],))
self.cr.execute('select ach_login as ach_uid,count(1) as no_lot, sum(obj_price) as adj_price, sum(buyer_price)-sum(obj_price) as buyer_cost ,sum(buyer_price) as to_pay from auction_lots where id in ('+','.join(map(str,self.auc_lot_ids))+') and auction_id=%s and ach_login is not null group by ach_login order by ach_login', (auc_date_ids[0],))
res = self.cr.dictfetchall()
for r in res:
# if r['ach_uid']:

View File

@ -7,7 +7,7 @@
<xsl:template match="achat-listing">
<document filename="example.pdf">
<template pageSize="21cm,29.7cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Bordereau acheteur" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template pageSize="21cm,29.7cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Bordereau acheteur" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="first">
<pageGraphics>
<drawRightString x="19.0cm" y="26.0cm"><xsl:value-of select="date"/></drawRightString>

View File

@ -124,25 +124,25 @@ class auction_catalog(report_rml):
lnum.appendChild(doc.createTextNode(escape(cat['lot_num'])))
infos.appendChild(lnum)
dest = os.path.join('/tmp/pdf_catalog/',str(cwid),str(cat['obj_desc'])+'.jpg')
if not cat['image']:
print "Cat with no Image "
if cat['image']:
import random
import tempfile
limg = doc.createElement('photo_small')
else:
import random
limg = doc.createElement('photo_small')
file_name = '/tmp/image_%d.jpg' % (random.randint(1,1000),)
fp = file(file_name,'wb+')
content = base64.decodestring(cat['image'])
fp.write(content)
fp.close()
fp = file(file_name,'r')
size = photo_shadow.convert_catalog(fp, '/tmp/test.jpg',110)
fp = file('/tmp/test.jpg')
file_data = fp.read()
test_data = base64.encodestring(file_data)
limg.appendChild(doc.createTextNode(test_data))
infos.appendChild(limg)
file_name = tempfile.mktemp(prefix='openerp_auction_', suffix='.jpg')
fp = file(file_name, 'w')
content = base64.decodestring(cat['image'])
fp.write(content)
fp.close()
fp = file(file_name,'r')
test_file_name = tempfile.mktemp(prefix='openerp_auction_test_', suffix='.jpg')
size = photo_shadow.convert_catalog(fp, test_file_name,110)
fp = file(test_file_name)
file_data = fp.read()
test_data = base64.encodestring(file_data)
fp.close()
limg.appendChild(doc.createTextNode(test_data))
infos.appendChild(limg)
for key in ('lot_est1','lot_est2'):
ref2 = doc.createElement(key)

View File

@ -7,7 +7,7 @@
<xsl:template match="report">
<document filename="example_5.pdf">
<template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="main">
<pageGraphics>
<fill color="(0.4,0.4,0.4)"/>

View File

@ -8,7 +8,7 @@
<xsl:template match="/">
<document xmlns:fo="http://www.w3.org/1999/XSL/Format">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Releve de compte" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20" pageSize="(21cm,29.7cm)">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Releve de compte" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20" pageSize="(21cm,29.7cm)">
<pageTemplate id="all">
<frame id="list" x1="1.0cm" y1="1.0cm" height="22.7cm" width="19cm"/>

View File

@ -8,7 +8,7 @@
<xsl:template match="lots">
<document xmlns:fo="http://www.w3.org/1999/XSL/Format">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Releve de compte" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Releve de compte" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="all">
<pageGraphics/>
<frame id="list" x1="1.0cm" y1="2.0cm" width="19.0cm" height="27cm"/>

View File

@ -6,7 +6,7 @@
<xsl:template match="lots">
<document xmlns:fo="http://www.w3.org/1999/XSL/Format">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="" author="Generated by Tiny ERP" allowSplitting="20" pageSize="29.7cm,21cm">
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="" author="Generated by Open ERP" allowSplitting="20" pageSize="29.7cm,21cm">
<pageTemplate id="all">
<pageGraphics/>

View File

@ -19,7 +19,7 @@
<xsl:template match="results">
<document filename="example_5.pdf">
<template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="main">
<pageGraphics>
<fill color="(0.4,0.4,0.4)"/>

View File

@ -20,7 +20,7 @@
<xsl:template match="results">
<document filename="example_5.pdf">
<template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="main">
<pageGraphics>
<fill color="(0.4,0.4,0.4)"/>

View File

@ -7,9 +7,9 @@
<xsl:template match="seller-list">
<document filename="example.pdf">
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<!--
<template pageSize="21m,29.7cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
<template pageSize="21m,29.7cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
-->
<pageTemplate id="first">
<pageGraphics>

View File

@ -23,7 +23,7 @@
"name" : "Audit Trail",
"version" : "1.0",
"depends" : ["base","account","purchase","mrp"],
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"author" : "Tiny",
"init_xml" : [],
"description": "Allows the administrator to track every user operations on all objects of the system.",

View File

@ -23,7 +23,7 @@
"name" : "Base Contact",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Base",
"description": """
This module allows you to manage entirely your contacts.

View File

@ -23,7 +23,7 @@
"name" : "Module Merger",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Base",
"description": """
* The wizard asks a many2many of modules

View File

@ -57,7 +57,7 @@ intro_start_fields = {
'version': {'string':'Version', 'type':'char', 'size':16, 'required':True},
'author': {'string':'Author', 'type':'char', 'size':64, 'default': lambda *args: 'Tiny', 'required':True},
'category': {'string':'Category', 'type':'char', 'size':64, 'default': lambda *args: 'Vertical Modules/Parametrization', 'required':True},
'website': {'string':'Documentation URL', 'type':'char', 'size':64, 'default': lambda *args: 'http://tinyerp.com', 'required':True},
'website': {'string':'Documentation URL', 'type':'char', 'size':64, 'default': lambda *args: 'http://www.openerp.com', 'required':True},
'description': {'string':'Full Description', 'type':'text', 'required':True},
'data_kind': {'string':'Type of Data', 'type':'selection', 'selection':[('demo','Demo Data'),('update','Normal Data')], 'required':True, 'default': lambda *args:'update'},
}
@ -69,7 +69,7 @@ intro_save_form = '''<?xml version="1.0"?>
<newline/>
<field name="module_file"/>
<separator string="Information" colspan="4"/>
<label string="If you think your module could interrest others people, we'd like you to publish it on TinyERP.com, in the 'Modules' section. You can do it through the website or using features of the 'base_module_publish' module." colspan="4" align="0.0"/>
<label string="If you think your module could interrest others people, we'd like you to publish it on OpenERP.com, in the 'Modules' section. You can do it through the website or using features of the 'base_module_publish' module." colspan="4" align="0.0"/>
<label string="Thanks in advance for your contribution." colspan="4" align="0.0"/>
</form>'''
@ -169,13 +169,10 @@ class base_module_merge(wizard.interface):
terp_file=os.path.join(fromurl,'__terp__.py')
terp_info=eval(tools.file_open(terp_file).read())
if os.path.basename(path) in terp_info['init_xml']:
print "in init_xml",new_path
self.init_xml+=[os.path.basename(new_path)]
elif os.path.basename(path) in terp_info['demo_xml']:
print "in demo_xml",new_path
self.demo_xml+=[os.path.basename(new_path)]
elif os.path.basename(path) in terp_info['update_xml']:
print "in update_xml",new_path
self.update_xml+=[os.path.basename(new_path)]
else:
file_data=tools.file_open(os.path.join(fromurl, path)).read()

View File

@ -23,12 +23,12 @@
"name" : "Module publisher",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Base",
"description": """
This module can be used by developpers to automatically publish their modules
in a few click to the following websites:
* http://TinyERP.com, section module
* http://OpenERP.com, section module
* http://TinyForge.org
* PyPi, The python offical repository
* http://Freshmeat.net

View File

@ -40,7 +40,7 @@ intro_fields = {
'text': {'string':'Introduction', 'type':'text', 'readonly':True,
'default': lambda *args: """
This system will automatically publish the selected module to the
Tiny ERP official website. You can use it to quickly publish a new
Open ERP official website. You can use it to quickly publish a new
module or update an existing one (new version).
Make sure you read the publication manual and modules guidelines
@ -123,7 +123,7 @@ check_fields = {
upload_info_form = '''<?xml version="1.0"?>
<form string="Module publication">
<separator string="User information" colspan="4"/>
<label string="Please provide here your login on the Tiny ERP website."
<label string="Please provide here your login on the Open ERP website."
align="0.0" colspan="4"/>
<label string="If you don't have an access, you can create one http://www.openerp.com/"
align="0.0" colspan="4"/>
@ -174,7 +174,7 @@ end_fields = {
Thank you for contributing !
Your module has been successfully uploaded to the official website.
You must wait a few hours/days so that the Tiny ERP core team review
You must wait a few hours/days so that the Open ERP core team review
your module for approval on the website.
"""},
'result': {'string':'Result page', 'type':'text', 'readonly':True}

View File

@ -36,7 +36,7 @@ intro_fields = {
'text': {'string': 'Introduction', 'type': 'text', 'readonly': True,
'default': lambda *a: """
This system will automatically publish and upload the selected modules to the
Tiny ERP official website. You can use it to quickly update a set of
Open ERP official website. You can use it to quickly update a set of
module (new version).
Make sure you read the publication manual and modules guidlines
@ -50,7 +50,7 @@ Thanks you for contributing!
login_form = '''<?xml version="1.0"?>
<form string="Module publication">
<separator string="User information" colspan="4"/>
<label string="Please provide here your login on the Tiny ERP website."
<label string="Please provide here your login on the Open ERP website."
align="0.0" colspan="4"/>
<label string="If you don't have an access, you can create one http://www.openerp.com/"
align="0.0" colspan="4"/>
@ -101,9 +101,6 @@ def _upload(self, cr, uid, datas, context):
], [('module', res['module_filename'],
res['module_file'])
])
print '-'*50
print result
print '-'*50
if result[0] == "1":
raise wizard.except_wizard('Error', 'Login failed!')
elif result[0] == "0":
@ -129,20 +126,14 @@ def _upload(self, cr, uid, datas, context):
'auto_login': datas['form']['login'],
'auto_password': datas['form']['password']
}
print updata
a = urlopen('http://www.openerp.com/mtree_interface.php?module=%s' % (mod.name,))
aa = a.read()
print '='*40
print aa
if aa[0]<>'0':
updata['link_id']=aa.split('\n')[0]
updata['cat_id']=aa.split('\n')[1]
updata['option'] = 'mtree'
result = post_multipart('www.openerp.com', '/index.php', updata.items(), [])
print '.'*50
print result
return {'update': '\n'.join(log[0]), 'already': '\n'.join(log[1]),
'error': '\n'.join(log[2])}
return {'update': '\n'.join(log[0]), 'already': '\n'.join(log[1]), 'error': '\n'.join(log[2])}
class base_module_publish_all(wizard.interface):
states = {

View File

@ -36,34 +36,16 @@ def _test_pylint(self, url, add_folder=None):
subfolder.update(res)
dict_files = {}
for file in list_files:
if file.split('.')[-1] == 'py':
save_file = file.split('.')[0]+".txt"
if file.split('.')[-1] == 'py' and not file.startswith('__init__'):
file_path = os.path.join(url, file)
os.system('pylint '+file_path+'>> '+save_file+' ')
a2 = os.system('cat '+save_file+' | tail -4 >> temp.txt')
os.system('rm '+save_file+' ')
fp = open('temp.txt','r')
result = fp.read()
fp.close()
str_result = ''
try:
for line in result:
str_result = str_result + line
finally:
fp = open('temp.txt','w')
fp.write('')
fp.close()
if str_result.startswith('Global'):
res = os.popen('pylint '+file_path+' | tail -4').read()
if res.startswith('Global'):
if add_folder:
dict_files[add_folder + '/' + file] = str_result
dict_files[add_folder + '/' + file] = res
else:
dict_files[file] = str_result
os.system(' rm temp.txt ')
dict_files[file] = res
dict_files.update(subfolder)
return dict_files
#
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -23,13 +23,13 @@
"name" : "Module Recorder",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Base",
"description": """
This module allows you to create a new module without any development.
It records all operations on objects during the recording session and
produce a .ZIP module. So you can create your own module directly from
the Tiny ERP client.
the Open ERP client.
This version works for creating and updating existing records. It recomputes
dependencies and links for all types of widgets (many2one, many2many, ...).
@ -40,7 +40,7 @@ for custom configurations and demo/testing data.
How to use it:
1. Start the recording
2. Do stuff in your Tiny ERP client
2. Do stuff in your Open ERP client
3. Stop the recording session
4. Export to a reusable module
""",

View File

@ -236,8 +236,6 @@ class base_module_record(osv.osv):
return result
def _create_function(self, cr, uid, doc, model, name, record_id):
print 'Create Function', model, name, record_id
record = doc.createElement('function')
record.setAttribute("name", name)
record.setAttribute("model", model)

View File

@ -27,14 +27,14 @@ import pooler
intro_stop_form = '''<?xml version="1.0"?>
<form string="Module Recording">
<separator string="Recording Information" colspan="4"/>
<label string="Tiny ERP recording is stopped. Don't forget to save the recorded module." colspan="4" align="0.0"/>
<label string="Open ERP recording is stopped. Don't forget to save the recorded module." colspan="4" align="0.0"/>
<label string="You can continue the recording session by relauching the 'start recording' wizard." colspan="4" align="0.0"/>
</form>'''
intro_start_form = '''<?xml version="1.0"?>
<form string="Recording Stopped">
<separator string="Recording information" colspan="4"/>
<label string="The module recorder allows you to record every operation made in the Tiny ERP client and save them as a module. You will be able to install this module on any database to reuse and/or publish it." colspan="4" align="0.0"/>
<label string="The module recorder allows you to record every operation made in the Open ERP client and save them as a module. You will be able to install this module on any database to reuse and/or publish it." colspan="4" align="0.0"/>
<field name="continue"/>
</form>'''

View File

@ -63,7 +63,7 @@ intro_start_fields = {
'version': {'string':'Version', 'type':'char', 'size':16, 'required':True},
'author': {'string':'Author', 'type':'char', 'size':64, 'default': lambda *args: 'Tiny', 'required':True},
'category': {'string':'Category', 'type':'char', 'size':64, 'default': lambda *args: 'Vertical Modules/Parametrization', 'required':True},
'website': {'string':'Documentation URL', 'type':'char', 'size':64, 'default': lambda *args: 'http://tinyerp.com', 'required':True},
'website': {'string':'Documentation URL', 'type':'char', 'size':64, 'default': lambda *args: 'http://www.openerp.com', 'required':True},
'description': {'string':'Full Description', 'type':'text', 'required':True},
'data_kind': {'string':'Type of Data', 'type':'selection', 'selection':[('demo','Demo Data'),('update','Normal Data')], 'required':True, 'default': lambda *args:'update'},
}
@ -75,7 +75,7 @@ intro_save_form = '''<?xml version="1.0"?>
<newline/>
<field name="module_file" filename="module_filename"/>
<separator string="Information" colspan="4"/>
<label string="If you think your module could interrest others people, we'd like you to publish it on TinyERP.com, in the 'Modules' section. You can do it through the website or using features of the 'base_module_publish' module." colspan="4" align="0.0"/>
<label string="If you think your module could interrest others people, we'd like you to publish it on OpenERP.com, in the 'Modules' section. You can do it through the website or using features of the 'base_module_publish' module." colspan="4" align="0.0"/>
<label string="Thanks in advance for your contribution." colspan="4" align="0.0"/>
</form>'''
@ -136,7 +136,7 @@ def _create_module(self, cr, uid, data, context):
"installable": True
} """ % data['form']
filewrite = {
'__init__.py':'#\n# Generated by the Tiny ERP module recorder !\n#\n',
'__init__.py':'#\n# Generated by the Open ERP module recorder !\n#\n',
'__terp__.py':_terp,
dname+'_data.xml': res_xml
}

View File

@ -166,7 +166,6 @@ def _set_form_value(self, cr, uid, data, context):
def _set_operator(self, cr, uid, data, context):
field = pooler.get_pool(cr.dbname).get('ir.model.fields').browse(cr, uid, data['form']['field_id'])
print field.ttype
operator = set_value_fields['operator']['selection']
while operator:
operator.pop(operator.__len__()-1)

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -28,10 +28,10 @@ OpenOffice.
"version" : "0.1",
"depends" : ["base"],
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Base",
"init_xml" : [ ],
"demo_xml" : ["base_report_user_data.xml"],
"demo_xml" : ["base_report_data.xml"],
"update_xml" : [ "base_report_designer_wizard.xml" ],
"active": False,
"installable": True

View File

@ -5,7 +5,7 @@
<field eval="[(6,0,[])]" name="menu_access"/>
<field eval="[(6,0,[])]" name="rule_groups"/>
<field eval="[(6,0,[ref('base.user_root')])]" name="users"/>
<field eval="&quot;&quot;&quot;OpenOfficeReportDesinger&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;OpenOfficeReportDesigner&quot;&quot;&quot;" name="name"/>
</record>
</data>
</openerp>

View File

@ -41,11 +41,11 @@ intro_fields = {
'readonly': True,
'default': lambda *args: """This system must be used with the Tiny OpenOffice plugin. If you
did not installed yet, you can find this package on:
http://tinyerp.com
http://www.openerp.com
This wizard will provide you the .SXW report that you can modify
in OpenOffice. After having modified it, you will be able to reupload
it to the Tiny ERP server.
it to the Open ERP server.
"""},
'operation': {
'string': 'Operation',
@ -83,7 +83,7 @@ get_form_result = '''<?xml version="1.0"?>
<newline/>
<field name="file_sxw"/>
<newline/>
<label colspan="4" string="This is the template of your requested report.\nSave it as a .SXW file and open it with OpenOffice.\nDon't forget to install the Tiny OpenOffice package to modify it.\nOnce it is modified, re-upload it in Tiny ERP using this wizard." align="0.0"/>
<label colspan="4" string="This is the template of your requested report.\nSave it as a .SXW file and open it with OpenOffice.\nDon't forget to install the Tiny OpenOffice package to modify it.\nOnce it is modified, re-upload it in Open ERP using this wizard." align="0.0"/>
</form>'''
get_form_fields = {

View File

@ -31,7 +31,7 @@
##############################################################################
"""
Tiny SXW2RML - The Tiny ERP's report engine
Tiny SXW2RML - The Open ERP's report engine
Tiny SXW2RMLis part of the Tiny report project.
Tiny Report is a module that allows you to render high quality PDF document

View File

@ -23,7 +23,7 @@
"name" : "Base Setup",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Base",
"description": """
This module implements a configuration system that helps user

View File

@ -65,7 +65,7 @@ class board_board(osv.osv):
view = self.create_view(cr, uid, ids[0], context)
id = board.view_id.id
cr.execute("update ir_ui_view set arch='%s' where id=%d" % (view, id))
cr.execute("update ir_ui_view set arch='%s' where id=%s" % (view, id))
cr.commit()
return result

View File

@ -23,25 +23,25 @@
"name" : "Customer & Supplier Relationship Management",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_crm.html",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/CRM & SRM",
"description": """The Tiny ERP case and request tracker enables a group of
"description": """The Open ERP case and request tracker enables a group of
people to intelligently and efficiently manage tasks, issues, and requests.
It manages key tasks such as communication, identification, prioritization,
assignment, resolution and notification.
Tiny ERP ensures that all cases are successfly tracked by users, customers and
Open ERP ensures that all cases are successfly tracked by users, customers and
suppliers. It can automatically send reminders, escalate the request, trigger
specific methods and lots of others actions based on your enterprise own rules.
The greatest thing about this system is that users don't need to do anything
special. They can just send email to the request tracker. Tiny ERP will take
special. They can just send email to the request tracker. Open ERP will take
care of thanking them for their message, automatically routing it to the
appropriate staff, and making sure all future correspondence gets to the right
place.
The CRM module has a email gateway for the synchronisation interface
between mails and Tiny ERP.""",
between mails and Open ERP.""",
"depends" : ["base"],
"init_xml" : ["crm_data.xml"],
"demo_xml" : ["crm_demo.xml"],

View File

@ -60,7 +60,7 @@ class crm_case_section(osv.osv):
'active': fields.boolean('Active'),
'sequence': fields.integer('Sequence'),
'user_id': fields.many2one('res.users', 'Responsible'),
'reply_to': fields.char('Reply-To', size=64, help="The email address wich is the 'Reply-To' of all email sent by Tiny ERP for cases in this section"),
'reply_to': fields.char('Reply-To', size=64, help="The email address wich is the 'Reply-To' of all email sent by Open ERP for cases in this section"),
'parent_id': fields.many2one('crm.case.section', 'Parent Section'),
'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Childs Sections'),
}

View File

@ -33,7 +33,7 @@ def som(cr, uid, partner_id, args):
'''
select s.factor from res_partner_event e
left join res_partner_som s
on (e.som=s.id) where partner_id=%d and date>=%s and date<%s''',
on (e.som=s.id) where partner_id=%s and date>=%s and date<%s''',
(partner_id,
time.strftime('%Y-%m-%d', time.gmtime(date_start)),
time.strftime('%Y-%m-%d', time.gmtime(next_date))))

View File

@ -59,7 +59,7 @@ class crm_segmentation(osv.osv):
for categ in categs:
if start:
if categ['exclusif']:
cr.execute('delete from res_partner_category_rel where category_id=%d', (categ['categ_id'][0],))
cr.execute('delete from res_partner_category_rel where category_id=%s', (categ['categ_id'][0],))
id = categ['id']
@ -68,7 +68,7 @@ class crm_segmentation(osv.osv):
if categ['sales_purchase_active']:
to_remove_list=[]
cr.execute('select id from crm_segmentation_line where segmentation_id=%d', (id,))
cr.execute('select id from crm_segmentation_line where segmentation_id=%s', (id,))
line_ids = [x[0] for x in cr.fetchall()]
for pid in partners:
@ -78,7 +78,7 @@ class crm_segmentation(osv.osv):
partners.remove(pid)
for partner_id in partners:
cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%d,%d)', (categ['categ_id'][0],partner_id))
cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%s,%s)', (categ['categ_id'][0],partner_id))
cr.commit()
self.write(cr, uid, [id], {'state':'not running', 'partner_id':0})
@ -124,14 +124,14 @@ class crm_segmentation_line(osv.osv):
cr.execute('SELECT SUM(l.price_unit * l.quantity) ' \
'FROM account_invoice_line l, account_invoice i ' \
'WHERE (l.invoice_id = i.id) ' \
'AND i.partner_id = %d '\
'AND i.partner_id = %s '\
'AND i.type = \'out_invoice\'',
(partner_id,))
value = cr.fetchone()[0] or 0.0
cr.execute('SELECT SUM(l.price_unit * l.quantity) ' \
'FROM account_invoice_line l, account_invoice i ' \
'WHERE (l.invoice_id = i.id) ' \
'AND i.partner_id = %d '\
'AND i.partner_id = %s '\
'AND i.type = \'out_refund\'',
(partner_id,))
value -= cr.fetchone()[0] or 0.0
@ -139,14 +139,14 @@ class crm_segmentation_line(osv.osv):
cr.execute('SELECT SUM(l.price_unit * l.quantity) ' \
'FROM account_invoice_line l, account_invoice i ' \
'WHERE (l.invoice_id = i.id) ' \
'AND i.partner_id = %d '\
'AND i.partner_id = %s '\
'AND i.type = \'in_invoice\'',
(partner_id,))
value = cr.fetchone()[0] or 0.0
cr.execute('SELECT SUM(l.price_unit * l.quantity) ' \
'FROM account_invoice_line l, account_invoice i ' \
'WHERE (l.invoice_id = i.id) ' \
'AND i.partner_id = %d '\
'AND i.partner_id = %s '\
'AND i.type = \'in_refund\'',
(partner_id,))
value -= cr.fetchone()[0] or 0.0

View File

@ -106,8 +106,8 @@ class email_parser(object):
try:
data.update(self.partner_get(self._decode_header(msg['From'])))
except Exception, e:
print e
#end try
import netsvc
netsvc.Logger().notifyChannel('mailgate', netsvc.LOG_ERROR, "%s" % e)
id = self.rpc('crm.case', 'create', data)
attachments = message['attachment']
@ -122,7 +122,6 @@ class email_parser(object):
'res_id': id
}
self.rpc('ir.attachment', 'create', data_attach)
#end for
return id
@ -297,11 +296,11 @@ if __name__ == '__main__':
group = optparse.OptionGroup(parser, "Note",
"This program parse a mail from standard input and communicate "
"with the Tiny ERP server for case management in the CRM module.")
"with the Open ERP server for case management in the CRM module.")
parser.add_option_group(group)
parser.add_option("-u", "--user", dest="userid", help="ID of the user in Tiny ERP", default=3, type='int')
parser.add_option("-p", "--password", dest="password", help="Password of the user in Tiny ERP", default='admin')
parser.add_option("-u", "--user", dest="userid", help="ID of the user in Open ERP", default=3, type='int')
parser.add_option("-p", "--password", dest="password", help="Password of the user in Open ERP", default='admin')
parser.add_option("-e", "--email", dest="email", help="Email address used in the From field of outgoing messages")
parser.add_option("-s", "--section", dest="section", help="ID or code of the case section", default="support")
parser.add_option("-m", "--default", dest="default", help="Default eMail in case of any trouble.", default=None)

View File

@ -23,10 +23,10 @@
"name" : "Customer Relationship Management",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_crm.html",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/CRM & SRM",
"description": """
The Tiny ERP case and request tracker enables a group of
The Open ERP case and request tracker enables a group of
people to intelligently and efficiently manage tasks, issues,
and requests. It manages key tasks such as communication,
identification, prioritization, assignment, resolution and notification.

View File

@ -36,7 +36,7 @@
* Note: this module is not compatible with the module segmentation, since it's the same which has been renamed.
""",
"website" : "http://tinyerp.com/",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/CRM & SRM",
"init_xml" : [],
"demo_xml" : ["crm_profiling_demo.xml"],

View File

@ -90,8 +90,8 @@ def _recompute_categ(self, cr, uid, pid, answers_ids):
cr.execute('''
select r.category_id
from res_partner_category_rel r left join crm_segmentation s on (r.category_id = s.categ_id)
where r.partner_id = %d and (s.exclusif = false or s.exclusif is null);
'''% pid)
where r.partner_id = %s and (s.exclusif = false or s.exclusif is null)
''', (pid,))
for x in cr.fetchall():
ok.append(x[0])
@ -173,10 +173,8 @@ class partner(osv.osv):
if x.startswith("quest_form") and data['form'][x] != 0 :
temp.append(data['form'][x])
query = """
select answer from partner_question_rel
where partner =%d"""% data['id']
cr.execute(query)
query = "select answer from partner_question_rel where partner=%s"
cr.execute(query, data['id'])
for x in cr.fetchall():
temp.append(x[0])
@ -212,7 +210,7 @@ class crm_segmentation(osv.osv):
for categ in categs:
if start:
if categ['exclusif']:
cr.execute('delete from res_partner_category_rel where category_id=%d', (categ['categ_id'][0],))
cr.execute('delete from res_partner_category_rel where category_id=%s', (categ['categ_id'][0],))
id = categ['id']
@ -221,7 +219,7 @@ class crm_segmentation(osv.osv):
if categ['sales_purchase_active']:
to_remove_list=[]
cr.execute('select id from crm_segmentation_line where segmentation_id=%d', (id,))
cr.execute('select id from crm_segmentation_line where segmentation_id=%s', (id,))
line_ids = [x[0] for x in cr.fetchall()]
for pid in partners:
@ -234,7 +232,7 @@ class crm_segmentation(osv.osv):
to_remove_list=[]
for pid in partners:
cr.execute('select distinct(answer) from partner_question_rel where partner=%d' % pid)
cr.execute('select distinct(answer) from partner_question_rel where partner=%s',(pid,))
answers_ids = [x[0] for x in cr.fetchall()]
if (not test_prof(cr, uid, id, pid, answers_ids)):
@ -243,7 +241,7 @@ class crm_segmentation(osv.osv):
partners.remove(pid)
for partner_id in partners:
cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%d,%d)', (categ['categ_id'][0],partner_id))
cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%s,%s)', (categ['categ_id'][0],partner_id))
cr.commit()
self.write(cr, uid, [id], {'state':'not running', 'partner_id':0})

View File

@ -17,7 +17,7 @@
<field name="name">Partner level?</field>
</record>
<record model="crm_profiling.question" id="partner_tiny">
<field name="name">TinyERP partner?</field>
<field name="name">OpenERP partner?</field>
</record>
<!--
@ -103,7 +103,7 @@
-->
<record model="crm.segmentation" id="crm_segmentation0">
<field name="name">TinyERP partners</field>
<field name="name">OpenERP partners</field>
<field name="answer_yes" eval="[(6,0,[partner_tiny1])]" />
<field name="categ_id" ref="base.res_partner_category_2"/>
<field name="profiling_active">True</field>

View File

@ -23,7 +23,7 @@
"name" : "CRM Verticalisation",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://www.openerp.com",
"category" : "Vertical Modules/Parametrization",
"description": """Simplification of the interface for CRM.""",
"depends" : ["crm_configuration"],

View File

@ -24,7 +24,7 @@
"version" : "1.0",
"author" : "Tiny",
"category" : "Generic Modules/Others",
"website": "http://www.tinyerp.com",
"website": "http://www.openerp.com",
"description": "Sample custom module where you can put your customer specific developments.",
"depends" : ["base"],
"init_xml" : [],

View File

@ -2,7 +2,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="signature" select="//corporate-header/user/signature"/>
<xsl:variable name="title">Tiny ERP Report</xsl:variable>
<xsl:variable name="title">Open ERP Report</xsl:variable>
<xsl:variable name="leftMargin">1cm</xsl:variable>
<xsl:variable name="rightMargin">1cm</xsl:variable>
<xsl:variable name="topMargin">1cm</xsl:variable>

View File

@ -24,7 +24,7 @@
"version" : "1.0",
"author" : "Tiny",
"category" : "Generic Modules/Sales & Purchases",
"description": "Allows to add delivery methods in sales order and packings. You can define your own carrier and delivery grids for prices. When creating invoices from pickings, Tiny ERP is able to add and compute the shipping line.",
"description": "Allows to add delivery methods in sales order and packings. You can define your own carrier and delivery grids for prices. When creating invoices from pickings, Open ERP is able to add and compute the shipping line.",
"depends" : ["sale","purchase", "stock",],
"init_xml" : ["delivery_data.xml"],
"demo_xml" : ["delivery_demo.xml"],

View File

@ -5,7 +5,7 @@
<record id="delivery_partner" model="res.partner">
<field name="name">The Poste</field>
<field name="website">http://tinyerp.com</field>
<field name="website">http://www.openerp.com</field>
</record>
<record id="delivery_partner_address" model="res.partner.address">
<field name="name">Fabien Pinckaers</field>

View File

@ -24,7 +24,7 @@
"version" : "1.0",
"author" : "Tiny",
"category" : "Generic Modules/Others",
"website": "http://www.tinyerp.com",
"website": "http://www.openerp.com",
"description": """This is a complete document management system:
* FTP Interface
* User Authentification

View File

@ -35,7 +35,7 @@ import StringIO
import random
import string
from psycopg2 import Binary
from tools import config
def random_name():
@ -522,9 +522,9 @@ class document_file(osv.osv):
v = base64.decodestring(value)
fp.write(v)
filesize = os.stat(fname).st_size
cr.execute('update ir_attachment set store_fname=%s,store_method=%s,file_size=%d where id=%d', (os.path.join(flag,filename),'fs',len(v),id))
cr.execute('update ir_attachment set store_fname=%s,store_method=%s,file_size=%s where id=%s', (os.path.join(flag,filename),'fs',len(v),id))
else:
cr.execute('update ir_attachment set datas=%s,store_method=%s where id=%d', (psycopg.Binary(value),'db',id))
cr.execute('update ir_attachment set datas=%s,store_method=%s where id=%s', (Binary(value),'db',id))
return True
_columns = {

View File

@ -494,7 +494,7 @@ class abstracted_fs:
elif src.object.res_id:
# I had to do that because writing False to an integer writes 0 instead of NULL
# change if one day we decide to improve osv/fields.py
dst_basedir.cr.execute('update ir_attachment set res_id=NULL where id=%d', (src.object.id,))
dst_basedir.cr.execute('update ir_attachment set res_id=NULL where id=%s', (src.object.id,))
pool.get('ir.attachment').write(src.cr, src.uid, [src.object.id], val)
src.cr.commit()

View File

@ -24,7 +24,7 @@
"version" : "1.0",
"author" : "Tiny",
"category" : "Generic Modules/Others",
"website": "http://www.tinyerp.com",
"website": "http://www.openerp.com",
"description": """Allows to synchronize calendars with others applications.""",
"depends" : ["document","crm_configuration"],
"init_xml" : ["document_data.xml"],

View File

@ -24,7 +24,7 @@ import pooler
def _event_registration(self, cr, uid, data, context):
event_id = data['id']
cr.execute(''' SELECT section_id FROM event_event WHERE id = %d '''% (event_id, ))
cr.execute('SELECT section_id FROM event_event WHERE id = %s', (event_id, ))
res = cr.fetchone()
value = {
'domain': [('section_id', '=', res[0])],

View File

@ -24,7 +24,7 @@ import pooler
def _event_tasks(self, cr, uid, data, context):
event_id = data['id']
cr.execute('''SELECT project_id FROM event_event WHERE id = %d '''% (event_id, ))
cr.execute('SELECT project_id FROM event_event WHERE id = %s', (event_id, ))
res = cr.fetchone()
if not res[0]:
raise wizard.except_wizard('Error !', 'No project defined for this event.\nYou can create one with the retro-planning button !')

Some files were not shown because too many files have changed in this diff Show More