diff --git a/addons/account/account.py b/addons/account/account.py index 57356f7d3ef..e5e29f178a3 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2516,22 +2516,25 @@ class account_account_template(osv.osv): 'nocreate': False, } - def _check_type(self, cr, uid, ids, context=None): - if context is None: - context = {} - accounts = self.browse(cr, uid, ids, context=context) - for account in accounts: - if account.parent_id and account.parent_id.type != 'view': - return False - return True - _check_recursion = check_cycle _constraints = [ (_check_recursion, 'Error!\nYou cannot create recursive account templates.', ['parent_id']), - (_check_type, 'Configuration Error!\nYou cannot define children to an account that has internal type other than "View".', ['type']), - ] + def create(self, cr, uid, vals, context=None): + if 'parent_id' in vals: + parent = self.read(cr, uid, [vals['parent_id']], ['type']) + if parent and parent[0]['type'] != 'view': + raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'.")) + return super(account_account_template, self).create(cr, uid, vals, context=context) + + def write(self, cr, uid, ids, vals, context=None): + if 'parent_id' in vals: + parent = self.read(cr, uid, [vals['parent_id']], ['type']) + if parent and parent[0]['type'] != 'view': + raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'.")) + return super(account_account_template, self).write(cr, uid, ids, vals, context=context) + def name_get(self, cr, uid, ids, context=None): if not ids: return [] diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 42d42e7ec1b..19af105c950 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -767,17 +767,20 @@ class account_invoice(osv.osv): if not key in tax_key: raise osv.except_osv(_('Warning!'), _('Taxes are missing!\nClick on compute button.')) - def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines): + def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines, context=None): + if context is None: + context={} total = 0 total_currency = 0 cur_obj = self.pool.get('res.currency') for i in invoice_move_lines: if inv.currency_id.id != company_currency: + context.update({'date': inv.date_invoice or time.strftime('%Y-%m-%d')}) i['currency_id'] = inv.currency_id.id i['amount_currency'] = i['price'] i['price'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, i['price'], - context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}) + context=context) else: i['amount_currency'] = False i['currency_id'] = False @@ -887,7 +890,7 @@ class account_invoice(osv.osv): # create one move line for the total and possibly adjust the other lines amount total = 0 total_currency = 0 - total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml) + total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml, context=ctx) acc_id = inv.account_id.id name = inv['name'] or '/' diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 5a3fd6b748a..8c0de73ef8c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2369,22 +2369,15 @@ -
-
-
diff --git a/addons/account/data/configurable_account_chart.xml b/addons/account/data/configurable_account_chart.xml index 18e22a5e4f2..b8b23344ff3 100644 --- a/addons/account/data/configurable_account_chart.xml +++ b/addons/account/data/configurable_account_chart.xml @@ -45,7 +45,6 @@ 0 Configurable Account Chart - view diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 94b3d2d4085..53f2b54e0ef 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -19,7 +19,6 @@ X0 Chart For Automated Tests - view diff --git a/addons/account/res_config.py b/addons/account/res_config.py index bb5dcedd0ee..91f1068d166 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -44,7 +44,7 @@ class account_config_settings(osv.osv_memory): 'paypal_account': fields.related('company_id', 'paypal_account', type='char', size=128, string='Paypal account', help="Paypal account (email) for receiving online payments (credit card, etc.) If you set a paypal account, the customer will be able to pay your invoices or quotations with a button \"Pay with Paypal\" in automated emails or through the OpenERP portal."), 'company_footer': fields.related('company_id', 'rml_footer', type='text', readonly=True, - string='Bank accounts on reports will displayed as followed', help="Bank accounts as printed in the footer of each customer's document. This is for information purpose only, you should configure these bank accounts through the above button \"Configure Bank Accounts\"."), + string='Bank accounts footer preview', help="Bank accounts as printed in the footer of each printed document"), 'has_chart_of_accounts': fields.boolean('Company has a chart of accounts'), 'chart_template_id': fields.many2one('account.chart.template', 'Template', domain="[('visible','=', True)]"), @@ -114,6 +114,9 @@ class account_config_settings(osv.osv_memory): help="This purchase tax will be assigned by default on new products."), 'decimal_precision': fields.integer('Decimal precision on journal entries', help="""As an example, a decimal precision of 2 will allow journal entries like: 9.99 EUR, whereas a decimal precision of 4 will allow journal entries like: 0.0231 EUR."""), + 'group_multi_currency': fields.boolean('allow multi currencies', + implied_group='base.group_multi_currency', + help="Allows you multi currency environment"), } def _default_company(self, cr, uid, context=None): diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index 79a65f70414..bc8ace5c262 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -121,6 +121,10 @@