From b2fdf09676a080eaa3202f6f98ae782ff45f4919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Tue, 2 Dec 2008 18:41:37 +0100 Subject: [PATCH 001/215] view debbugging improvement: cf branche definition bzr revid: rvalyi@gmail.com-20081202174137-zwqbqx7is0vcvrkw --- bin/osv/orm.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index c0c44e608b7..22ddd88fe47 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -770,7 +770,7 @@ class orm_template(object): def view_header_get(self, cr, user, view_id=None, view_type='form', context=None): return False - def __view_look_dom(self, cr, user, node, context=None): + def __view_look_dom(self, cr, user, node, view_id, context=None): if not context: context = {} result = False @@ -796,7 +796,7 @@ class orm_template(object): node.removeChild(f) ctx = context.copy() ctx['base_model_name'] = self._name - xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, ctx) + xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, view_id, ctx) views[str(f.localName)] = { 'arch': xarch, 'fields': xfields @@ -846,11 +846,11 @@ class orm_template(object): if childs: for f in node.childNodes: - fields.update(self.__view_look_dom(cr, user, f, context)) + fields.update(self.__view_look_dom(cr, user, f, view_id, context)) return fields - def __view_look_dom_arch(self, cr, user, node, context=None): - fields_def = self.__view_look_dom(cr, user, node, context=context) + def __view_look_dom_arch(self, cr, user, node, view_id, context=None): + fields_def = self.__view_look_dom(cr, user, node, view_id, context=context) buttons = xpath.Evaluate('//button', node) if buttons: @@ -877,7 +877,23 @@ class orm_template(object): arch = node.toxml(encoding="utf-8").replace('\t', '') fields = self.fields_get(cr, user, fields_def.keys(), context) for field in fields_def: - fields[field].update(fields_def[field]) + if fields.has_key(field): + fields[field].update(fields_def[field]) + else: + logger = netsvc.Logger() + print view_id + print field + cr.execute('select name, model from ir_ui_view where (id=%d or inherit_id=%d) and arch like %s', (view_id, view_id, '%'+ field + '%')) + res = cr.fetchall() + print 'select name, model from ir_ui_view where (id=%d or inherit_id=%d) and arch like %s', (view_id, view_id, field) + print res + msg = "Error, can't find database field or computed field:\n '%s' \nin the following view parts composing the view of object model '%s':\n\n" % (field, res[0][1]) + for line in res: + msg += "- %s\n" % line[0] + msg += "\nEither you wrongly customized this view, \nor some modules bringing those views are not compatible with your current data model" + logger.notifyChannel('orm', netsvc.LOG_ERROR, msg ) + raise except_orm('View error', msg ) + return arch, fields def __get_default_calendar_view(self): @@ -1057,7 +1073,7 @@ class orm_template(object): result['view_id'] = 0 doc = dom.minidom.parseString(result['arch'].encode('utf-8')) - xarch, xfields = self.__view_look_dom_arch(cr, user, doc, context=context) + xarch, xfields = self.__view_look_dom_arch(cr, user, doc, view_id, context=context) result['arch'] = xarch result['fields'] = xfields if toolbar: From 8f5cf3c953c800a0de1193253233ed2a3548a202 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Thu, 11 Dec 2008 21:57:07 +0100 Subject: [PATCH 002/215] [IMP] * add port and user database in logger bzr revid: christophe.chauvet@syleam.fr-20081211205707-juwwx8adizpj1p13 --- bin/openerp-server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 05734f7fdf7..3cad93176e1 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -62,7 +62,9 @@ import tools logger.notifyChannel("server", netsvc.LOG_INFO, "version - %s" % release.version ) for name, value in [('addons_path', tools.config['addons_path']), - ('database hostname', tools.config['db_host'] or 'localhost')]: + ('database hostname', tools.config['db_host'] or 'localhost'), + ('database port', tools.config['db_port'] or '5432'), + ('database user', tools.config['db_user'] or 'oerp')]: logger.notifyChannel("server", netsvc.LOG_INFO, "%s - %s" % ( name, value )) import time From b6a4f1b102928c40d7480ee52e281b1ecb54d4ce Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Thu, 11 Dec 2008 22:12:18 +0100 Subject: [PATCH 003/215] [FIX] * There is no database user by default. bzr revid: christophe.chauvet@syleam.fr-20081211211218-ofgaaq96rdetw279 --- bin/openerp-server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 3cad93176e1..9e7395d280e 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -64,7 +64,7 @@ logger.notifyChannel("server", netsvc.LOG_INFO, "version - %s" % release.version for name, value in [('addons_path', tools.config['addons_path']), ('database hostname', tools.config['db_host'] or 'localhost'), ('database port', tools.config['db_port'] or '5432'), - ('database user', tools.config['db_user'] or 'oerp')]: + ('database user', tools.config['db_user'])]: logger.notifyChannel("server", netsvc.LOG_INFO, "%s - %s" % ( name, value )) import time From 3b9bcb17cc878d4660306f08d4616b57deeec6d7 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Thu, 18 Dec 2008 23:17:55 +0100 Subject: [PATCH 004/215] [IMP] * order the database list in login connexion bzr revid: christophe.chauvet@syleam.fr-20081218221755-q0cwv6ph8w4xzk98 --- bin/service/web_services.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/service/web_services.py b/bin/service/web_services.py index 07fdd7412f9..81d8b7ce28c 100644 --- a/bin/service/web_services.py +++ b/bin/service/web_services.py @@ -246,9 +246,9 @@ class db(netsvc.Service): res = cr.fetchone() db_user = res and res[0] if db_user: - cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in ('template0', 'template1', 'postgres')", (db_user,)) + cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in ('template0', 'template1', 'postgres') order by datname", (db_user,)) else: - cr.execute("select datname from pg_database where datname not in('template0', 'template1','postgres')") + cr.execute("select datname from pg_database where datname not in('template0', 'template1','postgres') order by datname") res = [name for (name,) in cr.fetchall()] cr.close() except: From 9e72676066e05fe2cfe4b12a3d52a2f16401b361 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Fri, 19 Dec 2008 01:18:23 +0100 Subject: [PATCH 005/215] [IMP] * patch to authorized the database name started with a number * patch drop function to work with this improvement bzr revid: christophe.chauvet@syleam.fr-20081219001823-0ikl2j5ztcxlbhdy --- bin/service/web_services.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/service/web_services.py b/bin/service/web_services.py index f1946a01e88..08cf055dd11 100644 --- a/bin/service/web_services.py +++ b/bin/service/web_services.py @@ -70,7 +70,7 @@ class db(netsvc.Service): cr = db.cursor() cr.autocommit(True) time.sleep(0.2) - cr.execute('CREATE DATABASE ' + db_name + ' ENCODING \'unicode\'') + cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\'' % db_name) cr.close() class DBInitialize(object): def __call__(self, serv, id, db_name, demo, lang, user_password='admin'): @@ -149,7 +149,7 @@ class db(netsvc.Service): cr.autocommit(True) try: try: - cr.execute('DROP DATABASE ' + db_name) + cr.execute('DROP DATABASE "%s"' % db_name) except Exception, e: logger.notifyChannel("web-services", netsvc.LOG_ERROR, 'DROP DB: %s failed:\n%s' % (db_name, e)) @@ -198,7 +198,7 @@ class db(netsvc.Service): db = sql_db.db_connect('template1', serialize=1) cr = db.cursor() cr.autocommit(True) - cr.execute('CREATE DATABASE ' + db_name + ' ENCODING \'unicode\'') + cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\'' % db_name) cr.close() cmd = ['pg_restore'] From 9eae2d59410f4d4d0cf1e2d16ca09286fe8616b5 Mon Sep 17 00:00:00 2001 From: "pso (tiny)" Date: Tue, 6 Jan 2009 16:47:44 +0530 Subject: [PATCH 006/215] minor changes bzr revid: pso@tinyerp.com-20090106111744-84c8pm09jgydx1ka --- addons/product/pricelist.py | 2 +- addons/project/company.py | 2 +- .../report_analytic_planning/report_analytic_planning_view.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 2cc1ce7dce0..3c44d1a7bfe 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -56,7 +56,7 @@ class price_type(osv.osv): _columns = { "name" : fields.char("Price Name", size=32, required=True, translate=True, help="Name of this kind of price."), "active" : fields.boolean("Active"), - "field" : fields.selection(_price_field_get, "Product Field", required=True, help="Associated field in the product form."), + "field" : fields.selection(_price_field_get, "Product Field", size=32, required=True, help="Associated field in the product form."), "currency_id" : fields.many2one('res.currency', "Currency", required=True, help="The currency the field is expressed in."), } _defaults = { diff --git a/addons/project/company.py b/addons/project/company.py index d3ff9d8498f..ceafa04b954 100644 --- a/addons/project/company.py +++ b/addons/project/company.py @@ -32,7 +32,7 @@ class res_company(osv.osv): help='This will set the unit of measure used in projects and tasks.\n' \ "If you use the timesheet linked to projects (project_timesheet module), don't " \ "forget to setup the right unit of measure in your employees.", - required=True, + ), } _defaults = { diff --git a/addons/report_analytic_planning/report_analytic_planning_view.xml b/addons/report_analytic_planning/report_analytic_planning_view.xml index 0e57170e4c7..933c022e682 100644 --- a/addons/report_analytic_planning/report_analytic_planning_view.xml +++ b/addons/report_analytic_planning/report_analytic_planning_view.xml @@ -34,7 +34,7 @@ - + From 74a6e4000e1187e14af2387283f66e9808b04be7 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 9 Jan 2009 13:09:37 +0530 Subject: [PATCH 007/215] Minot edit of Account for recursion bzr revid: jvo@tinyerp.com-20090109073937-plxgu32hxe5y5w47 --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index a883755f7e4..dece8d18b21 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -154,7 +154,7 @@ class account_account(osv.osv): args[pos] = ('id','in',ids1) pos+=1 - if context and context.has_key('consolidate_childs'): #add concolidated childs of accounts + if context and context.has_key('consolidate_childs'): #add consolidated childs of accounts ids = super(account_account,self).search(cr, uid, args, offset, limit, order, context=context, count=count) for consolidate_child in self.browse(cr, uid, context['account_id']).child_consol_ids: @@ -170,7 +170,7 @@ class account_account(osv.osv): ids3 = [] for rec in self.browse(cr, uid, ids2, context=context): for child in rec.child_consol_ids: - ids3.append[child.id] + ids3.append(child.id) if ids3: ids3 = self._get_children_and_consol(cr, uid, ids3, context) return ids2+ids3 From 24216293789163df0af0d69ad09bd51ccc332eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Fri, 9 Jan 2009 09:26:58 +0100 Subject: [PATCH 010/215] add exception for cursor bzr revid: nel@tinyerp.com-20090109082658-uwf8zywyilsmiel9 --- addons/mrp/wizard/wizard_orderpoint_procurement.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/mrp/wizard/wizard_orderpoint_procurement.py b/addons/mrp/wizard/wizard_orderpoint_procurement.py index fad59243837..e847e117927 100644 --- a/addons/mrp/wizard/wizard_orderpoint_procurement.py +++ b/addons/mrp/wizard/wizard_orderpoint_procurement.py @@ -41,10 +41,13 @@ parameter_fields = { def _procure_calculation_orderpoint(self, db_name, uid, data, context): db, pool = pooler.get_db_and_pool(db_name) cr = db.cursor() - proc_obj = pool.get('mrp.procurement') - automatic = data['form']['automatic'] - proc_obj._procure_orderpoint_confirm(cr, uid, automatic=automatic,\ - use_new_cursor=cr.dbname, context=context) + try: + proc_obj = pool.get('mrp.procurement') + automatic = data['form']['automatic'] + proc_obj._procure_orderpoint_confirm(cr, uid, automatic=automatic,\ + use_new_cursor=cr.dbname, context=context) + finally: + cr.close() return {} def _procure_calculation(self, cr, uid, data, context): From 3ccc8357d5d5466acc97f1b065f500e9b096eeb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Fri, 9 Jan 2009 09:27:49 +0100 Subject: [PATCH 011/215] add exception for cursor bzr revid: nel@tinyerp.com-20090109082749-hpj8lpsu1jtukhis --- addons/mrp/wizard/wizard_procurement.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/mrp/wizard/wizard_procurement.py b/addons/mrp/wizard/wizard_procurement.py index b8a19c3ff97..7a0433f34c3 100644 --- a/addons/mrp/wizard/wizard_procurement.py +++ b/addons/mrp/wizard/wizard_procurement.py @@ -35,8 +35,11 @@ parameter_fields = { def _procure_calculation_procure(self, db_name, uid, data, context): db, pool = pooler.get_db_and_pool(db_name) cr = db.cursor() - proc_obj = pool.get('mrp.procurement') - proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context) + try: + proc_obj = pool.get('mrp.procurement') + proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context) + finally: + cr.close() return {} def _procure_calculation(self, cr, uid, data, context): From 02de8a94c797e589b23f2ed0557920a1bde5f324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Fri, 9 Jan 2009 09:30:15 +0100 Subject: [PATCH 012/215] change versions of terp files bzr revid: nel@tinyerp.com-20090109083015-1m378z8fkk6s38xy --- addons/account/__terp__.py | 2 +- addons/account_analytic_analysis/__terp__.py | 2 +- addons/account_payment/__terp__.py | 2 +- addons/hr/__terp__.py | 2 +- addons/hr_holidays/__terp__.py | 2 +- addons/mrp/__terp__.py | 2 +- addons/product/__terp__.py | 2 +- addons/project/__terp__.py | 2 +- addons/stock/__terp__.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index 3d3905ed249..ea8e9868628 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name" : "Accounting and financial management", - "version" : "1.0", + "version" : "1.1", "depends" : ["product", "base", "process"], "author" : "Tiny", "description": """Financial and accounting module that covers: diff --git a/addons/account_analytic_analysis/__terp__.py b/addons/account_analytic_analysis/__terp__.py index 650dcd4fb50..fc8e1c650b5 100644 --- a/addons/account_analytic_analysis/__terp__.py +++ b/addons/account_analytic_analysis/__terp__.py @@ -24,7 +24,7 @@ "description": """Modifiy the account analytic view to show important data for project manager of services companies. Add menu to show relevant information for each manager.""", - "version" : "1.0", + "version" : "1.1", "author" : "Camptocamp", "category" : "Generic Modules/Accounting", "module": "", diff --git a/addons/account_payment/__terp__.py b/addons/account_payment/__terp__.py index 0a88b0b5940..09790dc4e1e 100644 --- a/addons/account_payment/__terp__.py +++ b/addons/account_payment/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name": "Payment Management", - "version": "1.0", + "version": "1.1", "author": "Tiny", "category": "Generic Modules/Payment", "depends": ["account"], diff --git a/addons/hr/__terp__.py b/addons/hr/__terp__.py index d39891ed3ee..7fc30815e57 100644 --- a/addons/hr/__terp__.py +++ b/addons/hr/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name" : "Human Resources", - "version" : "1.0", + "version" : "1.1", "author" : "Tiny", "category" : "Generic Modules/Human Resources", "website" : "http://www.openerp.com", diff --git a/addons/hr_holidays/__terp__.py b/addons/hr_holidays/__terp__.py index 0018d20d984..feef8b159ea 100644 --- a/addons/hr_holidays/__terp__.py +++ b/addons/hr_holidays/__terp__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- { "name" : "Human Resources: Holidays management", - "version" : "0.1", + "version" : "1.1", "author" : "Tiny & Axelor", "category" : "Generic Modules/Human Resources", "website" : "http://www.openerp.com", diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index 5ea266c3a0d..3cb5bdbe1c7 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name" : "Manufacturing Resource Planning", - "version" : "1.0", + "version" : "1.1", "author" : "Tiny", "website" : "http://www.openerp.com", "category" : "Generic Modules/Production", diff --git a/addons/product/__terp__.py b/addons/product/__terp__.py index bbc4d667b75..8619679aeb6 100644 --- a/addons/product/__terp__.py +++ b/addons/product/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name" : "Products & Pricelists", - "version" : "1.0", + "version" : "1.1", "author" : "Tiny", "category" : "Generic Modules/Inventory Control", "depends" : ["base", "process"], diff --git a/addons/project/__terp__.py b/addons/project/__terp__.py index 3668c7d7470..1837346d740 100644 --- a/addons/project/__terp__.py +++ b/addons/project/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name" : "Project Management", - "version": "1.0", + "version": "1.1", "author" : "Tiny", "website" : "http://www.openerp.com", "category" : "Generic Modules/Projects & Services", diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py index dc09385b09f..bf10b150fe3 100644 --- a/addons/stock/__terp__.py +++ b/addons/stock/__terp__.py @@ -21,7 +21,7 @@ ############################################################################## { "name" : "Stock Management", - "version" : "1.0", + "version" : "1.1", "author" : "Tiny", "website" : "http://www.openerp.com", "depends" : ["product", "account"], From e700cb62757b8af23d00077388d636ece0e36b8d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 9 Jan 2009 14:48:17 +0100 Subject: [PATCH 013/215] modifs bzr revid: fp@tinyerp.com-20090109134817-3qp4riqpeto23bx0 --- addons/stock/stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 26b581c18e1..e5b66648a26 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -367,6 +367,7 @@ class stock_picking(osv.osv): res[pick]['max_date'] = dt2 return res + _columns = { 'name': fields.char('Reference', size=64, required=True, select=True), 'origin': fields.char('Origin Reference', size=64), From 7bc60a97aec122bcc9b48eb56d28415f08bdd1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Fri, 9 Jan 2009 16:02:58 +0100 Subject: [PATCH 014/215] delete process file from terp bzr revid: nel@tinyerp.com-20090109150258-m4nmvhz7df4n79mq --- addons/stock/__terp__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py index a698adc2564..319faba6e14 100644 --- a/addons/stock/__terp__.py +++ b/addons/stock/__terp__.py @@ -44,7 +44,6 @@ "report_stock_view.xml", "security/stock_security.xml", "security/ir.model.access.csv", - "process/stock_process.xml" ], 'demo_xml': ['stock_demo.xml'], 'installable': True, From 123f3119bac13d4c21a541afefe2cadf90c8ae98 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 9 Jan 2009 16:14:48 +0100 Subject: [PATCH 015/215] [IMP] change version number bzr revid: christophe@tinyerp.com-20090109151448-7ibcvg3h47k2mlf1 --- addons/purchase/__terp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/__terp__.py b/addons/purchase/__terp__.py index 129d020ebe9..f66c1d75dbe 100644 --- a/addons/purchase/__terp__.py +++ b/addons/purchase/__terp__.py @@ -23,7 +23,7 @@ { 'name': 'Purchase Management', - 'version': '1.0', + 'version': '1.1', 'category': 'Generic Modules/Sales & Purchases', 'description': """Module for purchase management Request for quotation, Create Supplier Invoice, Print Order...""", From b73ba942d883c04b672ec7fa96b2390ea3192124 Mon Sep 17 00:00:00 2001 From: "Sofia (Open ERP)" Date: Sat, 10 Jan 2009 12:42:27 +0530 Subject: [PATCH 016/215] bugfixed for duplicate fields bzr revid: sso@tinyerp.com-20090110071227-23m7p5bh7e7t9l4g --- addons/crm_configuration/crm_bugs_view.xml | 2 +- addons/crm_configuration/crm_fund_view.xml | 4 ++-- addons/crm_configuration/crm_jobs_view.xml | 2 +- addons/crm_configuration/crm_phonecall_view.xml | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/crm_configuration/crm_bugs_view.xml b/addons/crm_configuration/crm_bugs_view.xml index 5335aefbb7d..17c54f16377 100644 --- a/addons/crm_configuration/crm_bugs_view.xml +++ b/addons/crm_configuration/crm_bugs_view.xml @@ -87,7 +87,7 @@ - + diff --git a/addons/crm_configuration/crm_fund_view.xml b/addons/crm_configuration/crm_fund_view.xml index 51cf92d9bd1..038cfc23bdf 100644 --- a/addons/crm_configuration/crm_fund_view.xml +++ b/addons/crm_configuration/crm_fund_view.xml @@ -37,7 +37,7 @@ - + @@ -70,7 +70,7 @@ - +
diff --git a/addons/crm_configuration/crm_jobs_view.xml b/addons/crm_configuration/crm_jobs_view.xml index dd33f9c2e0a..3e196da0ac2 100644 --- a/addons/crm_configuration/crm_jobs_view.xml +++ b/addons/crm_configuration/crm_jobs_view.xml @@ -115,7 +115,7 @@ - + diff --git a/addons/crm_configuration/crm_phonecall_view.xml b/addons/crm_configuration/crm_phonecall_view.xml index c87eef8c535..61eba3043fb 100644 --- a/addons/crm_configuration/crm_phonecall_view.xml +++ b/addons/crm_configuration/crm_phonecall_view.xml @@ -74,7 +74,6 @@ - From fd499facba36b89e5eaeb490f3bd0f6d374025ac Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 12 Jan 2009 12:14:44 +0530 Subject: [PATCH 017/215] Bug 316173 lp bug: https://launchpad.net/bugs/316173 fixed bzr revid: jvo@tinyerp.com-20090112064444-ye7mayvd42uj7j9f --- addons/account/invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 64a1c31da64..8a5cc00589e 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -383,6 +383,8 @@ class account_invoice(osv.osv): cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) for taxe in ait_obj.compute(cr, uid, id).values(): ait_obj.create(cr, uid, taxe) + # Update the stored value (fields.function), so we write to trigger recompute + self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) return True def button_compute(self, cr, uid, ids, context=None, set_total=False): From 52a7fb6e87c125181cdefb84b6ffc96494579542 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Mon, 12 Jan 2009 12:18:05 +0530 Subject: [PATCH 018/215] quality bzr revid: mra@tinyerp.com-20090112064805-6noberspeq4a27lz --- addons/base_module_quality/speed_test/speed_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/base_module_quality/speed_test/speed_test.py b/addons/base_module_quality/speed_test/speed_test.py index 33456e4729f..99523f23735 100644 --- a/addons/base_module_quality/speed_test/speed_test.py +++ b/addons/base_module_quality/speed_test/speed_test.py @@ -50,7 +50,7 @@ This test checks the speed of the module. Note that at least 5 demo data is need module_name = module_path.split('/')[-1] obj_list = self.get_objects(cr, uid, module_name) obj_counter = 0 - score = 0 + score = 0.0 obj_ids = self.get_ids(cr, uid, obj_list) result_dict = {} result_dict2 = {} @@ -63,7 +63,7 @@ This test checks the speed of the module. Note that at least 5 demo data is need if size: list = [] - #we perform the operation twice, and count the number of queries in the second run. This allows to avoid the cache effect. (like translated terms that asks for more queries) + #we perform the operation twice, and count the number of queries in the second run. This allows to avoid the cache effect. (like translated terms that asks for more queries) pool.get(obj).read(cr, uid, [ids[0]]) c = cr.count pool.get(obj).read(cr, uid, [ids[0]]) From 3ba7c3ec903cf566268d2cad3ce766ad9f95d107 Mon Sep 17 00:00:00 2001 From: "pso (tiny)" Date: Mon, 12 Jan 2009 14:22:06 +0530 Subject: [PATCH 019/215] minor changes in all process bzr revid: pso@tinyerp.com-20090112085206-2z0wswrum7ejhaea --- .../process/customer_invoice_process.xml | 26 +++++++------- addons/account/process/statement_process.xml | 12 +++---- .../process/supplier_invoice_process.xml | 22 ++++++------ .../process/base_contact_process.xml | 12 +++---- .../process/crm_configuration_process.xml | 12 +++---- addons/hr/process/hr_process.xml | 10 +++--- .../hr_expense/process/hr_expense_process.xml | 18 +++++----- .../process/hr_holidays_process.xml | 18 +++++----- .../process/hr_timesheet_process.xml | 4 +-- .../process/hr_timesheet_project_process.xml | 6 ++-- .../process/hr_timesheet_sheet_process.xml | 32 ++++++++--------- .../membership/process/membership_process.xml | 16 ++++----- addons/mrp/process/procurement_process.xml | 36 +++++++++---------- .../mrp/process/service_product_process.xml | 12 +++---- .../mrp/process/stockable_product_process.xml | 14 ++++---- .../process/mrp_operation_process.xml | 14 ++++---- addons/product/process/product_process.xml | 8 ++--- addons/project/process/task_process.xml | 16 ++++----- .../process/project_mrp_process.xml | 12 +++---- addons/purchase/process/purchase_process.xml | 32 ++++++++--------- addons/sale/process/sale_process.xml | 32 ++++++++--------- addons/sale_crm/process/sale_crm_process.xml | 10 +++--- addons/scrum/process/scrum_process.xml | 2 +- 23 files changed, 188 insertions(+), 188 deletions(-) diff --git a/addons/account/process/customer_invoice_process.xml b/addons/account/process/customer_invoice_process.xml index 7af469d142f..acdce086ee4 100755 --- a/addons/account/process/customer_invoice_process.xml +++ b/addons/account/process/customer_invoice_process.xml @@ -6,10 +6,10 @@ Process --> - + - + - + - + - + - + - - + + @@ -22,7 +22,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/addons/crm_configuration/process/crm_configuration_process.xml b/addons/crm_configuration/process/crm_configuration_process.xml index 89ca44ecf54..048e7101a87 100755 --- a/addons/crm_configuration/process/crm_configuration_process.xml +++ b/addons/crm_configuration/process/crm_configuration_process.xml @@ -6,10 +6,10 @@ Process --> - + - + - + - + - + - + - - + + @@ -22,7 +22,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/addons/hr_timesheet/process/hr_timesheet_process.xml b/addons/hr_timesheet/process/hr_timesheet_process.xml index aee609b5120..2574d70ca31 100755 --- a/addons/hr_timesheet/process/hr_timesheet_process.xml +++ b/addons/hr_timesheet/process/hr_timesheet_process.xml @@ -6,10 +6,10 @@ Process --> - + - + diff --git a/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml b/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml index 390e572c52b..8de8ff47f81 100755 --- a/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml +++ b/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -34,7 +34,7 @@ - + diff --git a/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml b/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml index c29de87a601..bc08e566376 100755 --- a/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml +++ b/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml @@ -6,10 +6,10 @@ Process --> - + - + - - + + @@ -22,7 +22,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -74,7 +74,7 @@ - + diff --git a/addons/mrp/process/procurement_process.xml b/addons/mrp/process/procurement_process.xml index 79d33a8e98d..eb658f52745 100755 --- a/addons/mrp/process/procurement_process.xml +++ b/addons/mrp/process/procurement_process.xml @@ -6,8 +6,8 @@ Process --> - - + + @@ -22,8 +22,8 @@ - - + + @@ -34,8 +34,8 @@ - - + + @@ -46,7 +46,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -78,8 +78,8 @@ - - + + @@ -90,8 +90,8 @@ - - + + @@ -102,8 +102,8 @@ - - + + @@ -113,7 +113,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -133,7 +133,7 @@ - + diff --git a/addons/mrp/process/service_product_process.xml b/addons/mrp/process/service_product_process.xml index e7aacaaf044..fe9a32f0ec3 100644 --- a/addons/mrp/process/service_product_process.xml +++ b/addons/mrp/process/service_product_process.xml @@ -6,8 +6,8 @@ Process --> - - + + @@ -22,7 +22,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -44,8 +44,8 @@ - - + + diff --git a/addons/mrp/process/stockable_product_process.xml b/addons/mrp/process/stockable_product_process.xml index 92da99f635e..34ff93d3228 100644 --- a/addons/mrp/process/stockable_product_process.xml +++ b/addons/mrp/process/stockable_product_process.xml @@ -6,8 +6,8 @@ Process --> - - + + @@ -22,7 +22,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -44,8 +44,8 @@ - - + + @@ -56,7 +56,7 @@ - + diff --git a/addons/mrp_operations/process/mrp_operation_process.xml b/addons/mrp_operations/process/mrp_operation_process.xml index 013a629d3a7..0e8fe053f70 100644 --- a/addons/mrp_operations/process/mrp_operation_process.xml +++ b/addons/mrp_operations/process/mrp_operation_process.xml @@ -6,8 +6,8 @@ Process --> - - + + @@ -22,7 +22,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -66,7 +66,7 @@ - + diff --git a/addons/product/process/product_process.xml b/addons/product/process/product_process.xml index c3564e09b1d..3b2ce6000c9 100755 --- a/addons/product/process/product_process.xml +++ b/addons/product/process/product_process.xml @@ -6,10 +6,10 @@ Process --> - + - + - + - + - + - + - + - + + + + account.fiscal.position.template.form + account.fiscal.position.template + form + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + account.fiscal.position.template.tree + account.fiscal.position.template + tree + + + + + + + + + Fiscal Position Templates + account.fiscal.position.template + form + tree,form + + + diff --git a/addons/l10n_be/__terp__.py b/addons/l10n_be/__terp__.py index da667a14984..a8dd1fea1f7 100644 --- a/addons/l10n_be/__terp__.py +++ b/addons/l10n_be/__terp__.py @@ -42,7 +42,9 @@ 'author': 'Tiny', 'depends': ['account', 'account_report', 'base_vat', 'base_iban', 'account_chart'], 'init_xml': [], - 'update_xml': ['account_pcmn_belgium.xml', 'l10n_be_wizard.xml', 'l10n_be_sequence.xml'], + 'update_xml': ['account_pcmn_belgium.xml', 'l10n_be_wizard.xml', + 'l10n_be_sequence.xml', 'fiscal_templates.xml', + ], 'demo_xml': [], 'installable': True, 'certificate': '31977724637', diff --git a/addons/l10n_be/fiscal_templates.xml b/addons/l10n_be/fiscal_templates.xml new file mode 100644 index 00000000000..9d54a94b29b --- /dev/null +++ b/addons/l10n_be/fiscal_templates.xml @@ -0,0 +1,69 @@ + + + + + + + + Fiscal Position for Sale + + + + Fiscal Position for Purchase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 974624a15211160bcddcb39b49099d68619f40e2 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 08:34:04 +0100 Subject: [PATCH 034/215] [FIX] Typo bzr revid: stephane@tinyerp.com-20090114073404-5u00fmohsradtpid --- addons/base_module_quality/__terp__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/base_module_quality/__terp__.py b/addons/base_module_quality/__terp__.py index d77b50cd830..1ad92d5d3a9 100644 --- a/addons/base_module_quality/__terp__.py +++ b/addons/base_module_quality/__terp__.py @@ -25,8 +25,7 @@ 'name': 'Base module quality', 'version': '1.0', 'category': 'Tiny Specific Modules/Base module quality', - 'description': """" -This module's aim is to check the quality of other modules. + 'description': """This module's aim is to check the quality of other modules. It defines a wizard on the list of modules in OpenERP, which allow you to evaluate them on different criteria such as: the respect of OpenERP coding standards, the speed efficiency... From aaa22b707f1cd6802745ae6023b9aeec629c3a3e Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 08:54:20 +0100 Subject: [PATCH 035/215] [IMP] Use tempfile.mkstemp instead of os.tempname. mkstemp is more secure bzr revid: stephane@tinyerp.com-20090114075420-yfgsx5cz8pjxcrkf --- addons/document/content_index.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/document/content_index.py b/addons/document/content_index.py index db78217b6d6..96297ff7a8b 100644 --- a/addons/document/content_index.py +++ b/addons/document/content_index.py @@ -23,6 +23,7 @@ import time import os import StringIO import odt2txt +import tempfile # # This should be the indexer @@ -36,11 +37,10 @@ def content_index(content, filename=None, content_type=None): stdin.close() result = stdout.read().decode('latin1','replace').encode('utf-8','replace') elif ext == '.pdf': - fname = os.tempnam(filename)+'.pdf' - fp = file(fname,'wb') - fp.write(content) - fp.close() - fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+fname+' -', 'r') + file_descriptor, file_name = tempfile.mkstemp(suffix=ext) + os.write(file_descriptor, content) + os.close(file_descriptor) + fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r') result = fp.read() fp.close() elif ext in ('.xls','.ods','.odt','.odp'): @@ -52,4 +52,4 @@ def content_index(content, filename=None, content_type=None): result = content else: result = content - return result \ No newline at end of file + return result From 892eeea5ae2c7be313c718a88830ac9ec948a9ef Mon Sep 17 00:00:00 2001 From: Olivier Laurent Date: Wed, 14 Jan 2009 08:59:02 +0100 Subject: [PATCH 036/215] Fixed a potential IndexError if variable 'dir' equals '' bzr revid: olt@tinyerp.com-20090114075902-tz5sbtlkcsrg56qc --- bin/addons/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index a75f30f1cf6..bf0dc39e279 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -154,8 +154,9 @@ def get_module_filetree(module, dir='.'): return False dir = os.path.normpath(dir) - if dir == '.': dir = '' - if dir.startswith('..') or dir[0] == '/': + if dir == '.': + dir = '' + if dir.startswith('..') or (dir and dir[0] == '/'): raise Exception('Cannot access file outside the module') if not os.path.isdir(path): From 9acb5b8ca4a06360610026f016b47e510ccc83f9 Mon Sep 17 00:00:00 2001 From: Olivier Laurent Date: Wed, 14 Jan 2009 09:10:41 +0100 Subject: [PATCH 037/215] Fixed a bug when 'dir' equals ''. Filename's first character was truncated. bzr revid: olt@tinyerp.com-20090114081041-ft5vynfi58078vj6 --- bin/addons/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index bf0dc39e279..980125a41e6 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -170,7 +170,8 @@ def get_module_filetree(module, dir='.'): for f in files: if not f.startswith(dir): continue - f = f[len(dir)+int(not dir.endswith('/')):] + if dir: + f = f[len(dir)+int(not dir.endswith('/')):] lst = f.split(os.sep) current = tree while len(lst) != 1: From b01f0410471a41cc459494e6fe06477bf4a85bf7 Mon Sep 17 00:00:00 2001 From: Olivier Laurent Date: Wed, 14 Jan 2009 10:12:23 +0100 Subject: [PATCH 038/215] pep8 bzr revid: olt@tinyerp.com-20090114091223-lbuvca2agsqehdbp --- bin/addons/__init__.py | 107 ++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 49 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 980125a41e6..1c6618a824e 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -56,6 +56,7 @@ if ad != _ad: # Modules already loaded loaded = [] + class Graph(dict): def addNode(self, name, deps): @@ -79,6 +80,7 @@ class Graph(dict): yield module level += 1 + class Singleton(object): def __new__(cls, name, graph): @@ -90,6 +92,7 @@ class Singleton(object): graph[name] = inst return inst + class Node(Singleton): def __init__(self, name, graph): @@ -107,7 +110,7 @@ class Node(Singleton): for attr in ('init', 'update', 'demo'): if hasattr(self, attr): setattr(node, attr, True) - self.childs.sort(lambda x,y: cmp(x.name, y.name)) + self.childs.sort(lambda x, y: cmp(x.name, y.name)) def hasChild(self, name): return Node(name, self.graph) in self.childs or \ @@ -135,9 +138,9 @@ class Node(Singleton): s += '%s`-> %s' % (' ' * depth, c._pprint(depth+1)) return s + def get_module_path(module): - """Return the path of the given module. - """ + """Return the path of the given module.""" if os.path.exists(opj(ad, module)) or os.path.exists(opj(ad, '%s.zip' % module)): return opj(ad, module) @@ -148,11 +151,12 @@ def get_module_path(module): logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: module not found' % (module,)) return False + def get_module_filetree(module, dir='.'): path = get_module_path(module) if not path: return False - + dir = os.path.normpath(dir) if dir == '.': dir = '' @@ -165,11 +169,12 @@ def get_module_filetree(module, dir='.'): files = ['/'.join(f.split('/')[1:]) for f in zip.namelist()] else: files = tools.osutil.listdir(path, True) - + tree = {} for f in files: if not f.startswith(dir): continue + if dir: f = f[len(dir)+int(not dir.endswith('/')):] lst = f.split(os.sep) @@ -177,14 +182,14 @@ def get_module_filetree(module, dir='.'): while len(lst) != 1: current = current.setdefault(lst.pop(0), {}) current[lst.pop(0)] = None - + return tree def get_module_as_zip(modulename, b64enc=True, src=True): - + RE_exclude = re.compile('(?:^\..+\.swp$)|(?:\.py[oc]$)|(?:\.bak$)|(?:\.~.~$)', re.I) - + def _zippy(archive, path, src=True): path = os.path.abspath(path) base = os.path.basename(path) @@ -192,12 +197,12 @@ def get_module_as_zip(modulename, b64enc=True, src=True): bf = os.path.basename(f) if not RE_exclude.search(bf) and (src or bf == '__terp__.py' or not path.endswith('.py')): archive.write(os.path.join(path, f), os.path.join(base, f)) - + ap = get_module_path(str(modulename)) if not ap: raise Exception('Unable to find path for module %s' % modulename) - - ap = ap.encode('utf8') + + ap = ap.encode('utf8') if os.path.isfile(ap + '.zip'): val = file(ap + '.zip', 'rb').read() else: @@ -225,6 +230,7 @@ def get_module_resource(module, *args): a = get_module_path(module) return a and opj(a, *args) or False + def get_modules(): """Returns the list of module names """ @@ -242,9 +248,10 @@ def get_modules(): return list(set(listdir(ad) + listdir(_ad))) + def create_graph(module_list, force=None): if not force: - force=[] + force = [] graph = Graph() packages = [] @@ -256,7 +263,8 @@ def create_graph(module_list, force=None): except IOError: continue terp_file = get_module_resource(module, '__terp__.py') - if not terp_file: continue + if not terp_file: + continue if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'): try: info = eval(tools.file_open(terp_file).read()) @@ -265,14 +273,14 @@ def create_graph(module_list, force=None): raise if info.get('installable', True): packages.append((module, info.get('depends', []), info)) - + dependencies = dict([(p, deps) for p, deps, data in packages]) current, later = Set([p for p, dep, data in packages]), Set() while packages and current > later: package, deps, data = packages[0] # if all dependencies of 'package' are already in the graph, add 'package' in the graph - if reduce(lambda x,y: x and y in graph, deps, True): + if reduce(lambda x, y: x and y in graph, deps, True): if not package in current: packages.pop(0) continue @@ -288,15 +296,15 @@ def create_graph(module_list, force=None): later.add(package) packages.append((package, deps, data)) packages.pop(0) - + for package in later: unmet_deps = filter(lambda p: p not in graph, dependencies[package]) logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: Unmet dependencies: %s' % (package, ', '.join(unmet_deps))) return graph + def init_module_objects(cr, module_name, obj_list): - pool = pooler.get_pool(cr.dbname) logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: creating or updating database tables' % module_name) todo = [] for obj in obj_list: @@ -311,6 +319,7 @@ def init_module_objects(cr, module_name, obj_list): t[1](cr, *t[2]) cr.commit() + def register_class(m): """ Register module named m, if not already registered @@ -351,8 +360,8 @@ class MigrationManager(object): This class manage the migration of modules Migrations files must be python files containing a "migrate(cr, installed_version)" function. Theses files must respect a directory tree structure: A 'migrations' folder which containt a - folder by version. Version can be 'module' version or 'server.module' version (in this case, - the files will only be processed by this version of the server). Python file names must start + folder by version. Version can be 'module' version or 'server.module' version (in this case, + the files will only be processed by this version of the server). Python file names must start by 'pre' or 'post' and will be executed, respectively, before and after the module initialisation Example: @@ -368,7 +377,7 @@ class MigrationManager(object): | `-- post-clean-data.py `-- foo.py # not processed - This similar structure is generated by the maintenance module with the migrations files get by + This similar structure is generated by the maintenance module with the migrations files get by the maintenance contract """ @@ -393,7 +402,6 @@ class MigrationManager(object): self.migrations[pkg.name]['module'] = get_module_filetree(pkg.name, 'migrations') or {} self.migrations[pkg.name]['maintenance'] = get_module_filetree('base', 'maintenance/migrations/' + pkg.name) or {} - def migrate_module(self, pkg, stage): assert stage in ('pre', 'post') stageformat = {'pre': '[>%s]', @@ -402,7 +410,7 @@ class MigrationManager(object): if not (hasattr(pkg, 'update') or pkg.state == 'to upgrade'): return - + def convert_version(version): if version.startswith(release.major_version) and version != release.major_version: return version # the version number already containt the server version @@ -413,7 +421,7 @@ class MigrationManager(object): return [d for d in tree if tree[d] is not None] versions = list(set( - __get_dir(self.migrations[pkg.name]['module']) + + __get_dir(self.migrations[pkg.name]['module']) + __get_dir(self.migrations[pkg.name]['maintenance']) )) versions.sort(key=lambda k: parse_version(convert_version(k))) @@ -424,7 +432,7 @@ class MigrationManager(object): """ m = self.migrations[pkg.name] lst = [] - + mapping = {'module': {'module': pkg.name, 'rootdir': opj('migrations')}, 'maintenance': {'module': 'base', 'rootdir': opj('maintenance', 'migrations', pkg.name)}, } @@ -439,7 +447,7 @@ class MigrationManager(object): lst.append((mapping[x]['module'], opj(mapping[x]['rootdir'], version, f))) return lst - def mergedict(a,b): + def mergedict(a, b): a = a.copy() a.update(b) return a @@ -448,7 +456,7 @@ class MigrationManager(object): parsed_installed_version = parse_version(pkg.installed_version or '') current_version = parse_version(convert_version(pkg.data.get('version', '0'))) - + versions = _get_migration_versions(pkg) for version in versions: @@ -458,7 +466,7 @@ class MigrationManager(object): 'stage': stage, 'version': stageformat[stage] % version, } - + for modulename, pyfile in _get_migration_files(pkg, version, stage): name, ext = os.path.splitext(os.path.basename(pyfile)) if ext.lower() != '.py': @@ -466,18 +474,18 @@ class MigrationManager(object): mod = fp = fp2 = None try: fp = tools.file_open(opj(modulename, pyfile)) - - # imp.load_source need a real file object, so we create + + # imp.load_source need a real file object, so we create # on from the file-like object we get from file_open fp2 = os.tmpfile() fp2.write(fp.read()) fp2.seek(0) try: mod = imp.load_source(name, pyfile, fp2) - logger.notifyChannel('migration', netsvc.LOG_INFO, 'module %(addon)s: Running migration %(version)s %(name)s"' % mergedict({'name': mod.__name__},strfmt)) + logger.notifyChannel('migration', netsvc.LOG_INFO, 'module %(addon)s: Running migration %(version)s %(name)s"' % mergedict({'name': mod.__name__}, strfmt)) mod.migrate(self.cr, pkg.installed_version) except ImportError: - logger.notifyChannel('migration', netsvc.LOG_ERROR, 'module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': opj(modulename,pyfile)}, strfmt)) + logger.notifyChannel('migration', netsvc.LOG_ERROR, 'module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': opj(modulename, pyfile)}, strfmt)) raise except AttributeError: logger.notifyChannel('migration', netsvc.LOG_ERROR, 'module %(addon)s: Each %(stage)s-migration file must have a "migrate(cr, installed_version)" function' % strfmt) @@ -490,12 +498,12 @@ class MigrationManager(object): fp2.close() if mod: del mod - + def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): # **kwargs is passed directly to convert_xml_import if not status: - status={} + status = {} status = status.copy() package_todo = [] @@ -519,14 +527,14 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): for package in graph: for k, v in additional_data[package.name].items(): setattr(package, k, v) - + migrations = MigrationManager(cr, graph) check_rules = False modobj = None for package in graph: - status['progress'] = (float(statusi)+0.1)/len(graph) + status['progress'] = (float(statusi)+0.1) / len(graph) m = package.name mid = package.id @@ -543,14 +551,14 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): modobj.check(cr, 1, [mid]) idref = {} - status['progress'] = (float(statusi)+0.4)/len(graph) + status['progress'] = (float(statusi)+0.4) / len(graph) if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): check_rules = True init_module_objects(cr, m, modules) for kind in ('init', 'update'): for filename in package.data.get('%s_xml' % kind, []): mode = 'update' - if hasattr(package, 'init') or package.state=='to install': + if hasattr(package, 'init') or package.state == 'to install': mode = 'init' logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading %s' % (m, filename)) name, ext = os.path.splitext(filename) @@ -567,7 +575,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): tools.convert_xml_import(cr, m, fp, idref, mode=mode, **kwargs) fp.close() if hasattr(package, 'demo') or (package.dbdemo and package.state != 'installed'): - status['progress'] = (float(statusi)+0.75)/len(graph) + status['progress'] = (float(statusi)+0.75) / len(graph) for xml in package.data.get('demo_xml', []): name, ext = os.path.splitext(xml) logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading %s' % (m, xml)) @@ -584,7 +592,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): #cr.execute("update ir_module_module set state='installed', latest_version=%s where id=%s", (ver, mid,)) # Set new modules and dependencies - modobj.write(cr, 1, [mid], {'state':'installed', 'latest_version':ver}) + modobj.write(cr, 1, [mid], {'state': 'installed', 'latest_version': ver}) cr.commit() # Update translations for all installed languages @@ -593,12 +601,12 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): cr.commit() migrations.migrate_module(package, 'post') - statusi+=1 + statusi += 1 if perform_checks and check_rules: cr.execute("""select model,name from ir_model where id not in (select model_id from ir_model_access)""") - for (model,name) in cr.fetchall(): - logger.notifyChannel('init', netsvc.LOG_WARNING, 'object %s (%s) has no access rules!' % (model,name)) + for (model, name) in cr.fetchall(): + logger.notifyChannel('init', netsvc.LOG_WARNING, 'object %s (%s) has no access rules!' % (model, name)) cr.execute('select model from ir_model where state=%s', ('manual',)) @@ -608,9 +616,10 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): pool.get('ir.model.data')._process_end(cr, 1, package_todo) cr.commit() + def load_modules(db, force_demo=False, status=None, update_module=False): if not status: - status={} + status = {} cr = db.cursor() force = [] @@ -632,20 +641,20 @@ def load_modules(db, force_demo=False, status=None, update_module=False): ids = modobj.search(cr, 1, ['&', ('state', '=', 'uninstalled'), ('name', 'in', mods)]) if ids: modobj.button_install(cr, 1, ids) - + mods = [k for k in tools.config['update'] if tools.config['update'][k]] if mods: - ids = modobj.search(cr, 1, ['&',('state', '=', 'installed'), ('name', 'in', mods)]) + ids = modobj.search(cr, 1, ['&', ('state', '=', 'installed'), ('name', 'in', mods)]) if ids: modobj.button_upgrade(cr, 1, ids) - + cr.execute("update ir_module_module set state=%s where name=%s", ('installed', 'base')) cr.execute("select name from ir_module_module where state in ('installed', 'to install', 'to upgrade')") else: cr.execute("select name from ir_module_module where state in ('installed', 'to upgrade')") module_list = [name for (name,) in cr.fetchall()] graph = create_graph(module_list, force) - + # the 'base' module has already been updated base = graph['base'] base.state = 'installed' @@ -658,7 +667,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): logger.notifyChannel('init', netsvc.LOG_INFO, report) for kind in ('init', 'demo', 'update'): - tools.config[kind]={} + tools.config[kind] = {} cr.commit() if update_module: @@ -666,7 +675,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): for mod_id, mod_name in cr.fetchall(): pool = pooler.get_pool(cr.dbname) cr.execute('select model,res_id from ir_model_data where noupdate=%s and module=%s order by id desc', (False, mod_name,)) - for rmod,rid in cr.fetchall(): + for rmod, rid in cr.fetchall(): uid = 1 pool.get(rmod).unlink(cr, uid, [rid]) cr.execute('delete from ir_model_data where noupdate=%s and module=%s', (False, mod_name,)) From 7a8d5c0c2cc3dd7197cd7523d0d5f07b602e88d7 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 10:52:10 +0100 Subject: [PATCH 039/215] [REF] Remove unusued code bzr revid: stephane@tinyerp.com-20090114095210-mdxolxl7884o1fzq --- addons/custom/__init__.py | 2 -- addons/custom/custom.py | 37 ------------------------------------- 2 files changed, 39 deletions(-) delete mode 100644 addons/custom/custom.py diff --git a/addons/custom/__init__.py b/addons/custom/__init__.py index 345290445e6..7ed460db2b3 100644 --- a/addons/custom/__init__.py +++ b/addons/custom/__init__.py @@ -20,7 +20,5 @@ # ############################################################################## -import custom - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/custom/custom.py b/addons/custom/custom.py deleted file mode 100644 index 2000b89e66a..00000000000 --- a/addons/custom/custom.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## - -from osv import osv, fields - -#class custom_material(osv.osv): -# _name = 'network.material' -# _inherit = 'network.material' -# _columns = { -# } -# _defaults = { -# } -#custom_material() - - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - From 58ac90e77466f5ca7f4608d9617f99b5ae67d9b9 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 14 Jan 2009 12:17:10 +0100 Subject: [PATCH 040/215] [FIX] Use the header field from the ir.actions.report.xml to print the header in the rml report lp bug: https://launchpad.net/bugs/316184 fixed bzr revid: stephane@tinyerp.com-20090114111710-rags1eq0p4n0kb0h --- bin/report/report_sxw.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index c4f10212b5a..3e10bed3c77 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -598,6 +598,7 @@ class report_sxw(report_rml): report_xml = None title='' attach = False + want_header = self.header if report_xml_ids: report_xml = ir_actions_report_xml_obj.browse(cr, uid, report_xml_ids[0], context=context) @@ -605,6 +606,7 @@ class report_sxw(report_rml): attach = report_xml.attachment rml = report_xml.report_rml_content report_type = report_xml.report_type + want_header = report_xml.header else: ir_menu_report_obj = pool.get('ir.ui.menu') report_menu_ids = ir_menu_report_obj.search(cr, uid, @@ -657,14 +659,14 @@ class report_sxw(report_rml): pe.childNodes[0].data=data['model'] meta = rml_dom_meta.documentElement.toxml('utf-8') - rml2 = rml_parser._parse(rml_dom, objs, data, header=self.header) + rml2 = rml_parser._parse(rml_dom, objs, data, header=want_header) sxw_z = zipfile.ZipFile(sxw_io, mode='a') sxw_z.writestr('content.xml', "" + \ rml2) sxw_z.writestr('meta.xml', "" + \ meta) - if self.header: + if want_header: #Add corporate header/footer if report_type=='odt': rml = tools.file_open('custom/corporate_odt_header.xml').read() @@ -676,7 +678,7 @@ class report_sxw(report_rml): objs = self.getObjects(cr, uid, ids, context) rml_parser.preprocess(objs, data, ids) rml_dom = xml.dom.minidom.parseString(rml) - rml2 = rml_parser._parse(rml_dom, objs, data, header=self.header) + rml2 = rml_parser._parse(rml_dom, objs, data, header=want_header) sxw_z.writestr('styles.xml',"" + \ rml2) sxw_z.close() @@ -690,7 +692,7 @@ class report_sxw(report_rml): objs = self.getObjects(cr, uid, ids, context) rml_parser.preprocess(objs, data, ids) rml_dom = xml.dom.minidom.parseString(rml) - rml2 = rml_parser._parse(rml_dom, objs, data, header=self.header) + rml2 = rml_parser._parse(rml_dom, objs, data, header=want_header) if rml_parser.logo: logo = base64.decodestring(rml_parser.logo) From 6b59779b4598d07766720657af3e3cf053b36cd2 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:01:37 +0100 Subject: [PATCH 041/215] [FIX] lp:315408 Added domain [('type','!=','view')] on default_debit_account_id and default_credit_account_id fields of account_journal lp bug: https://launchpad.net/bugs/315408 fixed bzr revid: qdp@jade-20090114130137-ok0pnyde622gohgj --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index c249e704f81..9ae28c4ab1f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -448,8 +448,8 @@ class account_journal(osv.osv): 'active': fields.boolean('Active'), 'view_id': fields.many2one('account.journal.view', 'View', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tell Open ERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), - 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account'), - 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account'), + 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]"), + 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]"), 'centralisation': fields.boolean('Centralised counterpart', help="Check this box if you want that each entry doesn't create a counterpart but share the same counterpart for each entry of this journal. This is used in fiscal year closing."), 'update_posted': fields.boolean('Allow Cancelling Entries'), 'group_invoice_lines': fields.boolean('Group invoice lines', help="If this box is cheked, the system will try to group the accouting lines when generating them from invoices."), From 5368288e81055057b3870715724875f5a98886a4 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:13:08 +0100 Subject: [PATCH 042/215] [FIX] lp:315415 Added a domain [('state','<>','done')] on period_id field of account_invoice lp bug: https://launchpad.net/bugs/315415 fixed bzr revid: qdp@jade-20090114131308-n05tcaj8kyv7pw3z --- addons/account/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 8a5cc00589e..6dd6ee1ccee 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -182,7 +182,7 @@ class account_invoice(osv.osv): 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]} ), - 'period_id': fields.many2one('account.period', 'Force Period', help="Keep empty to use the period of the validation date."), + 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done'), help="Keep empty to use the period of the validation date."), 'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The partner account used for this invoice."), 'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}), From 2203fc2d57516429bb0fcb102997f86921d6703d Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:31:50 +0100 Subject: [PATCH 043/215] typo corrected bzr revid: qdp@jade-20090114133150-pi18cjb4kh0no10j --- addons/account/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 6dd6ee1ccee..f6cccdcf2f0 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -182,7 +182,7 @@ class account_invoice(osv.osv): 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]} ), - 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done'), help="Keep empty to use the period of the validation date."), + 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation date."), 'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The partner account used for this invoice."), 'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}), From 37323b62a771901f7092383cc35a05f364379364 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:33:59 +0100 Subject: [PATCH 044/215] [FIX] added domain=[('type','<>','view')] on accounts of fiscal_position and fiscal_position templates lp bug: https://launchpad.net/bugs/315443 fixed bzr revid: qdp@jade-20090114133359-muarqlhiiy6ne3f9 --- addons/account/account.py | 4 ++-- addons/account/partner.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 9ae28c4ab1f..790d9adc15c 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1901,8 +1901,8 @@ class account_fiscal_position_account_template(osv.osv): _rec_name = 'position_id' _columns = { 'position_id': fields.many2one('account.fiscal.position.template', 'Fiscal Position', required=True, ondelete='cascade'), - 'account_src_id': fields.many2one('account.account.template', 'Account Source', required=True), - 'account_dest_id': fields.many2one('account.account.template', 'Account Destination', required=True) + 'account_src_id': fields.many2one('account.account.template', 'Account Source', domain=[('type','<>','view')], required=True), + 'account_dest_id': fields.many2one('account.account.template', 'Account Destination', domain=[('type','<>','view')], required=True) } account_fiscal_position_account_template() diff --git a/addons/account/partner.py b/addons/account/partner.py index d32a6b785e5..a2e981fb4ab 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -76,8 +76,8 @@ class account_fiscal_position_account(osv.osv): _rec_name = 'position_id' _columns = { 'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'), - 'account_src_id': fields.many2one('account.account', 'Account Source', required=True), - 'account_dest_id': fields.many2one('account.account', 'Account Destination', required=True) + 'account_src_id': fields.many2one('account.account', 'Account Source', domain=[('type','<>','view')], required=True), + 'account_dest_id': fields.many2one('account.account', 'Account Destination', domain=[('type','<>','view')], required=True) } account_fiscal_position_account() From 0f9a96368b311e7b34c505f22ca4b0c95d9185e5 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 14 Jan 2009 14:52:31 +0100 Subject: [PATCH 045/215] [FIX] lp:315471 added readonly="1" on state field of fiscalyear. Use have to go through the wizard for closing fiscal year if they want to change the status lp bug: https://launchpad.net/bugs/315471 fixed bzr revid: qdp@jade-20090114135231-na2gxb55ifavl2l6 --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 2eb2ae92738..600114e90bd 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -28,7 +28,7 @@
- +