From 7d84e3e1d258e655c6b55e9145d1f3513ff357ea Mon Sep 17 00:00:00 2001 From: Jordi Esteve Date: Mon, 9 Feb 2015 20:11:44 +0100 Subject: [PATCH] Allows insert a party in move lines despite the financial account has not the party requeried option checked --- __init__.py | 1 + doc/es/index.rst | 3 +++ doc/index.rst | 6 ++++++ move.py | 27 ++++++++++++++++++++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 2e7231f..9cd5dd4 100644 --- a/__init__.py +++ b/__init__.py @@ -9,5 +9,6 @@ from .move import * def register(): Pool.register( Account, + Line, Reconciliation, module='account_reconcile_different_party', type_='model') diff --git a/doc/es/index.rst b/doc/es/index.rst index 49728dd..90c642d 100644 --- a/doc/es/index.rst +++ b/doc/es/index.rst @@ -7,3 +7,6 @@ tengan un tercero distinto. Añade un campo en las cuentas contables que si se marca, permite conciliar los apuntes contables de esa cuenta aunque tengan un tercero distinto. + +También permite introducir un tercero en los apuntes aunque la cuenta contable +no tenga la casilla tercero requerido marcada. diff --git a/doc/index.rst b/doc/index.rst index 9443bda..e953716 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -3,3 +3,9 @@ Account Reconcile Different Party This module allows move lines of specific accounts to be reconciled despite having different party. + +Adds a field in the financial accounts that if checked allows reconcile move +lines with this account despite having a different party. + +Also allows insert a party in move lines despite the financial account has +not the party requeried option checked. diff --git a/move.py b/move.py index e7cc895..a420224 100644 --- a/move.py +++ b/move.py @@ -3,10 +3,35 @@ # the full copyright notices and license terms. from trytond.pool import PoolMeta -__all__ = ['Reconciliation'] +__all__ = ['Line', 'Reconciliation'] __metaclass__ = PoolMeta +class Line(): + __name__ = 'account.move.line' + + @classmethod + def __setup__(cls): + super(Line, cls).__setup__() + if cls.party.states.get('invisible'): + cls.party.states.pop('invisible') + + def on_change_account(self): + changes = super(Line, self).on_change_account() + # Not remove party if account is not party required + if changes.get('party'): + changes.pop('party') + return changes + + def check_account(self): + try: + super(Line, self).check_account() + except: + # Not raise if there is a party and account is not party required + if self.account.party_required or not self.party: + raise + + class Reconciliation(): __name__ = 'account.move.reconciliation'