This file is indexed.

/usr/lib/python2.7/dist-packages/trytond/modules/account_invoice_history/invoice.py is in tryton-modules-account-invoice-history 3.4.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
48
49
50
51
52
#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import datetime

from trytond.model import ModelView, Workflow, fields
from trytond.pool import PoolMeta

__all__ = ['Invoice']
__metaclass__ = PoolMeta


class Invoice:
    __name__ = 'account.invoice'
    open_date = fields.DateTime('Open Date')

    @classmethod
    def __setup__(cls):
        super(Invoice, cls).__setup__()
        cls.party.datetime_field = 'open_date'
        if 'open_date' not in cls.party.depends:
            cls.party.depends.append('open_date')
        cls.invoice_address.datetime_field = 'open_date'
        if 'open_date' not in cls.invoice_address.depends:
            cls.invoice_address.depends.append('open_date')
        cls.payment_term.datetime_field = 'open_date'
        if 'open_date' not in cls.payment_term.depends:
            cls.payment_term.depends.append('open_date')

    def set_number(self):
        set_open_date = not self.number
        super(Invoice, self).set_number()
        if set_open_date:
            self.write([self], {
                    'open_date': datetime.datetime.now(),
                    })

    @classmethod
    @ModelView.button
    @Workflow.transition('draft')
    def draft(cls, invoices):
        super(Invoice, cls).draft(invoices)
        cls.write(invoices, {
                'open_date': None,
                })

    @classmethod
    def copy(cls, invoices, default=None):
        if default is None:
            default = {}
        default = default.copy()
        default['open_date'] = None
        return super(Invoice, cls).copy(invoices, default=default)