diff --git a/CHANGELOG b/CHANGELOG index e19d8f002d..595789617e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Remove centralised counterpart option and functionality + Version 2.8.0 - 2013-04-22 * Bug fixes (see mercurial logs for details) * Make period's post_move_sequence optional and use fiscal year's one if empty diff --git a/__init__.py b/__init__.py index add3581bd2..21f9eefe94 100644 --- a/__init__.py +++ b/__init__.py @@ -43,7 +43,6 @@ def register(): Move, Reconciliation, Line, - Move2, OpenJournalAsk, ReconcileLinesWriteOff, UnreconcileLinesStart, diff --git a/doc/index.rst b/doc/index.rst index e19efc8dd7..6a1d161c94 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -96,14 +96,10 @@ A Journal contains the following fields: - Active: A checkbox that allow to disable the tax. - View: Defines how the moves lines on this journal should be displayed. -- Centralised counterpart: If checked all created lines are linked to - the last open movement for the current journal and the current - period. - Update Posted: if true it allow to upate posted moves of this journal. - Default Credit Account, Default Debit Account: Used as default - accounts on move lines for centralised journals and for journal of - *Cash* type. + accounts on move lines for journals of *Cash* type. - Type: By default take one of the following values: *General*, *Revenue*, *Expense*, *Cash*, *Situation*. diff --git a/journal.py b/journal.py index 21d5c63d67..3d834cdebf 100644 --- a/journal.py +++ b/journal.py @@ -93,7 +93,6 @@ class Journal(ModelSQL, ModelView): active = fields.Boolean('Active', select=True) type = fields.Selection('get_types', 'Type', required=True) view = fields.Many2One('account.journal.view', 'View') - centralised = fields.Boolean('Centralised counterpart') update_posted = fields.Boolean('Allow cancelling moves') sequence = fields.Property(fields.Many2One('ir.sequence', 'Sequence', domain=[('code', '=', 'account.journal')], @@ -107,22 +106,20 @@ class Journal(ModelSQL, ModelView): ('company', '=', Eval('context', {}).get('company', 0)), ], states={ - 'required': ((Eval('centralised', False) - | (Eval('type') == 'cash')) + 'required': ((Eval('type') == 'cash') & Bool(Eval('context', {}).get('company', 0))), 'invisible': ~Eval('context', {}).get('company', 0), - }, depends=['type', 'centralised'])) + }, depends=['type'])) debit_account = fields.Property(fields.Many2One('account.account', 'Default Debit Account', domain=[ ('kind', '!=', 'view'), ('company', '=', Eval('context', {}).get('company', 0)), ], states={ - 'required': ((Eval('centralised', False) - | (Eval('type') == 'cash')) + 'required': ((Eval('type') == 'cash') & Bool(Eval('context', {}).get('company', 0))), 'invisible': ~Eval('context', {}).get('company', 0), - }, depends=['type', 'centralised'])) + }, depends=['type'])) @classmethod def __setup__(cls): @@ -150,10 +147,6 @@ class Journal(ModelSQL, ModelView): def default_active(): return True - @staticmethod - def default_centralised(): - return False - @staticmethod def default_update_posted(): return False diff --git a/move.py b/move.py index 3e9c651126..23cde4d3a4 100644 --- a/move.py +++ b/move.py @@ -17,7 +17,7 @@ from trytond.pool import Pool, PoolMeta from trytond.rpc import RPC from trytond.tools import reduce_ids -__all__ = ['Move', 'Reconciliation', 'Line', 'Move2', 'OpenJournalAsk', +__all__ = ['Move', 'Reconciliation', 'Line', 'OpenJournalAsk', 'OpenJournal', 'OpenAccount', 'ReconcileLinesWriteOff', 'ReconcileLines', 'UnreconcileLinesStart', 'UnreconcileLines', 'OpenReconcileLinesStart', 'OpenReconcileLines', 'FiscalYearLine', 'FiscalYear2', @@ -79,10 +79,6 @@ class Move(ModelSQL, ModelView): '"%(move)s" to draft in journal "%(journal)s".'), 'modify_posted_move': ('You can not modify move "%s" because ' 'it is already posted.'), - 'period_centralized_journal': ('Move "%(move)s" cannot be ' - 'created because there is already a move in journal ' - '"%(journal)s" and you cannot create more than one move ' - 'per period in a centralized journal.'), 'company_in_move': ('You can not create lines on accounts' 'of different companies in move "%s".'), 'date_outside_period': ('You can not create move "%(move)s" ' @@ -172,23 +168,9 @@ class Move(ModelSQL, ModelView): def validate(cls, moves): super(Move, cls).validate(moves) for move in moves: - move.check_centralisation() move.check_company() move.check_date() - def check_centralisation(self): - if self.journal.centralised: - moves = self.search([ - ('period', '=', self.period.id), - ('journal', '=', self.journal.id), - ('state', '!=', 'posted'), - ], limit=2) - if len(moves) > 1: - self.raise_user_error('period_centralized_journal', { - 'move': self.rec_name, - 'journal': self.journal.rec_name, - }) - def check_company(self): company_id = -1 for line in self.lines: @@ -245,15 +227,6 @@ class Move(ModelSQL, ModelView): vals['number'] = Sequence.get_id(journal.sequence.id) moves = super(Move, cls).create(vlist) - for move in moves: - if move.journal.centralised: - line, = MoveLine.create([{ - 'account': move.journal.credit_account.id, - 'move': move.id, - }]) - cls.write([move], { - 'centralised_line': line.id, - }) cls.validate_move(moves) return moves @@ -289,7 +262,7 @@ class Move(ModelSQL, ModelView): @classmethod def validate_move(cls, moves): ''' - Validate balanced move and centralise it if in centralised journal + Validate balanced move ''' pool = Pool() MoveLine = pool.get('account.move.line') @@ -335,39 +308,7 @@ class Move(ModelSQL, ModelView): draft_lines = MoveLine.browse( list(move2draft_lines.get(move.id, []))) if not company.currency.is_zero(amount): - if not move.journal.centralised: - draft_moves.append(move.id) - else: - if not move.centralised_line: - centralised_amount = - amount - else: - centralised_amount = move.centralised_line.debit \ - - move.centralised_line.credit \ - - amount - if centralised_amount >= Decimal('0.0'): - debit = centralised_amount - credit = Decimal('0.0') - account_id = move.journal.debit_account.id - else: - debit = Decimal('0.0') - credit = - centralised_amount - account_id = move.journal.credit_account.id - if not move.centralised_line: - centralised_line, = MoveLine.create([{ - 'debit': debit, - 'credit': credit, - 'account': account_id, - 'move': move.id, - }]) - cls.write([move], { - 'centralised_line': centralised_line.id, - }) - else: - MoveLine.write([move.centralised_line], { - 'debit': debit, - 'credit': credit, - 'account': account_id, - }) + draft_moves.append(move.id) continue if not draft_lines: continue @@ -1296,15 +1237,6 @@ class Line(ModelSQL, ModelView): if not journal_id: cls.raise_user_error('no_journal') journal = Journal(journal_id) - if journal.centralised: - moves = Move.search([ - ('period', '=', vals.get('period') - or Transaction().context.get('period')), - ('journal', '=', journal_id), - ('state', '!=', 'posted'), - ], limit=1) - if moves: - vals['move'] = moves[0].id if not vals.get('move'): vals['move'] = Move.create([{ 'period': (vals.get('period') @@ -1445,12 +1377,6 @@ class Line(ModelSQL, ModelView): }])[0] -class Move2: - __name__ = 'account.move' - centralised_line = fields.Many2One('account.move.line', 'Centralised Line', - readonly=True) - - class OpenJournalAsk(ModelView): 'Open Journal Ask' __name__ = 'account.move.open_journal.ask' diff --git a/view/journal_form.xml b/view/journal_form.xml index 86a3404ffd..6834a60aec 100644 --- a/view/journal_form.xml +++ b/view/journal_form.xml @@ -21,8 +21,6 @@ this repository contains the full copyright notices and license terms. -->