Ravish(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1095652-rmu into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1095652 in OpenERP Addons: "[Accounting] Accounting => Bank and Cash => 
Bank Statements: possible to select a date that doesn't correspond to the 
period but not viceversa"
  https://bugs.launchpad.net/openobject-addons/+bug/1095652

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1095652-rmu/+merge/142284

Hello,

I have been fixed in lp:~openerp-dev/openobject-addons/trunk-bug-1095652-rmu 
with Following Revision ID and Revison Number

Revision ID: r...@tinyerp.com-20130108110232-nonf0el110j9xwem.
Revision No:8496.

Thanks,

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1095652-rmu/+merge/142284
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1095652-rmu.
=== modified file 'account/account_bank_statement.py'
--- account/account_bank_statement.py	2012-12-20 11:54:56 +0000
+++ account/account_bank_statement.py	2013-01-08 11:14:34 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 import time
+from datetime import datetime
 
 from openerp.osv import fields, osv
 from openerp.tools.translate import _
@@ -148,6 +149,18 @@
     _constraints = [
         (_check_company_id, 'The journal and period chosen have to belong to the same company.', ['journal_id','period_id']),
     ]
+    
+    def _check_period_id(self, cr, uid, ids, context=None):
+        statement = self.browse(cr, uid, ids[0], context=context)
+        period_month = (datetime.strptime(statement.period_id.date_start,'%Y-%m-%d')).month
+        date_month = (datetime.strptime(statement.date,'%Y-%m-%d')).month
+        if date_month != period_month:
+            return False    
+        return True
+
+    _constraints = [
+        (_check_period_id, 'The date and period chosen have to belong to the same month.', ['date','period_id']),]
+    
 
     def onchange_date(self, cr, uid, ids, date, company_id, context=None):
         """

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to