diff --git a/__init__.py b/__init__.py index 7d218891bb..ec6972d412 100644 --- a/__init__.py +++ b/__init__.py @@ -4,6 +4,7 @@ from trytond.pool import Pool from .journal import * from .statement import * +from .account import * def register(): @@ -11,4 +12,5 @@ def register(): Journal, Statement, Line, + Move, module='account_statement', type_='model') diff --git a/account.py b/account.py new file mode 100644 index 0000000000..af74f270ee --- /dev/null +++ b/account.py @@ -0,0 +1,14 @@ +#This file is part of Tryton. The COPYRIGHT file at the top level of +#this repository contains the full copyright notices and license terms. +from trytond.pool import PoolMeta + +__all__ = ['Move'] +__metaclass__ = PoolMeta + + +class Move: + __name__ = 'account.move' + + @classmethod + def _get_origin(cls): + return super(Move, cls)._get_origin() + ['account.statement.line'] diff --git a/statement.py b/statement.py index 4310f0189a..f2610bc545 100644 --- a/statement.py +++ b/statement.py @@ -173,6 +173,7 @@ class Statement(Workflow, ModelSQL, ModelView): res[statement.id] = (statement.journal.name + ' ' + Lang.currency(lang, statement.start_balance, statement.journal.currency, symbol=False, grouping=True) + + ' - ' + Lang.currency(lang, statement.end_balance, statement.journal.currency, symbol=False, grouping=True)) return res @@ -444,6 +445,9 @@ class Line(ModelSQL, ModelView): res['invoice'] = None return res + def get_rec_name(self, name): + return self.statement.rec_name + @classmethod def copy(cls, lines, default=None): if default is None: @@ -472,10 +476,10 @@ class Line(ModelSQL, ModelView): move_lines = self._get_move_lines() move = Move( - name=unicode(self.date), period=period_id, journal=self.statement.journal.journal, date=self.date, + origin=self, lines=move_lines, ) move.save() @@ -547,7 +551,7 @@ class Line(ModelSQL, ModelView): move_lines = [] move_lines.append(MoveLine( - name=unicode(self.date), + description=self.description, debit=amount < zero and -amount or zero, credit=amount >= zero and amount or zero, account=self.account, @@ -566,7 +570,7 @@ class Line(ModelSQL, ModelView): if self.account == account: self.raise_user_error('same_debit_credit_account') move_lines.append(MoveLine( - name=unicode(self.date), + description=self.description, debit=amount >= zero and amount or zero, credit=amount < zero and -amount or zero, account=account, diff --git a/statement.xml b/statement.xml index a7b78b4e30..7eef24a984 100644 --- a/statement.xml +++ b/statement.xml @@ -166,6 +166,8 @@ this repository contains the full copyright notices and license terms. --> +