mirror of
https://gitlab.com/datalifeit/trytond-account_bank
synced 2023-12-14 06:23:07 +01:00
Get payable or receivable payment type when on_change party from account_kind field
This commit is contained in:
parent
2f48858738
commit
de09fd56c3
18
account.py
18
account.py
|
@ -333,19 +333,15 @@ class Line(BankMixin, metaclass=PoolMeta):
|
||||||
if self.payment_type and self.party:
|
if self.payment_type and self.party:
|
||||||
self._get_bank_account()
|
self._get_bank_account()
|
||||||
|
|
||||||
@fields.depends('party', 'debit', 'credit', 'move', '_parent_move.id')
|
@fields.depends('party', 'account_kind', 'move', '_parent_move.id')
|
||||||
def on_change_with_payment_type(self, name=None):
|
def on_change_with_payment_type(self, name=None):
|
||||||
if self.party:
|
if self.party:
|
||||||
if self.credit > 0 or self.debit < 0:
|
if self.account_kind == 'payable':
|
||||||
name = 'supplier_payment_type'
|
return (self.party.supplier_payment_type.id
|
||||||
elif self.debit > 0 or self.credit < 0:
|
if self.party.supplier_payment_type else None)
|
||||||
name = 'customer_payment_type'
|
elif self.account_kind == 'receivable':
|
||||||
else:
|
return (self.party.customer_payment_type.id
|
||||||
return
|
if self.party.customer_payment_type else None)
|
||||||
payment_type = getattr(self.party, name)
|
|
||||||
if payment_type:
|
|
||||||
return payment_type.id
|
|
||||||
return
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def copy(cls, lines, default=None):
|
def copy(cls, lines, default=None):
|
||||||
|
|
Loading…
Reference in a new issue