-
+
@@ -133,7 +133,7 @@
-
+
diff --git a/openerp/addons/base/module/wizard/base_export_language.py b/openerp/addons/base/module/wizard/base_export_language.py
index 5ff99501943..95f1d85bf6c 100644
--- a/openerp/addons/base/module/wizard/base_export_language.py
+++ b/openerp/addons/base/module/wizard/base_export_language.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
+# OpenERP, Open Source Business Applications
+# Copyright (c) 2004-2012 OpenERP S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -22,68 +22,58 @@
import tools
import base64
import cStringIO
-import pooler
from osv import fields,osv
from tools.translate import _
from tools.misc import get_iso_codes
+NEW_LANG_KEY = '__new__'
+
class base_language_export(osv.osv_memory):
+ _name = "base.language.export"
def _get_languages(self, cr, uid, context):
- lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
- ids=lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
- langs=lang_obj.browse(cr, uid, ids)
- return [(lang.code, lang.name) for lang in langs]
-
- def act_cancel(self, cr, uid, ids, context=None):
- #self.unlink(cr, uid, ids, context)
- return {'type':'ir.actions.act_window_close' }
-
- def act_destroy(self, *args):
- return {'type':'ir.actions.act_window_close' }
+ lang_obj = self.pool.get('res.lang')
+ ids = lang_obj.search(cr, uid, [('translatable', '=', True)])
+ langs = lang_obj.browse(cr, uid, ids)
+ return [(NEW_LANG_KEY, _('New Language (Empty translation template)'))] + [(lang.code, lang.name) for lang in langs]
+
+ _columns = {
+ 'name': fields.char('File Name', readonly=True),
+ 'lang': fields.selection(_get_languages, 'Language', required=True),
+ 'format': fields.selection([('csv','CSV File'),
+ ('po','PO File'),
+ ('tgz', 'TGZ Archive')], 'File Format', required=True),
+ 'modules': fields.many2many('ir.module.module', 'rel_modules_langexport', 'wiz_id', 'module_id', 'Modules To Export', domain=[('state','=','installed')]),
+ 'data': fields.binary('File', readonly=True),
+ 'state': fields.selection([('choose', 'choose'), # choose language
+ ('get', 'get')]) # get the file
+ }
+ _defaults = {
+ 'state': 'choose',
+ 'name': 'lang.tar.gz',
+ 'lang': NEW_LANG_KEY,
+ 'format': 'csv',
+ }
def act_getfile(self, cr, uid, ids, context=None):
this = self.browse(cr, uid, ids)[0]
+ lang = this.lang if this.lang != NEW_LANG_KEY else False
mods = map(lambda m: m.name, this.modules) or ['all']
mods.sort()
- buf=cStringIO.StringIO()
- tools.trans_export(this.lang, mods, buf, this.format, cr)
- if this.format == 'csv':
- this.advice = _("Save this document to a .CSV file and open it with your favourite spreadsheet software. The file encoding is UTF-8. You have to translate the latest column before reimporting it.")
- elif this.format == 'po':
- if not this.lang:
- this.format = 'pot'
- this.advice = _("Save this document to a %s file and edit it with a specific software or a text editor. The file encoding is UTF-8.") % ('.'+this.format,)
- elif this.format == 'tgz':
- ext = this.lang and '.po' or '.pot'
- this.advice = _('Save this document to a .tgz file. This archive containt UTF-8 %s files and may be uploaded to launchpad.') % (ext,)
- filename = _('new')
- if not this.lang and len(mods) == 1:
+ buf = cStringIO.StringIO()
+ tools.trans_export(lang, mods, buf, this.format, cr)
+ filename = 'new'
+ if lang:
+ filename = get_iso_codes(lang)
+ elif len(mods) == 1:
filename = mods[0]
- if this.lang:
- filename = get_iso_codes(this.lang)
this.name = "%s.%s" % (filename, this.format)
- out=base64.encodestring(buf.getvalue())
+ out = base64.encodestring(buf.getvalue())
buf.close()
- return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice, 'name':this.name}, context=context)
+ self.write(cr, uid, ids, {'state': 'get',
+ 'data': out,
+ 'name':this.name}, context=context)
+ return True
- _name = "base.language.export"
- _inherit = "ir.wizard.screen"
- _columns = {
- 'name': fields.char('File Name', 16, readonly=True),
- 'lang': fields.selection(_get_languages, 'Language', help='To export a new language, do not select a language.'), # not required: unset = new language
- 'format': fields.selection( ( ('csv','CSV File'), ('po','PO File'), ('tgz', 'TGZ Archive')), 'File Format', required=True),
- 'modules': fields.many2many('ir.module.module', 'rel_modules_langexport', 'wiz_id', 'module_id', 'Modules', domain=[('state','=','installed')]),
- 'data': fields.binary('File', readonly=True),
- 'advice': fields.text('Advice', readonly=True),
- 'state': fields.selection( ( ('choose','choose'), # choose language
- ('get','get'), # get the file
- ) ),
- }
- _defaults = {
- 'state': lambda *a: 'choose',
- 'name': lambda *a: 'lang.tar.gz'
- }
-base_language_export()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/openerp/addons/base/module/wizard/base_export_language_view.xml b/openerp/addons/base/module/wizard/base_export_language_view.xml
index 88e411845c3..cbf7104f957 100644
--- a/openerp/addons/base/module/wizard/base_export_language_view.xml
+++ b/openerp/addons/base/module/wizard/base_export_language_view.xml
@@ -1,31 +1,43 @@
-
Export Translations
base.language.export
diff --git a/openerp/addons/base/module/wizard/base_import_language.py b/openerp/addons/base/module/wizard/base_import_language.py
index 94b9ae4db59..9c36c9d7c54 100644
--- a/openerp/addons/base/module/wizard/base_import_language.py
+++ b/openerp/addons/base/module/wizard/base_import_language.py
@@ -29,11 +29,9 @@ class base_language_import(osv.osv_memory):
_name = "base.language.import"
_description = "Language Import"
- _inherit = "ir.wizard.screen"
-
_columns = {
- 'name': fields.char('Language Name',size=64 , required=True),
- 'code': fields.char('Code (eg:en__US)',size=5 , required=True),
+ 'name': fields.char('Language Name', size=64 , required=True),
+ 'code': fields.char('ISO Code', size=5, help="ISO Language and Country code, e.g. en_US", required=True),
'data': fields.binary('File', required=True),
'overwrite': fields.boolean('Overwrite Existing Terms',
help="If you enable this option, existing translations (including custom ones) "
@@ -41,31 +39,25 @@ class base_language_import(osv.osv_memory):
}
def import_lang(self, cr, uid, ids, context=None):
- """
- Import Language
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: the ID or list of IDs
- @param context: A standard dictionary
- """
if context is None:
context = {}
- import_data = self.browse(cr, uid, ids)[0]
- if import_data.overwrite:
+ this = self.browse(cr, uid, ids[0])
+ if this.overwrite:
context.update(overwrite=True)
fileobj = TemporaryFile('w+')
- fileobj.write(base64.decodestring(import_data.data))
+ try:
+ fileobj.write(base64.decodestring(this.data))
+
+ # now we determine the file format
+ fileobj.seek(0)
+ first_line = fileobj.readline().strip().replace('"', '').replace(' ', '')
+ fileformat = first_line.endswith("type,name,res_id,src,value") and 'csv' or 'po'
+ fileobj.seek(0)
+
+ tools.trans_load_data(cr, fileobj, fileformat, this.code, lang_name=this.name, context=context)
+ finally:
+ fileobj.close()
+ return True
- # now we determine the file format
- fileobj.seek(0)
- first_line = fileobj.readline().strip().replace('"', '').replace(' ', '')
- fileformat = first_line.endswith("type,name,res_id,src,value") and 'csv' or 'po'
- fileobj.seek(0)
-
- tools.trans_load_data(cr, fileobj, fileformat, import_data.code, lang_name=import_data.name, context=context)
- fileobj.close()
- return {}
-
-base_language_import()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/openerp/addons/base/module/wizard/base_import_language_view.xml b/openerp/addons/base/module/wizard/base_import_language_view.xml
index 727de4e381b..5e2aada7766 100644
--- a/openerp/addons/base/module/wizard/base_import_language_view.xml
+++ b/openerp/addons/base/module/wizard/base_import_language_view.xml
@@ -8,7 +8,7 @@
diff --git a/openerp/addons/base/publisher_warranty/__init__.py b/openerp/addons/base/publisher_warranty/__init__.py
deleted file mode 100644
index 6b60ddf3ca1..00000000000
--- a/openerp/addons/base/publisher_warranty/__init__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import publisher_warranty
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py
deleted file mode 100644
index 897210ce817..00000000000
--- a/openerp/addons/base/publisher_warranty/publisher_warranty.py
+++ /dev/null
@@ -1,354 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 OpenERP S.A. ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-"""
-Module to handle publisher warranty contracts as well as notifications from
-OpenERP.
-"""
-
-import datetime
-import logging
-import sys
-import urllib
-import urllib2
-
-import pooler
-import release
-from osv import osv, fields
-from tools.translate import _
-from tools.safe_eval import safe_eval
-from tools.config import config
-from tools import misc
-
-_logger = logging.getLogger(__name__)
-
-"""
-Time interval that will be used to determine up to which date we will
-check the logs to see if a message we just received was already logged.
-@type: datetime.timedelta
-"""
-_PREVIOUS_LOG_CHECK = datetime.timedelta(days=365)
-
-class publisher_warranty_contract(osv.osv):
- """
- Osv representing a publisher warranty contract.
- """
- _name = "publisher_warranty.contract"
-
- def _get_valid_contracts(self, cr, uid):
- """
- Return the list of the valid contracts encoded in the system.
-
- @return: A list of contracts
- @rtype: list of publisher_warranty.contract browse records
- """
- return [contract for contract in self.browse(cr, uid, self.search(cr, uid, []))
- if contract.state == 'valid']
-
- def status(self, cr, uid):
- """ Method called by the client to check availability of publisher warranty contract. """
-
- contracts = self._get_valid_contracts(cr, uid)
- return {
- 'status': "full" if contracts else "none" ,
- 'uncovered_modules': list(),
- }
-
- def send(self, cr, uid, tb, explanations, remarks=None, issue_name=None):
- """ Method called by the client to send a problem to the publisher warranty server. """
-
- if not remarks:
- remarks = ""
-
- valid_contracts = self._get_valid_contracts(cr, uid)
- valid_contract = valid_contracts[0]
-
- try:
- origin = 'client'
- dbuuid = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
- db_create_date = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.create_date')
- user = self.pool.get("res.users").browse(cr, uid, uid)
- user_name = user.name
- email = user.email
-
- msg = {'contract_name': valid_contract.name,
- 'tb': tb,
- 'explanations': explanations,
- 'remarks': remarks,
- 'origin': origin,
- 'dbname': cr.dbname,
- 'dbuuid': dbuuid,
- 'db_create_date': db_create_date,
- 'issue_name': issue_name,
- 'email': email,
- 'user_name': user_name,
- }
-
-
- add_arg = {"timeout":30} if sys.version_info >= (2,6) else {}
- uo = urllib2.urlopen(config.get("publisher_warranty_url"),
- urllib.urlencode({'arg0': msg, "action": "send",}),**add_arg)
- try:
- submit_result = uo.read()
- finally:
- uo.close()
-
- result = safe_eval(submit_result)
-
- crm_case_id = result
-
- if not crm_case_id:
- return False
-
- except osv.except_osv:
- raise
- except Exception:
- _logger.warning("Error sending problem report", exc_info=1)
- raise osv.except_osv(_("Error"),
- _("Error during communication with the publisher warranty server."))
-
- return True
-
- def check_validity(self, cr, uid, ids, context=None):
- """
- Check the validity of a publisher warranty contract. This method just call get_logs() but checks
- some more things, so it can be called from a user interface.
- """
- contract_id = ids[0]
- contract = self.browse(cr, uid, contract_id)
- state = contract.state
- validated = state != "unvalidated"
-
- self.get_logs(cr, uid, ids, cron_mode=False, context=context)
-
- contract = self.browse(cr, uid, contract_id)
- validated2 = contract.state != "unvalidated"
- if not validated and not validated2:
- raise osv.except_osv(_("Contract validation error"),
- _("Please verify your publisher warranty serial number and validity."))
- return True
-
- def get_logs(self, cr, uid, ids, cron_mode=True, context=None):
- """
- Send a message to OpenERP's publisher warranty server to check the validity of
- the contracts, get notifications, etc...
-
- @param cron_mode: If true, catch all exceptions (appropriate for usage in a cron).
- @type cron_mode: boolean
- """
- try:
- try:
- result = get_sys_logs(cr, uid)
- except Exception:
- if cron_mode: # we don't want to see any stack trace in cron
- return False
- _logger.debug("Exception while sending a get logs messages", exc_info=1)
- raise osv.except_osv(_("Error"), _("Error during communication with the publisher warranty server."))
-
- contracts = result["contracts"]
- for contract in contracts:
- c_id = self.search(cr, uid, [("name","=",contract)])[0]
- # for backward compatibility
- if type(contracts[contract]) == tuple:
- self.write(cr, uid, c_id, {
- "date_start": contracts[contract][0],
- "date_stop": contracts[contract][1],
- "state": contracts[contract][2],
- "check_support": False,
- "check_opw": False,
- "kind": "",
- })
- else:
- self.write(cr, uid, c_id, {
- "date_start": contracts[contract]["date_from"],
- "date_stop": contracts[contract]["date_to"],
- "state": contracts[contract]["state"],
- "check_support": contracts[contract]["check_support"],
- "check_opw": contracts[contract]["check_opw"],
- "kind": contracts[contract]["kind"],
- })
-
-
- limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
-
- # old behavior based on res.log; now on mail.message, that is not necessarily installed
- mail_message_obj = self.pool.get('mail.message')
- if mail_message_obj:
- for message in result["messages"]:
- ids = mail_message_obj.search(cr, uid, [("model", "=", "publisher_warranty.contract"),
- ("create_date", ">=", limit_date),
- ("body_text", "=", message)])
- if ids:
- continue
- mail_message_obj.create(cr, uid, {
- 'name': message,
- 'model': "publisher_warranty.contract",
- 'user_id': False,
- }, context=context)
- except Exception:
- if cron_mode:
- return False # we don't want to see any stack trace in cron
- else:
- raise
- return True
-
- def get_last_user_messages(self, cr, uid, limit, context=None):
- """
- Get the messages to be written in the web client.
- @return: A list of html messages with ids, can be False or empty.
- @rtype: list of tuples(int,string)
- """
- if not self.pool.get('mail.message'):
- return []
- ids = self.pool.get('mail.message').search(cr, uid, [("model", "=", "publisher_warranty.contract")]
- , order="create_date desc", limit=limit, context=context)
- if not ids:
- return []
- messages = [(x.id, x.name) for x in self.pool.get('mail.message').browse(cr, uid, ids, context=context)]
- return messages
-
- _columns = {
- 'name' : fields.char('Serial Key', size=384, required=True, help="Your OpenERP Publisher's Warranty Contract unique key, also called serial number."),
- 'date_start' : fields.date('Starting Date', readonly=True),
- 'date_stop' : fields.date('Ending Date', readonly=True),
- 'state' : fields.selection([('unvalidated', 'Unvalidated'), ('valid', 'Valid')
- , ('terminated', 'Terminated'), ('canceled', 'Canceled')], string="State", readonly=True),
- 'kind' : fields.char('Contract Category', size=64, readonly=True),
- "check_support": fields.boolean("Support Level 1", readonly=True),
- "check_opw": fields.boolean("OPW", readonly=True, help="Checked if this is an OpenERP Publisher's Warranty contract (versus older contract types"),
- }
-
- _defaults = {
- 'state': 'unvalidated',
- }
-
- _sql_constraints = [
- ('uniq_name', 'unique(name)', "That contract is already registered in the system.")
- ]
-
-publisher_warranty_contract()
-
-class maintenance_contract(osv.osv_memory):
- """ Old osv we only keep for compatibility with the clients. """
-
- _name = "maintenance.contract"
-
- def status(self, cr, uid):
- return self.pool.get("publisher_warranty.contract").status(cr, uid)
-
- def send(self, cr, uid, tb, explanations, remarks=None, issue_name=None):
- return self.pool.get("publisher_warranty.contract").send(cr, uid, tb,
- explanations, remarks, issue_name)
-
-maintenance_contract()
-
-class publisher_warranty_contract_wizard(osv.osv_memory):
- """
- A wizard osv to help people entering a publisher warranty contract.
- """
- _name = 'publisher_warranty.contract.wizard'
- _inherit = "ir.wizard.screen"
-
- _columns = {
- 'name' : fields.char('Serial Key', size=256, required=True, help="Your OpenERP Publisher's Warranty Contract unique key, also called serial number."),
- 'state' : fields.selection([("draft", "Draft"), ("finished", "Finished")])
- }
-
- _defaults = {
- "state": "draft",
- }
-
- def action_validate(self, cr, uid, ids, context=None):
- if not ids:
- return False
-
- wiz = self.browse(cr, uid, ids[0])
- c_name = wiz.name
-
- contract_osv = self.pool.get("publisher_warranty.contract")
- contracts = contract_osv.search(cr, uid, [("name","=",c_name)])
- if contracts:
- raise osv.except_osv(_("Error"), _("That contract is already registered in the system."))
-
- contract_id = contract_osv.create(cr, uid, {
- "name": c_name,
- "state": "unvalidated",
- })
-
- contract_osv.check_validity(cr, uid, [contract_id])
-
- self.write(cr, uid, ids, {"state": "finished"})
-
- # We should return an action ?
- return True
-
-
-publisher_warranty_contract_wizard()
-
-def get_sys_logs(cr, uid):
- """
- Utility method to send a publisher warranty get logs messages.
- """
- pool = pooler.get_pool(cr.dbname)
-
- dbuuid = pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
- db_create_date = pool.get('ir.config_parameter').get_param(cr, uid, 'database.create_date')
- limit_date = datetime.datetime.now()
- limit_date = limit_date - datetime.timedelta(15)
- limit_date_str = limit_date.strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
- nbr_users = pool.get("res.users").search(cr, uid, [], count=True)
- nbr_active_users = pool.get("res.users").search(cr, uid, [("date", ">=", limit_date_str)], count=True)
- nbr_share_users = False
- nbr_active_share_users = False
- if "share" in pool.get("res.users")._all_columns:
- nbr_share_users = pool.get("res.users").search(cr, uid, [("share", "=", True)], count=True)
- nbr_active_share_users = pool.get("res.users").search(cr, uid, [("share", "=", True), ("date", ">=", limit_date_str)], count=True)
- contractosv = pool.get('publisher_warranty.contract')
- contracts = contractosv.browse(cr, uid, contractosv.search(cr, uid, []))
- user = pool.get("res.users").browse(cr, uid, uid)
- msg = {
- "dbuuid": dbuuid,
- "nbr_users": nbr_users,
- "nbr_active_users": nbr_active_users,
- "nbr_share_users": nbr_share_users,
- "nbr_active_share_users": nbr_active_share_users,
- "dbname": cr.dbname,
- "db_create_date": db_create_date,
- "version": release.version,
- "contracts": [c.name for c in contracts],
- "language": user.lang,
- }
-
- add_arg = {"timeout":30} if sys.version_info >= (2,6) else {}
- arguments = {'arg0': msg, "action": "update",}
- arguments_raw = urllib.urlencode(arguments)
- url = config.get("publisher_warranty_url")
- uo = urllib2.urlopen(url, arguments_raw, **add_arg)
- try:
- submit_result = uo.read()
- finally:
- uo.close()
-
- result = safe_eval(submit_result) if submit_result else {}
-
- return result
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty_data.xml b/openerp/addons/base/publisher_warranty/publisher_warranty_data.xml
deleted file mode 100644
index 68594e5d88f..00000000000
--- a/openerp/addons/base/publisher_warranty/publisher_warranty_data.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
- Update System Logs
-
-
- 1
- weeks
- -1
-
-
-
-
- 1000
-
-
-
-
\ No newline at end of file
diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty_view.xml b/openerp/addons/base/publisher_warranty/publisher_warranty_view.xml
deleted file mode 100644
index f4c196db672..00000000000
--- a/openerp/addons/base/publisher_warranty/publisher_warranty_view.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
-
-
-
- publisher_warranty.contract.tree
- publisher_warranty.contract
-
-
-
-
-
-
-
-
-
-
-
- publisher_warranty.contract.form
- publisher_warranty.contract
-
-
-
-
-
-
- publisher_warranty.contract.search
- publisher_warranty.contract
-
-
-
-
-
-
-
-
-
-
- publisher_warranty.contract.calendar
- publisher_warranty.contract
-
-
-
-
-
-
-
-
-
- Contracts
- ir.actions.act_window
- publisher_warranty.contract
- form
- tree,form,calendar
-
-
-
-
-
-
- publisher_warranty.contract.add.wizard
- publisher_warranty.contract.wizard
-
-
-
-
-
-
- Register a Contract
- ir.actions.act_window
- publisher_warranty.contract.wizard
- form
- form
- new
-
-
-
-
-
diff --git a/openerp/addons/base/report/corporate_defaults.xml b/openerp/addons/base/report/corporate_defaults.xml
index 12e8bb5eeea..751693e7e89 100644
--- a/openerp/addons/base/report/corporate_defaults.xml
+++ b/openerp/addons/base/report/corporate_defaults.xml
@@ -2,8 +2,7 @@
-
-
+
diff --git a/openerp/addons/base/report/corporate_defaults.xsl b/openerp/addons/base/report/corporate_defaults.xsl
index e0f6918ec59..9e976381e48 100644
--- a/openerp/addons/base/report/corporate_defaults.xsl
+++ b/openerp/addons/base/report/corporate_defaults.xsl
@@ -39,8 +39,7 @@
1.5cm 2.2cm 19.9cm 2.2cm
-
-
+
Your contact :
@@ -73,8 +72,7 @@
1.5cm 1.2cm 19.9cm 1.2cm
-
-
+
diff --git a/openerp/addons/base/report/corporate_sxw_header.xml b/openerp/addons/base/report/corporate_sxw_header.xml
index d752ffa91a5..6cd8e5a218f 100644
--- a/openerp/addons/base/report/corporate_sxw_header.xml
+++ b/openerp/addons/base/report/corporate_sxw_header.xml
@@ -233,8 +233,7 @@
- [[ company.rml_footer1 ]]
- [[ company.rml_footer2 ]]
+ [[ company.rml_footer ]]
Contact : [[ user.name ]]
diff --git a/openerp/addons/base/report/mako_footer.html b/openerp/addons/base/report/mako_footer.html
index 7c2d5b67a08..9f8990998a7 100644
--- a/openerp/addons/base/report/mako_footer.html
+++ b/openerp/addons/base/report/mako_footer.html
@@ -7,15 +7,8 @@
|
- % if company['rml_footer1']:
- ${company.rml_footer1}
- %endif
- |
-
-
- |
- % if company['rml_footer2']:
- ${company.rml_footer2}
+ % if company['rml_footer']:
+ ${company.rml_footer}
%endif
|
diff --git a/openerp/addons/base/res/res_bank.py b/openerp/addons/base/res/res_bank.py
index c5c05c1807c..3d6fce8113a 100644
--- a/openerp/addons/base/res/res_bank.py
+++ b/openerp/addons/base/res/res_bank.py
@@ -109,7 +109,7 @@ class res_partner_bank(osv.osv):
if not context.get('address'):
return value
- for address in self.pool.get('res.partner').resolve_o2m_commands_to_record_dicts(
+ for address in self.pool.get('res.partner').resolve_2many_commands(
cursor, user, 'address', context['address'], ['type', field], context=context):
if address.get('type') == 'default':
@@ -172,38 +172,35 @@ class res_partner_bank(osv.osv):
('required', field.required)]
return res
- def _prepare_name_get(self, cr, uid, bank_type_obj, bank_obj, context=None):
+ def _prepare_name_get(self, cr, uid, bank_dicts, context=None):
+ """ Format the name of a res.partner.bank.
+ This function is designed to be inherited to add replacement fields.
+ :param bank_dicts: a list of res.partner.bank dicts, as returned by the method read()
+ :return: [(id, name), ...], as returned by the method name_get()
"""
- Format the name of a res.partner.bank.
- This function is designed to be inherited to add replacement fields.
- :param browse_record bank_type_obj: res.partner.bank.type object
- :param browse_record bank_obj: res.partner.bank object
- :rtype: str
- :return: formatted name of a res.partner.bank record
- """
- return bank_type_obj.format_layout % bank_obj._data[bank_obj.id]
+ # prepare a mapping {code: format_layout} for all bank types
+ bank_type_obj = self.pool.get('res.partner.bank.type')
+ bank_types = bank_type_obj.browse(cr, uid, bank_type_obj.search(cr, uid, []), context=context)
+ bank_code_format = dict((bt.code, bt.format_layout) for bt in bank_types)
+
+ res = []
+ for data in bank_dicts:
+ name = data['acc_number']
+ if data['state'] and bank_code_format.get(data['state']):
+ try:
+ if not data.get('bank_name'):
+ data['bank_name'] = _('BANK')
+ name = bank_code_format[data['state']] % data
+ except Exception:
+ raise osv.except_osv(_("Formating Error"), _("Invalid Bank Account Type Name format."))
+ res.append((data.get('id', False), name))
+ return res
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
- bank_type_obj = self.pool.get('res.partner.bank.type')
- res = []
- for val in self.browse(cr, uid, ids, context=context):
- result = val.acc_number
- if val.state:
- type_ids = bank_type_obj.search(cr, uid, [('code','=',val.state)])
- if type_ids:
- t = bank_type_obj.browse(cr, uid, type_ids[0], context=context)
- try:
- # avoid the default format_layout to result in "False: ..."
- if not val._data[val.id]['bank_name']:
- val._data[val.id]['bank_name'] = _('BANK')
- result = self._prepare_name_get(cr, uid, t, val, context=context)
- except:
- result += ' [Formatting Error]'
- raise
- res.append((val.id, result))
- return res
+ bank_dicts = self.read(cr, uid, ids, context=context)
+ return self._prepare_name_get(cr, uid, bank_dicts, context=context)
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
result = {}
diff --git a/openerp/addons/base/res/res_bank_view.xml b/openerp/addons/base/res/res_bank_view.xml
index 0c88ceeff7c..33b98c690c6 100644
--- a/openerp/addons/base/res/res_bank_view.xml
+++ b/openerp/addons/base/res/res_bank_view.xml
@@ -90,9 +90,10 @@