From ccfcb47149feebb74d5cb98d454d0c0528acfc36 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 29 Sep 2011 13:55:15 +0200 Subject: [PATCH 1/5] [IMP] base: each ir.module.category will be assigned with an autogenerated xml-id during the creation of the database [IMP] base: Create the records for the categories of OpenERP bzr revid: stw@openerp.com-20110929115515-rqlwqfzndxblxqtz --- openerp/addons/base/module/module.py | 30 ++++++--- openerp/addons/base/module/module_data.xml | 78 ++++++++++++++++++++++ openerp/modules/db.py | 5 ++ 3 files changed, 105 insertions(+), 8 deletions(-) diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py index a35e4b5d1ce..419f0c8b4b9 100644 --- a/openerp/addons/base/module/module.py +++ b/openerp/addons/base/module/module.py @@ -42,13 +42,13 @@ from osv import fields, osv, orm ACTION_DICT = { - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'base.module.upgrade', - 'target': 'new', - 'type': 'ir.actions.act_window', - 'nodestroy':True, - } + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'base.module.upgrade', + 'target': 'new', + 'type': 'ir.actions.act_window', + 'nodestroy':True, +} class module_category(osv.osv): _name = "ir.module.category" @@ -70,11 +70,25 @@ class module_category(osv.osv): result.get(id, 0)) return result + def name_get(self, cr, uid, ids, context=None): + result = [] + + reads = self.read(cr, uid, ids, ['name', 'parent_id'], context=context) + for record in reads: + name = record['name'] + if record['parent_id']: + name = record['parent_id'][1] + ' / ' + name + result.append((record['id'], name,)) + + return result + _columns = { 'name': fields.char("Name", size=128, required=True, select=True), 'parent_id': fields.many2one('ir.module.category', 'Parent Category', select=True), 'child_ids': fields.one2many('ir.module.category', 'parent_id', 'Child Categories'), - 'module_nr': fields.function(_module_nbr, method=True, string='Number of Modules', type='integer') + 'module_nr': fields.function(_module_nbr, method=True, string='Number of Modules', type='integer'), + 'module_ids' : fields.one2many('ir.module.module', 'category_id', 'Modules'), + 'description' : fields.text("Description"), } _order = 'name' module_category() diff --git a/openerp/addons/base/module/module_data.xml b/openerp/addons/base/module/module_data.xml index 5ae06fca897..b05a8796363 100644 --- a/openerp/addons/base/module/module_data.xml +++ b/openerp/addons/base/module/module_data.xml @@ -1,6 +1,84 @@ + + Customer Relationship Management + Helps you track and manage relations with customers such as leads, requests or issues. Can automatically send reminders, escalate requests or trigger business-specific actions based on standard events. + + + + Sales Management + Helps you handle your quotations, sale orders and invoicing. + + + + Project Management + Helps you manage your projects and tasks by tracking them, generating plannings, etc... + + + + + Knowledge Management + Lets you install addons geared towards sharing knowledge with and between your employees. + + + + Warehouse Management + Helps you manage your inventory and main stock operations: delivery orders, receptions, etc. + + + + Manufacturing + Helps you manage your manufacturing processes and generate reports on those processes. + + + + Invoicing & Payments + Allows you to create your invoices and track the payments. It is an easier version of the accounting module for managers who are not accountants. + + + + Accounting & Finance + Helps you handle your accounting needs, if you are not an accountant, we suggest you to install only the Invoicing. + + + + Purchase Management + Helps you manage your purchase-related processes such as requests for quotations, supplier invoices, etc... + + + Human Resources + Helps you manage your human resources by encoding your employees structure, generating work sheets, tracking attendance and more. + + + + Point of Sales + Helps you get the most out of your points of sales with fast sale encoding, simplified payment mode encoding, automatic picking lists generation and more. + + + + Marketing + Helps you manage your marketing campaigns step by step. + + + + Extra Tools + Lets you install various interesting but non-essential tools like Survey, Lunch and Ideas box. + + + + Advanced Reporting + Lets you install various tools to simplify and enhance OpenERP's report creation. + + + + Localization + + + + Account Charts + + diff --git a/openerp/modules/db.py b/openerp/modules/db.py index 6e6dd64b13c..e621564076f 100644 --- a/openerp/modules/db.py +++ b/openerp/modules/db.py @@ -102,7 +102,9 @@ def create_categories(cr, categories): """ p_id = None + category = [] while categories: + category.append(categories[0]) if p_id is not None: cr.execute('SELECT id \ FROM ir_module_category \ @@ -117,6 +119,9 @@ def create_categories(cr, categories): (name, parent_id) \ VALUES (%s, %s) RETURNING id', (categories[0], p_id)) c_id = cr.fetchone()[0] + xml_id = 'module_category_' + ('_'.join(map(lambda x: x.lower(), category))).replace('&', 'and').replace(' ', '_') + cr.execute('INSERT INTO ir_model_data (module, name, res_id, model) \ + VALUES (%s, %s, %s, %s)', ('base', xml_id, c_id, 'ir.module.category')) else: c_id = c_id[0] p_id = c_id From 593f997a43ff7285c7481f9f211b59d3aeefab50 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 29 Sep 2011 14:37:05 +0200 Subject: [PATCH 2/5] [FIX] base: assign a parent_id for the account charts subcategory bzr revid: stw@openerp.com-20110929123705-zm5518i1odwv06fb --- openerp/addons/base/module/module_data.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/addons/base/module/module_data.xml b/openerp/addons/base/module/module_data.xml index b05a8796363..dc955b8f9f5 100644 --- a/openerp/addons/base/module/module_data.xml +++ b/openerp/addons/base/module/module_data.xml @@ -76,6 +76,7 @@ + Account Charts From 80caa96c0c5e9bed7012a9fe1d9ecfc5949c704c Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 30 Sep 2011 17:48:44 +0200 Subject: [PATCH 3/5] [FIX] base: add a sequence field in ir.module.category bzr revid: stw@openerp.com-20110930154844-9wgiysywpxwyr3z0 --- openerp/addons/base/module/module.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py index 419f0c8b4b9..08e11bcd6a5 100644 --- a/openerp/addons/base/module/module.py +++ b/openerp/addons/base/module/module.py @@ -89,6 +89,7 @@ class module_category(osv.osv): 'module_nr': fields.function(_module_nbr, method=True, string='Number of Modules', type='integer'), 'module_ids' : fields.one2many('ir.module.module', 'category_id', 'Modules'), 'description' : fields.text("Description"), + 'sequence' : fields.integer('Sequence'), } _order = 'name' module_category() From 3befd0be34bb8e84bcd190a5b9fa1f893d818209 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 30 Sep 2011 17:49:11 +0200 Subject: [PATCH 4/5] [FIX] base: Add the sequence in the ir.module.category records bzr revid: stw@openerp.com-20110930154911-r3cyw94au06b4xse --- openerp/addons/base/module/module_data.xml | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/openerp/addons/base/module/module_data.xml b/openerp/addons/base/module/module_data.xml index dc955b8f9f5..c3117caec64 100644 --- a/openerp/addons/base/module/module_data.xml +++ b/openerp/addons/base/module/module_data.xml @@ -4,71 +4,85 @@ Customer Relationship Management Helps you track and manage relations with customers such as leads, requests or issues. Can automatically send reminders, escalate requests or trigger business-specific actions based on standard events. + 1 Sales Management Helps you handle your quotations, sale orders and invoicing. + 2 Project Management Helps you manage your projects and tasks by tracking them, generating plannings, etc... + 3 Knowledge Management Lets you install addons geared towards sharing knowledge with and between your employees. + 4 Warehouse Management Helps you manage your inventory and main stock operations: delivery orders, receptions, etc. + 5 Manufacturing Helps you manage your manufacturing processes and generate reports on those processes. + 6 Invoicing & Payments Allows you to create your invoices and track the payments. It is an easier version of the accounting module for managers who are not accountants. + 7 Accounting & Finance Helps you handle your accounting needs, if you are not an accountant, we suggest you to install only the Invoicing. + 8 Purchase Management Helps you manage your purchase-related processes such as requests for quotations, supplier invoices, etc... + 9 Human Resources Helps you manage your human resources by encoding your employees structure, generating work sheets, tracking attendance and more. - - - - Point of Sales - Helps you get the most out of your points of sales with fast sale encoding, simplified payment mode encoding, automatic picking lists generation and more. - - - - Marketing - Helps you manage your marketing campaigns step by step. + 10 Extra Tools Lets you install various interesting but non-essential tools like Survey, Lunch and Ideas box. + 11 + + + + Marketing + Helps you manage your marketing campaigns step by step. + 12 + + + + Point of Sales + Helps you get the most out of your points of sales with fast sale encoding, simplified payment mode encoding, automatic picking lists generation and more. + 13 Advanced Reporting Lets you install various tools to simplify and enhance OpenERP's report creation. + 14 @@ -80,6 +94,11 @@ Account Charts + + Associations + Installs a preselected set of OpenERP applications which will help you manage your association more efficiently. + + From 29337910dfa1ce13d1201b79453f395346d9a380 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 3 Oct 2011 14:10:21 +0200 Subject: [PATCH 5/5] [FIX] base: pass the context and define a new category for the modules bzr revid: stw@openerp.com-20111003121021-hmf0xs2wod6rjkwr --- openerp/addons/base/module/module.py | 2 +- openerp/addons/base/module/module_data.xml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py index 08e11bcd6a5..69db5fec4d3 100644 --- a/openerp/addons/base/module/module.py +++ b/openerp/addons/base/module/module.py @@ -303,7 +303,7 @@ class module(osv.osv): if level<1: raise orm.except_orm(_('Error'), _('Recursion error in modules dependencies !')) demo = False - for module in self.browse(cr, uid, ids): + for module in self.browse(cr, uid, ids, context=context): mdemo = False for dep in module.dependencies_id: if dep.state == 'unknown': diff --git a/openerp/addons/base/module/module_data.xml b/openerp/addons/base/module/module_data.xml index c3117caec64..02b4643b767 100644 --- a/openerp/addons/base/module/module_data.xml +++ b/openerp/addons/base/module/module_data.xml @@ -1,6 +1,10 @@ + + Link + 0 + Customer Relationship Management Helps you track and manage relations with customers such as leads, requests or issues. Can automatically send reminders, escalate requests or trigger business-specific actions based on standard events.