+ on_change="onchange_journal_id(journal_id, context)" options="{'no_create': True}"/>
diff --git a/addons/account_check_writing/account_voucher.py b/addons/account_check_writing/account_voucher.py
index e4933708f7a..c3abe28eef0 100644
--- a/addons/account_check_writing/account_voucher.py
+++ b/addons/account_check_writing/account_voucher.py
@@ -41,6 +41,23 @@ class account_voucher(osv.osv):
'number': fields.char('Number', size=32),
}
+ def _amount_to_text(self, cr, uid, amount, currency_id, context=None):
+ # Currency complete name is not available in res.currency model
+ # Exceptions done here (EUR, USD, BRL) cover 75% of cases
+ # For other currencies, display the currency code
+ currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)
+ if currency.name.upper() == 'EUR':
+ currency_name = 'Euro'
+ elif currency.name.upper() == 'USD':
+ currency_name = 'Dollars'
+ elif currency.name.upper() == 'BRL':
+ currency_name = 'reais'
+ else:
+ currency_name = currency.name
+ #TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
+ #amount_in_word = amount_to_text(amount, context=context)
+ return amount_to_text(amount, currency=currency_name)
+
def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id, context=None):
""" Inherited - add amount_in_word and allow_check_writting in returned value dictionary """
if not context:
@@ -48,22 +65,7 @@ class account_voucher(osv.osv):
default = super(account_voucher, self).onchange_amount(cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id, context=context)
if 'value' in default:
amount = 'amount' in default['value'] and default['value']['amount'] or amount
-
- # Currency complete name is not available in res.currency model
- # Exceptions done here (EUR, USD, BRL) cover 75% of cases
- # For other currencies, display the currency code
- currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)
- if currency.name.upper() == 'EUR':
- currency_name = 'Euro'
- elif currency.name.upper() == 'USD':
- currency_name = 'Dollars'
- elif currency.name.upper() == 'BRL':
- currency_name = 'reais'
- else:
- currency_name = currency.name
- #TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
- #amount_in_word = amount_to_text(amount, context=context)
- amount_in_word = amount_to_text(amount, currency=currency_name)
+ amount_in_word = self._amount_to_text(cr, uid, amount, currency_id, context=context)
default['value'].update({'amount_in_word':amount_in_word})
if journal_id:
allow_check_writing = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context).allow_check_writing
@@ -92,6 +94,19 @@ class account_voucher(osv.osv):
},
'nodestroy': True
}
+ def create(self, cr, uid, vals, context=None):
+ if vals.get('amount') and vals.get('journal_id') and 'amount_in_word' not in vals:
+ vals['amount_in_word'] = self._amount_to_text(cr, uid, vals['amount'], vals.get('currency_id') or \
+ self.pool['account.journal'].browse(cr, uid, vals['journal_id'], context=context).currency.id or \
+ self.pool['res.company'].browse(cr, uid, vals['company_id']).currency_id.id, context=context)
+ return super(account_voucher, self).create(cr, uid, vals, context=context)
+
+ def write(self, cr, uid, ids, vals, context=None):
+ if vals.get('amount') and vals.get('journal_id') and 'amount_in_word' not in vals:
+ vals['amount_in_word'] = self._amount_to_text(cr, uid, vals['amount'], vals.get('currency_id') or \
+ self.pool['account.journal'].browse(cr, uid, vals['journal_id'], context=context).currency.id or \
+ self.pool['res.company'].browse(cr, uid, vals['company_id']).currency_id.id, context=context)
+ return super(account_voucher, self).write(cr, uid, ids, vals, context=context)
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
"""
diff --git a/addons/account_followup/report/account_followup_print.rml b/addons/account_followup/report/account_followup_print.rml
index a363126635c..6eadaed8675 100644
--- a/addons/account_followup/report/account_followup_print.rml
+++ b/addons/account_followup/report/account_followup_print.rml
@@ -149,7 +149,7 @@
- [[ format(get_text(o,data['form']['followup_id'])) ]]
+ [[ format(get_text(o,data['form']['followup_id'])) ]]
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
index ca4a15bca6e..71008e0855b 100644
--- a/addons/audittrail/audittrail.py
+++ b/addons/audittrail/audittrail.py
@@ -463,14 +463,12 @@ def process_data(cr, uid, pool, res_ids, model, method, old_values=None, new_val
# if at least one modification has been found
for model_id, resource_id in lines:
line_model = pool.get('ir.model').browse(cr, SUPERUSER_ID, model_id).model
- name = pool.get(line_model).name_get(cr, uid, [resource_id])[0][1]
vals = {
'method': method,
'object_id': model_id,
'user_id': uid,
'res_id': resource_id,
- 'name': name,
}
if (model_id, resource_id) not in old_values and method not in ('copy', 'read'):
# the resource was not existing so we are forcing the method to 'create'
@@ -481,7 +479,11 @@ def process_data(cr, uid, pool, res_ids, model, method, old_values=None, new_val
# the resource is not existing anymore so we are forcing the method to 'unlink'
# (because it could also come with the value 'write' if we are deleting the
# record through a one2many field)
+ name = old_values[(model_id, resource_id)]['value'].get('name',False)
vals.update({'method': 'unlink'})
+ else :
+ name = pool[line_model].name_get(cr, uid, [resource_id])[0][1]
+ vals.update({'name': name})
# create the audittrail log in super admin mode, only if a change has been detected
if lines[(model_id, resource_id)]:
log_id = pool.get('audittrail.log').create(cr, SUPERUSER_ID, vals)
diff --git a/addons/auth_oauth/__init__.py b/addons/auth_oauth/__init__.py
index a56db75633b..08c1dd3d6b5 100644
--- a/addons/auth_oauth/__init__.py
+++ b/addons/auth_oauth/__init__.py
@@ -2,3 +2,4 @@ import controllers
import auth_oauth
import res_users
import res_config
+import ir_configparameter
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py
index b62fb31d8b0..22a240e310b 100644
--- a/addons/auth_oauth/controllers/main.py
+++ b/addons/auth_oauth/controllers/main.py
@@ -15,6 +15,7 @@ from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
+
#----------------------------------------------------------
# helpers
#----------------------------------------------------------
@@ -30,11 +31,15 @@ def fragment_to_query_string(func):
var s = l.search ? (l.search === '?' ? '' : '&') : '?';
r = l.pathname + l.search + s + q;
}
+ if (r == l.pathname) {
+ r = '/';
+ }
window.location = r;