Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-901554-mdi into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #901554 in OpenERP Addons: "Account: Can close period evenif there is 
unposted items on period"
  https://bugs.launchpad.net/openobject-addons/+bug/901554

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-901554-mdi/+merge/85093

Hello Sir,

I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/901554 
"Account: Can close period evenif there is unposted items on period".

Thanks and Regards,

Divyesh Makwana(MDI)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-901554-mdi/+merge/85093
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-901554-mdi.
=== modified file 'account/wizard/account_period_close.py'
--- account/wizard/account_period_close.py	2011-01-14 00:11:01 +0000
+++ account/wizard/account_period_close.py	2011-12-09 10:06:25 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 from osv import fields, osv
+from tools.translate import _
 
 class account_period_close(osv.osv_memory):
     """
@@ -39,11 +40,16 @@
         @param ids: account period close’s ID or list of IDs
          """
         period_pool = self.pool.get('account.period')
+        account_move_obj = self.pool.get('account.move')
 
         mode = 'done'
         for form in self.read(cr, uid, ids, context=context):
             if form['sure']:
                 for id in context['active_ids']:
+                    account_move_ids = account_move_obj.search(cr, uid, [('period_id', '=', id), ('state', '=', "draft")], context=context)
+                    if account_move_ids:
+                        raise osv.except_osv(_('Invalid action !'), _('In order to close a period, you must first post related journal items.'))
+
                     cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
                     cr.execute('update account_period set state=%s where id=%s', (mode, id))
 

_______________________________________________
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

Reply via email to