account: remove exception when inactive account with entries
authorced <>
Wed, 1 Aug 2007 14:03:45 +0000 (14:03 +0000)
committerced <>
Wed, 1 Aug 2007 14:03:45 +0000 (14:03 +0000)
bzr revid: ced-414daff2fea67fa3fbe4601ce84aa32d468a57d3

addons/account/account.py
addons/account/account_view.xml

index 26bc467..d899d92 100644 (file)
@@ -321,8 +321,9 @@ class account_account(osv.osv):
                if 'active' in vals and not vals['active']:
                        line_obj = self.pool.get('account.move.line')
                        if line_obj.search(cr, uid, [('account_id', 'in', ids)]):
-                               raise osv.except_osv('Error!', 'You can not deactivate a account with entry lines!')
-               super(account_account, self).write(cr, uid, ids, vals, context=context)
+                               vals=vals.copy()
+                               del vals['active']
+               return super(account_account, self).write(cr, uid, ids, vals, context=context)
 account_account()
 
 class account_journal_view(osv.osv):
index 1aeb243..4a32562 100644 (file)
                                <page string="General Information">
                                        <field name="name" select="1" colspan="4"/>
                                        <field name="company_id" select="2"/>
+                                       <field name="active"/>
                                        <newline/>
                                        <field name="type" select="1"/>
                                        <field name="code" select="1"/>
                                        <field name="note" colspan="4" nolabel="1"/>
                                </page>
                                </notebook>
-                               <field name="active" invisible="1" readonly="1"/>
                        </form>
                </field>
        </record>