Allow to compare start/end date for period with other period

This commit is contained in:
Cédric Krier committed 2008-03-29 17:00:11 +01:00
1 parent 356ae40ff9
commit 134ab682ff
2 files changed
+22 -3

No files matched your search

+4 -3
View File
@@ -363,11 +363,12 @@ class PrintGeneralLegderInit(WizardOSV):
_name = 'account.account.open_general_ledger.init'
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
required=True)
#TODO add domain for start_period <= end_period
start_period = fields.Many2One('account.period', 'Start Period',
domain="[('fiscalyear', '=', fiscalyear)]")
domain="[('fiscalyear', '=', fiscalyear), " \
"('end_date', '<', (end_period, 'start_date'))]")
end_period = fields.Many2One('account.period', 'End Period',
domain="[('fiscalyear', '=', fiscalyear)]")
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '>', (start_period, 'end_date'))]")
company = fields.Many2One('company.company', 'Company', required=True)
posted = fields.Boolean('Posted Move', help='Only posted move')
+18
View File
@@ -58,6 +58,24 @@ class Period(OSV):
'a period with moves!')
return
def search(self, cursor, user, args, offset=0, limit=None, order=None,
context=None, count=False, query_string=False):
args = args[:]
i = 0
while i < len(args):
if args[i][0] in ('start_date', 'end_date'):
if isinstance(args[i][2], (list, tuple)):
if not args[i][2][0]:
args[i] = ('id', '!=', '0')
else:
period = self.browse(cursor, user, args[i][2][0],
context=context)
args[i] = (args[i][0], args[i][1], period[args[i][2][1]])
i += 1
return super(Period, self).search(cursor, user, args, offset=offset,
limit=limit, order=order, context=context, count=count,
query_string=query_string)
def create(self, cursor, user, vals, context=None):
fiscalyear_obj = self.pool.get('account.fiscalyear')
if vals.get('fiscalyear'):