This file is indexed.

/usr/lib/python2.7/dist-packages/trytond/modules/sale_credit_limit/party.py is in tryton-modules-sale-credit-limit 4.2.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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 Pool, PoolMeta
from trytond.transaction import Transaction

__all__ = ['Party']


class Party:
    __metaclass__ = PoolMeta
    __name__ = 'party.party'

    @classmethod
    def get_credit_amount(cls, parties, name):
        pool = Pool()
        Sale = pool.get('sale.sale')
        Currency = pool.get('currency.currency')
        User = pool.get('res.user')

        amounts = super(Party, cls).get_credit_amount(parties, name)

        user = User(Transaction().user)
        if not user.company:
            return amounts
        currency = user.company.currency

        sales = Sale.search([
                ('party', 'in', [p.id for p in parties]),
                ('state', '=', 'processing'),
                ])
        for sale in sales:
            amount = 0
            for line in sale.lines:
                amount += Currency.compute(sale.currency, line.amount,
                    currency, round=False)
                for invoice_line in line.invoice_lines:
                    invoice = invoice_line.invoice
                    if invoice and invoice.move:
                        amount -= Currency.compute(invoice.currency,
                            invoice_line.amount, currency)
            amounts[sale.party.id] += amount
        return amounts

    @classmethod
    def _credit_limit_to_lock(cls):
        return super(Party, cls)._credit_limit_to_lock() + [
            'sale.sale', 'sale.line']