Skip to content

Commit

Permalink
Removed total field to speed up view task #165822 (#12)
Browse files Browse the repository at this point in the history
#165822
  • Loading branch information
dCeylan authored and nan-tic-dev committed Jul 18, 2024
1 parent 2f1b7bb commit 016a551
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
12 changes: 0 additions & 12 deletions payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from trytond.exceptions import UserError
from trytond.transaction import Transaction
from trytond.modules.currency.fields import Monetary

__all__ = ['Journal', 'Group', 'Payment', 'PayLine']

_ZERO = Decimal(0)
Expand All @@ -36,8 +35,6 @@ class Group(metaclass=PoolMeta):
'on_change_with_payment_type')
currency = fields.Function(fields.Many2One('currency.currency', 'Currency'),
'on_change_with_currency')
amount = fields.Function(Monetary('Total',
digits='currency', currency='currency'), 'get_amount')

@fields.depends('journal')
def on_change_with_payment_type(self, name=None):
Expand All @@ -49,15 +46,6 @@ def on_change_with_currency(self, name=None):
if self.journal and self.journal.currency:
return self.journal.currency.id

def get_amount(self, name):
amount = _ZERO
for payment in self.payments:
amount += payment.amount
if self.journal and self.journal.currency:
return self.journal.currency.round(amount)
else:
return amount


class Payment(metaclass=PoolMeta):
__name__ = 'account.payment'
Expand Down
2 changes: 0 additions & 2 deletions view/payment_group_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ copyright notices and license terms. -->
position="after">
<label name="payment_type"/>
<field name="payment_type"/>
<label name="amount"/>
<field name="amount"/>
<field name="payments" colspan="4"/>
</xpath>
</data>
1 change: 0 additions & 1 deletion view/payment_group_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ copyright notices and license terms. -->
<xpath expr="/tree/field[@name=&quot;kind&quot;]"
position="after">
<field name="payment_type"/>
<field name="amount"/>
</xpath>
</data>

0 comments on commit 016a551

Please sign in to comment.