Fix for new modeldb

This commit is contained in:
Cédric Krier
2009-02-02 13:09:08 +01:00
parent 048eb7bf66
commit 94aeae9901
4 changed files with 23 additions and 17 deletions
+14 -9
View File
@@ -3,7 +3,6 @@
"Account"
from trytond.osv import fields, OSV
from trytond.osv.orm import exclude
from trytond.wizard import Wizard, WizardOSV
from trytond.report import Report
from decimal import Decimal
@@ -336,7 +335,7 @@ class AccountTemplate(OSV):
ids = [ids]
return [(r['id'], r['code'] and r['code'] + ' - ' + unicode(r[self._rec_name]) \
or unicode(r[self._rec_name])) for r in self.read(cursor, user, ids,
[self._rec_name, 'code'], context=context, load='_classic_write')]
[self._rec_name, 'code'], context=context)]
def _get_account_value(self, cursor, user, template, context=None):
@@ -832,7 +831,7 @@ class Account(OSV):
ids = [ids]
return [(r['id'], r['code'] and r['code'] + ' - ' + unicode(r[self._rec_name]) \
or unicode(r[self._rec_name])) for r in self.read(cursor, user, ids,
[self._rec_name, 'code'], context=context, load='_classic_write')]
[self._rec_name, 'code'], context=context)]
def copy(self, cursor, user, ids, default=None, context=None):
res = super(Account, self).copy(cursor, user, ids, default=default,
@@ -1116,14 +1115,16 @@ class GeneralLegder(Report):
('fiscalyear', '=', datas['form']['fiscalyear']),
('end_date', '<=', end_period.start_date),
], context=context)
end_period_ids = exclude(end_period_ids, start_period_ids)
end_period_ids = list(set(end_period_ids).difference(
set(start_period_ids)))
if datas['form']['end_period'] not in end_period_ids:
end_period_ids.append(datas['form']['end_period'])
else:
end_period_ids = period_obj.search(cursor, user, [
('fiscalyear', '=', datas['form']['fiscalyear']),
], context=context)
end_period_ids = exclude(end_period_ids, start_period_ids)
end_period_ids = list(set(end_period_ids).difference(
set(start_period_ids)))
end_context = context.copy()
end_context['fiscalyear'] = datas['form']['fiscalyear']
@@ -1318,14 +1319,16 @@ class TrialBalance(Report):
('fiscalyear', '=', datas['form']['fiscalyear']),
('end_date', '<=', end_period.start_date),
], context=context)
end_period_ids = exclude(end_period_ids, start_period_ids)
end_period_ids = list(set(end_period_ids).difference(
set(start_period_ids)))
if datas['form']['end_period'] not in end_period_ids:
end_period_ids.append(datas['form']['end_period'])
else:
end_period_ids = period_obj.search(cursor, user, [
('fiscalyear', '=', datas['form']['fiscalyear']),
], context=context)
end_period_ids = exclude(end_period_ids, start_period_ids)
end_period_ids = list(set(end_period_ids).difference(
set(start_period_ids)))
ctx = context.copy()
ctx['fiscalyear'] = datas['form']['fiscalyear']
@@ -1553,14 +1556,16 @@ class OpenIncomeStatement(Wizard):
('fiscalyear', '=', datas['form']['fiscalyear']),
('end_date', '<=', end_period.start_date),
], context=context)
end_period_ids = exclude(end_period_ids, start_period_ids)
end_period_ids = list(set(end_period_ids).difference(
ste(start_period_ids)))
if datas['form']['end_period'] not in end_period_ids:
end_period_ids.append(datas['form']['end_period'])
else:
end_period_ids = period_obj.search(cursor, user, [
('fiscalyear', '=', datas['form']['fiscalyear']),
], context=context)
end_period_ids = exclude(end_period_ids, start_period_ids)
end_period_ids = list(set(end_period_ids).difference(
set(start_period_ids)))
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_account_income_statement_tree'),
+2 -2
View File
@@ -110,8 +110,8 @@ class Journal(OSV):
super(Journal, self).__init__()
self._order.insert(0, ('name', 'ASC'))
def _auto_init(self, cursor, module_name):
super(Journal, self)._auto_init(cursor, module_name)
def init(self, cursor, module_name):
super(Journal, self).init(cursor, module_name)
table = table_handler(cursor, self._table, self._name, module_name)
# Migration from 1.0 sequence Many2One change into Property
+6 -5
View File
@@ -70,8 +70,9 @@ class Move(OSV):
'with date outside the period!',
})
def _auto_init(self, cursor, module_name):
super(Move, self)._auto_init(cursor, module_name)
def init(self, cursor, module_name):
super(Move, self).init(cursor, module_name)
cursor.execute('SELECT indexname FROM pg_indexes ' \
'WHERE indexname = \'account_move_journal_period_index\'')
if not cursor.rowcount:
@@ -1182,14 +1183,14 @@ class Line(OSV):
journal_obj = self.pool.get('account.journal')
period_obj = self.pool.get('account.period')
if not context.get('journal') or not context.get('period'):
return False
return value
journal = journal_obj.browse(cursor, user, context['journal'],
context=context)
period = period_obj.browse(cursor, user, context['period'],
context=context)
if journal and period:
return journal.name + ': ' + period.name
return False
return value
def fields_view_get(self, cursor, user, view_id=None, view_type='form',
context=None, toolbar=False, hexmd5=None):
@@ -1210,7 +1211,7 @@ class Line(OSV):
xml = '<?xml version="1.0"?>\n' \
'<tree string="%s" editable="top" on_write="on_write" ' \
'colors="red:state==\'draft\'">\n'
'colors="red:state==\'draft\'">\n' % title
fields = []
for column in journal.view.columns:
fields.append(column.field.name)
+1 -1
View File
@@ -227,7 +227,7 @@ class Code(OSV):
return [(r['id'], r['code'] and r['code'] + ' - ' + \
unicode(r[self._rec_name]) or unicode(r[self._rec_name]))
for r in self.read(cursor, user, ids,
[self._rec_name, 'code'], context=context, load='_classic_write')]
[self._rec_name, 'code'], context=context)]
def delete(self, cursor, user, ids, context=None):
if isinstance(ids, (int, long)):