[IMP] Add comments
authorThibault Delavallée <tde@openerp.com>
Mon, 13 Feb 2012 15:21:21 +0000 (16:21 +0100)
committerThibault Delavallée <tde@openerp.com>
Mon, 13 Feb 2012 15:21:21 +0000 (16:21 +0100)
bzr revid: tde@openerp.com-20120213152121-tkdldypj70v52jrn

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

index a7d3eb2..0e5d889 100644 (file)
             <field name="model_id" ref="base.model_ir_actions_todo"/>
             <field eval="5" name="sequence"/>
             <field name="code">
+# check for unconfigured companies
 account_installer_obj = self.pool.get('account.installer')
 account_installer_obj.check_unconfigured_cmp(cr, uid, context=context)
 action_ids = []
+# fetch the act_window actions related to chart of account configuration
+# we use ir.actions.todo to enable the possibility for other modules to insert their own
+# wizards during the configuration process
 ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_wizard_multi_chart')
 if ref:
     action_ids += [ref[1]]
index e7b8efa..ad48da0 100644 (file)
@@ -80,6 +80,8 @@ class account_installer(osv.osv_memory):
     }
     
     def get_unconfigured_cmp(self, cr, uid, context=None):
+        """ get the list of companies that have not been configured yet
+        but don't care about the demo chart of accounts """
         cmp_select = []
         company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
         cr.execute("SELECT company_id FROM account_account WHERE active = 't' AND account_account.parent_id IS NULL AND name != %s", ("Chart For Automated Tests",))
@@ -88,12 +90,14 @@ class account_installer(osv.osv_memory):
         return unconfigured_cmp
     
     def check_unconfigured_cmp(self, cr, uid, context=None):
+        """ check if there are still unconfigured companies """
         if not self.get_unconfigured_cmp(cr, uid, context=context):
             raise osv.except_osv(_('No unconfigured company !'), _("There are currently no company without chart of account. The wizard will therefore not be executed."))
     
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
         res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
         cmp_select = []
+        # display in the widget selection only the companies that haven't been configured yet
         unconfigured_cmp = self.get_unconfigured_cmp(cr, uid, context=context)
         for field in res['fields']:
             if field == 'company_id':