Vijaykumar Baladaniya has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1006097-vba into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1006097-vba/+merge/126860

Hello,

     Fix the issue of account email template.

     - Add Domain in parent_id field.
     - Remove unnecessary code.

     Kindly review the code.

Thanks,
 VBA
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1006097-vba/+merge/126860
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1006097-vba.
=== modified file 'account/account.py'
--- account/account.py	2012-09-24 16:26:45 +0000
+++ account/account.py	2012-09-28 06:11:23 +0000
@@ -2518,7 +2518,7 @@
         'reconcile': fields.boolean('Allow Reconciliation', help="Check this option if you want the user to reconcile entries in this account."),
         'shortcut': fields.char('Shortcut', size=12),
         'note': fields.text('Note'),
-        'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade'),
+        'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade', domain=[('type','=','view')]),
         'child_parent_ids':fields.one2many('account.account.template', 'parent_id', 'Children'),
         'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel', 'account_id', 'tax_id', 'Default Taxes'),
         'nocreate': fields.boolean('Optional create', help="If checked, the new chart of accounts will not contain this by default."),
@@ -2536,20 +2536,6 @@
         (_check_recursion, 'Error!\nYou cannot create recursive account templates.', ['parent_id']),
     ]
 
-    def create(self, cr, uid, vals, context=None):
-        if 'parent_id' in vals:
-            parent = self.read(cr, uid, [vals['parent_id']], ['type'])
-            if parent and parent[0]['type'] != 'view':
-                raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'."))
-        return super(account_account_template, self).create(cr, uid, vals, context=context)
-
-    def write(self, cr, uid, ids, vals, context=None):
-        if 'parent_id' in vals:
-            parent = self.read(cr, uid, [vals['parent_id']], ['type'])
-            if parent and parent[0]['type'] != 'view':
-                raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'."))
-        return super(account_account_template, self).write(cr, uid, ids, vals, context=context)
-
     def name_get(self, cr, uid, ids, context=None):
         if not ids:
             return []

_______________________________________________
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