Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-35939-ado into
lp:openobject-addons/6.0.
Requested reviews:
Priyesh (OpenERP) (pso-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-35939-ado/+merge/82123
Hello,
[FIX] Check date not in the period = True is not working while creating journal
entries manually
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-35939-ado/+merge/82123
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-35939-ado.
=== modified file 'account/account.py'
--- account/account.py 2011-10-24 12:22:19 +0000
+++ account/account.py 2011-11-14 11:05:29 +0000
@@ -1166,6 +1166,21 @@
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',
@@ -1173,6 +1188,9 @@
(_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):
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp