From 92300c9c63da6c7ceb0ea966506830bfcbfb84c3 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Sat, 1 Oct 2011 11:34:37 +0200 Subject: [PATCH] [IMP] Remove account sequence code madness bzr revid: al@openerp.com-20111001093437-hplwdkq57wcspcv9 --- addons/account/__openerp__.py | 3 +- addons/account/account.py | 26 ++----- .../{account_data2.xml => account_data.xml} | 67 +++++++++-------- addons/account/data/account_invoice.xml | 75 ------------------- .../account/test/account_fiscalyear_close.yml | 1 - 5 files changed, 46 insertions(+), 126 deletions(-) rename addons/account/data/{account_data2.xml => account_data.xml} (94%) delete mode 100644 addons/account/data/account_invoice.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 0a75b52213f..19662ea2f33 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -103,8 +103,7 @@ module named account_voucher. 'account_end_fy.xml', 'account_invoice_view.xml', 'partner_view.xml', - 'data/account_invoice.xml', - 'data/account_data2.xml', + 'data/account_data.xml', 'account_invoice_workflow.xml', 'project/project_view.xml', 'project/project_report.xml', diff --git a/addons/account/account.py b/addons/account/account.py index 538f9ed3b4e..4273c4c0288 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -672,32 +672,22 @@ class account_journal(osv.osv): return super(account_journal, self).write(cr, uid, ids, vals, context=context) def create_sequence(self, cr, uid, vals, context=None): + """ Create new no_gap entry sequence for every new Joural """ - Create new entry sequence for every new Joural - """ - seq_pool = self.pool.get('ir.sequence') - seq_typ_pool = self.pool.get('ir.sequence.type') - - name = vals['name'] - code = vals['code'].lower() - - types = { - 'name': name, - 'code': code - } - seq_typ_pool.create(cr, uid, types) + # in account.journal code is actually the prefix of the sequence + # whereas ir.sequence code is a key to lookup global sequences. + prefix = vals['code'].upper() seq = { - 'name': name, - 'code': code, - 'active': True, - 'prefix': code + "/%(year)s/", + 'name': vals['name'], + 'implementation':'no_gap', + 'prefix': prefix + "/%(year)s/", 'padding': 4, 'number_increment': 1 } if 'company_id' in vals: seq['company_id'] = vals['company_id'] - return seq_pool.create(cr, uid, seq) + return self.pool.get('ir.sequence').create(cr, uid, seq) def create(self, cr, uid, vals, context=None): if not 'sequence_id' in vals or not vals['sequence_id']: diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data.xml similarity index 94% rename from addons/account/data/account_data2.xml rename to addons/account/data/account_data.xml index 48630c9899d..0de4966b69c 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data.xml @@ -469,66 +469,48 @@ Account Journal Sequences --> - - Account Journal - account.journal - - - Account Journal - account.journal - - - Sale Journal - account.journal + Account Default Sale Journal SAJ/%(year)s/ - Sales Credit Note Journal - account.journal + Account Default Sales Credit Note Journal SCNJ/%(year)s/ - Purchase Journal - account.journal + Account Default Purchase Journal EXJ/%(year)s/ - Expenses Credit Notes Journal - account.journal + Account Default Expenses Credit Notes Journal ECNJ/%(year)s/ - Bank Journal - account.journal + Account Default Bank Journal BNK/%(year)s/ - Checks Journal - account.journal + Account Default Checks Journal CHK/%(year)s/ - Cash Journal - account.journal + Account Default Cash Journal CSH/%(year)s/ - Opening Entries Journal - account.journal + Account Default Opening Entries Journal OPEJ/%(year)s/ - Miscellaneous Journal - account.journal + Account Default Miscellaneous Journal MISJ/%(year)s/ @@ -538,7 +520,7 @@ --> - Account reconcile sequence + Account Reconcile account.reconcile @@ -550,7 +532,7 @@ - Bank Statement + Account Bank Statement account.bank.statement @@ -562,7 +544,7 @@ - Cash Statement + Account Cash Statement account.cash.statement @@ -572,5 +554,30 @@ + + + + Analytic account + account.analytic.account + + + Analytic account sequence + account.analytic.account + + + + + + + Invoice + account.invoice + + + + diff --git a/addons/account/data/account_invoice.xml b/addons/account/data/account_invoice.xml deleted file mode 100644 index 54f5ed6de91..00000000000 --- a/addons/account/data/account_invoice.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Invoice - account.invoice - - - - - Account Invoice Out - account.invoice.out_invoice - - - Account Invoice In - account.invoice.in_invoice - - - Account Refund Out - account.invoice.out_refund - - - Account Refund In - account.invoice.in_refund - - - - - Account Invoice Out - account.invoice.out_invoice - - %(year)s/ - - - Account Invoice In - account.invoice.in_invoice - - %(year)s/ - - - Account Refund Out - account.invoice.out_refund - - %(year)s/ - - - Account Refund In - account.invoice.in_refund - - %(year)s/ - - - - - Analytic account - account.analytic.account - - - - - Analytic account sequence - account.analytic.account - - - - - diff --git a/addons/account/test/account_fiscalyear_close.yml b/addons/account/test/account_fiscalyear_close.yml index 109b098d6a7..1e24d2ca0e7 100644 --- a/addons/account/test/account_fiscalyear_close.yml +++ b/addons/account/test/account_fiscalyear_close.yml @@ -26,7 +26,6 @@ code: NEW type: situation analytic_journal_id: sit - sequence_id: sequence_journal default_debit_account_id: cash default_credit_account_id: cash company_id: base.main_company