Amit Bhavsar (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1015459-amb into 
lp:openobject-addons.

Requested reviews:
  Amit Parik (OpenERP) (amp-openerp)
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1015459 in OpenERP Addons: "Constraint on account.account object"
  https://bugs.launchpad.net/openobject-addons/+bug/1015459

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1015459-amb/+merge/111335

Hello,

Add the validation on Secondary currency(account_account), when select the 
currency same as the company currency.

Thanks
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1015459-amb/+merge/111335
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1015459-amb.
=== modified file 'account/account.py'
--- account/account.py	2012-08-23 14:26:56 +0000
+++ account/account.py	2012-08-24 09:28:28 +0000
@@ -540,7 +540,17 @@
                 return False
         return True
 
+    def _check_currency(self, cr, uid, ids, context=None):
+        for account in self.browse(cr, uid, ids, context=context):
+            if account.company_id.currency_id == account.currency_id:
+                return False
+        return True
+
     _constraints = [
+        (_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id']),
+        (_check_currency, 'Configuration Error! \nYou can not set a "Secondary currency" which is the same as the company currency', ['currency_id']),
+        (_check_type, 'Configuration Error! \nYou can not define children to an account with internal type different of "View"! ', ['type']),
+        (_check_account_type, 'Configuration Error! \nYou can not select an account type with a deferral method different of "Unreconciled" for accounts with internal type "Payable/Receivable"! ', ['user_type','type']),
         (_check_recursion, 'Error!\nYou cannot 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 select an account type with a deferral method different of "Unreconciled" for accounts with internal type "Payable/Receivable".', ['user_type','type']),

_______________________________________________
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