summaryrefslogtreecommitdiff
path: root/bin/addons/base
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2010-11-30 12:09:40 +0100
committerOlivier Dony <odo@openerp.com>2010-11-30 12:09:40 +0100
commitf1cfc436a7311d8d1c0b4572ea59a983d65a2cd4 (patch)
treecba13723c5b3a5abd7021b930c467c4a2bafa3b0 /bin/addons/base
parent4dd9ccb1b96fe96d7a57023ce1b0ac3db56babe2 (diff)
parent456579b198cd0ec544c90c36226308d298ea93fa (diff)
[MERGE+FIX] fixes for translations,sequence,copy,error messages - some patches courtesy of Margarita Manterola and Don Kirkby
lp bug: https://launchpad.net/bugs/672130 fixed lp bug: https://launchpad.net/bugs/663775 fixed lp bug: https://launchpad.net/bugs/673194 fixed lp bug: https://launchpad.net/bugs/663977 fixed bzr revid: odo@openerp.com-20101130110940-0tf6ra0uwhiptieb
Diffstat (limited to 'bin/addons/base')
-rw-r--r--bin/addons/base/ir/ir_sequence.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/addons/base/ir/ir_sequence.py b/bin/addons/base/ir/ir_sequence.py
index 83ab79f20ac..641dd333b81 100644
--- a/bin/addons/base/ir/ir_sequence.py
+++ b/bin/addons/base/ir/ir_sequence.py
@@ -74,10 +74,18 @@ class ir_sequence(osv.osv):
def get_id(self, cr, uid, sequence_id, test='id', context=None):
assert test in ('code','id')
- cr.execute('SELECT id, number_next, prefix, suffix, padding FROM ir_sequence WHERE '+test+'=%s AND active=%s FOR UPDATE NOWAIT', (sequence_id, True))
+ company_id = self.pool.get('res.users').read(cr, uid, uid, ['company_id'], context=context)['company_id'][0] or None
+ cr.execute('''SELECT id, number_next, prefix, suffix, padding
+ FROM ir_sequence
+ WHERE %s=%%s
+ AND active=true
+ AND (company_id = %%s or company_id is NULL)
+ ORDER BY company_id, id
+ FOR UPDATE NOWAIT''' % test,
+ (sequence_id, company_id))
res = cr.dictfetchone()
if res:
- cr.execute('UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s AND active=%s', (res['id'], True))
+ cr.execute('UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s AND active=true', (res['id'],))
if res['number_next']:
return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix'])
else: