diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 0afe7f878e0..abd3d1f459d 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -46,14 +46,18 @@ module named account_voucherss 'security/account_security.xml', 'security/ir.model.access.csv', 'account_menuitem.xml', + 'account_wizard.xml', + 'wizard/account_statement_from_invoice_view.xml', + 'wizard/account_move_bank_reconcile_view.xml', + 'wizard/account_use_model_view.xml', + 'account_view.xml', + 'account_report.xml', 'wizard/account_invoice_refund_view.xml', 'wizard/account_period_close_view.xml', 'wizard/account_fiscalyear_close_state.xml', 'wizard/account_chart_view.xml', - 'wizard/account_move_bank_reconcile_view.xml', - 'wizard/account_move_line_reconcile_select_view.xml', 'wizard/account_move_journal_view.xml', - 'account_wizard.xml', + 'wizard/account_move_line_reconcile_select_view.xml', 'wizard/account_open_closed_fiscalyear_view.xml', 'wizard/account_move_line_unreconcile_select_view.xml', 'wizard/account_vat_view.xml', @@ -66,15 +70,19 @@ module named account_voucherss 'wizard/account_journal_select_view.xml', 'wizard/account_change_currency_view.xml', 'wizard/account_validate_move_view.xml', - 'wizard/account_statement_from_invoice_view.xml', 'wizard/account_pay_invoice_view.xml', 'wizard/account_unreconcile_view.xml', + 'wizard/account_general_ledger_report_view.xml', 'wizard/account_invoice_state_view.xml', + 'wizard/account_partner_balance_report_view.xml', + 'wizard/account_balance_report_view.xml', + 'wizard/account_move_line_select_view.xml', + 'wizard/account_aged_trial_balance_view.xml', + 'wizard/account_compare_account_balance_report_view.xml', + 'wizard/account_third_party_ledger.xml', 'project/wizard/project_account_analytic_line_view.xml', - 'account_view.xml', 'account_end_fy.xml', 'account_invoice_view.xml', - 'account_report.xml', 'partner_view.xml', 'data/account_invoice.xml', 'data/account_data2.xml', @@ -91,17 +99,16 @@ module named account_voucherss 'account_installer.xml', 'report/account_invoice_report_view.xml', 'report/account_report_view.xml', + 'report/account_analytic_report_view.xml', ], 'demo_xml': [ + #'demo/price_accuracy00.yml', 'account_demo.xml', 'project/project_demo.xml', 'project/analytic_account_demo.xml', 'demo/account_minimal.xml', 'account_unit_test.xml', ], - 'test': [ - 'test/price_accuracy00.yml', - ], 'installable': True, 'active': False, 'certificate': '0080331923549', diff --git a/addons/account/account.py b/addons/account/account.py index 12868487c49..74531102073 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -291,7 +291,7 @@ class account_account(osv.osv): "special effects in Open ERP: view can not have entries, consolidation are accounts that "\ "can have children accounts for multi-company consolidations, payable/receivable are for "\ "partners accounts (for debit/credit computations), closed for depreciated accounts."), - 'user_type': fields.many2one('account.account.type', 'Account Type', required=True, + 'user_type': fields.many2one('account.account.type', 'Account Type', required=True, help="These types are defined according to your country. The type contains more information "\ "about the account and its specificities."), 'parent_id': fields.many2one('account.account', 'Parent', ondelete='cascade'), @@ -437,18 +437,18 @@ class account_account(osv.osv): elif method == 'unlink': raise osv.except_osv(_('Error !'), _('You cannot remove an account which has account entries!. ')) return True - + def write(self, cr, uid, ids, vals, context=None): if not context: context = {} if 'active' in vals and not vals['active']: self._check_moves(cr, uid, ids, "write", context) return super(account_account, self).write(cr, uid, ids, vals, context=context) - + def unlink(self, cr, uid, ids, context={}): self._check_moves(cr, uid, ids, "unlink", context) return super(account_account, self).unlink(cr, uid, ids, context) - + account_account() class account_journal_view(osv.osv): @@ -791,7 +791,7 @@ class account_move(osv.osv): for id in ids: result.setdefault(id, 0.0) return result - + def _search_amount(self, cr, uid, obj, name, args, context): ids = [] cr.execute('select move_id,sum(debit) from account_move_line group by move_id') @@ -801,10 +801,10 @@ class account_move(osv.osv): if item[1] == '>=': res = [('id', 'in', [k for k,v in result.iteritems() if v >= item[2]])] else: - res = [('id', 'in', [k for k,v in result.iteritems() if v <= item[2]])] + res = [('id', 'in', [k for k,v in result.iteritems() if v <= item[2]])] ids += res - if not ids: + if not ids: return [('id', '>', '0')] return ids @@ -1056,7 +1056,13 @@ class account_move(osv.osv): if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id): raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name))) - if abs(amount) < 0.0001: + # Check that the move balances, the tolerance for debit/credit must + # be smaller than the smallest value according to price accuracy + # (hence the +1 below) + # Example: + # difference == 0.01 is OK iff price_accuracy <= 1! + # difference == 0.0001 is OK iff price_accuracy <= 3! + if abs(amount) < 10 ** -(int(config['price_accuracy'])+1): if not len(line_draft_ids): continue self.pool.get('account.move.line').write(cr, uid, line_draft_ids, { @@ -1126,7 +1132,7 @@ class account_move_reconcile(osv.osv): 'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/', } def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}): - total = 0.0 + total = 0.0 for rec in self.browse(cr, uid, ids, context): for line in rec.line_partial_ids: total += (line.debit or 0.0) - (line.credit or 0.0) @@ -1880,7 +1886,7 @@ account_account_template() class account_add_tmpl_wizard(osv.osv_memory): """Add one more account from the template. - + With the 'nocreate' option, some accounts may not be created. Use this to add them later.""" _name = 'account.addtmpl.wizard' @@ -1906,7 +1912,7 @@ class account_add_tmpl_wizard(osv.osv_memory): _defaults = { 'cparent_id': _get_def_cparent, } - + def action_create(self,cr,uid,ids,context=None): acc_obj=self.pool.get('account.account') tmpl_obj=self.pool.get('account.account.template') @@ -1933,7 +1939,7 @@ class account_add_tmpl_wizard(osv.osv_memory): # print "Creating:", vals new_account = acc_obj.create(cr,uid,vals) return {'type':'state', 'state': 'end' } - + def action_cancel(self,cr,uid,ids,context=None): return { 'type': 'state', 'state': 'end' } diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index c0bd50eb7bc..9ace27294fa 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1176,7 +1176,7 @@ -