Purnendu Singh (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-constraint-account-type-psi into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-constraint-account-type-psi/+merge/66607

Hello,

account: 
   added new constraint on account object which will check when the internal 
type is payable/receiable then the deferral method on account type must be 
unreconciled.

Thanks,
Purnendu singh
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-constraint-account-type-psi/+merge/66607
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-constraint-account-type-psi.
=== modified file 'account/account.py'
--- account/account.py	2011-06-21 12:52:48 +0000
+++ account/account.py	2011-07-01 13:38:23 +0000
@@ -431,9 +431,16 @@
                 return False
         return True
 
+    def _check_account_type(self, cr, uid, ids, context=None):
+        for account in self.browse(cr, uid, ids, context=context):
+            if account.type in ('receivable', 'payable') and account.user_type.close_method != 'unreconciled':
+                return False
+        return True
+
     _constraints = [
         (_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id']),
         (_check_type, 'Configuration Error! \nYou cannot define children to an account with internal type different of "View"! ', ['type']),
+        (_check_account_type, 'Configuration Error! \nYou cannot define deferral method different of "Unreconciled" on account type to an account with internal type of "Payable/Receivable"! ', ['type']),
     ]
     _sql_constraints = [
         ('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')

_______________________________________________
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