return False
return True
+ def _check_date(self, cursor, user, ids, context=None):
+ journal_obj = self.pool.get('account.journal')
+ period_obj = self.pool.get('account.period')
+ for move in self.browse(cursor, user, ids, context=context):
+ journal_id = move.journal_id.id
+ period_id = move.period_id
+ entry_date = move.date
+ if journal_id and period_id and entry_date:
+ journal = journal_obj.browse(cursor, user, journal_id, context=context)
+ if journal.allow_date:
+ print period_id.id
+ if not time.strptime(entry_date[:10],'%Y-%m-%d') >= time.strptime(period_id.date_start, '%Y-%m-%d') or not time.strptime(entry_date[:10], '%Y-%m-%d') <= time.strptime(period_id.date_stop, '%Y-%m-%d'):
+ return False
+ return True
+
_constraints = [
(_check_centralisation,
'You cannot create more than one move per period on centralized journal',
(_check_period_journal,
'You cannot create entries on different periods/journals in the same move',
['line_id']),
+ (_check_date,
+ 'The date of your Journal Entry is not in the defined period!',
+ ['journal_id'])
]
def post(self, cr, uid, ids, context=None):