From 41628fc7027df0a3f372869d2349601bbe2040dc Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Fri, 12 Apr 2013 15:08:56 +0200 Subject: [PATCH 1/6] [FIX]product: add store=dict to field name_template bzr revid: csn@openerp.com-20130412130856-3g5e67v2r7y6ep5v --- addons/product/product.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 82b37f7b9e8..4dbd0752911 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -523,6 +523,14 @@ class product_product(osv.osv): def _set_image(self, cr, uid, id, name, value, args, context=None): return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context) + def _get_name_template_ids(self, cr, uid, ids, context=None): + result = set() + for template in self.browse(cr, uid, ids, context=context): + template_ids = self.pool.get('product.product').search(cr, uid, [('product_tmpl_id','=',template.id)]) + for el in template_ids: + result.add(el) + return list(result) + _defaults = { 'active': lambda *a: 1, 'price_extra': lambda *a: 0.0, @@ -554,7 +562,11 @@ class product_product(osv.osv): 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Product Price')), 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Product Price')), 'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'), - 'name_template': fields.related('product_tmpl_id', 'name', string="Template Name", type='char', size=128, store=True, select=True), + 'name_template': fields.related('product_tmpl_id', 'name', string="Template Name", type='char', size=128, store={ + 'product.template': (_get_name_template_ids, ['name'], 10), + 'product.product': (lambda self, cr, uid, ids, c={}: ids, [], 10), + + }, select=True), 'color': fields.integer('Color Index'), # image: all image fields are base64 encoded and PIL-supported 'image': fields.binary("Image", From f25c5d857b3432db99a2e422b35396db64aed652 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Mon, 15 Apr 2013 12:21:21 +0200 Subject: [PATCH 2/6] [REF]product: remove one extra loop bzr revid: csn@openerp.com-20130415102121-u74t7zd3zct3q3ts --- addons/product/product.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 4dbd0752911..239fc940b6b 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -525,10 +525,9 @@ class product_product(osv.osv): def _get_name_template_ids(self, cr, uid, ids, context=None): result = set() - for template in self.browse(cr, uid, ids, context=context): - template_ids = self.pool.get('product.product').search(cr, uid, [('product_tmpl_id','=',template.id)]) - for el in template_ids: - result.add(el) + template_ids = self.pool.get('product.product').search(cr, uid, [('product_tmpl_id', 'in', ids)]) + for el in template_ids: + result.add(el) return list(result) _defaults = { From d92f8821ef7db35311f23206b40a1d78b3b535d4 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of openerp <> Date: Wed, 17 Apr 2013 05:15:50 +0000 Subject: [PATCH 3/6] Launchpad automatic translations update. bzr revid: launchpad_translations_on_behalf_of_openerp-20130417051550-7yf32ngvesfbrxyn --- addons/account/i18n/nl_BE.po | 4 ++-- addons/account_followup/i18n/nl_BE.po | 4 ++-- addons/auth_signup/i18n/zh_CN.po | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/account/i18n/nl_BE.po b/addons/account/i18n/nl_BE.po index a3244945957..139807ab49b 100644 --- a/addons/account/i18n/nl_BE.po +++ b/addons/account/i18n/nl_BE.po @@ -13,8 +13,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-04-16 04:37+0000\n" -"X-Generator: Launchpad (build 16564)\n" +"X-Launchpad-Export-Date: 2013-04-17 05:15+0000\n" +"X-Generator: Launchpad (build 16567)\n" "Language: nl\n" #. module: account diff --git a/addons/account_followup/i18n/nl_BE.po b/addons/account_followup/i18n/nl_BE.po index 5125f27f2ff..64a73d776ef 100644 --- a/addons/account_followup/i18n/nl_BE.po +++ b/addons/account_followup/i18n/nl_BE.po @@ -13,8 +13,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-04-16 04:37+0000\n" -"X-Generator: Launchpad (build 16564)\n" +"X-Launchpad-Export-Date: 2013-04-17 05:15+0000\n" +"X-Generator: Launchpad (build 16567)\n" "Language: nl\n" #. module: account_followup diff --git a/addons/auth_signup/i18n/zh_CN.po b/addons/auth_signup/i18n/zh_CN.po index 9beb3a044d3..aa8d9f952c1 100644 --- a/addons/auth_signup/i18n/zh_CN.po +++ b/addons/auth_signup/i18n/zh_CN.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-04-16 04:37+0000\n" -"X-Generator: Launchpad (build 16564)\n" +"X-Launchpad-Export-Date: 2013-04-17 05:15+0000\n" +"X-Generator: Launchpad (build 16567)\n" #. module: auth_signup #: field:res.partner,signup_type:0 From d248aa30ba5ab3ce2c61390fffb3b696c359bc9a Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Wed, 17 Apr 2013 08:40:51 +0200 Subject: [PATCH 4/6] [REF] get_module_resource() must imported from openerp.modules (instead of openerp.addons). bzr revid: vmt@openerp.com-20130417064051-dvtgaya0kzyryvac --- addons/crm_helpdesk/test/process/help-desk.yml | 3 +-- addons/hr_recruitment/test/recruitment_process.yml | 3 +-- addons/l10n_lu/wizard/print_vat.py | 4 ++-- addons/project_issue/test/subscribe_issue.yml | 5 ++--- addons/report_webkit/webkit_report.py | 6 +++--- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/addons/crm_helpdesk/test/process/help-desk.yml b/addons/crm_helpdesk/test/process/help-desk.yml index e2be4a64ca3..95536b1c8dd 100644 --- a/addons/crm_helpdesk/test/process/help-desk.yml +++ b/addons/crm_helpdesk/test/process/help-desk.yml @@ -4,8 +4,7 @@ Mail script will be fetched him request from mail server. so I process that mail after read EML file - !python {model: mail.thread}: | - from openerp import addons - request_file = open(addons.get_module_resource('crm_helpdesk','test', 'customer_question.eml'),'rb') + request_file = open(openerp.modules.module.get_module_resource('crm_helpdesk','test', 'customer_question.eml'),'rb') request_message = request_file.read() self.message_process(cr, uid, 'crm.helpdesk', request_message) - diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml index f2d4e4736fa..335edc71892 100644 --- a/addons/hr_recruitment/test/recruitment_process.yml +++ b/addons/hr_recruitment/test/recruitment_process.yml @@ -4,8 +4,7 @@ An applicant is interested in the job position. So he sends a resume by email. - !python {model: mail.thread}: | - from openerp import addons - request_file = open(addons.get_module_resource('hr_recruitment','test', 'resume.eml'),'rb') + request_file = open(openerp.modules.module.get_module_resource('hr_recruitment','test', 'resume.eml'),'rb') request_message = request_file.read() self.message_process(cr, uid, 'hr.applicant', request_message) - diff --git a/addons/l10n_lu/wizard/print_vat.py b/addons/l10n_lu/wizard/print_vat.py index 79213026496..bfa058720d3 100644 --- a/addons/l10n_lu/wizard/print_vat.py +++ b/addons/l10n_lu/wizard/print_vat.py @@ -9,10 +9,10 @@ from __future__ import with_statement import openerp from openerp.osv import fields, osv from openerp import tools +from openerp.modules.module import get_module_resource from openerp.tools.translate import _ from openerp.report.render import render from openerp.report.interface import report_int -from openerp import addons import tempfile import os @@ -53,7 +53,7 @@ class report_custom(report_int): try: tmp_file = tempfile.mkstemp(".pdf")[1] try: - tools.pdf_utils.fill_pdf(addons.get_module_resource('l10n_lu','wizard', '2008_DECL_F_M10.pdf'), tmp_file, result) + tools.pdf_utils.fill_pdf(get_module_resource('l10n_lu','wizard', '2008_DECL_F_M10.pdf'), tmp_file, result) with open(tmp_file, "r") as ofile: self.obj = external_pdf(ofile.read()) finally: diff --git a/addons/project_issue/test/subscribe_issue.yml b/addons/project_issue/test/subscribe_issue.yml index 9f16dc80b97..af81ff4d295 100644 --- a/addons/project_issue/test/subscribe_issue.yml +++ b/addons/project_issue/test/subscribe_issue.yml @@ -2,8 +2,7 @@ In Order to test process of Issue in OpenERP, Custmer send the issue by email. - !python {model: mail.thread}: | - from openerp import addons - request_file = open(addons.get_module_resource('project_issue','test', 'issue.eml'),'rb') + request_file = open(openerp.modules.module.get_module_resource('project_issue','test', 'issue.eml'),'rb') request_message = request_file.read() self.message_process(cr, uid, 'project.issue', request_message) - @@ -14,4 +13,4 @@ assert issue_ids and len(issue_ids), "issue is not created after getting request" issue = self.browse(cr, uid, issue_ids[0], context=context) assert not issue.partner_id, "Customer should be a new" - assert issue.name == "Error in the account module", "Subject does not match" \ No newline at end of file + assert issue.name == "Error in the account module", "Subject does not match" diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py index 01536f471fe..3d8e41c42ff 100644 --- a/addons/report_webkit/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -40,8 +40,8 @@ import logging from report_helper import WebKitHelper import openerp +from openerp.modules.module import get_module_resource from openerp.report.report_sxw import * -from openerp import addons from openerp import tools from openerp.tools.translate import _ from openerp.osv.osv import except_osv @@ -280,7 +280,7 @@ class WebKitParser(report_sxw): template = False if report_xml.report_file : - path = addons.get_module_resource(*report_xml.report_file.split(os.path.sep)) + path = get_module_resource(*report_xml.report_file.split(os.path.sep)) if path and os.path.exists(path) : template = file(path).read() if not template and report_xml.report_webkit_data : @@ -296,7 +296,7 @@ class WebKitParser(report_sxw): ) if not report_xml.header : header = '' - default_head = addons.get_module_resource('report_webkit', 'default_header.html') + default_head = get_module_resource('report_webkit', 'default_header.html') with open(default_head,'r') as f: header = f.read() css = report_xml.webkit_header.css From 95415292154584aaa59c9d3449ab07f2f041cfe2 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Wed, 17 Apr 2013 09:55:46 +0200 Subject: [PATCH 5/6] [FIX] _auto_init(): when _auto_init() is overridden it does not return the super() result, which might brake functional fields initialization. bzr revid: vmt@openerp.com-20130417075546-e3crirzk1trl9yr1 --- addons/account/account_move_line.py | 3 ++- addons/hr_recruitment/hr_recruitment.py | 3 ++- addons/mail/mail_alias.py | 4 +++- addons/mail/res_users.py | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index b0b7815ad3c..48b2591485d 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -559,10 +559,11 @@ class account_move_line(osv.osv): ] def _auto_init(self, cr, context=None): - super(account_move_line, self)._auto_init(cr, context=context) + res = super(account_move_line, self)._auto_init(cr, context=context) cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'') if not cr.fetchone(): cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)') + return res def _check_no_view(self, cr, uid, ids, context=None): lines = self.browse(cr, uid, ids, context=context) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index b0b60db6bd5..e41d80fb348 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -510,8 +510,9 @@ class hr_job(osv.osv): def _auto_init(self, cr, context=None): """Installation hook to create aliases for all jobs and avoid constraint errors.""" - self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job,self)._auto_init, + res = self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job,self)._auto_init, self._columns['alias_id'], 'name', alias_prefix='job+', alias_defaults={'job_id': 'id'}, context=context) + return res def create(self, cr, uid, vals, context=None): mail_alias = self.pool.get('mail.alias') diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py index f806b325291..8730599ad72 100644 --- a/addons/mail/mail_alias.py +++ b/addons/mail/mail_alias.py @@ -160,7 +160,7 @@ class mail_alias(osv.Model): alias_id_column.required = False # call _auto_init - child_model_auto_init_fct(cr, context=context) + res = child_model_auto_init_fct(cr, context=context) registry = RegistryManager.get(cr.dbname) mail_alias = registry.get('mail.alias') @@ -188,6 +188,8 @@ class mail_alias(osv.Model): # set back the unique alias_id constraint alias_id_column.required = True + return res + def create_unique_alias(self, cr, uid, vals, model_name=None, context=None): """Creates an email.alias record according to the values provided in ``vals``, with 2 alterations: the ``alias_name`` value may be suffixed in order to diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py index f7c91939b98..5545745b235 100644 --- a/addons/mail/res_users.py +++ b/addons/mail/res_users.py @@ -60,8 +60,9 @@ class res_users(osv.Model): def _auto_init(self, cr, context=None): """ Installation hook: aliases, partner following themselves """ # create aliases for all users and avoid constraint errors - self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init, + res = self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init, self._columns['alias_id'], 'login', alias_force_key='id', context=context) + return res def create(self, cr, uid, data, context=None): # create default alias same as the login From 912d45de5162f1d66e58537d13b09c390a5dc1c8 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Wed, 17 Apr 2013 10:05:50 +0200 Subject: [PATCH 6/6] [FIX]base-report-designer-plugin: when downloading plugin, file didn't have .zip extension, move zip file to static folder bzr revid: csn@openerp.com-20130417080550-duen03d70s4tryr1 --- .../base_report_designer_installer.xml | 2 +- addons/base_report_designer/installer.py | 8 ++++---- .../openerp_report_designer.zip | Bin 3 files changed, 5 insertions(+), 5 deletions(-) rename addons/base_report_designer/{plugin => static/base-report-designer-plugin}/openerp_report_designer.zip (100%) diff --git a/addons/base_report_designer/base_report_designer_installer.xml b/addons/base_report_designer/base_report_designer_installer.xml index 657eae8fd63..99898f5a703 100644 --- a/addons/base_report_designer/base_report_designer_installer.xml +++ b/addons/base_report_designer/base_report_designer_installer.xml @@ -20,7 +20,7 @@ - + diff --git a/addons/base_report_designer/installer.py b/addons/base_report_designer/installer.py index a21b6655af7..c75e13d662c 100644 --- a/addons/base_report_designer/installer.py +++ b/addons/base_report_designer/installer.py @@ -23,7 +23,6 @@ from openerp.osv import fields from openerp.osv import osv import base64 from openerp.tools.translate import _ -from openerp.modules.module import get_module_resource class base_report_designer_installer(osv.osv_memory): _name = 'base_report_designer.installer' @@ -31,13 +30,13 @@ class base_report_designer_installer(osv.osv_memory): def default_get(self, cr, uid, fields, context=None): data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context=context) - plugin_file = open(get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb') - data['plugin_file'] = base64.encodestring(plugin_file.read()) + base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + data['plugin_file'] = base_url + '/base_report_designer/static/base-report-designer-plugin/openerp_report_designer.zip' return data _columns = { 'name':fields.char('File name', size=34), - 'plugin_file':fields.binary('OpenObject Report Designer Plug-in', readonly=True, help="OpenObject Report Designer plug-in file. Save as this file and install this plug-in in OpenOffice."), + 'plugin_file':fields.char('OpenObject Report Designer Plug-in', size=256, readonly=True, help="OpenObject Report Designer plug-in file. Save as this file and install this plug-in in OpenOffice."), 'description':fields.text('Description', readonly=True) } @@ -58,5 +57,6 @@ class base_report_designer_installer(osv.osv_memory): 4. if your connection success, A message appears like 'You can start creating your report in current document.'. """ } +base_report_designer_installer() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_report_designer/plugin/openerp_report_designer.zip b/addons/base_report_designer/static/base-report-designer-plugin/openerp_report_designer.zip similarity index 100% rename from addons/base_report_designer/plugin/openerp_report_designer.zip rename to addons/base_report_designer/static/base-report-designer-plugin/openerp_report_designer.zip