Allows insert a party in move lines despite the financial account has not the party requeried option checked

This commit is contained in:
Jordi Esteve 2015-02-09 20:11:44 +01:00
parent 2d4c6424c4
commit 7d84e3e1d2
4 changed files with 36 additions and 1 deletions

View File

@ -9,5 +9,6 @@ from .move import *
def register():
Pool.register(
Account,
Line,
Reconciliation,
module='account_reconcile_different_party', type_='model')

View File

@ -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.

View File

@ -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.

27
move.py
View File

@ -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'